Compare commits

..
4 Commits
Author SHA1 Message Date
gitea e716f069ed Release v0.7.1: Add approval-runs list alias, handle EPIPE, and improve summary hints
Binaries / Build & Release Binaries (push) Has been cancelled
2026-08-25 15:19:11 +08:00
gitea b998a0527e Add Chinese onboarding guidance and empty corps diagnostic
Binaries / Build & Release Binaries (push) Has been cancelled
2026-08-25 14:46:16 +08:00
gitea 7f3a4b0fe4 Update installer to use user-writable bin directory without sudo
Binaries / Build & Release Binaries (push) Has been cancelled
2026-08-25 14:36:58 +08:00
gitea f0d3477d69 Add one-line install script and quick installation guide
Binaries / Build & Release Binaries (push) Has been cancelled
2026-08-25 14:34:17 +08:00
11 changed files with 204 additions and 64 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-home",
"version": "0.7.0",
"version": "0.7.1",
"description": "Seal Home tenant operations: approval-run diagnosis, minimal rule remediation, delegation links, Hose/合思 authorization, users, rules, billing, and search.",
"author": {
"name": "yingqing"
+25 -6
View File
@@ -6,16 +6,35 @@ The first provider is Hose/合思: `key`, `password`, `corpId`, `staffId`, and a
Seal-native enterprise pages can be added with a Seal Bearer token. The older `direct` source remains available for existing configs that already provide a Seal Bearer token.
## Setup
## Quick Install (Standalone Binary)
No Node.js, Bun, or external runtime required. Run the one-line installer for macOS and Linux:
```bash
bun install
cp enterprises/example.hose.json enterprises/local.json
bun run check
bun run probe -- <corpId>
bun run start
curl -fsSL https://raw.githubusercontent.com/yunyingk/seal-home/master/scripts/install.sh | bash
```
Or download the native binary directly from [GitHub Releases](https://github.com/yunyingk/seal-home/releases/latest):
- **macOS (Apple Silicon)**: `curl -fsSL https://github.com/yunyingk/seal-home/releases/latest/download/seal-home-darwin-arm64 -o /usr/local/bin/seal-home && chmod +x /usr/local/bin/seal-home`
- **macOS (Intel)**: `curl -fsSL https://github.com/yunyingk/seal-home/releases/latest/download/seal-home-darwin-x64 -o /usr/local/bin/seal-home && chmod +x /usr/local/bin/seal-home`
- **Linux (x86_64)**: `curl -fsSL https://github.com/yunyingk/seal-home/releases/latest/download/seal-home-linux-x64 -o /usr/local/bin/seal-home && chmod +x /usr/local/bin/seal-home`
- **Linux (ARM64)**: `curl -fsSL https://github.com/yunyingk/seal-home/releases/latest/download/seal-home-linux-arm64 -o /usr/local/bin/seal-home && chmod +x /usr/local/bin/seal-home`
- **Windows (x64)**: Download `seal-home-windows-x64.zip` from Releases and extract `seal-home-windows-x64.exe`.
After installation:
```bash
seal-home version # Check version
seal-home skill install # Install Agent skill to ~/.agents/skills/seal-home
seal-home mcp-config # Print .mcp.json snippet for Cursor / Claude Desktop / Codex
seal-home update # Future self-update directly from GitHub Release
```
## Source Setup & Development
For local development from source with Bun:
For an already-authenticated Seal-native source, use `seal-home corps add-seal` or copy `enterprises/example.seal.json`. Existing `direct` configs remain supported via `enterprises/example.direct.json`.
## Public Usage
+53 -42
View File
@@ -24943,7 +24943,7 @@ async function createSealClientForToken(corp, token) {
// package.json
var package_default = {
name: "seal-home",
version: "0.7.0",
version: "0.7.1",
type: "module",
module: "src/server.ts",
bin: {
@@ -28692,7 +28692,7 @@ function joinOutput(lines) {
function redactSensitiveText(value) {
return value.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi, "$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi, "$1<redacted>");
}
function printJson(value, options = {}) {
function printJson2(value, options = {}) {
protectLargeOutput(value, options);
const json2 = `${JSON.stringify(value, null, 2)}
`;
@@ -28829,9 +28829,9 @@ function globalConfigSummary(config2 = loadGlobalConfig()) {
};
}
async function runTool(name, client, corp, params, options = {}) {
printJson(await runToolResult(name, client, corp, params), options);
printJson2(await runToolResult2(name, client, corp, params), options);
}
async function runToolResult(name, client, corp, params) {
async function runToolResult2(name, client, corp, params) {
const tool = sealTools.find((item) => item.name === name);
if (!tool)
throw new Error(`Unknown Seal tool: ${name}`);
@@ -28843,7 +28843,7 @@ async function runToolResult(name, client, corp, params) {
// src/cli/commands/approval-runs.ts
async function handleApprovalRunsCommand(action, maybeName, client, corp, args) {
if (action === "summary") {
await runTool("seal_approval_runs_summary", client, corp, {
const result = await runToolResult("seal_approval_runs_summary", client, corp, {
date: stringOption(args.options.date),
timezone: stringOption(args.options.timezone),
limit: numberOption(args.options.limit),
@@ -28856,10 +28856,14 @@ async function handleApprovalRunsCommand(action, maybeName, client, corp, args)
sourceDocumentId: stringOption(args.options.sourceDocumentId),
humanResult: stringOption(args.options.humanResult),
query: stringOption(args.options.query)
}, outputOptions(args.options));
});
if (result?.matched === 0 && result?.total > 0) {
console.error(`提示:在 ${result.date} 未匹配到记录(该企业共有 ${result.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-home approval-runs list --limit 10 查看最近记录。`);
}
printJson(result, outputOptions(args.options));
return;
}
if (action === "search") {
if (action === "search" || action === "list") {
await runTool("seal_approval_runs_search", client, corp, {
limit: numberOption(args.options.limit),
offset: numberOption(args.options.offset),
@@ -28960,12 +28964,12 @@ async function handleApprovalRunsCommand(action, maybeName, client, corp, args)
// src/cli/commands/auth.ts
async function handleAuthCommand(action, corp, args) {
if (action === "diagnose") {
printJson(await diagnoseAuth(corp));
printJson2(await diagnoseAuth(corp));
return;
}
if (action === "hose-link") {
const expiresIn = numberOption(args.options.expire) ?? 7200;
printJson(await getHoseProvisionalAuthLink(corp, expiresIn));
printJson2(await getHoseProvisionalAuthLink(corp, expiresIn));
return;
}
throw new Error(`Unknown auth command: ${action ?? ""}. Run 'seal-home help' for available commands.`);
@@ -29204,20 +29208,20 @@ async function handleBillingCommand(action, client, corp, args) {
// src/cli/commands/config.ts
function handleConfigCommand(action, maybeName, args) {
if (action === "paths") {
printJson({
printJson2({
candidates: getEnterprisesDirCandidates(),
globalConfigFile: resolveGlobalConfigFile()
});
return;
}
if (action === "get" || action === "status") {
printJson(globalConfigSummary());
printJson2(globalConfigSummary());
return;
}
if (action === "mode") {
const mode = maybeName ?? stringOption(args.options.mode);
if (!mode) {
printJson(globalConfigSummary());
printJson2(globalConfigSummary());
return;
}
const stateful = parseStateMode(mode);
@@ -29228,7 +29232,7 @@ function handleConfigCommand(action, maybeName, args) {
stateful,
...defaultCorpId ? { defaultCorpId } : {}
});
printJson(globalConfigSummary(config2));
printJson2(globalConfigSummary(config2));
return;
}
throw new Error(`Unknown config command: ${action ?? ""}. Run 'seal-home help' for available commands.`);
@@ -29279,7 +29283,10 @@ async function handleCorpsCommand(action, maybeName, args) {
const corps = loadCorpConfigs();
const globalConfig2 = loadGlobalConfig();
const currentCorpId = corpId ?? (globalConfig2.stateful ? globalConfig2.defaultCorpId ?? corps[0]?.id : undefined);
printJson(corps.map((item) => ({
if (corps.length === 0) {
console.error("提示:当前未检测到企业配置。你可以使用 seal-home corps add-hose 或 seal-home corps add-seal 添加企业,或运行 seal-home help 查看说明。");
}
printJson2(corps.map((item) => ({
id: item.id,
name: item.name,
sourceType: item.source.type,
@@ -29290,7 +29297,7 @@ async function handleCorpsCommand(action, maybeName, args) {
}
if (action === "current") {
const corp = selectCorp(stringOption(args.options.corp));
printJson({
printJson2({
id: corp.id,
name: corp.name,
sourceType: corp.source.type,
@@ -29308,7 +29315,7 @@ async function handleCorpsCommand(action, maybeName, args) {
}
const corp = selectCorp(corpId);
saveGlobalConfig({ ...globalConfig2, stateful: true, defaultCorpId: corp.id });
printJson({
printJson2({
current: true,
id: corp.id,
name: corp.name
@@ -29374,7 +29381,7 @@ async function addHoseCorp(input) {
}
writeFileSync4(file2, `${JSON.stringify(config2, null, 2)}
`, { mode: 384 });
printJson({
printJson2({
id,
name,
corpId,
@@ -29436,7 +29443,7 @@ async function addSealCorp(input) {
}
writeFileSync4(file2, `${JSON.stringify(config2, null, 2)}
`, { mode: 384 });
printJson({
printJson2({
id,
name: config2.name,
tenantId,
@@ -29538,7 +29545,7 @@ async function handleMcpCommand(action, args) {
await startServer();
}
function printMcpConfig() {
printJson({
printJson2({
mcpServers: {
"seal-home": {
type: "stdio",
@@ -29556,7 +29563,7 @@ var openapi_default = {
openapi: "3.1.0",
info: {
title: "seal-home Wrapped API",
version: "0.7.0",
version: "0.7.1",
description: `Planned HTTP contract for the seal-home wrapped backend API.
These endpoints describe the intended stable API for frontend developers and agents once
@@ -32904,7 +32911,7 @@ function getOpenApiSchema() {
// src/cli/commands/openapi.ts
function handleOpenApiCommand(args) {
const schema = getOpenApiSchema();
printJson(schema, { ...outputOptions(args.options), allowFull: true });
printJson2(schema, { ...outputOptions(args.options), allowFull: true });
}
// src/cli/commands/permissions.ts
@@ -32976,9 +32983,9 @@ async function handleRulesCommand(action, maybeName, client, corp, args) {
}, outputOptions(args.options));
return;
}
const result = await runToolResult("seal_approval_rules_list", client, corp, { limit, offset });
const result = await runToolResult2("seal_approval_rules_list", client, corp, { limit, offset });
protectLargeRuleListOutput(result, booleanOption(args.options.full) === true);
printJson(result);
printJson2(result);
return;
}
if (action === "clear") {
@@ -32987,18 +32994,18 @@ async function handleRulesCommand(action, maybeName, client, corp, args) {
if (!confirmed && !dryRun) {
throw new Error("Refusing to clear rules without --yes. Use --dry-run to preview.");
}
const result = await runToolResult("seal_approval_rules_clear", client, corp, {
const result = await runToolResult2("seal_approval_rules_clear", client, corp, {
dryRun,
recode: booleanOption(args.options.recode)
});
if (!confirmed && dryRun && result && typeof result === "object") {
printJson({
printJson2({
...result,
nextCommand: `seal-home rules clear --corp ${corp.id} --yes`
}, outputOptions(args.options));
return;
}
printJson(result, outputOptions(args.options));
printJson2(result, outputOptions(args.options));
return;
}
if (action === "versions") {
@@ -33201,7 +33208,7 @@ async function handleServiceCommand(action, runtime) {
launcher: runtime.launcher
});
if (result !== undefined)
printJson(result);
printJson2(result);
}
// src/cli/commands/simulation.ts
@@ -33283,13 +33290,13 @@ import { dirname as dirname3, join as join6 } from "node:path";
// skills/seal-home/SKILL.md
var SKILL_default = `---
name: seal-home
description: "v0.7.0: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
description: "v0.7.1: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
metadata:
version: 0.7.0
short-description: Seal tenant and Hose approval automation (v0.7.0)
version: 0.7.1
short-description: Seal tenant and Hose approval automation (v0.7.1)
---
# Seal Home (v0.7.0)
# Seal Home (v0.7.1)
Use the \`seal_cli\` MCP tool when it is available; pass the command string as its \`command\` argument. If MCP is unavailable, fall back to the global \`seal-home\` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
@@ -33326,6 +33333,10 @@ seal-home tools list
- LLM Model Config & Providers: \`seal-home llm config --corp <corpId>\`, \`seal-home llm providers --corp <corpId>\`.
- System Permissions Config: \`seal-home permissions available --corp <corpId>\`, \`seal-home permissions configs --corp <corpId>\`.
- Billing & Feature Quotas: \`seal-home billing status --corp <corpId>\`, \`seal-home billing plans --corp <corpId>\`, \`seal-home billing features --corp <corpId>\`.
- Enterprise Onboarding (新机企业接入与配置):
- 合思/易快报企业: 从合思管理员后台获取 \`appKey\`、\`appSecurity\` 及员工工号 \`proxyStaffBizId\` (形如 \`corpId:staffId\`),运行 \`seal-home corps add-hose --json '{"name":"企业名","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'\`。
- Seal 租户直连: 登录 Seal 控制台获取 Bearer Token,运行 \`seal-home corps add-seal --json '{"sealUrl":"https://<tenant>.sealai.cc","token":"<bearer-token>"}'\`。
- 连通性诊断: 运行 \`seal-home auth diagnose --corp <corpId>\` 验证四级鉴权。
- Full CLI inventory: read \`references/cli.md\`.
## High-Value Commands
@@ -34405,7 +34416,7 @@ function handleSkillCommand(action, maybeName, args) {
const customDir = stringOption(args.options.dir) ?? stringOption(args.options.target) ?? maybeName;
const targetDir = customDir ? customDir : isLocal ? join7(process.cwd(), ".agents", "skills", "seal-home") : getDefaultGlobalSkillDir();
const result = installSkillFiles(targetDir);
printJson({
printJson2({
installed: true,
targetDir: result.targetDir,
fileCount: result.files.length,
@@ -34416,7 +34427,7 @@ function handleSkillCommand(action, maybeName, args) {
if (action === "status" || action === "get" || !action) {
const globalDir = getDefaultGlobalSkillDir();
const localDir = join7(process.cwd(), ".agents", "skills", "seal-home");
printJson({
printJson2({
global: {
dir: globalDir,
installed: existsSync7(join7(globalDir, "SKILL.md"))
@@ -34434,7 +34445,7 @@ function handleSkillCommand(action, maybeName, args) {
// src/cli/commands/source.ts
async function handleSourceCommand(action, corp) {
if (action === "config") {
printJson(await resolveLiveSealEnterpriseConfig(corp));
printJson2(await resolveLiveSealEnterpriseConfig(corp));
return;
}
throw new Error(`Unknown source command: ${action ?? ""}. Run 'seal-home help' for available commands.`);
@@ -34449,7 +34460,7 @@ async function handleToolCommand(action, client, corp, args) {
// src/cli/commands/tools.ts
function handleToolsListCommand() {
printJson(sealTools.map((tool) => ({ name: tool.name, description: tool.description })));
printJson2(sealTools.map((tool) => ({ name: tool.name, description: tool.description })));
}
// src/cli/commands/update.ts
@@ -34479,7 +34490,7 @@ async function handleUpdateCommand(runtime, options = {}) {
};
if (!isCompiledBinary()) {
if (options.checkOnly) {
printJson({
printJson2({
updated: false,
version: VERSION,
mode: "source",
@@ -34498,7 +34509,7 @@ async function handleUpdateCommand(runtime, options = {}) {
runCommand("bun", ["install"], { cwd: runtime.appRoot });
if (wasRunning2)
await runServiceCommand("start", serviceConfig);
printJson({
printJson2({
updated: true,
serviceRestarted: wasRunning2,
version: VERSION,
@@ -34511,7 +34522,7 @@ async function handleUpdateCommand(runtime, options = {}) {
const arch = detectArch();
const release = await fetchGitHubRelease(repo, options.targetVersion);
if (!release) {
printJson({
printJson2({
updated: false,
currentVersion: VERSION,
mode: "binary",
@@ -34523,7 +34534,7 @@ async function handleUpdateCommand(runtime, options = {}) {
const isUpgrade = isNewerVersion(latestVersion, VERSION);
const shouldUpdate = options.force || Boolean(options.targetVersion) || isUpgrade;
if (options.checkOnly) {
printJson({
printJson2({
updated: false,
updateAvailable: isUpgrade,
currentVersion: VERSION,
@@ -34535,7 +34546,7 @@ async function handleUpdateCommand(runtime, options = {}) {
return;
}
if (!shouldUpdate) {
printJson({
printJson2({
updated: false,
currentVersion: VERSION,
latestVersion,
@@ -34583,7 +34594,7 @@ async function handleUpdateCommand(runtime, options = {}) {
if (wasRunning)
await runServiceCommand("start", serviceConfig);
const skillSync = syncGlobalSkillIfPresent();
printJson({
printJson2({
updated: true,
fromVersion: VERSION,
toVersion: latestVersion,
@@ -34944,7 +34955,7 @@ async function dispatch(argv, runtime) {
const args = parseArgs(argv);
const [area, action, maybeName] = args.command;
if (area === "version" || area === "v" || Boolean(args.options.version) || Boolean(args.options.v) || Boolean(args.options.V)) {
printJson({
printJson2({
name: "seal-home",
version: VERSION
});
+1 -1
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "seal-home Wrapped API",
"version": "0.7.0",
"version": "0.7.1",
"description": "Planned HTTP contract for the seal-home wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-home is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
},
"servers": [
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: seal-home Wrapped API
version: 0.7.0
version: 0.7.1
description: |
Planned HTTP contract for the seal-home wrapped backend API.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-home",
"version": "0.7.0",
"version": "0.7.1",
"type": "module",
"module": "src/server.ts",
"bin": {
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
set -e
REPO="yunyingk/seal-home"
echo "==> Detecting platform and architecture..."
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$OS" in
darwin)
PLATFORM="darwin"
;;
linux)
PLATFORM="linux"
;;
*)
echo "Unsupported operating system: $OS" >&2
exit 1
;;
esac
case "$ARCH" in
x86_64|amd64)
ARCH_NAME="x64"
;;
arm64|aarch64)
ARCH_NAME="arm64"
;;
*)
echo "Unsupported architecture: $ARCH" >&2
exit 1
;;
esac
# Resolve best writable bin directory without requiring sudo
TARGET_DIR=""
for candidate in "/opt/homebrew/bin" "/usr/local/bin" "$HOME/.local/bin" "$HOME/bin"; do
if [ -d "$candidate" ] && [ -w "$candidate" ]; then
TARGET_DIR="$candidate"
break
fi
done
if [ -z "$TARGET_DIR" ]; then
mkdir -p "$HOME/.local/bin"
TARGET_DIR="$HOME/.local/bin"
fi
ASSET_NAME="seal-home-${PLATFORM}-${ARCH_NAME}"
DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${ASSET_NAME}"
TARGET_PATH="${TARGET_DIR}/seal-home"
echo "==> Downloading seal-home (${PLATFORM}-${ARCH_NAME}) into ${TARGET_DIR}..."
TMP_FILE="$(mktemp)"
if ! curl -fL "$DOWNLOAD_URL" -o "$TMP_FILE"; then
echo "Error: Failed to download $DOWNLOAD_URL" >&2
rm -f "$TMP_FILE"
exit 1
fi
chmod +x "$TMP_FILE"
mv "$TMP_FILE" "$TARGET_PATH"
# Ad-hoc sign on macOS
if [ "$PLATFORM" = "darwin" ] && command -v codesign >/dev/null 2>&1; then
codesign --force --sign - "$TARGET_PATH" 2>/dev/null || true
fi
echo "==> Initializing agent skill..."
"$TARGET_PATH" skill install >/dev/null 2>&1 || true
echo ""
echo "✨ seal-home successfully installed to ${TARGET_PATH}!"
"$TARGET_PATH" version
echo ""
echo "Quick start:"
echo " 1. Add enterprise: seal-home corps add-hose --json '{...}'"
echo " 2. View MCP config: seal-home mcp-config"
echo " 3. Self-update: seal-home update"
echo ""
+8 -4
View File
@@ -1,12 +1,12 @@
---
name: seal-home
description: "v0.7.0: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
description: "v0.7.1: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
metadata:
version: 0.7.0
short-description: Seal tenant and Hose approval automation (v0.7.0)
version: 0.7.1
short-description: Seal tenant and Hose approval automation (v0.7.1)
---
# Seal Home (v0.7.0)
# Seal Home (v0.7.1)
Use the `seal_cli` MCP tool when it is available; pass the command string as its `command` argument. If MCP is unavailable, fall back to the global `seal-home` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
@@ -43,6 +43,10 @@ seal-home tools list
- LLM Model Config & Providers: `seal-home llm config --corp <corpId>`, `seal-home llm providers --corp <corpId>`.
- System Permissions Config: `seal-home permissions available --corp <corpId>`, `seal-home permissions configs --corp <corpId>`.
- Billing & Feature Quotas: `seal-home billing status --corp <corpId>`, `seal-home billing plans --corp <corpId>`, `seal-home billing features --corp <corpId>`.
- Enterprise Onboarding (新机企业接入与配置):
- 合思/易快报企业: 从合思管理员后台获取 `appKey`、`appSecurity` 及员工工号 `proxyStaffBizId` (形如 `corpId:staffId`),运行 `seal-home corps add-hose --json '{"name":"企业名","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'`。
- Seal 租户直连: 登录 Seal 控制台获取 Bearer Token,运行 `seal-home corps add-seal --json '{"sealUrl":"https://<tenant>.sealai.cc","token":"<bearer-token>"}'`。
- 连通性诊断: 运行 `seal-home auth diagnose --corp <corpId>` 验证四级鉴权。
- Full CLI inventory: read `references/cli.md`.
## High-Value Commands
+19 -2
View File
@@ -4,6 +4,13 @@ import { fileURLToPath } from "node:url";
import { runCli } from "./cli/runner.js";
import { isCompiledBinary, resolveAppRoot, resolveDefaultLauncher } from "./core/runtime.js";
process.stdout.on("error", (err: any) => {
if (err?.code === "EPIPE") process.exit(0);
});
process.stderr.on("error", (err: any) => {
if (err?.code === "EPIPE") process.exit(0);
});
const entryFile = fileURLToPath(import.meta.url);
const isCompiled = isCompiledBinary();
const appRoot = resolveAppRoot(entryFile, isCompiled);
@@ -15,6 +22,16 @@ const result = await runCli(Bun.argv.slice(2), {
launcher
});
if (result.stdout) process.stdout.write(result.stdout);
if (result.stderr) process.stderr.write(`${result.stderr}${result.stderr.endsWith("\n") ? "" : "\n"}`);
try {
if (result.stdout) process.stdout.write(result.stdout);
} catch (err: any) {
if (err?.code !== "EPIPE") throw err;
}
try {
if (result.stderr) process.stderr.write(`${result.stderr}${result.stderr.endsWith("\n") ? "" : "\n"}`);
} catch (err: any) {
if (err?.code !== "EPIPE") throw err;
}
process.exitCode = result.exitCode;
+11 -6
View File
@@ -1,8 +1,8 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { runTool } from "../helpers.js";
import { runTool, runToolResult } from "../helpers.js";
import { booleanOption, numberOption, stringOption } from "../parser.js";
import { outputOptions } from "../printer.js";
import { outputOptions, printJson } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export async function handleApprovalRunsCommand(
@@ -13,7 +13,7 @@ export async function handleApprovalRunsCommand(
args: ParsedArgs
) {
if (action === "summary") {
await runTool(
const result = await runToolResult(
"seal_approval_runs_summary",
client,
corp,
@@ -30,13 +30,18 @@ export async function handleApprovalRunsCommand(
sourceDocumentId: stringOption(args.options.sourceDocumentId),
humanResult: stringOption(args.options.humanResult),
query: stringOption(args.options.query)
},
outputOptions(args.options)
}
);
if ((result as any)?.matched === 0 && (result as any)?.total > 0) {
console.error(
`提示:在 ${(result as any).date} 未匹配到记录(该企业共有 ${(result as any).total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-home approval-runs list --limit 10 查看最近记录。`
);
}
printJson(result, outputOptions(args.options));
return;
}
if (action === "search") {
if (action === "search" || action === "list") {
await runTool(
"seal_approval_runs_search",
client,
+3
View File
@@ -33,6 +33,9 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
? globalConfig.defaultCorpId ?? corps[0]?.id
: undefined
);
if (corps.length === 0) {
console.error("提示:当前未检测到企业配置。你可以使用 seal-home corps add-hose 或 seal-home corps add-seal 添加企业,或运行 seal-home help 查看说明。");
}
printJson(corps.map((item) => ({
id: item.id,
name: item.name,