39 KiB
Seal Use CLI Reference
Run from any directory after installing the global CLI:
seal-use <command>
Enterprise config lookup:
- If
SEAL_USE_ENTERPRISES_DIRis set, only that directory is loaded. - Otherwise the user-level
~/.config/seal-use/enterprisesdirectory is loaded. A configuredtestEnterprisesDiris loaded first for test-tenant workflows. The current working directory's./enterprisesdirectory is not loaded implicitly. - Set
SEAL_USE_ENTERPRISES_DIRto use one explicit directory instead. Legacy~/.config/seal-home/enterprisesfiles are migrated to the primary directory when possible.
Enterprise selection is stateless by default. Commands that access an enterprise require
--corp <corpId> unless stateful mode is explicitly enabled:
seal-use config mode stateful --corp <corpId>
seal-use corps switch <corpId>
seal-use config mode stateless
The global mode is stored in ~/.config/seal-use/config.json; set SEAL_USE_CONFIG_FILE to
override that path. The legacy current-corp file is not read.
Stream & Exit Code Contract
stdout: Pure, deterministic JSON for machine/Agent parsing.stderr: Diagnostics, probing logs, and Next-Step Command Suggestions with the stable prefix👉 Next action: seal-use ....Exit Code:0on success;1runtime/upstream failure,2usage/argument error,10explicit destructive-operation confirmation required,11missing/invalid authentication, and12output protection requiring a compact/file/query alternative.
Top-Level Commands
seal-use version
seal-use config paths
seal-use config get
seal-use config mode <stateful|stateless> [--corp <corpId>]
seal-use config test-dir [<path>|--clear]
seal-use config lint <enable|disable|status> [--linter <name>] [--min-score <score>]
seal-use rules count [--version <number|latest>] [--corp <corpId>]
seal-use rules list [--version <number|latest>] [--summary] [--limit 20] [--offset 0] [--output-file <path>] [--corp <corpId>]
seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>] [--corp <corpId>]
seal-use rules search <keyword> [--version <number|latest>] [--maxResults 20] [--corp <corpId>]
seal-use rules create --description <text> --scope <scope> [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--description-file <path>] [--corp <corpId>]
seal-use rules update <code> [--description <text>|--description-file <path>] [--scope <scope>] [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--corp <corpId>]
seal-use rules delete <code> --yes [--corp <corpId>]
seal-use rules publish <versionName> [--corp <corpId>]
seal-use rules versions [--corp <corpId>]
seal-use rules version <versionNumber|latest> [--corp <corpId>]
seal-use rules diff <fromVersion> <toVersion> [--code <code>] [--include-unchanged] [--full] [--corp <corpId>]
seal-use rules lint [--file <path>] [--linter <name|path>] [--version <number|latest>] [--code <code>] [--min-score <score>] [--level all|error|warning] [--summary] [--corp <corpId>]
seal-use rules linters [--corp <corpId>]
seal-use rules pull [--version <number|latest>] [--out <file>] [--corp <corpId>]
seal-use rules push [--file <path>] [--publish] [--version-name <name>] [--dry-run|--yes] [--corp <corpId>]
seal-use rules clear [--dry-run|--yes] [--corp <corpId>]
seal-use rules map [--version <number|latest>] [--code <code>] [--corp <corpId>]
seal-use documents list [--scenarios <audit,fill>] [--limit 50] [--offset 0] [--corp <corpId>]
seal-use documents get <documentId> [--corp <corpId>]
seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]
seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]
seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]
seal-use documents delete <documentId> --yes [--corp <corpId>]
seal-use service <start|stop|restart|status|logs> [--port 8787] [--host 127.0.0.1] [--lines 50]
seal-use http [--port 8787] [--host 127.0.0.1]
seal-use serve [--port 8787]
seal-use update [--check] [--force] [--version <v>]
seal-use update check
seal-use update changelog [--limit <n>]
seal-use changelog [--limit <n>]
seal-use mcp
seal-use mcp config
seal-use mcp-config
seal-use skill dump
seal-use skill install [--dir <path>|--local]
seal-use skill status
seal-use doctor [--quiet]
seal-use doctor tenant [--corp <corpId>] [--quiet]
seal-use doctor guide
seal-use doctor paths
seal-use test regression [--corp <corpId>] [--samples <N>] [--dry-run] [--fail-on-flips]
seal-use probe [<corpId>]
seal-use corps list [query] [--env <production|test>] [--limit <n>] [--all] [--strict] [--corp <corpId>]
seal-use corps search <query> [--env <production|test>] [--strict]
seal-use corps get <corpId>
seal-use corps current [--corp <corpId>]
seal-use corps switch <corpId>
seal-use corps mark <corpId> --env <production|test> [--confirm]
seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
seal-use corps unbind-test [<corpId>] [--confirm]
seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]
seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--sn-suffix <str>] [--dry-run] [--confirm|--yes] [--force]
seal-use corps add-hose-persistent --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use corps add-seal-bearer --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
seal-use corps add-link <url> [--name <customName>] [--elevate-hose] [--app-key <key>] [--key-id <id>] [--overwrite] [--dry-run]
seal-use corps probe-hose --json '{"appKey":"...","appSecurity":"...","domain":"https://..."}'
seal-use corps hose-staffs --json '{"appKey":"...","appSecurity":"...","role":"admin"}'
seal-use corps hose-extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--app-key <key>] [--key-id <id>] [--overwrite]
seal-use corps hose-keys [<url> | <corpId>] [--reveal] [--save] [--app-key <key>] [--key-id <id>]
seal-use auth hose-extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--app-key <key>] [--key-id <id>] [--overwrite]
seal-use auth hose-keys [--corp <corpId>] [--reveal]
seal-use auth check [--corp <corpId>]
seal-use auth link [--corp <corpId>] [--note <note>]
seal-use auth link --from-link <url> [--note <note>]
seal-use auth link list [--corp <corpId>]
seal-use auth link revoke <tokenId> [--corp <corpId>]
seal-use auth hose-link [--corp <corpId>] [--expire <seconds>] [--force]
seal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
seal-use users search <keyword> [--corp <corpId>]
seal-use users delegation <userIdOrPhone|name> [--note <note>] [--corp <corpId>]
seal-use users activate <userId> [--corp <corpId>]
seal-use users reset-password <userId> [--corp <corpId>]
seal-use users get <userId> [--corp <corpId>]
seal-use users delete <userId> [--corp <corpId>]
seal-use contacts departments [<departmentId>] [--corp <corpId>]
seal-use contacts children <departmentId> [--corp <corpId>]
seal-use contacts users <departmentId> [--corp <corpId>]
seal-use contacts sync-time [--corp <corpId>]
seal-use data expenses --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]
seal-use data invoices --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]
seal-use llm config [--corp <corpId>]
seal-use llm providers [--corp <corpId>]
seal-use permissions available [--corp <corpId>]
seal-use permissions configs [--corp <corpId>]
seal-use billing status [--corp <corpId>]
seal-use billing plans [--corp <corpId>]
seal-use billing features [--corp <corpId>]
seal-use webhook ready [<资源包.zip>] [--webhook <idOrName>] [--corp <corpId>]
seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]
seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]
seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]
seal-use webhook resource-pack export [--limit <n>] [--status <status>] [--output <file.zip>] [--to-downloads] [--corp <corpId>]
seal-use webhook resource-pack preview <资源包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--corp <corpId>]
seal-use webhook resource-pack push <资源包.zip|信息表.xlsx> [--webhook <idOrName>] [--corp <corpId>]
seal-use webhook replay [<recordId>] [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--sn-suffix <str>] [--dry-run] [--force] [--corp <corpId>]
seal-use deploy hosecloud requirements [--corp <corpId>]
seal-use deploy hosecloud list [--corp <corpId>]
seal-use deploy hosecloud get <sign-key> [--corp <corpId>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--dry-run] [--corp <corpId>]
seal-use deploy hosecloud sync [<sign-key>] [--auto] [--corp <corpId>]
seal-use preference get [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies list [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--dry-run] [--corp <corpId>]
seal-use context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
seal-use source config [--corp <corpId>]
seal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]
seal-use approval-runs stats --corp <corpId> [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id]
seal-use analytics insight --corp <corpId> [--start-date <ISO>] [--end-date <ISO>] [--limit <n>]
seal-use analytics risks <tagId> --corp <corpId> [--start-date <ISO>] [--end-date <ISO>]
seal-use analytics performance --corp <corpId> [--start-date <ISO|ms>] [--end-date <ISO|ms>]
seal-use analytics analyze <recordId> --corp <corpId>
seal-use analytics export --corp <corpId> [--downloads] [--out <file>] [--start-date <ISO>] [--end-date <ISO>] [--force]
seal-use approval-runs count --corp <corpId> [--status APPROVED] [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>]
seal-use approval-runs export --corp <corpId> [--sn <SN1,SN2>] [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--force] [--status <status>] [--manual-status <status>] [--completed-only] [--limit <n>] [--downloads] [--out <file>] [--with-flow]
# --sn / --sns: 定向筛选单据编号(支持逗号/分号/空格分隔,跳过全量分页,秒级定向导出特定单据)
# --with-flow: 启用合思原生审批流对齐,输出 E人工行为 / E人工意见 两列(含样式 2-B 三行展开式驳回目标与重审规则、中途修改置顶事实且保留时序、动作 Emoji,默认关闭以节省合思 API 调用)
# 导出文件名自动追加精确到分钟的 _YYYYMMDD_HHmm 时间戳后缀防止文件覆盖,格式:${企业名称}_审核记录_${时间区间}_${条数}_${导出时间戳}.xlsx
seal-use approval-runs search --corp <corpId> [--query text] [--limit 20] [--includeBridge true]
seal-use approval-runs get <recordId> --corp <corpId> [--fields metadata|document.fields,result.summary] [--output-file file.json]
seal-use approval-runs attachments <recordId> --corp <corpId>
seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] --corp <corpId>
seal-use approval-runs result <recordId> --corp <corpId> [--summary]
seal-use approval-runs link <recordId> --corp <corpId>
seal-use approval-runs link <recordId> --auto-login [--expire 7200] --corp <corpId>
seal-use approval-runs link <recordId> --type hose-document --corp <corpId>
seal-use approval-runs link --sn <documentSN> [--auto-login] --corp <corpId>
# 生成审批详情链接:seal-use approval-runs link <recordId>
seal-use approval-runs bridge --corp <corpId> [--sourceDocumentSN <sourceDocumentSN>]
seal-use simulation batch-records <batchId> --corp <corpId>
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--no-wait] --corp <corpId>
seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] --corp <corpId>
seal-use simulation create --source-system weaver --request-ids "req-01,req-02" --corp <corpId>
seal-use simulation status <batchId> --corp <corpId>
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] --corp <corpId>
seal-use simulation clean <batchId> --corp <corpId>
seal-use simulation specifications [--integration <sign-key>] --corp <corpId>
seal-use simulation approval-definitions --corp <corpId>
seal-use simulation list [--limit 50] --corp <corpId>
seal-use simulation get <batchId> --corp <corpId>
seal-use simulation templates --corp <corpId>
seal-use simulation integrations --corp <corpId>
seal-use simulation package-upload <材料包.zip> --corp <corpId>
CLI Command Overview
seal-use version returns:
{
"name": "seal-use",
"version": "<package version>"
}
seal-use service <start|stop|restart|status|logs> manages the persistent background service daemon with embedded HTTP server (serving /docs, /openapi.json, and POST /api/cli). status returns the PID, version, host, port, active HTTP URL, state directory, PID file, and log file.
seal-use update checks and installs the latest official release, preserves the service state when needed, and refreshes the installed Agent Skill. The installation method is handled automatically and should not be exposed in user-facing explanations. seal-use update --check only reports available releases, and seal-use update changelog reads release history.
System diagnostic & embedded architecture specifications:
seal-use doctor [--quiet]executes a comprehensive read-only environment diagnostic health check (runtime executable, filesystem paths health, enterprise assets summary, daemon status) with zero disk footprint.seal-use doctor tenant [--corp <corpId>] [--quiet]probes the tenant-level health contract: verifies user identity and administrative permissions, checks AI approval quota balance (balanceanddeductionAmount), inspects active rules count and unreleased draft safety, validates webhook integration readiness, and verifies 1-to-1 environment pairing with test staging. Outputs clean JSON onstdoutand a visual terminal dashboard onstderr.seal-use doctor guidereads the complete embedded system architecture & directory specification whitepaper directly from binary memory without touching disk.seal-use doctor pathsoutputs compact JSON audit of all filesystem paths touched by the CLI.
Enterprise and tenant management (corps is the enterprise-context entry point):
Use the command groups in this order for normal work: enterprise onboarding → discovery and selection → environment configuration → test pairing and verification. Hose probing, staff discovery, key extraction, and key inspection are secondary capabilities for Hose-sourced enterprises.
seal-use corps add-link <url> [--name <name>] [--elevate-hose] [--app-key <key>] [--key-id <id>] [--overwrite] [--dry-run]is the preferred onboarding entry point: it auto-detects a Seal native delegate link or a Hose assistance link. Native Seal links are registered as native Seal enterprises; Hose links can remain short-lived or use--elevate-hosefor durable Hose credentials.--dry-runnever writes local config.seal-use corps add-seal-bearer --json '{"sealUrl":"https://tenant.sealai.cc","token":"..."}'registers a native Seal enterprise directly from a Seal Bearer Token.seal-use corps add-hose-web-session --json '{"baseUrl":"https://wx2.ekuaibao.com","corpId":"...","staffId":"...","accessToken":"..."}'imports a normalized Hose web session (for example, parsed from a Hose admin cURL), saving the HosecloseTokenand personnel ID. Seal Bearer is exchanged only at runtime; this command does not create or save OpenAPIappKey/appSecuritycredentials.seal-use corps add-hose-persistent --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"..."}'registers and persists a Hose enterprise from durable OpenAPI credentials.
Durable Hose configs are identified by source.type: "hose" plus appKey/appSecurity; Hose Web Session configs use the same source type with closeToken + staffId. When the session material includes an expiry, it is recorded as expiresIn (TTL seconds) and expiresAt (UTC without milliseconds, for example 2026-09-22T05:30:00Z).
seal-use corps list [query] [--env <production|test>] [--limit <n>] [--all] [--strict] [--corp <corpId>](defaults to displaying the top 10 most frequently used enterprises in the last 7 days; sorting is automatic and query results keep relevance order)seal-use corps search <query> [--env <production|test>] [--strict](intelligent soft search by default: case-insensitive, Chinese homophones, front/back nasal vowels, flat/retroflex consonants, initials, typo/missing letter tolerance; pass--strictfor exact substring match)seal-use corps get <corpId>(rich enterprise attributes with sensitive secrets safely redacted)seal-use corps current [--corp <corpId>]seal-use corps switch <corpId>seal-use corps mark <corpId> --env <production|test> --confirmandseal-use corps rename <corpId> --name <newName>maintain local enterprise metadata.seal-use corps bind-test <prodCorpId> <testCorpId> --confirm [--force],unbind-test, andsync-testmanage the 1-to-1 production/test lifecycle.seal-use corps replay-test [<prodCorpId>] ... [--dry-run] [--confirm|--yes] [--force]replays sanitized approval records to the paired test Webhook. Preview does not send; live replay requires confirmation.--forceonly overrides missing/non-test pairing guards.seal-use corps probe-hose --json '{"appKey":"...","appSecurity":"...","domain":"https://..."}'probes Hose domains and discovers enterprise identity without saving configuration.seal-use corps hose-staffs --json '{"appKey":"...","appSecurity":"...","role":"admin"}'discovers role-based staff candidates; cellphones are masked by default.seal-use corps hose-extract-keys <url> [--reveal] [--save] [--name <name>] [--app-key <key>] [--key-id <id>] [--overwrite]extracts OpenAPI keys (appKeyandappSecurity) from a Hose assistance link (thirdparty.html). The oldextract-keys/extract-key/extract-hose-keysforms remain aliases. Hose Subdomain Privilege Elevation: elevates a short-lived session token to permanent Hose OpenAPI developer credentials. If--saveis specified, registers the enterprise as a durable Hose tenant. If the enterprise has multiple keys, execution halts and candidates are listed unless--app-keyor--key-idis passed.seal-use corps hose-keys [<url> | <corpId>] [--reveal] [--save]reads/displays OpenAPI keys for a Hose assistance link or configured Hose enterprise (masked by default,--revealdisplays plaintext). The oldkeysform remains an alias. Rejects non-Hose/native-Seal tenants with exit code 2.seal-use auth hose-extract-keys <url>andseal-use auth hose-keys [--corp <corpId>]are the explicit Hose auth-domain commands. The oldextract-keys/extract-key/extract-hose-keysandkeysforms remain aliases.
Read-only discovery:
seal-use contacts departments|children|users|sync-time --corp <corpId>queries the tenant's organization tree and last directory sync time.seal-use data expenses|invoices --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]queries paginated raw expense or invoice records.seal-use analytics insight --corp <corpId> [--start-date <ISO>] [--end-date <ISO>] [--limit <n>]queries risk-tag statistics; omitted dates use the current month.seal-use analytics risks <tagId> --corp <corpId> [--start-date <ISO>] [--end-date <ISO>]queries detailed risks and cited documents under a specific risk tag.seal-use analytics performance --corp <corpId> [--start-date <ISO|ms>] [--end-date <ISO|ms>]queries approval performance metrics and Sankey decision flow.seal-use analytics analyze <recordId> --corp <corpId>triggers on-demand smart insight risk analysis for an approval record.seal-use analytics export --corp <corpId> [--downloads] [--out <file>] [--start-date <ISO>] [--end-date <ISO>]exports a comprehensive multi-sheet Excel report covering performance KPIs, decision flow, top risk tags, and detailed risk citations.seal-use context --corp <corpId> [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50]aggregates rules, knowledge documents, and style preferences.seal-use source config --corp <corpId>resolves the live source-system configuration without changing it.
Test Enterprise Binding, Staging Synchronization & Automated Regression Testing:
- 1-to-1 Association: One production enterprise can only bind at most one test enterprise (
corps bind-test <prodCorpId> <testCorpId>). Multi-tier chaining is rejected. - Marking & Rigorous Confirmation: Marking (
corps mark <corpId> --env <production|test>) and binding require explicit--confirm. Without confirmation, the CLI blocks with exit code10(confirmationRequired). Overwriting existing bindings requires--force. - Production Safety Guarantee (
corps sync-test):- In the Production Enterprise: Rules remain strictly in draft state without publishing any live version.
- In the Test Enterprise: Style preferences (
decisionPreferences,thinkingDepthPreference) are updated to match production, test draft rules are cleared and populated with production draft rules, recoded, and immediately published as a new official version in the test tenant (--version-name <name>). - Semantic Version Naming: Defaults to
Sync from <ProdCorp> [Prod v<N> · #<Iteration>]tracking production baseline version and test draft iteration without redundant date strings. - Rule Mapping & Local Snapshot: Returns
versionMappingandruleMappingin CLI stdout and saves persistent snapshot to~/.config/seal-use/mappings/<testCorpId>-v<N>.jsonand<testCorpId>-latest.json. --dry-runpreviews the full preference diff, version mapping plan, and rule sync plan without sending mutations. Execution requires--yes.
- Approval Run Replay to Test Enterprise (
corps replay-test):- Automatically identifies the bound test enterprise for
<prodCorpId>(or current corp). - Fetches original approval records from the production enterprise (
--record-id,--sn, or batch via--limit/--status). - Cleans and normalizes payload structure, appends customizable suffix (default
-REPLAY-TEST) to avoid collision. - Automatically provisions
(Seal测-回放通道)withassistedmode on the test enterprise if no webhook integration exists. - Replays documents safely to the test enterprise webhook endpoint. Targeting production is blocked by default; if the enterprise has no bound test corp or target is production,
--forcecan be specified to override that guard, but live execution still requires--confirm/--yes.
- Automatically identifies the bound test enterprise for
- Automated Rule Regression Test Matrix (
seal-use test regression):- Runs an automated regression testing matrix across paired production and test enterprises before rule publication.
- Enforces Red Line 1: The replay target MUST be a test enterprise (
environment: "test"). Running regression tests directly in pure production is strictly forbidden. - Enforces Red Line 2: Pre-flight verification of target test enterprise AI approval balance (
balance >= samples * deductionAmount). If balance is insufficient, execution is blocked immediately to avoid quota starvation. - Samples historical completed production runs (
--samples <N>, default 10). - Replays sanitized documents into the test webhook integration.
- Uses outbound HTTPS polling for asynchronous test approval completion, eliminating any requirement for public IP or inbound webhook listeners behind NAT/VPNs.
- Normalizes and compares production vs. test decisions (
APPROVE,REJECT,MANUAL,ERROR). - Detects decision flips (e.g. production APPROVE becoming test REJECT), computes overall concordance rate, and computes boolean
safeToPublish. - Supports
--dry-runto preview sampled documents and verify quota without executing mutations. - Supports
--fail-on-flipsto terminate with a non-zero exit code (1) if any decision flip occurs, providing seamless integration with automated CI/CD safety gates.
Approval rule maintenance:
seal-use rules count [--version <number|latest>] [--corp <corpId>]seal-use rules list [--version <number|latest>] [--summary] [--limit 20] [--offset 0] [--output-file <path>] [--corp <corpId>]seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>] [--corp <corpId>]seal-use rules search <keyword> [--version <number|latest>] [--maxResults 20] [--corp <corpId>]seal-use rules create --description <text> --scope <scope> [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--description-file <path>] [--corp <corpId>]seal-use rules update <code> [--description <text>|--description-file <path>] [--scope <scope>] [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--corp <corpId>]seal-use rules delete <code> --yes [--corp <corpId>]seal-use rules publish <versionName> [--corp <corpId>]seal-use rules versions [--corp <corpId>]seal-use rules version <versionNumber|latest> [--corp <corpId>]seal-use rules diff <fromVersion> <toVersion> [--code <code>] [--include-unchanged] [--full] [--corp <corpId>](returns structured changes plus a Git-styleunifiedDiff; oversized output is truncated only when it exceeds the safety limit)seal-use rules lint [--file <path>] [--linter <name|path>] [--version <number|latest>] [--code <code>] [--min-score <score>] [--level all|error|warning] [--summary] [--corp <corpId>]seal-use rules linters [--corp <corpId>](lists official and custom linters with directory specs:~/.config/seal-use/lintersandofficial/)seal-use rules pull [--version <number|latest>] [--out <file>] [--corp <corpId>]seal-use rules push [--file <path>] [--publish] [--version-name <name>] [--dry-run|--yes] [--corp <corpId>]incrementally applies the local file: matched IDs are updated, missing local IDs are created, and remote IDs absent from the file are deleted. It does not clear/recreate the whole draft or recode it. Run--dry-runfirst; a local file exported withrules pullis preferred.seal-use rules clear [--dry-run|--yes] [--corp <corpId>]seal-use rules map [--version <number|latest>] [--code <code>] [--corp <corpId>](reads local sync rule mapping snapshot)
Rule identity and versioning (Draft by default vs. --version latest):
- Default = Current Draft: Whenever
--versionis omitted,rules count,rules list,rules get <code>,rules search,rules lint, andrules pullalways read the current draft. - Latest Published Version =
--version latest: To inspect the latest published version, you must explicitly pass--version latest(or--version <number>for a specific historical version, orrules version latestfor the full version snapshot). - In Seal, every rule has a 4-digit zero-padded
code(0000, 0001, 0025, 0038, ...). - A published version has its own snapshot and
codespace. Publishing or deleting rules can shiftcodenumbers across versions, so always paircodewith--versionor--record-idwhen inspecting historical approval runs.
Approval run lightweight queries:
seal-use approval-runs get <recordId> --corp <corpId> --fields metadataseal-use approval-runs get <recordId> --corp <corpId> --summaryseal-use approval-runs pick --corp <corpId> --sn <单号> --batch <batchId> --latestseal-use approval-runs document-summary <recordId> --corp <corpId>seal-use approval-runs cited-rules <recordId> --corp <corpId>seal-use approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summaryseal-use approval-runs attachments <recordId> --corp <corpId> --summaryseal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] --corp <corpId>seal-use approval-runs result <recordId> --corp <corpId> --summary
Approval knowledge documents:
seal-use documents list [--scenarios <audit,fill>] [--limit 50] [--offset 0] [--corp <corpId>]seal-use documents get <documentId> [--corp <corpId>]seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]seal-use documents delete <documentId> --yes [--corp <corpId>](删除前必须重新读取并确认;若只是暂时撤下内容,优先使用documents update <documentId> --enabled false)
--type 必须是 document、video、pdf、feishu_doc 或 policy(默认)之一;--scenarios 至少包含一个 fill(智能填单)或 audit(智能审核,默认)。这里的 scenarios 是产品能力开关,不是费用类别或业务场景名。
Webhook integrations:
seal-use webhook ready [<资源包.zip|信息表.xlsx>] [--webhook <idOrName>] [--corp <corpId>]seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--corp <corpId>]seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]seal-use webhook resource-pack export [--limit <n>] [--status <status>] [--output <file.zip>] [--to-downloads] --corp <corpId>(将线上审核记录打包导出为标准 Webhook 资源包,支持按条数、状态或指定单据 ID 筛选)seal-use webhook resource-pack preview <资源包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] --corp <corpId>seal-use webhook resource-pack push <资源包.zip|信息表.xlsx> [--webhook <idOrName>] --corp <corpId>(别名pack,旧名material-pack兼容支持)seal-use webhook replay [<recordId>] [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--sn-suffix <str>] [--dry-run] [--force] [--corp <corpId>](通用单据重放:从历史审批单据汲取结构化表单与明细,清洗规范化字段类型,支持单条或批量重放到目标企业的 Webhook 触发审批。默认阻止向未授权生产环境重放以防污染数据,提供--force显式覆盖支持)
Webhook writes read the current AI approval config and POST the merged full config back to api/v1/agent/ai-approval/config, preserving non-Webhook integrations. List/get mask secret by default; add returns the generated secret once. Each Webhook can also store a mutable materialPackFilePolicy with minFileSizeBytes, optional maxFileSizeBytes, and allowedExtensions. Update is a patch: omitted policy fields are retained; allowedExtensions replaces the complete list; --clear-max-file-size removes the upper bound.
Supported high-risk writes expose --dry-run previews, including rules clear/push, corps sync-test, preference updates, thinking-depth policy changes, HoseCloud configure, Webhook writes, and corps replay-test. Preview mode performs read-only discovery and never sends the mutation request. Use the command-specific --yes or --confirm gate for live execution; --force is an additional scope override and is not a confirmation substitute.
Approval runs, simulations, and Langfuse bridge:
seal-use approval-runs search --corp <corpId> [--query <text>] [--limit 20]seal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]seal-use approval-runs hose-flow <recordId|SN> --corp <corpId>(合思原生审批流时间线、员工意见、驳回原因与 AI 运行记录对齐;旧名flow兼容)seal-use approval-runs bridge --corp <corpId> [--sourceDocumentSN <sn>]seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>returns immediately with anasyncTicket(creation is non-blocking by default for compatibility).seal-use simulation status <batchId> --corp <corpId>performs one non-blocking status check and returnsQUEUED/RUNNING/COMPLETED/FAILED-style state plus counters.seal-use simulation approval-definitions --corp <corpId>lists available Feishu approval definitions so anapprovalCodecan be selected before creating a batch.seal-use simulation wait <batchId> --corp <corpId>seal-use simulation clean <batchId> --corp <corpId>seal-use simulation list --corp <corpId>seal-use simulation get <batchId> --corp <corpId>seal-use simulation batch-records <batchId> --corp <corpId>seal-use simulation templates --corp <corpId>seal-use simulation integrations --corp <corpId>
Common Examples
Add and verify a Hose enterprise:
seal-use corps add-hose-persistent --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use auth check --corp <corpId>
Force-write a Hose config without verification:
seal-use corps add-hose-persistent --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId","force":true}'
Check auth failures:
seal-use auth check --corp <corpId>
The diagnostic stages are hose.openapi, hose.provisional, seal.sso, and seal.whoami. Tokens are omitted from output.
Search approval rules or knowledge documents:
seal-use rules search <keyword> --maxResults 20 --corp <corpId>
seal-use documents search <keyword> --maxResults 20 --corp <corpId>
Get aggregated approval context:
seal-use context --documentLimit 20 --corp <corpId>
Create, update, and publish approval rules:
seal-use rules create --description "规则描述" --scope "适用场景" --strictness SHOULD_FOLLOW --corp <corpId>
seal-use rules update 25 --description "更新后的规则描述" --corp <corpId>
seal-use rules publish "版本名称" --corp <corpId>
Create and update an approval knowledge document:
seal-use documents create --title "标题" --purpose "用途" --content-file ./policy.md --type policy --scenarios audit --corp <corpId>
seal-use documents update <documentId> --content-file ./policy.md --corp <corpId>
Summarize one local date:
seal-use approval-runs summary --corp <corpId> --date 2026-06-09 --timezone Asia/Shanghai --limit 100
Find a run and include Langfuse bridge rows:
seal-use approval-runs search --corp <corpId> --query <sourceDocumentSN> --limit 20 --includeBridge true
Resolve Langfuse trace/session hints:
seal-use approval-runs bridge --corp <corpId> --sourceDocumentSN <sourceDocumentSN>
模拟测试批次(模拟发布闭环)创建与查询:
# 合思指定单号: 创建批次(响应只含 batchId)
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" --reject-node 财务 --thinking-depth medium --skip-invoice-generation --corp <corpId>
# 材料包导入: 先上传材料包 ZIP(服务端解析并返回 schemaConfig), 再用返回的 id 发起
seal-use simulation package-upload 测试材料包.zip --corp <corpId>
seal-use simulation create --mode material_pack --package-ids <materialPackageId> --template-id conference_reimbursement_v1 --schema-config schema.json --corp <corpId>
# 预留: 其他模式参数通过 --json 透传(如时间范围 startTime/endTime)
seal-use simulation create --mode hosecloud --flow-ids "B26017701" --json '{"startTime":0,"endTime":0}' --corp <corpId>
# 创建后轮询批次状态与记录
seal-use simulation list --limit 50 --corp <corpId>
seal-use simulation get <batchId> --corp <corpId>
seal-use simulation batch-records <batchId> --corp <corpId>
seal-use simulation templates --corp <corpId>
seal-use simulation integrations --corp <corpId>
Failure Handling
- CLI commands are short-lived processes. In-memory auth/search caches only live for that single process. Use
seal-use service restartafter updates so the optional local service picks up new code. - If no run is found by
sourceDocumentSN, retry withsourceDocumentIdor a broaderquery. - If date-based summaries look wrong, pass
--timezone Asia/Shanghaiand an explicit--date. - If
langfuseTraceIdis missing, uselangfuseSessionFallback. - If a write operation fails, report the raw JSON error and do not retry with guessed payloads.