Enforce cross-domain naming charter with silent legacy aliases
Unify the visible command surface on one canonical spelling per semantic concept while keeping every legacy spelling working as a silent parser/dispatcher alias (per .agents/rules/cli-protocol.md §6): - Fix silent-ignore accept-set gaps: webhook resource-pack export now reads --out/--output-file and --downloads/--download; approval-runs and webhook read canonical --start-date/--end-date; webhook secret reveal accepts --reveal/-r alongside legacy --show-secret. - Add kebab-case parser registrations for camel-only flags (human-result, manual-approval-status, include-bridge, rule-version, document-limit, context-lines, source-document-sn/-id, simulation-batch-id) and read them in rules/documents search, context, approval-runs list/summary/ bridge/export. - Retire verbs on the visible surface only: webhook create (add), simulation delete (clean), preference thinking-depth policies delete (remove); dispatch keeps both. Runtime nextAction suggestions and doctor knowledge switch to canonical spellings. - Add src/cli/naming-charter.test.ts: help surface must be lowercase kebab-case and free of retired tokens; canonical/legacy spellings must both parse; P0 accept-sets pinned. - Document the charter in .agents/rules/cli-protocol.md §7; sync AGENTS.md, README, and skills/references docs; regenerate cli.md and embedded skill artifacts.
This commit is contained in:
1 parent
5d703cec38
commit
245ec33d1a
21 files changed
+298
-110
No files matched your search
@@ -34,14 +34,17 @@ export async function handleApprovalRunsCommand(
|
||||
date: stringOption(args.options.date),
|
||||
timezone: stringOption(args.options.timezone),
|
||||
limit: numberOption(args.options.limit),
|
||||
startDate: stringOption(args.options.startDate),
|
||||
endDate: stringOption(args.options.endDate),
|
||||
startDate: stringOption(args.options["start-date"]) ?? stringOption(args.options.startDate),
|
||||
endDate: stringOption(args.options["end-date"]) ?? stringOption(args.options.endDate),
|
||||
status: stringOption(args.options.status),
|
||||
taskMode: stringOption(args.options.taskMode),
|
||||
manualApprovalStatus: stringOption(args.options.manualApprovalStatus),
|
||||
sourceDocumentSN: stringOption(args.options.sourceDocumentSN),
|
||||
sourceDocumentId: stringOption(args.options.sourceDocumentId),
|
||||
humanResult: stringOption(args.options.humanResult),
|
||||
taskMode: stringOption(args.options.taskMode) ?? stringOption(args.options["task-mode"]),
|
||||
manualApprovalStatus:
|
||||
stringOption(args.options["manual-approval-status"]) ?? stringOption(args.options.manualApprovalStatus),
|
||||
sourceDocumentSN:
|
||||
stringOption(args.options["source-document-sn"]) ?? stringOption(args.options.sourceDocumentSN),
|
||||
sourceDocumentId:
|
||||
stringOption(args.options["source-document-id"]) ?? stringOption(args.options.sourceDocumentId),
|
||||
humanResult: stringOption(args.options["human-result"]) ?? stringOption(args.options.humanResult),
|
||||
query: stringOption(args.options.query)
|
||||
}
|
||||
);
|
||||
@@ -80,10 +83,12 @@ export async function handleApprovalRunsCommand(
|
||||
|
||||
if (action === "count") {
|
||||
const rawStart =
|
||||
stringOption(args.options["start-date"]) ??
|
||||
stringOption(args.options.start) ??
|
||||
stringOption(args.options.startDate) ??
|
||||
stringOption(args.options.since);
|
||||
const rawEnd =
|
||||
stringOption(args.options["end-date"]) ??
|
||||
stringOption(args.options.end) ??
|
||||
stringOption(args.options.endDate);
|
||||
|
||||
@@ -113,21 +118,27 @@ export async function handleApprovalRunsCommand(
|
||||
limit: numberOption(args.options.limit),
|
||||
offset: numberOption(args.options.offset),
|
||||
startDate:
|
||||
stringOption(args.options["start-date"]) ??
|
||||
stringOption(args.options.startDate) ??
|
||||
stringOption(args.options.start) ??
|
||||
stringOption(args.options.since),
|
||||
endDate:
|
||||
stringOption(args.options["end-date"]) ??
|
||||
stringOption(args.options.endDate) ??
|
||||
stringOption(args.options.end),
|
||||
status: stringOption(args.options.status),
|
||||
taskMode: stringOption(args.options.taskMode),
|
||||
manualApprovalStatus: stringOption(args.options.manualApprovalStatus),
|
||||
sourceDocumentSN: stringOption(args.options.sourceDocumentSN),
|
||||
sourceDocumentId: stringOption(args.options.sourceDocumentId),
|
||||
humanResult: stringOption(args.options.humanResult),
|
||||
taskMode: stringOption(args.options.taskMode) ?? stringOption(args.options["task-mode"]),
|
||||
manualApprovalStatus:
|
||||
stringOption(args.options["manual-approval-status"]) ?? stringOption(args.options.manualApprovalStatus),
|
||||
sourceDocumentSN:
|
||||
stringOption(args.options["source-document-sn"]) ?? stringOption(args.options.sourceDocumentSN),
|
||||
sourceDocumentId:
|
||||
stringOption(args.options["source-document-id"]) ?? stringOption(args.options.sourceDocumentId),
|
||||
humanResult: stringOption(args.options["human-result"]) ?? stringOption(args.options.humanResult),
|
||||
hasExtraRisk: booleanOption(args.options["has-extra-risk"]) ?? booleanOption(args.options.hasExtraRisk),
|
||||
query: stringOption(args.options.query),
|
||||
includeBridge: booleanOption(args.options.includeBridge)
|
||||
includeBridge:
|
||||
booleanOption(args.options["include-bridge"]) ?? booleanOption(args.options.includeBridge)
|
||||
},
|
||||
outputOptions(args.options)
|
||||
);
|
||||
@@ -140,10 +151,13 @@ export async function handleApprovalRunsCommand(
|
||||
client,
|
||||
corp,
|
||||
{
|
||||
recordId: stringOption(args.options.recordId),
|
||||
sourceDocumentSN: stringOption(args.options.sourceDocumentSN),
|
||||
sourceDocumentId: stringOption(args.options.sourceDocumentId),
|
||||
simulationBatchId: stringOption(args.options.simulationBatchId),
|
||||
recordId: stringOption(args.options.recordId) ?? stringOption(args.options["record-id"]),
|
||||
sourceDocumentSN:
|
||||
stringOption(args.options["source-document-sn"]) ?? stringOption(args.options.sourceDocumentSN),
|
||||
sourceDocumentId:
|
||||
stringOption(args.options["source-document-id"]) ?? stringOption(args.options.sourceDocumentId),
|
||||
simulationBatchId:
|
||||
stringOption(args.options["simulation-batch-id"]) ?? stringOption(args.options.simulationBatchId),
|
||||
limit: numberOption(args.options.limit)
|
||||
},
|
||||
outputOptions(args.options)
|
||||
@@ -418,12 +432,15 @@ export async function handleApprovalRunsCommand(
|
||||
manualApprovalStatus:
|
||||
stringOption(args.options["manual-status"]) ??
|
||||
stringOption(args.options.manualStatus) ??
|
||||
stringOption(args.options["manual-approval-status"]) ??
|
||||
stringOption(args.options.manualApprovalStatus),
|
||||
includeCompletedOnly:
|
||||
booleanOption(args.options["completed-only"]) ?? booleanOption(args.options.completedOnly),
|
||||
outputFile:
|
||||
stringOption(args.options.out) ??
|
||||
stringOption(args.options["output-file"]) ??
|
||||
stringOption(args.options.output) ??
|
||||
stringOption(args.options.outputFile) ??
|
||||
stringOption(args.options.file),
|
||||
toDownloads:
|
||||
booleanOption(args.options["to-downloads"]) ??
|
||||
|
||||
@@ -15,8 +15,8 @@ export async function handleContextCommand(
|
||||
client,
|
||||
corp,
|
||||
{
|
||||
documentLimit: numberOption(args.options.documentLimit),
|
||||
...ruleVersionContextOptions(stringOption(args.options.ruleVersion))
|
||||
documentLimit: numberOption(args.options["document-limit"]) ?? numberOption(args.options.documentLimit),
|
||||
...ruleVersionContextOptions(stringOption(args.options["rule-version"]) ?? stringOption(args.options.ruleVersion))
|
||||
},
|
||||
outputOptions(args.options)
|
||||
);
|
||||
|
||||
@@ -113,7 +113,7 @@ export async function handleDocumentsCommand(
|
||||
if (action === "search") {
|
||||
const keyword = maybeName ?? stringOption(args.options.query);
|
||||
if (!keyword) {
|
||||
throw usageError("Usage: seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]");
|
||||
throw usageError("Usage: seal-use documents search <keyword> [--max-results 20] [--corp <corpId>]");
|
||||
}
|
||||
await runCapability(
|
||||
"sealApprovalSearch",
|
||||
@@ -122,8 +122,8 @@ export async function handleDocumentsCommand(
|
||||
{
|
||||
keywords: [keyword],
|
||||
areas: ["documents"],
|
||||
maxResults: numberOption(args.options.maxResults),
|
||||
contextLines: numberOption(args.options.contextLines),
|
||||
maxResults: numberOption(args.options["max-results"]) ?? numberOption(args.options.maxResults),
|
||||
contextLines: numberOption(args.options["context-lines"]) ?? numberOption(args.options.contextLines),
|
||||
refresh: booleanOption(args.options.refresh),
|
||||
snippetOnly: booleanOption(args.options.snippetOnly) ?? booleanOption(args.options["snippet-only"]),
|
||||
maxChars: numberOption(args.options.maxChars) ?? numberOption(args.options["max-chars"]),
|
||||
|
||||
@@ -301,7 +301,7 @@ export async function handleRulesCommand(
|
||||
|
||||
if (action === "search") {
|
||||
const keyword = maybeName ?? stringOption(args.options.query);
|
||||
if (!keyword) throw usageError("Usage: seal-use rules search <keyword> [--version <number|latest>] [--maxResults 20] [--corp <corpId>]");
|
||||
if (!keyword) throw usageError("Usage: seal-use rules search <keyword> [--version <number|latest>] [--max-results 20] [--corp <corpId>]");
|
||||
await runCapability(
|
||||
"sealApprovalSearch",
|
||||
client!,
|
||||
@@ -309,8 +309,8 @@ export async function handleRulesCommand(
|
||||
{
|
||||
keywords: [keyword],
|
||||
areas: ["rules"],
|
||||
maxResults: numberOption(args.options.maxResults),
|
||||
contextLines: numberOption(args.options.contextLines),
|
||||
maxResults: numberOption(args.options["max-results"]) ?? numberOption(args.options.maxResults),
|
||||
contextLines: numberOption(args.options["context-lines"]) ?? numberOption(args.options.contextLines),
|
||||
refresh: booleanOption(args.options.refresh),
|
||||
snippetOnly: booleanOption(args.options.snippetOnly) ?? booleanOption(args.options["snippet-only"]),
|
||||
maxChars: numberOption(args.options.maxChars) ?? numberOption(args.options["max-chars"]),
|
||||
|
||||
@@ -156,7 +156,7 @@ describe("simulation local search", () => {
|
||||
});
|
||||
|
||||
describe("simulation command confirmation gates", () => {
|
||||
test("simulation clean refuses without --yes and never reaches the API", async () => {
|
||||
test("simulation clean (legacy alias) refuses without --yes and never reaches the API", async () => {
|
||||
setupMockEnv();
|
||||
const mutations = trackMutationRequests();
|
||||
|
||||
@@ -165,7 +165,7 @@ describe("simulation command confirmation gates", () => {
|
||||
expect(result.isError).toBe(true);
|
||||
expect(result.exitCode).toBe(10);
|
||||
expect(result.stderr).toContain("Refusing to delete simulation batch 'batch-123' without --yes.");
|
||||
expect(result.stderr).toContain("seal-use simulation clean batch-123");
|
||||
expect(result.stderr).toContain("seal-use simulation delete batch-123");
|
||||
expect(mutations).toEqual([]);
|
||||
});
|
||||
|
||||
|
||||
@@ -172,12 +172,12 @@ export async function handleSimulationCommand(
|
||||
|
||||
if (action === "clean" || action === "delete") {
|
||||
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
|
||||
if (!batchId) throw usageError("Usage: seal-use simulation clean <batchId> --yes");
|
||||
if (!batchId) throw usageError("Usage: seal-use simulation delete <batchId> --yes");
|
||||
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
|
||||
if (!confirmed) {
|
||||
throw confirmationRequired(
|
||||
`Refusing to delete simulation batch '${batchId}' without --yes.`,
|
||||
`seal-use simulation clean ${batchId} --corp ${corp.id} --yes`
|
||||
`seal-use simulation delete ${batchId} --corp ${corp.id} --yes`
|
||||
);
|
||||
}
|
||||
await runCapability("sealSimulationBatchClean", client, corp, { batchId }, outputOptions(args.options));
|
||||
|
||||
@@ -280,6 +280,7 @@ export async function handleWebhookCommand(
|
||||
? false
|
||||
: booleanOption(args.options.attachments) !== false;
|
||||
const outputFile =
|
||||
stringOption(args.options.out) ??
|
||||
stringOption(args.options.output) ??
|
||||
stringOption(args.options.outputFile) ??
|
||||
stringOption(args.options["output-file"]) ??
|
||||
@@ -287,7 +288,11 @@ export async function handleWebhookCommand(
|
||||
stringOption(args.options.file) ??
|
||||
(args.command[3]?.endsWith(".zip") ? args.command[3] : undefined);
|
||||
const toDownloads =
|
||||
booleanOption(args.options.toDownloads) ?? booleanOption(args.options["to-downloads"]) ?? false;
|
||||
booleanOption(args.options.downloads) ??
|
||||
booleanOption(args.options.download) ??
|
||||
booleanOption(args.options.toDownloads) ??
|
||||
booleanOption(args.options["to-downloads"]) ??
|
||||
false;
|
||||
|
||||
const result = await exportApprovalRunsToResourcePack(client, corp, {
|
||||
recordId,
|
||||
@@ -338,7 +343,7 @@ export async function handleWebhookCommand(
|
||||
throw new CliError(
|
||||
"当前租户未配置任何 Webhook 集成通道。",
|
||||
1,
|
||||
`seal-use webhook add --name <name> --result-url <url> --corp ${corp.id}`
|
||||
`seal-use webhook create --name <name> --result-url <url> --corp ${corp.id}`
|
||||
);
|
||||
}
|
||||
const result = await pushMaterialPack(input.fileBuffer, input.fileName, {
|
||||
@@ -368,7 +373,7 @@ export async function handleWebhookCommand(
|
||||
|
||||
if (action === "get" || action === "find") {
|
||||
const selector = maybeName ?? stringOption(args.options.selector) ?? stringOption(args.options.id);
|
||||
if (!selector) throw usageError("Usage: seal-use webhook get <idOrName> [--show-secret]");
|
||||
if (!selector) throw usageError("Usage: seal-use webhook get <idOrName> [--reveal]");
|
||||
await runCapability(
|
||||
"sealWebhookGet",
|
||||
client,
|
||||
@@ -390,7 +395,7 @@ export async function handleWebhookCommand(
|
||||
stringOption(args.options.outgoingResultWebhook) ??
|
||||
stringOption(args.options["outgoing-result-webhook"]);
|
||||
if (!name || !outgoingResultWebhook) {
|
||||
throw usageError("Usage: seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic]");
|
||||
throw usageError("Usage: seal-use webhook create --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic]");
|
||||
}
|
||||
const autoApprovalRate = webhookRateOption(args.options);
|
||||
const materialPackFilePolicy = materialPackFilePolicyOptions(args.options);
|
||||
|
||||
Reference in new issue
Block a user