burgee 0.7.1 → 0.8.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/dist/cli.d.ts CHANGED
@@ -26,7 +26,7 @@ export declare const brandCommand: import("./execute.js").Command<{
26
26
  readonly type: "string";
27
27
  readonly description: "outline colour, hex. Omit for no outline";
28
28
  };
29
- readonly 'bordure-width': {
29
+ readonly bordureWidth: {
30
30
  readonly type: "string";
31
31
  readonly default: "1.5";
32
32
  readonly description: "outline width";
@@ -43,7 +43,7 @@ export declare const brandCommand: import("./execute.js").Command<{
43
43
  readonly type: "string";
44
44
  readonly description: "page colour(s) the flag will fly on, comma separated. Checked for contrast";
45
45
  };
46
- readonly 'allow-low-contrast': {
46
+ readonly allowLowContrast: {
47
47
  readonly type: "boolean";
48
48
  readonly description: "emit anyway when a contrast check fails. Says so in the output";
49
49
  };
@@ -54,9 +54,31 @@ export declare const brandCommand: import("./execute.js").Command<{
54
54
  * CLI's own weight and the framework's stay what they were (W4).
55
55
  */
56
56
  export declare const devCommand: import("./execute.js").Command<{
57
- readonly 'no-watch': {
57
+ readonly noWatch: {
58
58
  readonly type: "boolean";
59
59
  readonly description: "load once and serve; do not watch for changes";
60
60
  };
61
61
  }>;
62
+ /**
63
+ * `burgee migrate [dir]` — rewrite a commander or yargs project's imports to burgee's
64
+ * drop-in front-ends and report what changed, with the numbers that say why it was safe.
65
+ *
66
+ * The engine is loaded on this path only (K6), the same way `dev` is: a dynamic import, so
67
+ * `burgee`'s own start-up and the framework's weight are what they were. `weight.test.ts`
68
+ * denies `migrate.js` to the root entry by name, so that cannot drift back.
69
+ *
70
+ * `idempotent` is the honest answer rather than the conservative one, and it is earned:
71
+ * `burgee/commander` is not a key in the mapping, so a second run over a migrated tree
72
+ * rewrites nothing. N6 then requires the result to report `changed`, which it does.
73
+ */
74
+ export declare const migrateCommand: import("./execute.js").Command<{
75
+ readonly dryRun: {
76
+ readonly type: "boolean";
77
+ readonly description: "scan and report; write nothing";
78
+ };
79
+ readonly force: {
80
+ readonly type: "boolean";
81
+ readonly description: "migrate even though the git tree has uncommitted changes";
82
+ };
83
+ }>;
62
84
  export declare const program: import("./manifest.js").Manifest;
package/dist/cli.js CHANGED
@@ -44,14 +44,14 @@ export const brandCommand = defineCommand({
44
44
  description: 'path to an SVG whose contents replace the bars, drawn in a 0 0 100 100 box',
45
45
  },
46
46
  bordure: { type: 'string', description: 'outline colour, hex. Omit for no outline' },
47
- 'bordure-width': { type: 'string', default: DEFAULT_BORDURE_WIDTH, description: 'outline width' },
47
+ bordureWidth: { type: 'string', default: DEFAULT_BORDURE_WIDTH, description: 'outline width' },
48
48
  tagline: { type: 'string', description: 'one line under the name on the card and cover' },
49
49
  out: { type: 'string', description: 'directory to write into. Omit to print the flag only' },
50
50
  'on': {
51
51
  type: 'string',
52
52
  description: 'page colour(s) the flag will fly on, comma separated. Checked for contrast',
53
53
  },
54
- 'allow-low-contrast': {
54
+ allowLowContrast: {
55
55
  type: 'boolean',
56
56
  description: 'emit anyway when a contrast check fails. Says so in the output',
57
57
  },
@@ -68,7 +68,7 @@ export const brandCommand = defineCommand({
68
68
  : {
69
69
  bordure: {
70
70
  color: options.bordure,
71
- width: Number(options['bordure-width'] ?? DEFAULT_BORDURE_WIDTH),
71
+ width: Number(options.bordureWidth ?? DEFAULT_BORDURE_WIDTH),
72
72
  },
73
73
  };
74
74
  const brand = {
@@ -84,7 +84,7 @@ export const brandCommand = defineCommand({
84
84
  .filter((g) => g !== '');
85
85
  const findings = auditBurgee(brand, grounds);
86
86
  const failed = findings.filter((f) => !f.passes);
87
- if (failed.length > 0 && options['allow-low-contrast'] !== true) {
87
+ if (failed.length > 0 && options.allowLowContrast !== true) {
88
88
  throw new Error(`contrast below WCAG AA:\n${report(failed)}\n${CONTRAST_HINT}`);
89
89
  }
90
90
  const written = surfaces(brand, options.tagline ?? '');
@@ -103,7 +103,7 @@ export const devCommand = defineCommand({
103
103
  description: 'Watch a CLI entry, reload it on change, and serve it as MCP on stdio while you write it',
104
104
  arguments: [{ name: 'entry', description: 'the module that exports the program, as program or as its default export', required: true }],
105
105
  options: {
106
- 'no-watch': { type: 'boolean', description: 'load once and serve; do not watch for changes' },
106
+ noWatch: { type: 'boolean', description: 'load once and serve; do not watch for changes' },
107
107
  },
108
108
  effects: 'withheld',
109
109
  run: async ({ positionals, options }) => {
@@ -111,13 +111,31 @@ export const devCommand = defineCommand({
111
111
  if (entry === undefined)
112
112
  throw new Error('an entry file is required');
113
113
  const [{ dev }, { processRuntime }] = await Promise.all([import('./dev.js'), import('./runtime.js')]);
114
- const handle = dev({ entry, input: processRuntime.stdin, output: processRuntime.stdout, log: processRuntime.stderr, watch: options['no-watch'] !== true });
114
+ const handle = dev({ entry, input: processRuntime.stdin, output: processRuntime.stdout, log: processRuntime.stderr, watch: options.noWatch !== true });
115
115
  await handle.done;
116
116
  },
117
117
  });
118
+ export const migrateCommand = defineCommand({
119
+ name: 'migrate',
120
+ description: 'Rewrite commander and yargs imports to burgee’s drop-in front-ends, and report what changed',
121
+ arguments: [{ name: 'dir', description: 'the project to migrate. Defaults to the current directory', required: false }],
122
+ options: {
123
+ dryRun: { type: 'boolean', description: 'scan and report; write nothing' },
124
+ force: { type: 'boolean', description: 'migrate even though the git tree has uncommitted changes' },
125
+ },
126
+ effects: 'idempotent',
127
+ examples: [
128
+ { command: 'burgee migrate --dry-run', description: 'what it would change, without changing it' },
129
+ { command: 'burgee migrate --json', description: 'the same report as data; exit 1 when anything was refused' },
130
+ ],
131
+ run: async ({ positionals, options }) => {
132
+ const [{ migrate }, { host }] = await Promise.all([import('./migrate.js'), import('./runtime.js')]);
133
+ return await migrate({ dir: positionals[0] ?? host.cwd(), dryRun: options.dryRun === true, force: options.force === true });
134
+ },
135
+ });
118
136
  export const program = defineProgram({
119
137
  name: 'burgee',
120
138
  description: 'The agent-native CLI framework, and the tools that come with it',
121
- commands: [brandCommand, devCommand],
139
+ commands: [brandCommand, devCommand, migrateCommand],
122
140
  });
123
141
  run(program);
@@ -8,7 +8,6 @@ export class Argument {
8
8
  argChoices = undefined;
9
9
  required;
10
10
  _name;
11
- /** `<required>`, `[optional]`, bare = required; a trailing `...` makes it variadic. */
12
11
  constructor(name, description) {
13
12
  this.description = description || '';
14
13
  switch (name[0]) {
@@ -67,9 +66,7 @@ export class Argument {
67
66
  return this;
68
67
  }
69
68
  }
70
- /** `<name>` / `[name]` / `<name...>` for usage strings. */
71
69
  export function humanReadableArgName(arg) {
72
70
  const nameOutput = arg.name() + (arg.variadic ? '...' : '');
73
71
  return arg.required ? `<${nameOutput}>` : `[${nameOutput}]`;
74
72
  }
75
- //# sourceMappingURL=argument.js.map
@@ -72,6 +72,8 @@ interface SavedState {
72
72
  interface Burgee {
73
73
  exit: ((code: number) => void) | undefined;
74
74
  json: boolean;
75
+ /** One failure, one envelope (G5). */
76
+ reported?: boolean;
75
77
  }
76
78
  export declare class Command extends EventEmitter {
77
79
  commands: Command[];
@@ -244,6 +246,8 @@ export declare class Command extends EventEmitter {
244
246
  optsWithGlobals(): Record<string, unknown>;
245
247
  /** Display an error message and exit (or call exitOverride). */
246
248
  error(message: string, errorOptions?: ErrorOptions): never;
249
+ /** One failure as the envelope (E3, G5); `fix` only when one candidate was named. */
250
+ _reportJson(code: string, message: string): void;
247
251
  /** Apply environment variables to options that have no value from the cli or client code. */
248
252
  _parseOptionsEnv(): void;
249
253
  /** Apply implied option values where the option is undefined or at its default. */
@@ -328,15 +332,15 @@ export declare class Command extends EventEmitter {
328
332
  */
329
333
  _burgeeSurface(userArgs: string[]): boolean | Promise<boolean>;
330
334
  /** The surfaces after `completion`: `--schema` is synchronous, `--mcp` serves until stdin closes. */
331
- _burgeeSurfaceRest(head: string[], declared: (flag: string) => boolean): boolean | Promise<boolean>;
335
+ _burgeeSurfaceRest(head: string[]): boolean | Promise<boolean>;
332
336
  /** Additive, and the point of the whole exercise: plugins commander has never had (#2505, unlanded). */
333
337
  use(plugin: Plugin): this;
334
338
  /** Inject the streams and the exit for one parse; returns commander's own parse options. */
335
339
  _prepareBurgee(parseOptions?: BurgeeParseOptions): ParseOptions | undefined;
336
340
  /** In burgee mode the whole run settles to one E1 exit; otherwise commander's behaviour, untouched. */
337
341
  _runBurgee(run: () => unknown): unknown;
338
- /** `--json` that no command in the chain declared is burgee's envelope, not an unknown option. */
339
- _takeJson(unknown: string[]): void;
342
+ /** Any command from here down declares this flag, so burgee does not serve it: additive only. */
343
+ _declares(flag: string): boolean;
340
344
  /** The action, wrapped in the plugin hooks and followed by the envelope or the rendering. */
341
345
  _runAction(): unknown;
342
346
  /** burgee (M5): once per process, on stderr; only for a command that asked, so commander's own output is untouched. */