Refine corps command hierarchy and safety docs
This commit is contained in:
1 parent
60bdd8f36a
commit
b9533b1b66
11 files changed
+419
-224
No files matched your search
@@ -793,6 +793,17 @@ describe("corps list & current", () => {
|
||||
});
|
||||
|
||||
describe("corps replay-test", () => {
|
||||
test("requires confirmation before a live replay to a bound test enterprise", async () => {
|
||||
setupTestEnv();
|
||||
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
|
||||
|
||||
const result = await runCli(["corps", "replay-test", "corp-prod"]);
|
||||
|
||||
expect(result.isError).toBe(true);
|
||||
expect(result.exitCode).toBe(10);
|
||||
expect(result.stderr).toContain("without --confirm");
|
||||
});
|
||||
|
||||
test("fails if production corp has no bound test corp", async () => {
|
||||
setupTestEnv();
|
||||
const result = await runCli(["corps", "replay-test", "corp-test"]);
|
||||
|
||||
@@ -155,6 +155,22 @@ describe("corps link onboarding", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("does not save a Hose assistance link with --dry-run", async () => {
|
||||
const enterprises = setupConfigEnv();
|
||||
mockSealLinkRequests();
|
||||
|
||||
const result = await runCli(["corps", "add-link", hoseLink(), "--dry-run"]);
|
||||
|
||||
expect(result.isError).toBe(false);
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({
|
||||
dryRun: true,
|
||||
kind: "hose",
|
||||
corpId: "acme-01",
|
||||
sealUrl: "https://acme-01.sealai.cc"
|
||||
});
|
||||
expect(readDirectory(enterprises)).toEqual([]);
|
||||
});
|
||||
|
||||
test("rejects --as-hose when passed with a Seal native delegate link", async () => {
|
||||
mockSealLinkRequests();
|
||||
|
||||
@@ -747,6 +763,26 @@ describe("Hose OpenAPI key extraction from assistance link", () => {
|
||||
expect(config.source.appSecurity).toBe("sec_secret_password_456789");
|
||||
});
|
||||
|
||||
test("corps add-link --as-hose --dry-run does not save a Hose configuration", async () => {
|
||||
const enterprises = setupConfigEnv();
|
||||
mockHoseKeysRequests();
|
||||
|
||||
const result = await runCli(["corps", "add-link", hoseLink(), "--as-hose", "--dry-run"]);
|
||||
|
||||
expect(result.isError).toBe(false);
|
||||
const parsed = JSON.parse(result.stdout);
|
||||
expect(parsed).toMatchObject({
|
||||
dryRun: true,
|
||||
kind: "hose",
|
||||
corpId: "acme-01",
|
||||
selectedKey: {
|
||||
appKey: "ak_acme_production_123",
|
||||
appSecurity: "sec_secr...6789"
|
||||
}
|
||||
});
|
||||
expect(readDirectory(enterprises)).toEqual([]);
|
||||
});
|
||||
|
||||
test("auth extract-keys alias works before any enterprise is configured", async () => {
|
||||
setupConfigEnv();
|
||||
mockHoseKeysRequests();
|
||||
|
||||
+83
-18
@@ -475,14 +475,14 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
||||
prodDocsRes,
|
||||
testDocsRes
|
||||
] = await Promise.all([
|
||||
api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences).catch(() => ({} as any)),
|
||||
api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences).catch(() => ({} as any)),
|
||||
api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences),
|
||||
api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences),
|
||||
api.listApprovalRules(prodClient),
|
||||
api.listApprovalRules(testClient),
|
||||
api.listApprovalRuleVersions(prodClient).catch(() => []),
|
||||
api.listApprovalRuleVersions(testClient).catch(() => []),
|
||||
api.listApprovalDocuments(prodClient, { limit: 100 }).catch(() => ({ articles: [] })),
|
||||
api.listApprovalDocuments(testClient, { limit: 100 }).catch(() => ({ articles: [] }))
|
||||
api.listApprovalRuleVersions(prodClient),
|
||||
api.listApprovalRuleVersions(testClient),
|
||||
listAllApprovalDocuments(prodClient),
|
||||
listAllApprovalDocuments(testClient)
|
||||
]);
|
||||
|
||||
const prodDocs = (prodDocsRes.articles || []).filter((d) => !d.isDeleted);
|
||||
@@ -734,7 +734,10 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
||||
}
|
||||
|
||||
// 5. Batch recode rules in test enterprise
|
||||
await api.recodeApprovalRules(testClient).catch(() => undefined);
|
||||
const recodeResult = await api.recodeApprovalRules(testClient) as { ok: boolean; status: number };
|
||||
if (!recodeResult.ok) {
|
||||
throw new Error(`Failed to recode test approval rules: HTTP ${recodeResult.status}`);
|
||||
}
|
||||
|
||||
// 6. Publish new version in test enterprise
|
||||
const published = await api.publishApprovalRuleVersion(testClient, versionName);
|
||||
@@ -788,9 +791,7 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
||||
} catch {}
|
||||
|
||||
// 7. Sync hosecloud integrations from prod to test (hose-source corps only)
|
||||
const hosecloudSync = await syncHosecloudIntegrationsToTest(prodCorp, testCorp, prodClient, testClient).catch(
|
||||
(err) => ({ skipped: true, reason: `error: ${err?.message ?? String(err)}` } as HosecloudSyncResult)
|
||||
);
|
||||
const hosecloudSync = await syncHosecloudIntegrationsToTest(prodCorp, testCorp, prodClient, testClient);
|
||||
|
||||
printJson({
|
||||
success: true,
|
||||
@@ -850,6 +851,8 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
||||
const prodCorp = selectCorp(targetCorpId);
|
||||
|
||||
const force = booleanOption(args.options.force) === true;
|
||||
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]);
|
||||
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
|
||||
let testCorp: CorpConfig;
|
||||
|
||||
if (!prodCorp.testCorpId) {
|
||||
@@ -870,6 +873,13 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
||||
}
|
||||
}
|
||||
|
||||
if (!dryRun && !confirmed) {
|
||||
throw confirmationRequired(
|
||||
"Refusing to replay approval records without --confirm. Use --dry-run to preview the payload without sending it.",
|
||||
`seal-use corps replay-test ${targetCorpId ?? "<prodCorpId>"} --confirm`
|
||||
);
|
||||
}
|
||||
|
||||
const recordId =
|
||||
stringOption(args.options.recordId) ??
|
||||
stringOption(args.options["record-id"]) ??
|
||||
@@ -897,8 +907,6 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
||||
const snPrefix = stringOption(args.options.snPrefix) ?? stringOption(args.options["sn-prefix"]);
|
||||
const docIdSuffix = stringOption(args.options.docIdSuffix) ?? stringOption(args.options["doc-id-suffix"]);
|
||||
const docIdPrefix = stringOption(args.options.docIdPrefix) ?? stringOption(args.options["doc-id-prefix"]);
|
||||
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]);
|
||||
|
||||
const query: ReplayRecordsQuery = {
|
||||
recordId,
|
||||
recordIds,
|
||||
@@ -954,7 +962,10 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
||||
console.error(`👉 Next action: seal-use approval-runs list --corp ${testCorp.id} --limit ${result.totalCount}`);
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
if (!result.success) {
|
||||
process.exitCode = 1;
|
||||
throw new CliError(
|
||||
`Approval record replay failed: ${result.failureCount} record(s) failed.`,
|
||||
1
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1049,6 +1060,7 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
||||
stringOption(args.options.name),
|
||||
booleanOption(args.options.overwrite) === true,
|
||||
booleanOption(args.options.force) === true,
|
||||
dryRun,
|
||||
{
|
||||
appKey: stringOption(args.options["app-key"]) ?? stringOption(args.options.appKey),
|
||||
keyId: stringOption(args.options["key-id"]) ?? stringOption(args.options.keyId)
|
||||
@@ -1133,6 +1145,23 @@ export function maskCellphone(phone: string | undefined | null): string {
|
||||
// Hosecloud integration sync helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listAllApprovalDocuments(client: import("ky").KyInstance) {
|
||||
const pageSize = 100;
|
||||
const documents: Awaited<ReturnType<typeof api.listApprovalDocuments>>["articles"] = [];
|
||||
let offset = 0;
|
||||
|
||||
while (true) {
|
||||
const page = await api.listApprovalDocuments(client, { offset, limit: pageSize });
|
||||
documents.push(...page.articles);
|
||||
offset += page.articles.length;
|
||||
|
||||
if (page.articles.length === 0 || page.articles.length < pageSize) break;
|
||||
if (page.total !== undefined && offset >= page.total) break;
|
||||
}
|
||||
|
||||
return { articles: documents, total: documents.length };
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the outboundName for a test-env hosecloud integration.
|
||||
* Format: {企业名前7字}(Seal测) — capped at 13 chars total.
|
||||
@@ -1179,8 +1208,8 @@ async function syncHosecloudIntegrationsToTest(
|
||||
}
|
||||
|
||||
const [prodPref, testPref] = await Promise.all([
|
||||
api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences).catch(() => ({} as any)),
|
||||
api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences).catch(() => ({} as any))
|
||||
api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences),
|
||||
api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences)
|
||||
])
|
||||
|
||||
const prodIntegrations: any[] = (prodPref.integrations ?? []).filter((i: any) => i.type === "hosecloud")
|
||||
@@ -1198,7 +1227,7 @@ async function syncHosecloudIntegrationsToTest(
|
||||
const cid = item.corporationId ?? prodCorp.id
|
||||
if (!seenCorpIds.has(cid)) {
|
||||
seenCorpIds.add(cid)
|
||||
distinctProdIntegrations.push(item)
|
||||
distinctProdIntegrations.push({ ...item, corporationId: cid })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1341,7 +1370,7 @@ async function queryHoseStaffs(input: Record<string, unknown>) {
|
||||
staffs: staffDetails.map((s) => ({
|
||||
id: s.id,
|
||||
name: s.name,
|
||||
cellphone: s.cellphone,
|
||||
cellphone: maskCellphone(s.cellphone),
|
||||
active: s.active,
|
||||
authState: s.authState,
|
||||
userId: s.userId,
|
||||
@@ -1428,6 +1457,8 @@ async function addHoseCorp(input: Record<string, unknown>) {
|
||||
` • 按手机选择:追加 --staffPhone <手机号>(支持手机后4位,如: --staffPhone 5678)\n` +
|
||||
` • 或传 force:true / --force 自动使用默认首位管理员。`
|
||||
);
|
||||
} else {
|
||||
finalStaffId = staffDetails.find((staff) => staff.active)?.id ?? staffDetails[0]?.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1600,6 +1631,18 @@ async function addLinkCorp(link: string, name: string | undefined, overwrite: bo
|
||||
};
|
||||
|
||||
assertHoseAssistTenantMatches(session.corpId, identity.tenant);
|
||||
if (dryRun) {
|
||||
printJson({
|
||||
dryRun: true,
|
||||
kind: "hose",
|
||||
corpId: session.corpId,
|
||||
sealUrl: session.sealUrl,
|
||||
tenant: identity.tenant,
|
||||
user: identity.user
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
writeSealCorpConfig(
|
||||
{
|
||||
id: session.corpId,
|
||||
@@ -1680,6 +1723,7 @@ async function addLinkAsHoseCorp(
|
||||
name: string | undefined,
|
||||
overwrite: boolean,
|
||||
force = false,
|
||||
dryRun = false,
|
||||
selection?: { appKey?: string; keyId?: string }
|
||||
) {
|
||||
console.error("ℹ️ [合思子域提权] 正在通过合思协助链接提取 OpenAPI 开发者密钥并提升企业权限等级...");
|
||||
@@ -1691,8 +1735,29 @@ async function addLinkAsHoseCorp(
|
||||
`seal-use corps add-link "<url>" --as-hose`
|
||||
);
|
||||
console.error(
|
||||
`ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${selectedKey.appKey}, 应用: "${selectedKey.name || "未命名应用"}"),正在初始化为长期合思标准配置...`
|
||||
dryRun
|
||||
? `ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${selectedKey.appKey}, 应用: "${selectedKey.name || "未命名应用"}"),正在生成预览...`
|
||||
: `ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${selectedKey.appKey}, 应用: "${selectedKey.name || "未命名应用"}"),正在初始化为长期合思标准配置...`
|
||||
);
|
||||
if (dryRun) {
|
||||
printJson({
|
||||
dryRun: true,
|
||||
kind: "hose",
|
||||
provider: "hose",
|
||||
corpId: result.corpId,
|
||||
corpName: result.corpName,
|
||||
baseUrl: result.baseUrl,
|
||||
staffId: result.staffId,
|
||||
selectedKey: {
|
||||
id: selectedKey.id,
|
||||
name: selectedKey.name || "-",
|
||||
appKey: selectedKey.appKey,
|
||||
appSecurity: maskHoseSecurity(selectedKey.appSecurity),
|
||||
active: selectedKey.active
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
await addHoseCorp({
|
||||
domain: result.baseUrl,
|
||||
appKey: selectedKey.appKey,
|
||||
|
||||
@@ -73,6 +73,11 @@ describe("renderHelp", () => {
|
||||
expect(help).toContain("seal-use corps - Enterprise and tenant management");
|
||||
expect(help).toContain("seal-use corps bind-test");
|
||||
expect(help).toContain("seal-use corps sync-test");
|
||||
expect(help).toContain("发现与选择:");
|
||||
expect(help).toContain("企业接入:");
|
||||
expect(help).toContain("Hose 专属能力:");
|
||||
expect(help).toContain("seal-use corps probe-hose");
|
||||
expect(help).toContain("seal-use corps hose-staffs");
|
||||
expect(help).not.toContain("seal-use webhook");
|
||||
expect(help).not.toContain("seal-use simulation");
|
||||
expect(help).not.toContain("seal-use billing");
|
||||
|
||||
+58
-15
@@ -9,6 +9,7 @@ export interface CommandOptionHelp {
|
||||
export interface CommandHelp {
|
||||
name: string;
|
||||
aliases?: string[];
|
||||
group?: string;
|
||||
summary?: string;
|
||||
usage: string[];
|
||||
options?: CommandOptionHelp[];
|
||||
@@ -19,6 +20,7 @@ export interface AreaHelp {
|
||||
area: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
groupOrder?: string[];
|
||||
commands: CommandHelp[];
|
||||
}
|
||||
|
||||
@@ -27,9 +29,11 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
area: "corps",
|
||||
title: "Enterprise and tenant management",
|
||||
description: "Manage enterprise configurations, environment modes, test bindings, and syncing.",
|
||||
groupOrder: ["企业接入", "发现与选择", "企业配置", "测试配对与验证", "Hose 专属能力"],
|
||||
commands: [
|
||||
{
|
||||
name: "list",
|
||||
group: "发现与选择",
|
||||
summary: "List configured enterprises sorted by 7-day usage frequency",
|
||||
usage: ["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],
|
||||
options: [
|
||||
@@ -42,6 +46,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{
|
||||
name: "search",
|
||||
aliases: ["find"],
|
||||
group: "发现与选择",
|
||||
summary: "Search configured enterprises with intelligent soft fuzzy matching",
|
||||
usage: ["seal-use corps search <query> [--env <production|test>] [--strict]"],
|
||||
options: [
|
||||
@@ -53,22 +58,26 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{
|
||||
name: "get",
|
||||
aliases: ["show"],
|
||||
group: "发现与选择",
|
||||
summary: "Get rich details and configuration of an enterprise",
|
||||
usage: ["seal-use corps get <corpId>"],
|
||||
description: "Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."
|
||||
},
|
||||
{
|
||||
name: "current",
|
||||
group: "发现与选择",
|
||||
summary: "Show active enterprise in stateful mode",
|
||||
usage: ["seal-use corps current [--corp <corpId>]"]
|
||||
},
|
||||
{
|
||||
name: "switch",
|
||||
group: "发现与选择",
|
||||
summary: "Switch default active enterprise",
|
||||
usage: ["seal-use corps switch <corpId>"]
|
||||
},
|
||||
{
|
||||
name: "mark",
|
||||
group: "企业配置",
|
||||
summary: "Mark enterprise environment as production or test",
|
||||
usage: ["seal-use corps mark <corpId> --env <production|test> [--confirm]"],
|
||||
options: [
|
||||
@@ -79,6 +88,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
},
|
||||
{
|
||||
name: "rename",
|
||||
group: "企业配置",
|
||||
summary: "Rename an enterprise display name",
|
||||
usage: ["seal-use corps rename <corpId> --name <newName>"],
|
||||
options: [
|
||||
@@ -88,6 +98,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
},
|
||||
{
|
||||
name: "bind-test",
|
||||
group: "测试配对与验证",
|
||||
summary: "Bind a production enterprise to a test enterprise (1-to-1 association)",
|
||||
usage: [
|
||||
"seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]",
|
||||
@@ -102,6 +113,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
},
|
||||
{
|
||||
name: "unbind-test",
|
||||
group: "测试配对与验证",
|
||||
summary: "Unbind a production and test enterprise association",
|
||||
usage: ["seal-use corps unbind-test [<corpId>] [--confirm]"],
|
||||
options: [
|
||||
@@ -112,6 +124,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
},
|
||||
{
|
||||
name: "sync-test",
|
||||
group: "测试配对与验证",
|
||||
summary: "Synchronize rules and preferences from production to test enterprise",
|
||||
usage: ["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],
|
||||
options: [
|
||||
@@ -124,9 +137,10 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
},
|
||||
{
|
||||
name: "replay-test",
|
||||
group: "测试配对与验证",
|
||||
summary: "Replay approval records from production enterprise to bound test enterprise via Webhook",
|
||||
usage: [
|
||||
"seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--webhook <idOrName>] [--dry-run]"
|
||||
"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]"
|
||||
],
|
||||
options: [
|
||||
{ flag: "<prodCorpId>", description: "Production enterprise ID (default: active enterprise)" },
|
||||
@@ -136,22 +150,27 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{ flag: "--status <status>", description: "Filter records by status (e.g. completed, failed, rejected)" },
|
||||
{ flag: "--webhook <idOrName>", description: "Target Webhook integration on test enterprise" },
|
||||
{ flag: "--sn-suffix <str>", description: "Optional suffix appended to documentSN" },
|
||||
{ flag: "--dry-run", description: "Preview payload without sending" }
|
||||
{ flag: "--dry-run", description: "Preview payload without sending" },
|
||||
{ flag: "--confirm, --yes", description: "Confirm live replay and send the payload" },
|
||||
{ flag: "--force", description: "Allow replay without a bound test enterprise or into a non-test target" }
|
||||
],
|
||||
description: "Pulls production approval records from the production enterprise and replays them into the bound test enterprise's Webhook channel for rule verification."
|
||||
},
|
||||
{
|
||||
name: "add-hose",
|
||||
group: "企业接入",
|
||||
summary: "Add a Hose/Ekuaibao enterprise configuration",
|
||||
usage: ["seal-use corps add-hose --json '{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'"]
|
||||
},
|
||||
{
|
||||
name: "add-seal",
|
||||
group: "企业接入",
|
||||
summary: "Add a native Seal enterprise configuration",
|
||||
usage: ["seal-use corps add-seal --json '{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'"]
|
||||
},
|
||||
{
|
||||
name: "add-link",
|
||||
group: "企业接入",
|
||||
summary: "Import enterprise configuration from a Seal delegation link or Hose assistance link",
|
||||
usage: [
|
||||
"seal-use corps add-link <url> [--name <customName>] [--as-hose] [--app-key <key>] [--key-id <id>] [--overwrite] [--dry-run]"
|
||||
@@ -165,9 +184,24 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{ flag: "--overwrite", description: "Overwrite existing enterprise config" }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "probe-hose",
|
||||
group: "Hose 专属能力",
|
||||
summary: "Probe Hose domains and discover enterprise identity",
|
||||
usage: ["seal-use corps probe-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\",\"domain\":\"https://...\"}'"],
|
||||
description: "验证合思凭证、探测可用域名并发现企业与角色信息;不写入本地企业配置。"
|
||||
},
|
||||
{
|
||||
name: "hose-staffs",
|
||||
group: "Hose 专属能力",
|
||||
summary: "Discover Hose staff candidates by role",
|
||||
usage: ["seal-use corps hose-staffs --json '{\"appKey\":\"...\",\"appSecurity\":\"...\",\"role\":\"admin\"}'"],
|
||||
description: "按合思角色查询员工候选;手机号默认脱敏,供 add-hose 选择管理员。"
|
||||
},
|
||||
{
|
||||
name: "extract-keys",
|
||||
aliases: ["extract-key", "extract-hose-keys", "hose-extract-keys"],
|
||||
group: "Hose 专属能力",
|
||||
summary: "【合思子域提权】从合思协助链接提取 OpenAPI 开发者密钥 (appKey/appSecurity)",
|
||||
usage: [
|
||||
"seal-use corps extract-keys <url> [--reveal] [--save] [--app-key <key>] [--key-id <id>] [--name <customName>] [--overwrite]"
|
||||
@@ -185,6 +219,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{
|
||||
name: "keys",
|
||||
aliases: ["hose-keys"],
|
||||
group: "Hose 专属能力",
|
||||
summary: "【合思子域】查看企业已配置的合思 OpenAPI 密钥,或从协助链接中提取",
|
||||
usage: [
|
||||
"seal-use corps keys [<url> | <corpId>] [--reveal] [--save] [--app-key <key>]"
|
||||
@@ -195,17 +230,6 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{ flag: "--app-key <key>", description: "多套密钥时指定目标 appKey" }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "regression",
|
||||
aliases: ["test-regression"],
|
||||
summary: "Run automated rule regression test matrix against paired test enterprise",
|
||||
usage: ["seal-use corps regression [--corp <corpId>] [--samples <N>] [--dry-run] [--fail-on-flips]"],
|
||||
options: [
|
||||
{ flag: "--samples <N>", description: "Number of historical production runs to replay (default: 10)" },
|
||||
{ flag: "--dry-run", description: "Preview sample documents and verify quota without executing replayed audits" },
|
||||
{ flag: "--fail-on-flips", description: "Exit with non-zero code if any decision flip is detected" }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1348,9 +1372,28 @@ function renderAreaHelp(areaEntry: AreaHelp): string {
|
||||
}
|
||||
lines.push("");
|
||||
lines.push("Usage:");
|
||||
const groupedCommands = new Map<string, CommandHelp[]>();
|
||||
for (const cmd of areaEntry.commands) {
|
||||
for (const usage of cmd.usage) {
|
||||
lines.push(` ${usage}`);
|
||||
const group = cmd.group ?? "";
|
||||
const commands = groupedCommands.get(group) ?? [];
|
||||
commands.push(cmd);
|
||||
groupedCommands.set(group, commands);
|
||||
}
|
||||
const orderedGroups = [
|
||||
...(areaEntry.groupOrder ?? []),
|
||||
...[...groupedCommands.keys()].filter((group) => !areaEntry.groupOrder?.includes(group))
|
||||
];
|
||||
for (const group of orderedGroups) {
|
||||
const commands = groupedCommands.get(group);
|
||||
if (!commands) continue;
|
||||
if (group) {
|
||||
lines.push("");
|
||||
lines.push(`${group}:`);
|
||||
}
|
||||
for (const cmd of commands) {
|
||||
for (const usage of cmd.usage) {
|
||||
lines.push(` ${usage}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (areaEntry.commands.some((cmd) => cmd.name)) {
|
||||
|
||||
Reference in new issue
Block a user