@koda-sl/baker-cli 0.329.0 → 0.330.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/cli.js +26 -12
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,8 +99,9 @@ An option a command does not declare stops the run with `UNKNOWN_ARGUMENT`, nami
|
|
|
99
99
|
closest real one. Previously such an option was accepted and ignored, so a call that
|
|
100
100
|
looked like it had filtered or narrowed a result was in fact answering the unfiltered
|
|
101
101
|
question — and nothing in the output said so. Both spellings of an option work
|
|
102
|
-
(`--run-id` and `--runId`), as they always did.
|
|
103
|
-
every option
|
|
102
|
+
(`--run-id` and `--runId`), as they always did. The error's `fix` names the exact call
|
|
103
|
+
that lists every option: `baker schema <command>` (`check_schema`) when the command
|
|
104
|
+
registers a schema, `baker <command> --help` (`check_help`) when it does not.
|
|
104
105
|
|
|
105
106
|
### Fresh reads: `--no-cache`
|
|
106
107
|
|
|
@@ -3661,8 +3662,9 @@ Inspect command argument schemas for AI agent introspection.
|
|
|
3661
3662
|
|
|
3662
3663
|
```bash
|
|
3663
3664
|
baker schema # List all commands
|
|
3664
|
-
baker schema ads
|
|
3665
|
-
baker schema
|
|
3665
|
+
baker schema ads google query # Get query command schema, path as typed
|
|
3666
|
+
baker schema ads.google.query # Same schema, dotted name
|
|
3667
|
+
baker schema tag-manager read # Kebab-case paths resolve to their registered name (tagManager.read)
|
|
3666
3668
|
```
|
|
3667
3669
|
|
|
3668
3670
|
Not every command registers a schema. On `NOT_FOUND` the error carries a structured `fix` pointing at `--help` and the family's agent doc (`__tooling__/docs/tools/baker/<family>.md` in sandboxes). Every top-level family's `--help` also ends with a `Full guide:` line pointing at that doc; `packages/cli/__tests__/doc-coverage.test.ts` fails CI if a mounted command is missing from its family doc.
|
package/dist/cli.js
CHANGED
|
@@ -578,12 +578,24 @@ var registry = /* @__PURE__ */ new Map();
|
|
|
578
578
|
function registerSchema(schema) {
|
|
579
579
|
registry.set(schema.command, schema);
|
|
580
580
|
}
|
|
581
|
-
function getSchema(command) {
|
|
582
|
-
return registry.get(command);
|
|
583
|
-
}
|
|
584
581
|
function listSchemas() {
|
|
585
582
|
return [...registry.keys()];
|
|
586
583
|
}
|
|
584
|
+
function spellingKey(name) {
|
|
585
|
+
return name.toLowerCase().replaceAll("-", "");
|
|
586
|
+
}
|
|
587
|
+
function resolveSchemaName(words2, names) {
|
|
588
|
+
const joined = words2.join(".");
|
|
589
|
+
if (names.includes(joined)) {
|
|
590
|
+
return joined;
|
|
591
|
+
}
|
|
592
|
+
const matches = names.filter((name) => spellingKey(name) === spellingKey(joined));
|
|
593
|
+
return matches.length === 1 ? matches[0] : void 0;
|
|
594
|
+
}
|
|
595
|
+
function findSchema(words2) {
|
|
596
|
+
const name = resolveSchemaName(words2, listSchemas());
|
|
597
|
+
return name === void 0 ? void 0 : registry.get(name);
|
|
598
|
+
}
|
|
587
599
|
|
|
588
600
|
// ../api/src/actions.ts
|
|
589
601
|
import { z } from "zod";
|
|
@@ -62386,23 +62398,24 @@ function narrowToFamily(commandName, available) {
|
|
|
62386
62398
|
var schemaCommand2 = defineCommand204({
|
|
62387
62399
|
meta: {
|
|
62388
62400
|
name: "schema",
|
|
62389
|
-
description: "Inspect command argument schemas (for AI agent introspection). Lists all commands if no argument given. Example: baker schema images.search"
|
|
62401
|
+
description: "Inspect command argument schemas (for AI agent introspection). Lists all commands if no argument given. Example: baker schema images search (or images.search)"
|
|
62390
62402
|
},
|
|
62391
62403
|
args: {
|
|
62392
62404
|
command: {
|
|
62393
62405
|
type: "positional",
|
|
62394
|
-
description: "Command
|
|
62406
|
+
description: "Command path, as typed (images list) or dotted (images.list). Omit to list all.",
|
|
62395
62407
|
required: false
|
|
62396
62408
|
}
|
|
62397
62409
|
},
|
|
62398
62410
|
run: ({ args: args4 }) => {
|
|
62399
|
-
const
|
|
62400
|
-
if (
|
|
62411
|
+
const words2 = args4._.filter((word) => typeof word === "string" && word.length > 0);
|
|
62412
|
+
if (words2.length === 0) {
|
|
62401
62413
|
const schemas = listSchemas();
|
|
62402
62414
|
writeJson({ ok: true, data: { commands: schemas } });
|
|
62403
62415
|
return;
|
|
62404
62416
|
}
|
|
62405
|
-
const
|
|
62417
|
+
const commandName = words2.join(".");
|
|
62418
|
+
const schema = findSchema(words2);
|
|
62406
62419
|
if (!schema) {
|
|
62407
62420
|
const all = listSchemas();
|
|
62408
62421
|
const available = narrowToFamily(commandName, all);
|
|
@@ -66995,7 +67008,7 @@ function commandFor(root, argv) {
|
|
|
66995
67008
|
const { command, resolved } = resolveCommand2(root, argv);
|
|
66996
67009
|
return resolved ? command : null;
|
|
66997
67010
|
}
|
|
66998
|
-
function unknownFlagEnvelope(unknown, commandPath, suggestion) {
|
|
67011
|
+
function unknownFlagEnvelope(unknown, commandPath, suggestion, hasSchema) {
|
|
66999
67012
|
const list = unknown.join(", ");
|
|
67000
67013
|
return {
|
|
67001
67014
|
ok: false,
|
|
@@ -67003,8 +67016,8 @@ function unknownFlagEnvelope(unknown, commandPath, suggestion) {
|
|
|
67003
67016
|
code: "UNKNOWN_ARGUMENT",
|
|
67004
67017
|
message: `${list} ${unknown.length > 1 ? "are not options" : "is not an option"} of \`baker ${commandPath}\`.`,
|
|
67005
67018
|
fix: {
|
|
67006
|
-
action: "check_schema",
|
|
67007
|
-
explanation: (suggestion ? `Did you mean ${suggestion}? ` : "") + `Run
|
|
67019
|
+
action: hasSchema ? "check_schema" : "check_help",
|
|
67020
|
+
explanation: (suggestion ? `Did you mean ${suggestion}? ` : "") + `Run \`${hasSchema ? `baker schema ${commandPath}` : `baker ${commandPath} --help`}\` to see every option this command takes. Do not re-run the same call: until this version an unrecognised option was accepted and ignored, so a command that looked like it had filtered or narrowed the result was in fact answering the unfiltered question.`
|
|
67008
67021
|
},
|
|
67009
67022
|
retryable: false
|
|
67010
67023
|
}
|
|
@@ -67035,8 +67048,9 @@ function refuseUnknownFlags(root, argv) {
|
|
|
67035
67048
|
const command = commandFor(root, argv);
|
|
67036
67049
|
const first = unknown[0];
|
|
67037
67050
|
const suggestion = command && first ? closestFlag(first, command) : null;
|
|
67051
|
+
const path48 = commandPathOf(root, argv);
|
|
67038
67052
|
process.stdout.write(
|
|
67039
|
-
`${JSON.stringify(unknownFlagEnvelope(unknown,
|
|
67053
|
+
`${JSON.stringify(unknownFlagEnvelope(unknown, path48, suggestion, findSchema(path48.split(" ")) !== void 0), null, 2)}
|
|
67040
67054
|
`
|
|
67041
67055
|
);
|
|
67042
67056
|
process.exit(1);
|