@lesliechan721/aw 0.1.0-beta.23 → 0.1.0-beta.25
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/scripts/aw-skill-eval-materializer.d.ts +3 -1
- package/dist/scripts/aw-skill-eval-materializer.js +76 -79
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +2 -1
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +26 -0
- package/dist/src/commands/rebuild-integration.js +163 -6
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/review-inspection.d.ts +71 -12
- package/dist/src/commands/review-inspection.js +485 -61
- package/dist/src/commands/review-inspection.js.map +1 -1
- package/dist/src/commands/review-preparation.d.ts +49 -0
- package/dist/src/commands/review-preparation.js +427 -0
- package/dist/src/commands/review-preparation.js.map +1 -0
- package/dist/src/commands/skill-eval.js +2 -0
- package/dist/src/commands/skill-eval.js.map +1 -1
- package/dist/src/eval/manifest-v1.d.ts +4 -0
- package/dist/src/eval/manifest-v1.js +34 -6
- package/dist/src/eval/manifest-v1.js.map +1 -1
- package/dist/src/generators/local-plugin.d.ts +2 -1
- package/dist/src/generators/local-plugin.js +40 -34
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.js +146 -20
- package/dist/src/index.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +1 -0
- package/dist/src/portable/materializer.js +51 -11
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/review/review-profile.d.ts +17 -0
- package/dist/src/review/review-profile.js +177 -0
- package/dist/src/review/review-profile.js.map +1 -0
- package/dist/src/review/review-selection.d.ts +30 -0
- package/dist/src/review/review-selection.js +527 -0
- package/dist/src/review/review-selection.js.map +1 -0
- package/dist/src/review/review-types.d.ts +68 -0
- package/dist/src/review/review-types.js +16 -0
- package/dist/src/review/review-types.js.map +1 -0
- package/dist/src/review/skill-materialization.d.ts +13 -0
- package/dist/src/review/skill-materialization.js +75 -0
- package/dist/src/review/skill-materialization.js.map +1 -0
- package/dist/src/review/source-binding.d.ts +21 -9
- package/dist/src/review/source-binding.js +84 -24
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +8 -2
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +5 -2
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/model.d.ts +1 -0
- package/dist/src/tui/model.js +32 -3
- package/dist/src/tui/model.js.map +1 -1
- package/package.json +3 -3
package/dist/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { Command, CommanderError, Option } from 'commander';
|
|
6
|
+
import { Command, CommanderError, InvalidArgumentError, Option } from 'commander';
|
|
7
7
|
import { doctorEvalProviders } from '@lesliechan721/agent-skill-eval';
|
|
8
8
|
import { initCommand } from './commands/init.js';
|
|
9
9
|
import { resolveCatalogWorkspaceRoot } from './commands/catalog-workspace-resolution.js';
|
|
@@ -36,7 +36,8 @@ import { withAwHomeMutationLock, } from './utils/aw-home-mutation-lock.js';
|
|
|
36
36
|
import { installPortableSkills, materializePortableSkillsToDirectory, PortableCommandError, renderPortableReview, } from './portable/commands.js';
|
|
37
37
|
import { SkillsCliError } from './portable/skills-cli.js';
|
|
38
38
|
import { computeReviewComponentDigest, listReviewRecords, parseReviewAttachment, publishReviewRecord, showReviewRecord, verifyReviewRecord, } from './commands/review-publication.js';
|
|
39
|
-
import { createReviewInspectionFailure, inspectReviewTarget, } from './commands/review-inspection.js';
|
|
39
|
+
import { createReviewInspectionFailure, getReviewInspectionExitCode, inspectReviewTarget, } from './commands/review-inspection.js';
|
|
40
|
+
import { prepareReviewTarget, } from './commands/review-preparation.js';
|
|
40
41
|
import { resolveRepoRoot } from './utils/state-paths.js';
|
|
41
42
|
import { runCatalogBuildCommand, runCatalogInitCommand, runCatalogValidateCommand, runCatalogVersionCommand, runPluginBuildCommand, runPluginTestCommand, } from './authoring/workspace-commands.js';
|
|
42
43
|
import { runCatalogPublishApplyCommand, runCatalogPublishPlanCommand, } from './commands/catalog-publish.js';
|
|
@@ -55,6 +56,62 @@ function createDefaultIo() {
|
|
|
55
56
|
function writeLine(write, line) {
|
|
56
57
|
write(`${line}\n`);
|
|
57
58
|
}
|
|
59
|
+
function strictValueOption(flags, description, choices) {
|
|
60
|
+
let seen = false;
|
|
61
|
+
const option = new Option(flags, description);
|
|
62
|
+
return option.argParser((value) => {
|
|
63
|
+
if (seen)
|
|
64
|
+
throw new InvalidArgumentError(`${option.long} can be specified only once.`);
|
|
65
|
+
if (choices && !choices.includes(value)) {
|
|
66
|
+
throw new InvalidArgumentError(`${option.long} must be one of: ${choices.join(', ')}.`);
|
|
67
|
+
}
|
|
68
|
+
seen = true;
|
|
69
|
+
return value;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function collectUniqueOption(value, previous) {
|
|
73
|
+
return previous.includes(value) ? previous : [...previous, value];
|
|
74
|
+
}
|
|
75
|
+
function renderReviewSkills(write, skills, issues) {
|
|
76
|
+
for (const skill of skills) {
|
|
77
|
+
writeLine(write, `${skill.skill}\t${skill.profile.platform}/${skill.profile.scope}\t${skill.state}\t${skill.finalPath ?? '-'}`);
|
|
78
|
+
}
|
|
79
|
+
for (const issue of issues)
|
|
80
|
+
writeLine(write, `${issue.code}: ${issue.message}`);
|
|
81
|
+
}
|
|
82
|
+
function renderReviewInspection(write, receipt) {
|
|
83
|
+
writeLine(write, `Review inspection (${receipt.view}): ${receipt.ok ? 'ok' : 'failed'}`);
|
|
84
|
+
if (receipt.view === 'review') {
|
|
85
|
+
renderReviewSkills(write, receipt.skills, receipt.issues);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
for (const issue of receipt.issues)
|
|
89
|
+
writeLine(write, `${issue.code}: ${issue.message}`);
|
|
90
|
+
}
|
|
91
|
+
function renderReviewPreparation(write, receipt) {
|
|
92
|
+
writeLine(write, `Review preparation: ${receipt.ok ? 'complete' : 'failed'}`);
|
|
93
|
+
if (receipt.sourceBindingPath)
|
|
94
|
+
writeLine(write, `Source binding: ${receipt.sourceBindingPath}`);
|
|
95
|
+
renderReviewSkills(write, receipt.skills, receipt.issues);
|
|
96
|
+
}
|
|
97
|
+
function requestedReviewView(argv) {
|
|
98
|
+
const inline = argv.find((token) => token.startsWith('--view='));
|
|
99
|
+
if (inline === '--view=release')
|
|
100
|
+
return 'release';
|
|
101
|
+
const index = argv.indexOf('--view');
|
|
102
|
+
return index >= 0 && argv[index + 1] === 'release' ? 'release' : 'review';
|
|
103
|
+
}
|
|
104
|
+
function createReviewPreparationFailure(message, code = 'invalidArguments') {
|
|
105
|
+
return {
|
|
106
|
+
schemaVersion: 1,
|
|
107
|
+
command: 'review:prepare',
|
|
108
|
+
ok: false,
|
|
109
|
+
target: null,
|
|
110
|
+
sourceBindingPath: null,
|
|
111
|
+
skills: [],
|
|
112
|
+
issues: [{ code, path: null, message }],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
58
115
|
function writeWarnings(write, warnings, options = {}) {
|
|
59
116
|
for (const warning of formatWarnings(warnings, options)) {
|
|
60
117
|
writeLine(write, warning);
|
|
@@ -1192,10 +1249,15 @@ export function buildProgram(options = {}) {
|
|
|
1192
1249
|
review
|
|
1193
1250
|
.command('inspect')
|
|
1194
1251
|
.description('Inspect current AW Review source and materialization facts')
|
|
1195
|
-
.argument('<target>', '
|
|
1196
|
-
.
|
|
1197
|
-
.option('--
|
|
1198
|
-
.
|
|
1252
|
+
.argument('<target>', 'Catalog Workspace, Plugin, or source Skill path')
|
|
1253
|
+
.addOption(strictValueOption('--workspace-root <root>', 'explicit Catalog Workspace root'))
|
|
1254
|
+
.option('--skill <name>', 'select one declared Skill', collectUniqueOption, [])
|
|
1255
|
+
.addOption(strictValueOption('--platform <platform>', 'select codex, claude, or agent-skills', ['codex', 'claude', 'agent-skills']))
|
|
1256
|
+
.addOption(strictValueOption('--scope <scope>', 'select user or project scope', ['user', 'project']))
|
|
1257
|
+
.addOption(strictValueOption('--config <file>', 'review config JSON file'))
|
|
1258
|
+
.option('--materialization <receipt>', 'validate one aw-source-binding receipt', collectUniqueOption, [])
|
|
1259
|
+
.addOption(strictValueOption('--view <view>', 'select review or release view', ['review', 'release']).default('review'))
|
|
1260
|
+
.option('--json', 'emit one Review inspection JSON object', false)
|
|
1199
1261
|
.action(async (target, rawOptions) => {
|
|
1200
1262
|
try {
|
|
1201
1263
|
const receipt = await inspectReviewTarget({
|
|
@@ -1204,17 +1266,61 @@ export function buildProgram(options = {}) {
|
|
|
1204
1266
|
...(rawOptions.workspaceRoot === undefined
|
|
1205
1267
|
? {}
|
|
1206
1268
|
: { workspaceRoot: rawOptions.workspaceRoot }),
|
|
1207
|
-
|
|
1269
|
+
skills: rawOptions.skill,
|
|
1270
|
+
...(rawOptions.platform === undefined ? {} : { platform: rawOptions.platform }),
|
|
1271
|
+
...(rawOptions.scope === undefined ? {} : { scope: rawOptions.scope }),
|
|
1272
|
+
...(rawOptions.config === undefined ? {} : { configFile: rawOptions.config }),
|
|
1273
|
+
materializations: [...new Set(rawOptions.materialization
|
|
1274
|
+
.map((entry) => path.resolve(cwd, entry)))],
|
|
1275
|
+
view: rawOptions.view,
|
|
1208
1276
|
env,
|
|
1209
1277
|
});
|
|
1210
|
-
|
|
1211
|
-
|
|
1278
|
+
if (rawOptions.json)
|
|
1279
|
+
writeJsonReceipt(io.stdout, receipt);
|
|
1280
|
+
else
|
|
1281
|
+
renderReviewInspection(io.stdout, receipt);
|
|
1282
|
+
commandExitState.exitCode = 0;
|
|
1212
1283
|
}
|
|
1213
1284
|
catch (error) {
|
|
1214
|
-
|
|
1215
|
-
|
|
1285
|
+
const receipt = createReviewInspectionFailure(error, rawOptions.view);
|
|
1286
|
+
if (rawOptions.json)
|
|
1287
|
+
writeJsonReceipt(io.stdout, receipt);
|
|
1288
|
+
else
|
|
1289
|
+
renderReviewInspection(io.stdout, receipt);
|
|
1290
|
+
commandExitState.exitCode = getReviewInspectionExitCode(error);
|
|
1216
1291
|
}
|
|
1217
1292
|
});
|
|
1293
|
+
review
|
|
1294
|
+
.command('prepare')
|
|
1295
|
+
.description('Prepare deterministic Skill finals for AW Review')
|
|
1296
|
+
.argument('<target>', 'Plugin or source Skill path')
|
|
1297
|
+
.addOption(strictValueOption('--workspace-root <root>', 'explicit Catalog Workspace root'))
|
|
1298
|
+
.option('--skill <name>', 'select one declared Skill', collectUniqueOption, [])
|
|
1299
|
+
.addOption(strictValueOption('--platform <platform>', 'select codex, claude, or agent-skills', ['codex', 'claude', 'agent-skills']).makeOptionMandatory())
|
|
1300
|
+
.addOption(strictValueOption('--scope <scope>', 'select user or project scope', ['user', 'project']).makeOptionMandatory())
|
|
1301
|
+
.addOption(strictValueOption('--config <file>', 'review config JSON file'))
|
|
1302
|
+
.addOption(strictValueOption('--out <new-dir>', 'new output directory').makeOptionMandatory())
|
|
1303
|
+
.option('--json', 'emit one Review preparation JSON object', false)
|
|
1304
|
+
.action(async (target, rawOptions) => {
|
|
1305
|
+
const result = await prepareReviewTarget({
|
|
1306
|
+
cwd,
|
|
1307
|
+
target,
|
|
1308
|
+
...(rawOptions.workspaceRoot === undefined
|
|
1309
|
+
? {}
|
|
1310
|
+
: { workspaceRoot: rawOptions.workspaceRoot }),
|
|
1311
|
+
skills: rawOptions.skill,
|
|
1312
|
+
platform: rawOptions.platform,
|
|
1313
|
+
scope: rawOptions.scope,
|
|
1314
|
+
...(rawOptions.config === undefined ? {} : { configFile: rawOptions.config }),
|
|
1315
|
+
out: rawOptions.out,
|
|
1316
|
+
env,
|
|
1317
|
+
});
|
|
1318
|
+
if (rawOptions.json)
|
|
1319
|
+
writeJsonReceipt(io.stdout, result.receipt);
|
|
1320
|
+
else
|
|
1321
|
+
renderReviewPreparation(io.stdout, result.receipt);
|
|
1322
|
+
commandExitState.exitCode = result.exitCode;
|
|
1323
|
+
});
|
|
1218
1324
|
review
|
|
1219
1325
|
.command('digest')
|
|
1220
1326
|
.description('Compute one canonical workflow component digest')
|
|
@@ -3226,10 +3332,14 @@ export async function runCli(argv, options = {}) {
|
|
|
3226
3332
|
...createDefaultIo(),
|
|
3227
3333
|
...options.io,
|
|
3228
3334
|
};
|
|
3335
|
+
const reviewCommand = argv[0] === 'review' && ['inspect', 'prepare'].includes(argv[1] ?? '')
|
|
3336
|
+
? argv[1]
|
|
3337
|
+
: null;
|
|
3338
|
+
const jsonReviewCommand = reviewCommand !== null && argv.includes('--json');
|
|
3229
3339
|
const jsonAuthoringCommand = argv.includes('--json')
|
|
3230
3340
|
&& ((argv[0] === 'catalog' && ['init', 'context', 'version', 'build', 'validate', 'status', 'publish'].includes(argv[1] ?? ''))
|
|
3231
3341
|
|| (argv[0] === 'plugin' && ['build', 'test', 'validate', 'status', 'remove'].includes(argv[1] ?? ''))
|
|
3232
|
-
||
|
|
3342
|
+
|| reviewCommand !== null)
|
|
3233
3343
|
? `${argv[0]}:${argv[1]}`
|
|
3234
3344
|
: null;
|
|
3235
3345
|
const jsonCatalogDevCommand = argv.includes('--json')
|
|
@@ -3363,7 +3473,7 @@ export async function runCli(argv, options = {}) {
|
|
|
3363
3473
|
}
|
|
3364
3474
|
let catalogPublicationActionStarted = false;
|
|
3365
3475
|
let configMutationActionStarted = false;
|
|
3366
|
-
const programIo = jsonCatalogDevCommand || jsonWriteRequest
|
|
3476
|
+
const programIo = jsonCatalogDevCommand || jsonWriteRequest || jsonReviewCommand
|
|
3367
3477
|
? { ...io, stderr: () => undefined }
|
|
3368
3478
|
: jsonConfigMutation
|
|
3369
3479
|
? {
|
|
@@ -3407,6 +3517,17 @@ export async function runCli(argv, options = {}) {
|
|
|
3407
3517
|
return program.__awCommandExitState?.exitCode ?? 0;
|
|
3408
3518
|
}
|
|
3409
3519
|
catch (error) {
|
|
3520
|
+
if (reviewCommand && error instanceof CommanderError) {
|
|
3521
|
+
if (error.exitCode === 0)
|
|
3522
|
+
return 0;
|
|
3523
|
+
if (jsonReviewCommand) {
|
|
3524
|
+
const receipt = reviewCommand === 'inspect'
|
|
3525
|
+
? createReviewInspectionFailure(new Error(error.message), requestedReviewView(argv), 'invalidArguments')
|
|
3526
|
+
: createReviewPreparationFailure(error.message);
|
|
3527
|
+
writeJsonReceipt(io.stdout, receipt);
|
|
3528
|
+
}
|
|
3529
|
+
return 2;
|
|
3530
|
+
}
|
|
3410
3531
|
if (jsonCatalogDevCommand) {
|
|
3411
3532
|
const workspaceRootIndex = argv.findIndex((token) => token === '--workspace-root');
|
|
3412
3533
|
const workspaceRootOption = argv.find((token) => token.startsWith('--workspace-root='));
|
|
@@ -3491,7 +3612,10 @@ export async function runCli(argv, options = {}) {
|
|
|
3491
3612
|
});
|
|
3492
3613
|
}
|
|
3493
3614
|
else if (jsonAuthoringCommand === 'review:inspect') {
|
|
3494
|
-
writeJsonReceipt(io.stdout, createReviewInspectionFailure(error));
|
|
3615
|
+
writeJsonReceipt(io.stdout, createReviewInspectionFailure(error, requestedReviewView(argv)));
|
|
3616
|
+
}
|
|
3617
|
+
else if (jsonAuthoringCommand === 'review:prepare') {
|
|
3618
|
+
writeJsonReceipt(io.stdout, createReviewPreparationFailure(message, 'reviewPreparationFailed'));
|
|
3495
3619
|
}
|
|
3496
3620
|
else {
|
|
3497
3621
|
writeJsonReceipt(io.stdout, {
|
|
@@ -3504,12 +3628,14 @@ export async function runCli(argv, options = {}) {
|
|
|
3504
3628
|
}
|
|
3505
3629
|
if (jsonAuthoringCommand && error instanceof CommanderError) {
|
|
3506
3630
|
writeJsonReceipt(io.stdout, jsonAuthoringCommand === 'review:inspect'
|
|
3507
|
-
? createReviewInspectionFailure(error, 'invalidArguments')
|
|
3508
|
-
:
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3631
|
+
? createReviewInspectionFailure(new Error(error.message), requestedReviewView(argv), 'invalidArguments')
|
|
3632
|
+
: jsonAuthoringCommand === 'review:prepare'
|
|
3633
|
+
? createReviewPreparationFailure(error.message)
|
|
3634
|
+
: {
|
|
3635
|
+
command: jsonAuthoringCommand,
|
|
3636
|
+
ok: false,
|
|
3637
|
+
errors: [{ code: 'invalidArguments', message: error.message }],
|
|
3638
|
+
});
|
|
3513
3639
|
}
|
|
3514
3640
|
return handleCliError(error, io.stderr);
|
|
3515
3641
|
}
|