burgee 0.12.0 → 0.13.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/agent-format.d.ts +7 -0
- package/dist/agent-format.js +32 -0
- package/dist/argv.d.ts +16 -0
- package/dist/argv.js +12 -0
- package/dist/commander/command.d.ts +12 -0
- package/dist/commander/command.js +11 -5
- package/dist/compat.d.ts +22 -0
- package/dist/compat.js +29 -0
- package/dist/config-layers.d.ts +16 -0
- package/dist/config-layers.js +19 -0
- package/dist/execute.d.ts +1 -3
- package/dist/execute.js +20 -238
- package/dist/failure.d.ts +26 -0
- package/dist/failure.js +90 -0
- package/dist/fields.d.ts +6 -6
- package/dist/fields.js +10 -4
- package/dist/mcp.js +20 -1
- package/dist/migrate.js +2 -2
- package/dist/program-schema.json +1 -1
- package/dist/relations.d.ts +7 -0
- package/dist/relations.js +49 -0
- package/dist/schema.d.ts +7 -0
- package/dist/surfaces.d.ts +81 -0
- package/dist/surfaces.js +116 -0
- package/dist/validate.d.ts +1 -6
- package/dist/validate.js +1 -48
- package/dist/yargs/factory.d.ts +8 -1
- package/dist/yargs/factory.js +26 -13
- package/package.json +4 -4
package/dist/yargs/factory.js
CHANGED
|
@@ -66,6 +66,7 @@ export class YargsInstance {
|
|
|
66
66
|
#versionOpt = null;
|
|
67
67
|
#validation;
|
|
68
68
|
#burgee = undefined;
|
|
69
|
+
#floor = false;
|
|
69
70
|
#effects = undefined;
|
|
70
71
|
#manifest = undefined;
|
|
71
72
|
constructor(processArgs = [], cwd, parentRequire, shim) {
|
|
@@ -356,7 +357,7 @@ export class YargsInstance {
|
|
|
356
357
|
return;
|
|
357
358
|
}
|
|
358
359
|
if (this.#exitProcess)
|
|
359
|
-
this.#shim.process.exit(burgee?.json === true ? e1 : code);
|
|
360
|
+
this.#shim.process.exit(burgee?.json === true || this.#floor ? e1 : code);
|
|
360
361
|
}
|
|
361
362
|
exitProcess(enabled = true) {
|
|
362
363
|
argsert('[boolean]', [enabled], arguments.length);
|
|
@@ -602,11 +603,11 @@ export class YargsInstance {
|
|
|
602
603
|
const seam = this.#burgee?.exit === undefined ? undefined : this.#burgee;
|
|
603
604
|
if (seam === undefined) {
|
|
604
605
|
const escape = (err) => {
|
|
605
|
-
const
|
|
606
|
-
if (
|
|
607
|
-
this.#
|
|
606
|
+
const report = (this.#burgee?.json === true || this.#floor) && !(err instanceof YError);
|
|
607
|
+
if (report)
|
|
608
|
+
this.#failHandler(err);
|
|
608
609
|
restore();
|
|
609
|
-
if (!
|
|
610
|
+
if (!report)
|
|
610
611
|
throw err;
|
|
611
612
|
return undefined;
|
|
612
613
|
};
|
|
@@ -1159,8 +1160,11 @@ export class YargsInstance {
|
|
|
1159
1160
|
this.manifest.use(plugin);
|
|
1160
1161
|
return this;
|
|
1161
1162
|
}
|
|
1162
|
-
burgee(seam) {
|
|
1163
|
-
|
|
1163
|
+
burgee({ floor, ...seam }) {
|
|
1164
|
+
if (floor !== undefined)
|
|
1165
|
+
this.#floor = floor;
|
|
1166
|
+
if (Object.keys(seam).length > 0)
|
|
1167
|
+
this.#burgee = { ...(this.#burgee ?? { json: false, lastError: '' }), ...seam };
|
|
1164
1168
|
return this;
|
|
1165
1169
|
}
|
|
1166
1170
|
#snapshot() {
|
|
@@ -1279,7 +1283,8 @@ export class YargsInstance {
|
|
|
1279
1283
|
});
|
|
1280
1284
|
}
|
|
1281
1285
|
if (head.includes('--schema') && !this.#declares('schema')) {
|
|
1282
|
-
|
|
1286
|
+
const shadows = ['--json', '--mcp', 'completion'].filter((name) => (name === 'completion' && this.#completionCommand !== null) || this.#declares(name.replace(/^--/, '')));
|
|
1287
|
+
this.#logger.log(machineJson({ ...schemaOf(this.manifest), ...(shadows.length > 0 && { shadows }) }, head));
|
|
1283
1288
|
this.exit(0);
|
|
1284
1289
|
return true;
|
|
1285
1290
|
}
|
|
@@ -1314,9 +1319,14 @@ export class YargsInstance {
|
|
|
1314
1319
|
this.#settle(value, argv);
|
|
1315
1320
|
return value;
|
|
1316
1321
|
};
|
|
1322
|
+
const failed = (cause) => {
|
|
1323
|
+
if (!this.#floor || this.#burgee?.exit)
|
|
1324
|
+
throw cause;
|
|
1325
|
+
return this.#failHandler(cause);
|
|
1326
|
+
};
|
|
1317
1327
|
if (manifest === undefined || manifest.plugins.length === 0) {
|
|
1318
1328
|
const result = handler(argv);
|
|
1319
|
-
return isPromise(result) ? result.then(settle) : settle(result);
|
|
1329
|
+
return isPromise(result) ? result.then(settle, failed) : settle(result);
|
|
1320
1330
|
}
|
|
1321
1331
|
const name = original.replace(/^\$0 ?/, '').split(' ')[0] ?? '';
|
|
1322
1332
|
const options = {};
|
|
@@ -1331,7 +1341,7 @@ export class YargsInstance {
|
|
|
1331
1341
|
})
|
|
1332
1342
|
.catch(async (cause) => {
|
|
1333
1343
|
await manifest.fire('onError', name, options);
|
|
1334
|
-
|
|
1344
|
+
return failed(cause);
|
|
1335
1345
|
});
|
|
1336
1346
|
}
|
|
1337
1347
|
#settle(value, argv) {
|
|
@@ -1358,9 +1368,12 @@ export class YargsInstance {
|
|
|
1358
1368
|
burgee.reported = true;
|
|
1359
1369
|
this.#logger.log(JSON.stringify({ ok: false, error: this.#failureOf(err).error }));
|
|
1360
1370
|
}
|
|
1361
|
-
#
|
|
1362
|
-
this.#
|
|
1363
|
-
|
|
1371
|
+
#failHandler(err) {
|
|
1372
|
+
const { exit, error } = this.#failureOf(err);
|
|
1373
|
+
if (this.#burgee?.json)
|
|
1374
|
+
this.#failureEnvelope(err);
|
|
1375
|
+
else
|
|
1376
|
+
this.#logger.error(error.message);
|
|
1364
1377
|
if (this.#exitProcess)
|
|
1365
1378
|
this.#shim.process.exit(exit);
|
|
1366
1379
|
else
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "burgee",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "An agent-native CLI framework, drop-in compatible with commander and yargs. One declaration; help, --json, --schema, --mcp and completions all projected from it.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -147,11 +147,11 @@
|
|
|
147
147
|
"provenance": true
|
|
148
148
|
},
|
|
149
149
|
"dependencies": {
|
|
150
|
-
"bellpull": "^0.4.
|
|
150
|
+
"bellpull": "^0.4.1",
|
|
151
151
|
"closeout": "^0.5.2",
|
|
152
|
-
"linegauge": "^0.5.
|
|
152
|
+
"linegauge": "^0.5.3",
|
|
153
153
|
"roundel": "^0.5.2",
|
|
154
|
-
"seniority": "^0.6.
|
|
154
|
+
"seniority": "^0.6.1"
|
|
155
155
|
},
|
|
156
156
|
"devDependencies": {
|
|
157
157
|
"vitest": "^5.0.1"
|