From aa6f6321e57e422dcc694754b8c08bb3753142f6 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Tue, 9 Jun 2026 12:02:27 +0800 Subject: [PATCH] Add CLI version command --- README.md | 11 ++++++++++- skills/seal-home/SKILL.md | 3 ++- skills/seal-home/references/cli.md | 11 +++++++++++ src/cli.ts | 11 +++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3fff6de..4130b29 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,15 @@ bun run cli -- source config bun run cli -- tools list ``` +Update an existing checkout: + +```bash +git pull +bun install +bun run cli -- version +bun run cli -- tools list +``` + Local enterprise config files are ignored by git: ```text @@ -86,7 +95,7 @@ CLI output is JSON on stdout. Errors are written to stderr. - `seal_corp_switch`: switch the active local enterprise config. - `seal_whoami`: current Seal user and tenant. -- `seal_approval_search`: keyword search across approval rules, documents, approval preferences, and optionally published rule history. Results include area, entity, field, line number, and surrounding context. Search data is cached in memory for 5 minutes. +- `seal_approval_search`: keyword search across approval rules, documents, approval preferences, and optionally published rule history. Results include area, entity, field, line number, and surrounding context. Search data is cached in memory for 5 minutes only within a long-lived process such as the MCP server; separate CLI invocations do not share this cache. - `seal_approval_context_get`: read current approval rules, approval documents, and approval style preferences in one call. - `seal_runs_search`: search the approval run history from `api/v1/approvals`. This is the broad record table for historical runs and returns compact run fields; set `includeBridge` only when full Langfuse bridge rows are needed. - `seal_action`: low-frequency management router. Use `action: "help"` or `payload.topic` to discover actions. diff --git a/skills/seal-home/SKILL.md b/skills/seal-home/SKILL.md index ec8b82e..c4abd5b 100644 --- a/skills/seal-home/SKILL.md +++ b/skills/seal-home/SKILL.md @@ -11,6 +11,7 @@ Run commands from the seal-home repository root: ```bash bun run cli -- help +bun run cli -- version bun run cli -- tools list ``` @@ -73,7 +74,7 @@ Use for "which rule/document mentions X" or before changing rule/document conten bun run cli -- tool seal_approval_search --json '{"keywords":["关键词"],"matchMode":"any","maxResults":20}' ``` -Use `areas` to narrow to `rules`, `documents`, or `preferences`. Use `refresh:true` when recent edits may not be reflected in the in-memory cache. +Use `areas` to narrow to `rules`, `documents`, or `preferences`. Use `refresh:true` when recent edits may not be reflected in the MCP server's in-memory cache. Separate CLI invocations are short-lived processes and do not share this cache. ### Update approval rules diff --git a/skills/seal-home/references/cli.md b/skills/seal-home/references/cli.md index d6bc972..073c744 100644 --- a/skills/seal-home/references/cli.md +++ b/skills/seal-home/references/cli.md @@ -9,6 +9,7 @@ bun run cli -- ## Top-Level Commands ```bash +bun run cli -- version bun run cli -- tools list bun run cli -- corps list [--corp ] bun run cli -- source config [--corp ] @@ -21,6 +22,15 @@ bun run cli -- simulation batch-records ## Fine-Grained Tools +`bun run cli -- version` returns: + +```json +{ + "name": "seal-home", + "version": "0.3.0" +} +``` + Identity and session: - `seal_whoami` @@ -184,6 +194,7 @@ Update style preferences: ## Failure Handling +- CLI commands are short-lived processes. In-memory auth/search caches only live for that single process. The MCP server is long-lived, so it can reuse in-memory caches across tool calls until refresh or TTL expiry. - If no run is found by `sourceDocumentSN`, retry with `sourceDocumentId` or a broader `query`. - If date-based summaries look wrong, pass `--timezone Asia/Shanghai` and an explicit `--date`. - If `langfuseTraceId` is missing, use `langfuseSessionFallback`. diff --git a/src/cli.ts b/src/cli.ts index 3d96bc8..26c5e9e 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -6,6 +6,8 @@ import { resolveLiveSealEnterpriseConfig } from "./domains/seal/source.js"; import { sealTools, type SealTool } from "./domains/seal/tools.js"; import { CorpConfig } from "./core/config/types.js"; +const VERSION = "0.3.0"; + type ParsedArgs = { command: string[]; options: Record; @@ -21,6 +23,14 @@ async function main() { return; } + if (area === "version") { + printJson({ + name: "seal-home", + version: VERSION + }); + return; + } + if (area === "tools" && action === "list") { printJson(sealTools.map((tool) => ({ name: tool.name, description: tool.description }))); return; @@ -210,6 +220,7 @@ function printHelp() { console.log(`seal-home CLI Usage: + seal-home version seal-home tools list seal-home corps list [--corp ] seal-home source config [--corp ]