Add rich update check, version diffs, and changelog release history querying
Binaries / Build & Release Binaries (push) Has been cancelled
Binaries / Build & Release Binaries (push) Has been cancelled
This commit is contained in:
1 parent
e716f069ed
commit
63d579c273
6 files changed
+338
-71
No files matched your search
Vendored
+152
-50
@@ -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 printJson2(value, options = {}) {
|
||||
function printJson(value, options = {}) {
|
||||
protectLargeOutput(value, options);
|
||||
const json2 = `${JSON.stringify(value, null, 2)}
|
||||
`;
|
||||
@@ -28745,8 +28745,10 @@ Usage:
|
||||
seal-home config paths
|
||||
seal-home config get
|
||||
seal-home config mode <stateful|stateless> [--corp <corpId>]
|
||||
seal-home service <start|stop|restart|status>
|
||||
seal-home update
|
||||
seal-home update [--check] [--force] [--version <v>]
|
||||
seal-home update check
|
||||
seal-home update changelog [--limit <n>]
|
||||
seal-home changelog [--limit <n>]
|
||||
seal-home tools list
|
||||
seal-home corps list [--corp <corpId>]
|
||||
seal-home corps current [--corp <corpId>]
|
||||
@@ -28788,7 +28790,7 @@ Usage:
|
||||
seal-home rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
|
||||
seal-home context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
|
||||
seal-home approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
|
||||
seal-home approval-runs search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
||||
seal-home approval-runs list|search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
||||
seal-home approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
|
||||
seal-home approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
|
||||
seal-home approval-runs cited-rules <recordId> [--corp <corpId>]
|
||||
@@ -28829,9 +28831,9 @@ function globalConfigSummary(config2 = loadGlobalConfig()) {
|
||||
};
|
||||
}
|
||||
async function runTool(name, client, corp, params, options = {}) {
|
||||
printJson2(await runToolResult2(name, client, corp, params), options);
|
||||
printJson(await runToolResult(name, client, corp, params), options);
|
||||
}
|
||||
async function runToolResult2(name, client, corp, params) {
|
||||
async function runToolResult(name, client, corp, params) {
|
||||
const tool = sealTools.find((item) => item.name === name);
|
||||
if (!tool)
|
||||
throw new Error(`Unknown Seal tool: ${name}`);
|
||||
@@ -28964,12 +28966,12 @@ async function handleApprovalRunsCommand(action, maybeName, client, corp, args)
|
||||
// src/cli/commands/auth.ts
|
||||
async function handleAuthCommand(action, corp, args) {
|
||||
if (action === "diagnose") {
|
||||
printJson2(await diagnoseAuth(corp));
|
||||
printJson(await diagnoseAuth(corp));
|
||||
return;
|
||||
}
|
||||
if (action === "hose-link") {
|
||||
const expiresIn = numberOption(args.options.expire) ?? 7200;
|
||||
printJson2(await getHoseProvisionalAuthLink(corp, expiresIn));
|
||||
printJson(await getHoseProvisionalAuthLink(corp, expiresIn));
|
||||
return;
|
||||
}
|
||||
throw new Error(`Unknown auth command: ${action ?? ""}. Run 'seal-home help' for available commands.`);
|
||||
@@ -29208,20 +29210,20 @@ async function handleBillingCommand(action, client, corp, args) {
|
||||
// src/cli/commands/config.ts
|
||||
function handleConfigCommand(action, maybeName, args) {
|
||||
if (action === "paths") {
|
||||
printJson2({
|
||||
printJson({
|
||||
candidates: getEnterprisesDirCandidates(),
|
||||
globalConfigFile: resolveGlobalConfigFile()
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (action === "get" || action === "status") {
|
||||
printJson2(globalConfigSummary());
|
||||
printJson(globalConfigSummary());
|
||||
return;
|
||||
}
|
||||
if (action === "mode") {
|
||||
const mode = maybeName ?? stringOption(args.options.mode);
|
||||
if (!mode) {
|
||||
printJson2(globalConfigSummary());
|
||||
printJson(globalConfigSummary());
|
||||
return;
|
||||
}
|
||||
const stateful = parseStateMode(mode);
|
||||
@@ -29232,7 +29234,7 @@ function handleConfigCommand(action, maybeName, args) {
|
||||
stateful,
|
||||
...defaultCorpId ? { defaultCorpId } : {}
|
||||
});
|
||||
printJson2(globalConfigSummary(config2));
|
||||
printJson(globalConfigSummary(config2));
|
||||
return;
|
||||
}
|
||||
throw new Error(`Unknown config command: ${action ?? ""}. Run 'seal-home help' for available commands.`);
|
||||
@@ -29286,7 +29288,7 @@ async function handleCorpsCommand(action, maybeName, args) {
|
||||
if (corps.length === 0) {
|
||||
console.error("提示:当前未检测到企业配置。你可以使用 seal-home corps add-hose 或 seal-home corps add-seal 添加企业,或运行 seal-home help 查看说明。");
|
||||
}
|
||||
printJson2(corps.map((item) => ({
|
||||
printJson(corps.map((item) => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
sourceType: item.source.type,
|
||||
@@ -29297,7 +29299,7 @@ async function handleCorpsCommand(action, maybeName, args) {
|
||||
}
|
||||
if (action === "current") {
|
||||
const corp = selectCorp(stringOption(args.options.corp));
|
||||
printJson2({
|
||||
printJson({
|
||||
id: corp.id,
|
||||
name: corp.name,
|
||||
sourceType: corp.source.type,
|
||||
@@ -29315,7 +29317,7 @@ async function handleCorpsCommand(action, maybeName, args) {
|
||||
}
|
||||
const corp = selectCorp(corpId);
|
||||
saveGlobalConfig({ ...globalConfig2, stateful: true, defaultCorpId: corp.id });
|
||||
printJson2({
|
||||
printJson({
|
||||
current: true,
|
||||
id: corp.id,
|
||||
name: corp.name
|
||||
@@ -29381,7 +29383,7 @@ async function addHoseCorp(input) {
|
||||
}
|
||||
writeFileSync4(file2, `${JSON.stringify(config2, null, 2)}
|
||||
`, { mode: 384 });
|
||||
printJson2({
|
||||
printJson({
|
||||
id,
|
||||
name,
|
||||
corpId,
|
||||
@@ -29443,7 +29445,7 @@ async function addSealCorp(input) {
|
||||
}
|
||||
writeFileSync4(file2, `${JSON.stringify(config2, null, 2)}
|
||||
`, { mode: 384 });
|
||||
printJson2({
|
||||
printJson({
|
||||
id,
|
||||
name: config2.name,
|
||||
tenantId,
|
||||
@@ -29545,7 +29547,7 @@ async function handleMcpCommand(action, args) {
|
||||
await startServer();
|
||||
}
|
||||
function printMcpConfig() {
|
||||
printJson2({
|
||||
printJson({
|
||||
mcpServers: {
|
||||
"seal-home": {
|
||||
type: "stdio",
|
||||
@@ -32911,7 +32913,7 @@ function getOpenApiSchema() {
|
||||
// src/cli/commands/openapi.ts
|
||||
function handleOpenApiCommand(args) {
|
||||
const schema = getOpenApiSchema();
|
||||
printJson2(schema, { ...outputOptions(args.options), allowFull: true });
|
||||
printJson(schema, { ...outputOptions(args.options), allowFull: true });
|
||||
}
|
||||
|
||||
// src/cli/commands/permissions.ts
|
||||
@@ -32983,9 +32985,9 @@ async function handleRulesCommand(action, maybeName, client, corp, args) {
|
||||
}, outputOptions(args.options));
|
||||
return;
|
||||
}
|
||||
const result = await runToolResult2("seal_approval_rules_list", client, corp, { limit, offset });
|
||||
const result = await runToolResult("seal_approval_rules_list", client, corp, { limit, offset });
|
||||
protectLargeRuleListOutput(result, booleanOption(args.options.full) === true);
|
||||
printJson2(result);
|
||||
printJson(result);
|
||||
return;
|
||||
}
|
||||
if (action === "clear") {
|
||||
@@ -32994,18 +32996,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 runToolResult2("seal_approval_rules_clear", client, corp, {
|
||||
const result = await runToolResult("seal_approval_rules_clear", client, corp, {
|
||||
dryRun,
|
||||
recode: booleanOption(args.options.recode)
|
||||
});
|
||||
if (!confirmed && dryRun && result && typeof result === "object") {
|
||||
printJson2({
|
||||
printJson({
|
||||
...result,
|
||||
nextCommand: `seal-home rules clear --corp ${corp.id} --yes`
|
||||
}, outputOptions(args.options));
|
||||
return;
|
||||
}
|
||||
printJson2(result, outputOptions(args.options));
|
||||
printJson(result, outputOptions(args.options));
|
||||
return;
|
||||
}
|
||||
if (action === "versions") {
|
||||
@@ -33208,7 +33210,7 @@ async function handleServiceCommand(action, runtime) {
|
||||
launcher: runtime.launcher
|
||||
});
|
||||
if (result !== undefined)
|
||||
printJson2(result);
|
||||
printJson(result);
|
||||
}
|
||||
|
||||
// src/cli/commands/simulation.ts
|
||||
@@ -33290,13 +33292,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.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."
|
||||
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."
|
||||
metadata:
|
||||
version: 0.7.1
|
||||
short-description: Seal tenant and Hose approval automation (v0.7.1)
|
||||
version: 0.7.0
|
||||
short-description: Seal tenant and Hose approval automation (v0.7.0)
|
||||
---
|
||||
|
||||
# Seal Home (v0.7.1)
|
||||
# Seal Home (v0.7.0)
|
||||
|
||||
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.
|
||||
|
||||
@@ -33333,10 +33335,6 @@ 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
|
||||
@@ -34416,7 +34414,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);
|
||||
printJson2({
|
||||
printJson({
|
||||
installed: true,
|
||||
targetDir: result.targetDir,
|
||||
fileCount: result.files.length,
|
||||
@@ -34427,7 +34425,7 @@ function handleSkillCommand(action, maybeName, args) {
|
||||
if (action === "status" || action === "get" || !action) {
|
||||
const globalDir = getDefaultGlobalSkillDir();
|
||||
const localDir = join7(process.cwd(), ".agents", "skills", "seal-home");
|
||||
printJson2({
|
||||
printJson({
|
||||
global: {
|
||||
dir: globalDir,
|
||||
installed: existsSync7(join7(globalDir, "SKILL.md"))
|
||||
@@ -34445,7 +34443,7 @@ function handleSkillCommand(action, maybeName, args) {
|
||||
// src/cli/commands/source.ts
|
||||
async function handleSourceCommand(action, corp) {
|
||||
if (action === "config") {
|
||||
printJson2(await resolveLiveSealEnterpriseConfig(corp));
|
||||
printJson(await resolveLiveSealEnterpriseConfig(corp));
|
||||
return;
|
||||
}
|
||||
throw new Error(`Unknown source command: ${action ?? ""}. Run 'seal-home help' for available commands.`);
|
||||
@@ -34460,7 +34458,7 @@ async function handleToolCommand(action, client, corp, args) {
|
||||
|
||||
// src/cli/commands/tools.ts
|
||||
function handleToolsListCommand() {
|
||||
printJson2(sealTools.map((tool) => ({ name: tool.name, description: tool.description })));
|
||||
printJson(sealTools.map((tool) => ({ name: tool.name, description: tool.description })));
|
||||
}
|
||||
|
||||
// src/cli/commands/update.ts
|
||||
@@ -34488,11 +34486,51 @@ async function handleUpdateCommand(runtime, options = {}) {
|
||||
version: VERSION,
|
||||
launcher: runtime.launcher
|
||||
};
|
||||
const repo = options.repo || process.env[GITHUB_REPO_ENV]?.trim() || DEFAULT_GITHUB_REPO;
|
||||
if (options.changelogOnly) {
|
||||
const releases2 = await fetchGitHubReleases(repo, options.limit ?? 10);
|
||||
printJson({
|
||||
currentVersion: VERSION,
|
||||
totalQueried: releases2.length,
|
||||
releases: releases2.map((r) => ({
|
||||
version: r.version,
|
||||
tagName: r.tagName,
|
||||
publishedAt: r.publishedAt,
|
||||
author: r.author,
|
||||
releaseNotes: r.notes,
|
||||
releaseUrl: r.htmlUrl,
|
||||
isCurrent: r.version === VERSION,
|
||||
isNewer: isNewerVersion(r.version, VERSION)
|
||||
}))
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!isCompiledBinary()) {
|
||||
if (options.checkOnly) {
|
||||
printJson2({
|
||||
const releases2 = await fetchGitHubReleases(repo, 30);
|
||||
const latestRelease = releases2[0];
|
||||
const latestVersion2 = latestRelease?.version ?? VERSION;
|
||||
const currentRelease2 = releases2.find((r) => r.version === VERSION);
|
||||
const isUpgrade2 = isNewerVersion(latestVersion2, VERSION);
|
||||
const pendingReleases2 = releases2.filter((r) => isNewerVersion(r.version, VERSION));
|
||||
printJson({
|
||||
updated: false,
|
||||
version: VERSION,
|
||||
updateAvailable: isUpgrade2,
|
||||
currentVersion: VERSION,
|
||||
currentVersionPublishedAt: currentRelease2?.publishedAt,
|
||||
latestVersion: latestVersion2,
|
||||
latestVersionPublishedAt: latestRelease?.publishedAt,
|
||||
behindCount: pendingReleases2.length,
|
||||
pendingReleases: pendingReleases2.map((r) => ({
|
||||
version: r.version,
|
||||
tagName: r.tagName,
|
||||
publishedAt: r.publishedAt,
|
||||
author: r.author,
|
||||
releaseNotes: r.notes,
|
||||
releaseUrl: r.htmlUrl
|
||||
})),
|
||||
releaseNotes: latestRelease?.notes ?? "",
|
||||
releaseUrl: latestRelease?.htmlUrl ?? "",
|
||||
mode: "source",
|
||||
message: "Running in source development mode. Run 'seal-home update' to git pull & bun install."
|
||||
});
|
||||
@@ -34509,7 +34547,7 @@ async function handleUpdateCommand(runtime, options = {}) {
|
||||
runCommand("bun", ["install"], { cwd: runtime.appRoot });
|
||||
if (wasRunning2)
|
||||
await runServiceCommand("start", serviceConfig);
|
||||
printJson2({
|
||||
printJson({
|
||||
updated: true,
|
||||
serviceRestarted: wasRunning2,
|
||||
version: VERSION,
|
||||
@@ -34517,12 +34555,12 @@ async function handleUpdateCommand(runtime, options = {}) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
const repo = options.repo || process.env[GITHUB_REPO_ENV]?.trim() || DEFAULT_GITHUB_REPO;
|
||||
const platform = detectPlatform();
|
||||
const arch = detectArch();
|
||||
const release = await fetchGitHubRelease(repo, options.targetVersion);
|
||||
const releases = await fetchGitHubReleases(repo, 30);
|
||||
const release = options.targetVersion ? releases.find((r) => r.version === options.targetVersion || r.tagName === options.targetVersion) ?? await fetchGitHubRelease(repo, options.targetVersion) : releases[0] ?? await fetchGitHubRelease(repo);
|
||||
if (!release) {
|
||||
printJson2({
|
||||
printJson({
|
||||
updated: false,
|
||||
currentVersion: VERSION,
|
||||
mode: "binary",
|
||||
@@ -34531,14 +34569,27 @@ async function handleUpdateCommand(runtime, options = {}) {
|
||||
return;
|
||||
}
|
||||
const latestVersion = release.version;
|
||||
const currentRelease = releases.find((r) => r.version === VERSION);
|
||||
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
||||
const shouldUpdate = options.force || Boolean(options.targetVersion) || isUpgrade;
|
||||
const pendingReleases = releases.filter((r) => isNewerVersion(r.version, VERSION));
|
||||
if (options.checkOnly) {
|
||||
printJson2({
|
||||
printJson({
|
||||
updated: false,
|
||||
updateAvailable: isUpgrade,
|
||||
currentVersion: VERSION,
|
||||
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||
latestVersion,
|
||||
latestVersionPublishedAt: release.publishedAt,
|
||||
behindCount: pendingReleases.length,
|
||||
pendingReleases: pendingReleases.map((r) => ({
|
||||
version: r.version,
|
||||
tagName: r.tagName,
|
||||
publishedAt: r.publishedAt,
|
||||
author: r.author,
|
||||
releaseNotes: r.notes,
|
||||
releaseUrl: r.htmlUrl
|
||||
})),
|
||||
releaseNotes: release.notes,
|
||||
releaseUrl: release.htmlUrl,
|
||||
mode: "binary"
|
||||
@@ -34546,10 +34597,12 @@ async function handleUpdateCommand(runtime, options = {}) {
|
||||
return;
|
||||
}
|
||||
if (!shouldUpdate) {
|
||||
printJson2({
|
||||
printJson({
|
||||
updated: false,
|
||||
currentVersion: VERSION,
|
||||
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||
latestVersion,
|
||||
latestVersionPublishedAt: release.publishedAt,
|
||||
mode: "binary",
|
||||
message: `seal-home is already up to date (v${VERSION})`
|
||||
});
|
||||
@@ -34594,7 +34647,7 @@ async function handleUpdateCommand(runtime, options = {}) {
|
||||
if (wasRunning)
|
||||
await runServiceCommand("start", serviceConfig);
|
||||
const skillSync = syncGlobalSkillIfPresent();
|
||||
printJson2({
|
||||
printJson({
|
||||
updated: true,
|
||||
fromVersion: VERSION,
|
||||
toVersion: latestVersion,
|
||||
@@ -34618,6 +34671,48 @@ function detectPlatform() {
|
||||
function detectArch() {
|
||||
return process.arch === "arm64" ? "arm64" : "x64";
|
||||
}
|
||||
async function fetchGitHubReleases(repo, limit = 20) {
|
||||
const url2 = `https://api.github.com/repos/${repo}/releases?per_page=${limit}`;
|
||||
const headers = {
|
||||
"User-Agent": `seal-home/${VERSION}`,
|
||||
Accept: "application/vnd.github.v3+json"
|
||||
};
|
||||
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
||||
if (token) {
|
||||
headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
try {
|
||||
const res = await fetch(url2, { headers });
|
||||
if (!res.ok)
|
||||
return [];
|
||||
const json2 = await res.json();
|
||||
if (!Array.isArray(json2))
|
||||
return [];
|
||||
return json2.map((item) => {
|
||||
const tagName = item.tag_name ?? "";
|
||||
const version2 = tagName.replace(/^v/, "");
|
||||
if (!version2)
|
||||
return;
|
||||
const assets = (item.assets ?? []).map((a) => ({
|
||||
name: a.name,
|
||||
downloadUrl: a.browser_download_url,
|
||||
size: a.size ?? 0
|
||||
}));
|
||||
return {
|
||||
version: version2,
|
||||
tagName,
|
||||
name: item.name ?? tagName,
|
||||
publishedAt: item.published_at,
|
||||
author: item.author?.login,
|
||||
notes: item.body ?? "",
|
||||
htmlUrl: item.html_url ?? "",
|
||||
assets
|
||||
};
|
||||
}).filter((item) => Boolean(item));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
async function fetchGitHubRelease(repo, targetVersion) {
|
||||
const url2 = targetVersion ? `https://api.github.com/repos/${repo}/releases/tags/${targetVersion.startsWith("v") ? targetVersion : `v${targetVersion}`}` : `https://api.github.com/repos/${repo}/releases/latest`;
|
||||
const headers = {
|
||||
@@ -34645,6 +34740,9 @@ async function fetchGitHubRelease(repo, targetVersion) {
|
||||
return {
|
||||
version: version2,
|
||||
tagName,
|
||||
name: json2.name ?? tagName,
|
||||
publishedAt: json2.published_at,
|
||||
author: json2.author?.login,
|
||||
notes: json2.body ?? "",
|
||||
htmlUrl: json2.html_url ?? "",
|
||||
assets
|
||||
@@ -34955,7 +35053,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)) {
|
||||
printJson2({
|
||||
printJson({
|
||||
name: "seal-home",
|
||||
version: VERSION
|
||||
});
|
||||
@@ -34996,10 +35094,14 @@ async function dispatch(argv, runtime) {
|
||||
await handleServiceCommand(action, runtime);
|
||||
return;
|
||||
}
|
||||
if (area === "update") {
|
||||
const targetVersion = stringOption(args.options.version) ?? stringOption(args.options.tag) ?? (action && !action.startsWith("-") ? action : undefined);
|
||||
if (area === "update" || area === "changelog") {
|
||||
const isChangelog = area === "changelog" || action === "changelog" || action === "log" || action === "history" || booleanOption(args.options.changelog) === true;
|
||||
const isCheck = action === "check" || booleanOption(args.options.check) === true || booleanOption(args.options["check-only"]) === true;
|
||||
const targetVersion = stringOption(args.options.version) ?? stringOption(args.options.tag) ?? (!isChangelog && !isCheck && action && !action.startsWith("-") ? action : undefined);
|
||||
await handleUpdateCommand(runtime, {
|
||||
checkOnly: booleanOption(args.options.check) ?? booleanOption(args.options["check-only"]),
|
||||
checkOnly: isCheck,
|
||||
changelogOnly: isChangelog,
|
||||
limit: numberOption(args.options.limit),
|
||||
force: booleanOption(args.options.force),
|
||||
targetVersion,
|
||||
repo: stringOption(args.options.repo)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
name: seal-home
|
||||
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."
|
||||
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."
|
||||
metadata:
|
||||
version: 0.7.1
|
||||
short-description: Seal tenant and Hose approval automation (v0.7.1)
|
||||
version: 0.7.0
|
||||
short-description: Seal tenant and Hose approval automation (v0.7.0)
|
||||
---
|
||||
|
||||
# Seal Home (v0.7.1)
|
||||
# Seal Home (v0.7.0)
|
||||
|
||||
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,10 +43,6 @@ 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
|
||||
|
||||
@@ -165,6 +165,26 @@ describe("CLI version & help handling", () => {
|
||||
expect(parsed.info.title).toContain("seal-home");
|
||||
expect(parsed.paths).toHaveProperty("/v1/corps");
|
||||
});
|
||||
|
||||
test("update check subcommand outputs structured check payload", () => {
|
||||
const result = runCli(["update", "check"]);
|
||||
expect(result.status).toBe(0);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
expect(parsed).toHaveProperty("currentVersion");
|
||||
expect(parsed).toHaveProperty("latestVersion");
|
||||
expect(parsed).toHaveProperty("updateAvailable");
|
||||
expect(parsed).toHaveProperty("behindCount");
|
||||
expect(parsed).toHaveProperty("pendingReleases");
|
||||
expect(Array.isArray(parsed.pendingReleases)).toBe(true);
|
||||
});
|
||||
|
||||
test("changelog command outputs release history list", () => {
|
||||
const result = runCli(["changelog", "--limit", "5"]);
|
||||
expect(result.status).toBe(0);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
expect(parsed.currentVersion).toBe(VERSION);
|
||||
expect(Array.isArray(parsed.releases)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
function makeConfigEnv(): Record<string, string> {
|
||||
|
||||
+133
-5
@@ -15,6 +15,8 @@ const GITHUB_REPO_ENV = "SEAL_HOME_GITHUB_REPO";
|
||||
|
||||
export type UpdateOptions = {
|
||||
checkOnly?: boolean;
|
||||
changelogOnly?: boolean;
|
||||
limit?: number;
|
||||
force?: boolean;
|
||||
targetVersion?: string;
|
||||
repo?: string;
|
||||
@@ -29,12 +31,56 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
||||
launcher: runtime.launcher
|
||||
};
|
||||
|
||||
// 1. Source development mode (running via bun/node)
|
||||
const repo = options.repo || process.env[GITHUB_REPO_ENV]?.trim() || DEFAULT_GITHUB_REPO;
|
||||
|
||||
// 1. Changelog / Release History query
|
||||
if (options.changelogOnly) {
|
||||
const releases = await fetchGitHubReleases(repo, options.limit ?? 10);
|
||||
printJson({
|
||||
currentVersion: VERSION,
|
||||
totalQueried: releases.length,
|
||||
releases: releases.map((r) => ({
|
||||
version: r.version,
|
||||
tagName: r.tagName,
|
||||
publishedAt: r.publishedAt,
|
||||
author: r.author,
|
||||
releaseNotes: r.notes,
|
||||
releaseUrl: r.htmlUrl,
|
||||
isCurrent: r.version === VERSION,
|
||||
isNewer: isNewerVersion(r.version, VERSION)
|
||||
}))
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Source development mode (running via bun/node)
|
||||
if (!isCompiledBinary()) {
|
||||
if (options.checkOnly) {
|
||||
const releases = await fetchGitHubReleases(repo, 30);
|
||||
const latestRelease = releases[0];
|
||||
const latestVersion = latestRelease?.version ?? VERSION;
|
||||
const currentRelease = releases.find((r) => r.version === VERSION);
|
||||
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
||||
const pendingReleases = releases.filter((r) => isNewerVersion(r.version, VERSION));
|
||||
|
||||
printJson({
|
||||
updated: false,
|
||||
version: VERSION,
|
||||
updateAvailable: isUpgrade,
|
||||
currentVersion: VERSION,
|
||||
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||
latestVersion,
|
||||
latestVersionPublishedAt: latestRelease?.publishedAt,
|
||||
behindCount: pendingReleases.length,
|
||||
pendingReleases: pendingReleases.map((r) => ({
|
||||
version: r.version,
|
||||
tagName: r.tagName,
|
||||
publishedAt: r.publishedAt,
|
||||
author: r.author,
|
||||
releaseNotes: r.notes,
|
||||
releaseUrl: r.htmlUrl
|
||||
})),
|
||||
releaseNotes: latestRelease?.notes ?? "",
|
||||
releaseUrl: latestRelease?.htmlUrl ?? "",
|
||||
mode: "source",
|
||||
message: "Running in source development mode. Run 'seal-home update' to git pull & bun install."
|
||||
});
|
||||
@@ -62,12 +108,16 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Standalone binary mode: check GitHub Releases
|
||||
const repo = options.repo || process.env[GITHUB_REPO_ENV]?.trim() || DEFAULT_GITHUB_REPO;
|
||||
// 3. Standalone binary mode: check GitHub Releases
|
||||
const platform = detectPlatform();
|
||||
const arch = detectArch();
|
||||
|
||||
const release = await fetchGitHubRelease(repo, options.targetVersion);
|
||||
const releases = await fetchGitHubReleases(repo, 30);
|
||||
const release = options.targetVersion
|
||||
? (releases.find((r) => r.version === options.targetVersion || r.tagName === options.targetVersion) ??
|
||||
await fetchGitHubRelease(repo, options.targetVersion))
|
||||
: (releases[0] ?? await fetchGitHubRelease(repo));
|
||||
|
||||
if (!release) {
|
||||
printJson({
|
||||
updated: false,
|
||||
@@ -79,15 +129,28 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
||||
}
|
||||
|
||||
const latestVersion = release.version;
|
||||
const currentRelease = releases.find((r) => r.version === VERSION);
|
||||
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
||||
const shouldUpdate = options.force || Boolean(options.targetVersion) || isUpgrade;
|
||||
const pendingReleases = releases.filter((r) => isNewerVersion(r.version, VERSION));
|
||||
|
||||
if (options.checkOnly) {
|
||||
printJson({
|
||||
updated: false,
|
||||
updateAvailable: isUpgrade,
|
||||
currentVersion: VERSION,
|
||||
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||
latestVersion,
|
||||
latestVersionPublishedAt: release.publishedAt,
|
||||
behindCount: pendingReleases.length,
|
||||
pendingReleases: pendingReleases.map((r) => ({
|
||||
version: r.version,
|
||||
tagName: r.tagName,
|
||||
publishedAt: r.publishedAt,
|
||||
author: r.author,
|
||||
releaseNotes: r.notes,
|
||||
releaseUrl: r.htmlUrl
|
||||
})),
|
||||
releaseNotes: release.notes,
|
||||
releaseUrl: release.htmlUrl,
|
||||
mode: "binary"
|
||||
@@ -99,7 +162,9 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
||||
printJson({
|
||||
updated: false,
|
||||
currentVersion: VERSION,
|
||||
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||
latestVersion,
|
||||
latestVersionPublishedAt: release.publishedAt,
|
||||
mode: "binary",
|
||||
message: `seal-home is already up to date (v${VERSION})`
|
||||
});
|
||||
@@ -200,11 +265,68 @@ type GitHubAsset = {
|
||||
type GitHubRelease = {
|
||||
version: string;
|
||||
tagName: string;
|
||||
name?: string;
|
||||
publishedAt?: string;
|
||||
author?: string;
|
||||
notes: string;
|
||||
htmlUrl: string;
|
||||
assets: GitHubAsset[];
|
||||
};
|
||||
|
||||
async function fetchGitHubReleases(repo: string, limit = 20): Promise<GitHubRelease[]> {
|
||||
const url = `https://api.github.com/repos/${repo}/releases?per_page=${limit}`;
|
||||
const headers: Record<string, string> = {
|
||||
"User-Agent": `seal-home/${VERSION}`,
|
||||
Accept: "application/vnd.github.v3+json"
|
||||
};
|
||||
|
||||
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
||||
if (token) {
|
||||
headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch(url, { headers });
|
||||
if (!res.ok) return [];
|
||||
const json = (await res.json()) as Array<{
|
||||
tag_name?: string;
|
||||
name?: string;
|
||||
body?: string;
|
||||
html_url?: string;
|
||||
published_at?: string;
|
||||
author?: { login?: string };
|
||||
assets?: Array<{ name: string; browser_download_url: string; size?: number }>;
|
||||
}>;
|
||||
|
||||
if (!Array.isArray(json)) return [];
|
||||
|
||||
const list: GitHubRelease[] = [];
|
||||
for (const item of json) {
|
||||
const tagName = item.tag_name ?? "";
|
||||
const version = tagName.replace(/^v/, "");
|
||||
if (!version) continue;
|
||||
const assets: GitHubAsset[] = (item.assets ?? []).map((a) => ({
|
||||
name: a.name,
|
||||
downloadUrl: a.browser_download_url,
|
||||
size: a.size ?? 0
|
||||
}));
|
||||
list.push({
|
||||
version,
|
||||
tagName,
|
||||
name: item.name ?? tagName,
|
||||
publishedAt: item.published_at,
|
||||
author: item.author?.login,
|
||||
notes: item.body ?? "",
|
||||
htmlUrl: item.html_url ?? "",
|
||||
assets
|
||||
});
|
||||
}
|
||||
return list;
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchGitHubRelease(repo: string, targetVersion?: string): Promise<GitHubRelease | undefined> {
|
||||
const url = targetVersion
|
||||
? `https://api.github.com/repos/${repo}/releases/tags/${targetVersion.startsWith("v") ? targetVersion : `v${targetVersion}`}`
|
||||
@@ -225,8 +347,11 @@ async function fetchGitHubRelease(repo: string, targetVersion?: string): Promise
|
||||
if (!res.ok) return undefined;
|
||||
const json = (await res.json()) as {
|
||||
tag_name?: string;
|
||||
name?: string;
|
||||
body?: string;
|
||||
html_url?: string;
|
||||
published_at?: string;
|
||||
author?: { login?: string };
|
||||
assets?: Array<{ name: string; browser_download_url: string; size?: number }>;
|
||||
};
|
||||
|
||||
@@ -243,6 +368,9 @@ async function fetchGitHubRelease(repo: string, targetVersion?: string): Promise
|
||||
return {
|
||||
version,
|
||||
tagName,
|
||||
name: json.name ?? tagName,
|
||||
publishedAt: json.published_at,
|
||||
author: json.author?.login,
|
||||
notes: json.body ?? "",
|
||||
htmlUrl: json.html_url ?? "",
|
||||
assets
|
||||
|
||||
+5
-3
@@ -85,8 +85,10 @@ Usage:
|
||||
seal-home config paths
|
||||
seal-home config get
|
||||
seal-home config mode <stateful|stateless> [--corp <corpId>]
|
||||
seal-home service <start|stop|restart|status>
|
||||
seal-home update
|
||||
seal-home update [--check] [--force] [--version <v>]
|
||||
seal-home update check
|
||||
seal-home update changelog [--limit <n>]
|
||||
seal-home changelog [--limit <n>]
|
||||
seal-home tools list
|
||||
seal-home corps list [--corp <corpId>]
|
||||
seal-home corps current [--corp <corpId>]
|
||||
@@ -128,7 +130,7 @@ Usage:
|
||||
seal-home rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
|
||||
seal-home context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
|
||||
seal-home approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
|
||||
seal-home approval-runs search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
||||
seal-home approval-runs list|search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
||||
seal-home approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
|
||||
seal-home approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
|
||||
seal-home approval-runs cited-rules <recordId> [--corp <corpId>]
|
||||
|
||||
+24
-5
@@ -27,7 +27,7 @@ import { handleUpdateCommand } from "./commands/update.js";
|
||||
import { handleUsersCommand } from "./commands/users.js";
|
||||
import { handleWebhookCommand } from "./commands/webhook.js";
|
||||
import { selectCorp } from "./helpers.js";
|
||||
import { booleanOption, parseArgs, stringOption } from "./parser.js";
|
||||
import { booleanOption, numberOption, parseArgs, stringOption } from "./parser.js";
|
||||
import {
|
||||
formatConsoleOutput,
|
||||
joinOutput,
|
||||
@@ -63,7 +63,8 @@ const KNOWN_AREAS = new Set([
|
||||
"mcp-config",
|
||||
"skill",
|
||||
"openapi",
|
||||
"probe"
|
||||
"probe",
|
||||
"changelog"
|
||||
]);
|
||||
|
||||
export type { CliResult, CliRunOptions } from "./types.js";
|
||||
@@ -181,10 +182,28 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (area === "update") {
|
||||
const targetVersion = stringOption(args.options.version) ?? stringOption(args.options.tag) ?? (action && !action.startsWith("-") ? action : undefined);
|
||||
if (area === "update" || area === "changelog") {
|
||||
const isChangelog =
|
||||
area === "changelog" ||
|
||||
action === "changelog" ||
|
||||
action === "log" ||
|
||||
action === "history" ||
|
||||
booleanOption(args.options.changelog) === true;
|
||||
|
||||
const isCheck =
|
||||
action === "check" ||
|
||||
booleanOption(args.options.check) === true ||
|
||||
booleanOption(args.options["check-only"]) === true;
|
||||
|
||||
const targetVersion =
|
||||
stringOption(args.options.version) ??
|
||||
stringOption(args.options.tag) ??
|
||||
(!isChangelog && !isCheck && action && !action.startsWith("-") ? action : undefined);
|
||||
|
||||
await handleUpdateCommand(runtime, {
|
||||
checkOnly: booleanOption(args.options.check) ?? booleanOption(args.options["check-only"]),
|
||||
checkOnly: isCheck,
|
||||
changelogOnly: isChangelog,
|
||||
limit: numberOption(args.options.limit),
|
||||
force: booleanOption(args.options.force),
|
||||
targetVersion,
|
||||
repo: stringOption(args.options.repo)
|
||||
|
||||
Reference in new issue
Block a user