speckeeper 0.12.0 → 0.13.1
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/cli-contract.yaml +87 -119
- package/dist/cli.js +148 -189
- package/dist/cli.js.map +1 -1
- package/dist/{config-api-coyCX1SB.d.ts → config-api-BvCV9_r8.d.ts} +1 -1
- package/dist/dsl/index.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/docs/cli-reference.md +12 -20
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -39,7 +39,9 @@ var init_agents = __esm({
|
|
|
39
39
|
can_execute_tools: [
|
|
40
40
|
"speckeeper-cli"
|
|
41
41
|
],
|
|
42
|
-
can_invoke_agents: [
|
|
42
|
+
can_invoke_agents: [
|
|
43
|
+
"spec-quality-reviewer"
|
|
44
|
+
],
|
|
43
45
|
can_return_handoffs: [
|
|
44
46
|
"requirement-audit-result",
|
|
45
47
|
"trace-link-result",
|
|
@@ -449,9 +451,14 @@ var init_workflows = __esm({
|
|
|
449
451
|
type: "delegate",
|
|
450
452
|
task: "audit-requirement-quality",
|
|
451
453
|
from_agent: "spec-quality-reviewer",
|
|
452
|
-
description: "",
|
|
454
|
+
description: "Execute LLM-based requirement audit. Retries once on adapter error (exit 12).",
|
|
453
455
|
optional: false,
|
|
454
|
-
max_retries:
|
|
456
|
+
max_retries: 1
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
type: "gate",
|
|
460
|
+
gate_kind: "requirement-audit-result",
|
|
461
|
+
description: "Block if RequirementAuditResult fails schema validation or no specs were found in configuration (stop_and_report)."
|
|
455
462
|
}
|
|
456
463
|
]
|
|
457
464
|
};
|
|
@@ -467,9 +474,14 @@ var init_workflows = __esm({
|
|
|
467
474
|
type: "delegate",
|
|
468
475
|
task: "propose-trace-links",
|
|
469
476
|
from_agent: "spec-quality-reviewer",
|
|
470
|
-
description: "",
|
|
477
|
+
description: "Execute LLM-based trace link analysis. Retries once on adapter error (exit 12).",
|
|
471
478
|
optional: false,
|
|
472
|
-
max_retries:
|
|
479
|
+
max_retries: 1
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
type: "gate",
|
|
483
|
+
gate_kind: "trace-link-result",
|
|
484
|
+
description: "Block if TraceLinkResult fails schema validation or no specs were found in configuration (stop_and_report)."
|
|
473
485
|
}
|
|
474
486
|
]
|
|
475
487
|
};
|
|
@@ -485,9 +497,14 @@ var init_workflows = __esm({
|
|
|
485
497
|
type: "delegate",
|
|
486
498
|
task: "explain-impact-result",
|
|
487
499
|
from_agent: "spec-quality-reviewer",
|
|
488
|
-
description: "",
|
|
500
|
+
description: "Execute LLM-based impact explanation. Retries once on adapter error (exit 12).",
|
|
489
501
|
optional: false,
|
|
490
|
-
max_retries:
|
|
502
|
+
max_retries: 1
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
type: "gate",
|
|
506
|
+
gate_kind: "impact-explain-result",
|
|
507
|
+
description: "Block if ImpactExplainResult fails schema validation or stdin was empty/invalid (stop_and_report)."
|
|
491
508
|
}
|
|
492
509
|
]
|
|
493
510
|
};
|
|
@@ -503,9 +520,14 @@ var init_workflows = __esm({
|
|
|
503
520
|
type: "delegate",
|
|
504
521
|
task: "propose-acceptance-criteria",
|
|
505
522
|
from_agent: "spec-quality-reviewer",
|
|
506
|
-
description: "",
|
|
523
|
+
description: "Execute LLM-based acceptance criteria proposal. Retries once on adapter error (exit 12).",
|
|
507
524
|
optional: false,
|
|
508
|
-
max_retries:
|
|
525
|
+
max_retries: 1
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
type: "gate",
|
|
529
|
+
gate_kind: "acceptance-criteria-result",
|
|
530
|
+
description: "Block if AcceptanceCriteriaResult fails schema validation or no specs were found in configuration (stop_and_report)."
|
|
509
531
|
}
|
|
510
532
|
]
|
|
511
533
|
};
|
|
@@ -570,9 +592,9 @@ function derivePolicy(input) {
|
|
|
570
592
|
const riskLevels = [];
|
|
571
593
|
let executionMode;
|
|
572
594
|
let explicitConfirmation;
|
|
573
|
-
if (input.
|
|
574
|
-
const ce = input.
|
|
575
|
-
riskLevels.push(ce.
|
|
595
|
+
if (input.command_effects) {
|
|
596
|
+
const ce = input.command_effects;
|
|
597
|
+
riskLevels.push(ce.risk_level ?? "low");
|
|
576
598
|
if (ce.writes) {
|
|
577
599
|
sideEffects.add("file_write");
|
|
578
600
|
for (const w of ce.writes) {
|
|
@@ -583,9 +605,9 @@ function derivePolicy(input) {
|
|
|
583
605
|
overwrite: w.overwrite,
|
|
584
606
|
destructive: w.destructive,
|
|
585
607
|
...w.idempotent !== void 0 ? { idempotent: w.idempotent } : {},
|
|
586
|
-
...w.
|
|
587
|
-
...w.
|
|
588
|
-
source: `command:${input.
|
|
608
|
+
...w.idempotency_key ? { idempotency_key: w.idempotency_key } : {},
|
|
609
|
+
...w.idempotent_note ? { idempotent_note: w.idempotent_note } : {},
|
|
610
|
+
source: `command:${input.command_id}`
|
|
589
611
|
});
|
|
590
612
|
}
|
|
591
613
|
}
|
|
@@ -595,7 +617,7 @@ function derivePolicy(input) {
|
|
|
595
617
|
kind: "semantic",
|
|
596
618
|
target: r.target,
|
|
597
619
|
description: r.description,
|
|
598
|
-
source: `command:${input.
|
|
620
|
+
source: `command:${input.command_id}`
|
|
599
621
|
});
|
|
600
622
|
}
|
|
601
623
|
}
|
|
@@ -606,17 +628,17 @@ function derivePolicy(input) {
|
|
|
606
628
|
...ce.network.description ? { description: ce.network.description } : {},
|
|
607
629
|
...ce.network.domains ? { domains: ce.network.domains } : {},
|
|
608
630
|
...ce.network.idempotent !== void 0 ? { idempotent: ce.network.idempotent } : {},
|
|
609
|
-
...ce.network.
|
|
610
|
-
...ce.network.
|
|
611
|
-
source: `command:${input.
|
|
631
|
+
...ce.network.idempotency_key ? { idempotency_key: ce.network.idempotency_key } : {},
|
|
632
|
+
...ce.network.idempotent_note ? { idempotent_note: ce.network.idempotent_note } : {},
|
|
633
|
+
source: `command:${input.command_id}`
|
|
612
634
|
});
|
|
613
635
|
}
|
|
614
636
|
}
|
|
615
|
-
if (ce.
|
|
616
|
-
executionMode = ce.
|
|
637
|
+
if (ce.execution_mode) {
|
|
638
|
+
executionMode = ce.execution_mode;
|
|
617
639
|
}
|
|
618
|
-
if (ce.
|
|
619
|
-
explicitConfirmation = ce.
|
|
640
|
+
if (ce.requires_confirmation !== void 0) {
|
|
641
|
+
explicitConfirmation = ce.requires_confirmation;
|
|
620
642
|
}
|
|
621
643
|
}
|
|
622
644
|
for (const [optName, optInput] of Object.entries(input.options)) {
|
|
@@ -647,7 +669,7 @@ function derivePolicy(input) {
|
|
|
647
669
|
}
|
|
648
670
|
if (definition.effects) {
|
|
649
671
|
const eff = definition.effects;
|
|
650
|
-
riskLevels.push(eff.
|
|
672
|
+
riskLevels.push(eff.risk_level ?? "low");
|
|
651
673
|
if (eff.writes) {
|
|
652
674
|
sideEffects.add("file_write");
|
|
653
675
|
for (const w of eff.writes) {
|
|
@@ -658,8 +680,8 @@ function derivePolicy(input) {
|
|
|
658
680
|
overwrite: w.overwrite,
|
|
659
681
|
destructive: w.destructive,
|
|
660
682
|
...w.idempotent !== void 0 ? { idempotent: w.idempotent } : {},
|
|
661
|
-
...w.
|
|
662
|
-
...w.
|
|
683
|
+
...w.idempotency_key ? { idempotency_key: w.idempotency_key } : {},
|
|
684
|
+
...w.idempotent_note ? { idempotent_note: w.idempotent_note } : {},
|
|
663
685
|
source: `option:${optName}`
|
|
664
686
|
});
|
|
665
687
|
}
|
|
@@ -681,17 +703,17 @@ function derivePolicy(input) {
|
|
|
681
703
|
...eff.network.description ? { description: eff.network.description } : {},
|
|
682
704
|
...eff.network.domains ? { domains: eff.network.domains } : {},
|
|
683
705
|
...eff.network.idempotent !== void 0 ? { idempotent: eff.network.idempotent } : {},
|
|
684
|
-
...eff.network.
|
|
685
|
-
...eff.network.
|
|
706
|
+
...eff.network.idempotency_key ? { idempotency_key: eff.network.idempotency_key } : {},
|
|
707
|
+
...eff.network.idempotent_note ? { idempotent_note: eff.network.idempotent_note } : {},
|
|
686
708
|
source: `option:${optName}`
|
|
687
709
|
});
|
|
688
710
|
}
|
|
689
711
|
}
|
|
690
|
-
if (eff.
|
|
691
|
-
executionMode = eff.
|
|
712
|
+
if (eff.execution_mode && !executionMode) {
|
|
713
|
+
executionMode = eff.execution_mode;
|
|
692
714
|
}
|
|
693
|
-
if (eff.
|
|
694
|
-
explicitConfirmation = eff.
|
|
715
|
+
if (eff.requires_confirmation !== void 0 && explicitConfirmation === void 0) {
|
|
716
|
+
explicitConfirmation = eff.requires_confirmation;
|
|
695
717
|
}
|
|
696
718
|
}
|
|
697
719
|
}
|
|
@@ -712,15 +734,15 @@ function derivePolicy(input) {
|
|
|
712
734
|
const semanticWrites = writes.filter((w) => w.kind === "semantic");
|
|
713
735
|
const idempotent = semanticWrites.every((w) => w.idempotent === true) && networkEffects.every((n) => n.idempotent === true);
|
|
714
736
|
return {
|
|
715
|
-
|
|
716
|
-
requiresConfirmation,
|
|
737
|
+
risk_level: finalRiskLevel,
|
|
738
|
+
requires_confirmation: requiresConfirmation,
|
|
717
739
|
idempotent,
|
|
718
|
-
|
|
740
|
+
side_effects: [...sideEffects],
|
|
719
741
|
reads,
|
|
720
742
|
writes,
|
|
721
743
|
...networkEffects.length > 0 ? { network: networkEffects } : {},
|
|
722
|
-
...executionMode ? { executionMode } : {},
|
|
723
|
-
...requiresSecrets ? { requiresSecrets } : {}
|
|
744
|
+
...executionMode ? { execution_mode: executionMode } : {},
|
|
745
|
+
...requiresSecrets ? { requires_secrets: requiresSecrets } : {}
|
|
724
746
|
};
|
|
725
747
|
}
|
|
726
748
|
|
|
@@ -728,7 +750,7 @@ function derivePolicy(input) {
|
|
|
728
750
|
var commandDefinitions = {
|
|
729
751
|
"init": {
|
|
730
752
|
"effects": {
|
|
731
|
-
"
|
|
753
|
+
"risk_level": "medium",
|
|
732
754
|
"writes": [
|
|
733
755
|
{
|
|
734
756
|
"target": "speckeeper.config.ts, design/ directory",
|
|
@@ -745,7 +767,7 @@ var commandDefinitions = {
|
|
|
745
767
|
"default": false
|
|
746
768
|
},
|
|
747
769
|
"effects": {
|
|
748
|
-
"
|
|
770
|
+
"risk_level": "high",
|
|
749
771
|
"writes": [
|
|
750
772
|
{
|
|
751
773
|
"target": "existing project files",
|
|
@@ -785,7 +807,7 @@ var commandDefinitions = {
|
|
|
785
807
|
},
|
|
786
808
|
"build": {
|
|
787
809
|
"effects": {
|
|
788
|
-
"
|
|
810
|
+
"risk_level": "low",
|
|
789
811
|
"writes": [
|
|
790
812
|
{
|
|
791
813
|
"target": "docs/ directory",
|
|
@@ -832,9 +854,7 @@ var commandDefinitions = {
|
|
|
832
854
|
"type": "boolean",
|
|
833
855
|
"default": false
|
|
834
856
|
},
|
|
835
|
-
"effects": {
|
|
836
|
-
"executionMode": "watch"
|
|
837
|
-
}
|
|
857
|
+
"effects": {}
|
|
838
858
|
},
|
|
839
859
|
{
|
|
840
860
|
"name": "verbose",
|
|
@@ -1033,7 +1053,7 @@ var commandDefinitions = {
|
|
|
1033
1053
|
},
|
|
1034
1054
|
"new": {
|
|
1035
1055
|
"effects": {
|
|
1036
|
-
"
|
|
1056
|
+
"risk_level": "low",
|
|
1037
1057
|
"writes": [
|
|
1038
1058
|
{
|
|
1039
1059
|
"target": "design/ directory",
|
|
@@ -1158,7 +1178,7 @@ var commandDefinitions = {
|
|
|
1158
1178
|
},
|
|
1159
1179
|
"scaffold": {
|
|
1160
1180
|
"effects": {
|
|
1161
|
-
"
|
|
1181
|
+
"risk_level": "low",
|
|
1162
1182
|
"writes": [
|
|
1163
1183
|
{
|
|
1164
1184
|
"target": "design/ directory",
|
|
@@ -1193,7 +1213,7 @@ var commandDefinitions = {
|
|
|
1193
1213
|
"default": false
|
|
1194
1214
|
},
|
|
1195
1215
|
"effects": {
|
|
1196
|
-
"
|
|
1216
|
+
"risk_level": "medium",
|
|
1197
1217
|
"writes": [
|
|
1198
1218
|
{
|
|
1199
1219
|
"target": "existing model and spec files",
|
|
@@ -1239,7 +1259,7 @@ var commandDefinitions = {
|
|
|
1239
1259
|
},
|
|
1240
1260
|
"convert": {
|
|
1241
1261
|
"effects": {
|
|
1242
|
-
"
|
|
1262
|
+
"risk_level": "low",
|
|
1243
1263
|
"writes": [
|
|
1244
1264
|
{
|
|
1245
1265
|
"target": ".yaml output file",
|
|
@@ -1320,20 +1340,6 @@ var commandDefinitions = {
|
|
|
1320
1340
|
"type": "string"
|
|
1321
1341
|
}
|
|
1322
1342
|
},
|
|
1323
|
-
{
|
|
1324
|
-
"name": "dry-run",
|
|
1325
|
-
"schema": {
|
|
1326
|
-
"type": "boolean",
|
|
1327
|
-
"default": false
|
|
1328
|
-
}
|
|
1329
|
-
},
|
|
1330
|
-
{
|
|
1331
|
-
"name": "show-prompt",
|
|
1332
|
-
"schema": {
|
|
1333
|
-
"type": "boolean",
|
|
1334
|
-
"default": false
|
|
1335
|
-
}
|
|
1336
|
-
},
|
|
1337
1343
|
{
|
|
1338
1344
|
"name": "fail-on",
|
|
1339
1345
|
"schema": {
|
|
@@ -1422,20 +1428,6 @@ var commandDefinitions = {
|
|
|
1422
1428
|
"type": "string"
|
|
1423
1429
|
}
|
|
1424
1430
|
},
|
|
1425
|
-
{
|
|
1426
|
-
"name": "dry-run",
|
|
1427
|
-
"schema": {
|
|
1428
|
-
"type": "boolean",
|
|
1429
|
-
"default": false
|
|
1430
|
-
}
|
|
1431
|
-
},
|
|
1432
|
-
{
|
|
1433
|
-
"name": "show-prompt",
|
|
1434
|
-
"schema": {
|
|
1435
|
-
"type": "boolean",
|
|
1436
|
-
"default": false
|
|
1437
|
-
}
|
|
1438
|
-
},
|
|
1439
1431
|
{
|
|
1440
1432
|
"name": "fail-on",
|
|
1441
1433
|
"schema": {
|
|
@@ -1513,20 +1505,6 @@ var commandDefinitions = {
|
|
|
1513
1505
|
"type": "string"
|
|
1514
1506
|
}
|
|
1515
1507
|
},
|
|
1516
|
-
{
|
|
1517
|
-
"name": "dry-run",
|
|
1518
|
-
"schema": {
|
|
1519
|
-
"type": "boolean",
|
|
1520
|
-
"default": false
|
|
1521
|
-
}
|
|
1522
|
-
},
|
|
1523
|
-
{
|
|
1524
|
-
"name": "show-prompt",
|
|
1525
|
-
"schema": {
|
|
1526
|
-
"type": "boolean",
|
|
1527
|
-
"default": false
|
|
1528
|
-
}
|
|
1529
|
-
},
|
|
1530
1508
|
{
|
|
1531
1509
|
"name": "fail-on",
|
|
1532
1510
|
"schema": {
|
|
@@ -1615,20 +1593,6 @@ var commandDefinitions = {
|
|
|
1615
1593
|
"type": "string"
|
|
1616
1594
|
}
|
|
1617
1595
|
},
|
|
1618
|
-
{
|
|
1619
|
-
"name": "dry-run",
|
|
1620
|
-
"schema": {
|
|
1621
|
-
"type": "boolean",
|
|
1622
|
-
"default": false
|
|
1623
|
-
}
|
|
1624
|
-
},
|
|
1625
|
-
{
|
|
1626
|
-
"name": "show-prompt",
|
|
1627
|
-
"schema": {
|
|
1628
|
-
"type": "boolean",
|
|
1629
|
-
"default": false
|
|
1630
|
-
}
|
|
1631
|
-
},
|
|
1632
1596
|
{
|
|
1633
1597
|
"name": "fail-on",
|
|
1634
1598
|
"schema": {
|
|
@@ -1680,27 +1644,27 @@ var commandDefinitions = {
|
|
|
1680
1644
|
}
|
|
1681
1645
|
}
|
|
1682
1646
|
};
|
|
1683
|
-
function deriveCommandPolicy(
|
|
1684
|
-
const def = commandDefinitions[
|
|
1685
|
-
if (!def) throw new Error(`Unknown command: ${
|
|
1647
|
+
function deriveCommandPolicy(command_id, optionValues) {
|
|
1648
|
+
const def = commandDefinitions[command_id];
|
|
1649
|
+
if (!def) throw new Error(`Unknown command: ${command_id}`);
|
|
1686
1650
|
const cmdDef = def;
|
|
1687
1651
|
const options = {};
|
|
1688
|
-
const
|
|
1652
|
+
const active_options = [];
|
|
1689
1653
|
for (const optDef of cmdDef.options ?? []) {
|
|
1690
1654
|
const value = optionValues[optDef.name];
|
|
1691
1655
|
const specified = optDef.name in optionValues && value !== void 0;
|
|
1692
1656
|
options[optDef.name] = { value, specified, definition: optDef };
|
|
1693
1657
|
if (isOptionActive(optDef, value, specified)) {
|
|
1694
|
-
|
|
1658
|
+
active_options.push(optDef.name);
|
|
1695
1659
|
}
|
|
1696
1660
|
}
|
|
1697
1661
|
const policy = derivePolicy({
|
|
1698
|
-
|
|
1699
|
-
|
|
1662
|
+
command_id,
|
|
1663
|
+
command_effects: cmdDef.effects,
|
|
1700
1664
|
options,
|
|
1701
1665
|
env: cmdDef.env
|
|
1702
1666
|
});
|
|
1703
|
-
return { command:
|
|
1667
|
+
return { command: command_id, active_options, policy };
|
|
1704
1668
|
}
|
|
1705
1669
|
|
|
1706
1670
|
// src/generated/program.ts
|
|
@@ -1789,40 +1753,60 @@ function createProgram(handlers2, version) {
|
|
|
1789
1753
|
}
|
|
1790
1754
|
await handlers2.convert(file, opts, globalOpts);
|
|
1791
1755
|
});
|
|
1792
|
-
program.command("audit-requirements").description("Run LLM-based requirement quality audit.").option("-c, --config <path>", "Path to config file.").option("-a, --adapter <name>", "SDK adapter to use for LLM execution.").option("--model <name>", "LLM model override.").option("
|
|
1756
|
+
program.command("audit-requirements").description("Run LLM-based requirement quality audit.").option("-c, --config <path>", "Path to config file.").option("-a, --adapter <name>", "SDK adapter to use for LLM execution.").option("--model <name>", "LLM model override.").option("--fail-on <level>", "Minimum severity that causes a non-zero exit.", "error").option("-o, --output <file>", "Write result to a file instead of stdout.").option("--report-format <fmt>", "Output format for the audit report.", "json").option("--show-prompt", "Output the constructed prompt without calling the LLM API.", false).action(async (opts, cmd) => {
|
|
1793
1757
|
const globalOpts = cmd.optsWithGlobals();
|
|
1794
1758
|
if (globalOpts.introspect) {
|
|
1795
1759
|
const policy = deriveCommandPolicy("audit-requirements", opts);
|
|
1796
1760
|
console.log(JSON.stringify(policy, null, 2));
|
|
1797
1761
|
return;
|
|
1798
1762
|
}
|
|
1763
|
+
if (opts.showPrompt) {
|
|
1764
|
+
const prompt = await handlers2.auditRequirements(opts, globalOpts);
|
|
1765
|
+
if (typeof prompt === "string") process.stdout.write(prompt + "\n");
|
|
1766
|
+
return;
|
|
1767
|
+
}
|
|
1799
1768
|
await handlers2.auditRequirements(opts, globalOpts);
|
|
1800
1769
|
});
|
|
1801
|
-
program.command("propose-trace-links").description("LLM-based traceability link proposal.").option("-c, --config <path>", "Path to config file.").option("-a, --adapter <name>", "SDK adapter to use for LLM execution.").option("--model <name>", "LLM model override.").option("
|
|
1770
|
+
program.command("propose-trace-links").description("LLM-based traceability link proposal.").option("-c, --config <path>", "Path to config file.").option("-a, --adapter <name>", "SDK adapter to use for LLM execution.").option("--model <name>", "LLM model override.").option("--fail-on <level>", "Minimum severity that causes a non-zero exit.", "error").option("-o, --output <file>", "Write result to a file instead of stdout.").option("--report-format <fmt>", "Output format for the report.", "json").option("--show-prompt", "Output the constructed prompt without calling the LLM API.", false).action(async (opts, cmd) => {
|
|
1802
1771
|
const globalOpts = cmd.optsWithGlobals();
|
|
1803
1772
|
if (globalOpts.introspect) {
|
|
1804
1773
|
const policy = deriveCommandPolicy("propose-trace-links", opts);
|
|
1805
1774
|
console.log(JSON.stringify(policy, null, 2));
|
|
1806
1775
|
return;
|
|
1807
1776
|
}
|
|
1777
|
+
if (opts.showPrompt) {
|
|
1778
|
+
const prompt = await handlers2.proposeTraceLinks(opts, globalOpts);
|
|
1779
|
+
if (typeof prompt === "string") process.stdout.write(prompt + "\n");
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1808
1782
|
await handlers2.proposeTraceLinks(opts, globalOpts);
|
|
1809
1783
|
});
|
|
1810
|
-
program.command("explain-impact").description("LLM-based explanation of impact analysis output.").option("-a, --adapter <name>", "SDK adapter to use for LLM execution.").option("--model <name>", "LLM model override.").option("
|
|
1784
|
+
program.command("explain-impact").description("LLM-based explanation of impact analysis output.").option("-a, --adapter <name>", "SDK adapter to use for LLM execution.").option("--model <name>", "LLM model override.").option("--fail-on <level>", "Minimum severity that causes a non-zero exit.", "error").option("-o, --output <file>", "Write result to a file instead of stdout.").option("--report-format <fmt>", "Output format for the report.", "json").option("--show-prompt", "Output the constructed prompt without calling the LLM API.", false).action(async (opts, cmd) => {
|
|
1811
1785
|
const globalOpts = cmd.optsWithGlobals();
|
|
1812
1786
|
if (globalOpts.introspect) {
|
|
1813
1787
|
const policy = deriveCommandPolicy("explain-impact", opts);
|
|
1814
1788
|
console.log(JSON.stringify(policy, null, 2));
|
|
1815
1789
|
return;
|
|
1816
1790
|
}
|
|
1791
|
+
if (opts.showPrompt) {
|
|
1792
|
+
const prompt = await handlers2.explainImpact(opts, globalOpts);
|
|
1793
|
+
if (typeof prompt === "string") process.stdout.write(prompt + "\n");
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1817
1796
|
await handlers2.explainImpact(opts, globalOpts);
|
|
1818
1797
|
});
|
|
1819
|
-
program.command("propose-acceptance-criteria").description("LLM-based acceptance criteria proposal.").argument("[specIds...]", "Spec IDs to propose criteria for. Defaults to all specs if omitted.").option("-c, --config <path>", "Path to config file.").option("-a, --adapter <name>", "SDK adapter to use for LLM execution.").option("--model <name>", "LLM model override.").option("
|
|
1798
|
+
program.command("propose-acceptance-criteria").description("LLM-based acceptance criteria proposal.").argument("[specIds...]", "Spec IDs to propose criteria for. Defaults to all specs if omitted.").option("-c, --config <path>", "Path to config file.").option("-a, --adapter <name>", "SDK adapter to use for LLM execution.").option("--model <name>", "LLM model override.").option("--fail-on <level>", "Minimum severity that causes a non-zero exit.", "error").option("-o, --output <file>", "Write result to a file instead of stdout.").option("--report-format <fmt>", "Output format for the report.", "json").option("--show-prompt", "Output the constructed prompt without calling the LLM API.", false).action(async (specIds, opts, cmd) => {
|
|
1820
1799
|
const globalOpts = cmd.optsWithGlobals();
|
|
1821
1800
|
if (globalOpts.introspect) {
|
|
1822
1801
|
const policy = deriveCommandPolicy("propose-acceptance-criteria", opts);
|
|
1823
1802
|
console.log(JSON.stringify(policy, null, 2));
|
|
1824
1803
|
return;
|
|
1825
1804
|
}
|
|
1805
|
+
if (opts.showPrompt) {
|
|
1806
|
+
const prompt = await handlers2.proposeAcceptanceCriteria(specIds, opts, globalOpts);
|
|
1807
|
+
if (typeof prompt === "string") process.stdout.write(prompt + "\n");
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1826
1810
|
await handlers2.proposeAcceptanceCriteria(specIds, opts, globalOpts);
|
|
1827
1811
|
});
|
|
1828
1812
|
return program;
|
|
@@ -4428,19 +4412,7 @@ async function createAdapter(runtimePkg, name, config) {
|
|
|
4428
4412
|
);
|
|
4429
4413
|
}
|
|
4430
4414
|
}
|
|
4431
|
-
async function runAgentTask(userRequest, taskId, auditConfig,
|
|
4432
|
-
if (options.dryRun) {
|
|
4433
|
-
return {
|
|
4434
|
-
taskId,
|
|
4435
|
-
data: null,
|
|
4436
|
-
raw: "",
|
|
4437
|
-
prompt: userRequest,
|
|
4438
|
-
dryRun: true,
|
|
4439
|
-
status: "success",
|
|
4440
|
-
followUpsUsed: 0,
|
|
4441
|
-
retriesUsed: 0
|
|
4442
|
-
};
|
|
4443
|
-
}
|
|
4415
|
+
async function runAgentTask(userRequest, taskId, auditConfig, _options) {
|
|
4444
4416
|
const RUNTIME_PKG = ["agent-contracts", "runtime"].join("-");
|
|
4445
4417
|
let runTask;
|
|
4446
4418
|
let agentRegistry2, taskRegistry2, handoffSchemas2;
|
|
@@ -4450,7 +4422,7 @@ async function runAgentTask(userRequest, taskId, auditConfig, options) {
|
|
|
4450
4422
|
} catch {
|
|
4451
4423
|
throw Object.assign(
|
|
4452
4424
|
new Error(
|
|
4453
|
-
"agent-contracts-runtime is not installed. Install it to use this command, or use --
|
|
4425
|
+
"agent-contracts-runtime is not installed. Install it to use this command, or use --show-prompt to inspect the prompt.\n npm install agent-contracts-runtime"
|
|
4454
4426
|
),
|
|
4455
4427
|
{ exitCode: EXIT_RUNTIME_MISSING }
|
|
4456
4428
|
);
|
|
@@ -4487,7 +4459,6 @@ async function runAgentTask(userRequest, taskId, auditConfig, options) {
|
|
|
4487
4459
|
data: outcome.status === "success" ? outcome.data : null,
|
|
4488
4460
|
raw: outcome.raw ?? "",
|
|
4489
4461
|
prompt: userRequest,
|
|
4490
|
-
dryRun: false,
|
|
4491
4462
|
status: outcome.status,
|
|
4492
4463
|
errorMessage: outcome.status === "error" ? outcome.message : outcome.status === "escalation" ? outcome.reason : outcome.status === "validation_error" ? outcome.errors?.message : void 0,
|
|
4493
4464
|
followUpsUsed: result.follow_ups_used,
|
|
@@ -4495,7 +4466,6 @@ async function runAgentTask(userRequest, taskId, auditConfig, options) {
|
|
|
4495
4466
|
};
|
|
4496
4467
|
}
|
|
4497
4468
|
function computeExitCode(result, options) {
|
|
4498
|
-
if (result.dryRun) return 0;
|
|
4499
4469
|
if (result.status !== "success" || !result.data) return 1;
|
|
4500
4470
|
const failOn = options.failOn ?? "error";
|
|
4501
4471
|
const severityOrder = ["info", "warning", "error", "critical"];
|
|
@@ -4506,9 +4476,6 @@ function computeExitCode(result, options) {
|
|
|
4506
4476
|
return hasBlocking ? 10 : 0;
|
|
4507
4477
|
}
|
|
4508
4478
|
function formatResultText(result) {
|
|
4509
|
-
if (result.dryRun) {
|
|
4510
|
-
return result.prompt;
|
|
4511
|
-
}
|
|
4512
4479
|
if (result.status !== "success" || !result.data) {
|
|
4513
4480
|
return result.errorMessage ?? `Task failed with status: ${result.status}`;
|
|
4514
4481
|
}
|
|
@@ -4544,20 +4511,12 @@ function formatResultText(result) {
|
|
|
4544
4511
|
return lines.join("\n");
|
|
4545
4512
|
}
|
|
4546
4513
|
function formatResultJson(result) {
|
|
4547
|
-
if (result.dryRun) {
|
|
4548
|
-
return JSON.stringify({ dryRun: true, prompt: result.prompt }, null, 2);
|
|
4549
|
-
}
|
|
4550
4514
|
if (!result.data) {
|
|
4551
4515
|
return JSON.stringify({ error: result.errorMessage, status: result.status }, null, 2);
|
|
4552
4516
|
}
|
|
4553
4517
|
return JSON.stringify(result.data, null, 2);
|
|
4554
4518
|
}
|
|
4555
4519
|
function formatResultYaml(result) {
|
|
4556
|
-
if (result.dryRun) {
|
|
4557
|
-
return `dryRun: true
|
|
4558
|
-
prompt: |
|
|
4559
|
-
${indent(result.prompt)}`;
|
|
4560
|
-
}
|
|
4561
4520
|
if (!result.data) {
|
|
4562
4521
|
return `error: ${JSON.stringify(result.errorMessage)}
|
|
4563
4522
|
status: ${result.status}`;
|
|
@@ -4638,12 +4597,14 @@ ${val}`;
|
|
|
4638
4597
|
// src/cli/audit-requirements.ts
|
|
4639
4598
|
async function commandAuditRequirements(opts) {
|
|
4640
4599
|
const context = await buildAuditRequirementsContext(opts.config);
|
|
4600
|
+
if (opts.showPrompt) {
|
|
4601
|
+
return context;
|
|
4602
|
+
}
|
|
4641
4603
|
const auditConfig = {
|
|
4642
4604
|
adapter: opts.adapter,
|
|
4643
4605
|
model: opts.model
|
|
4644
4606
|
};
|
|
4645
4607
|
const auditOpts = {
|
|
4646
|
-
dryRun: opts.dryRun,
|
|
4647
4608
|
failOn: opts.failOn
|
|
4648
4609
|
};
|
|
4649
4610
|
try {
|
|
@@ -4672,12 +4633,14 @@ async function commandAuditRequirements(opts) {
|
|
|
4672
4633
|
}
|
|
4673
4634
|
async function commandProposeTraceLinks(opts) {
|
|
4674
4635
|
const context = await buildProposeTraceLinksContext(opts.config);
|
|
4636
|
+
if (opts.showPrompt) {
|
|
4637
|
+
return context;
|
|
4638
|
+
}
|
|
4675
4639
|
const auditConfig = {
|
|
4676
4640
|
adapter: opts.adapter,
|
|
4677
4641
|
model: opts.model
|
|
4678
4642
|
};
|
|
4679
4643
|
const auditOpts = {
|
|
4680
|
-
dryRun: opts.dryRun,
|
|
4681
4644
|
failOn: opts.failOn
|
|
4682
4645
|
};
|
|
4683
4646
|
try {
|
|
@@ -4712,12 +4675,14 @@ async function commandExplainImpact(opts) {
|
|
|
4712
4675
|
process.exit(2);
|
|
4713
4676
|
}
|
|
4714
4677
|
const context = buildExplainImpactContext(stdin);
|
|
4678
|
+
if (opts.showPrompt) {
|
|
4679
|
+
return context;
|
|
4680
|
+
}
|
|
4715
4681
|
const auditConfig = {
|
|
4716
4682
|
adapter: opts.adapter,
|
|
4717
4683
|
model: opts.model
|
|
4718
4684
|
};
|
|
4719
4685
|
const auditOpts = {
|
|
4720
|
-
dryRun: opts.dryRun,
|
|
4721
4686
|
failOn: opts.failOn
|
|
4722
4687
|
};
|
|
4723
4688
|
try {
|
|
@@ -4758,12 +4723,14 @@ function readStdin() {
|
|
|
4758
4723
|
async function commandProposeAcceptanceCriteria(specIds, opts) {
|
|
4759
4724
|
const targetSpecIds = specIds.length > 0 ? specIds : void 0;
|
|
4760
4725
|
const context = await buildProposeAcceptanceCriteriaContext(opts.config, targetSpecIds);
|
|
4726
|
+
if (opts.showPrompt) {
|
|
4727
|
+
return context;
|
|
4728
|
+
}
|
|
4761
4729
|
const auditConfig = {
|
|
4762
4730
|
adapter: opts.adapter,
|
|
4763
4731
|
model: opts.model
|
|
4764
4732
|
};
|
|
4765
4733
|
const auditOpts = {
|
|
4766
|
-
dryRun: opts.dryRun,
|
|
4767
4734
|
failOn: opts.failOn
|
|
4768
4735
|
};
|
|
4769
4736
|
try {
|
|
@@ -4829,49 +4796,41 @@ var handlers = {
|
|
|
4829
4796
|
convert: async (file, opts) => {
|
|
4830
4797
|
await runConvert(file, opts);
|
|
4831
4798
|
},
|
|
4832
|
-
auditRequirements:
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
adapter: opts.adapter,
|
|
4868
|
-
model: opts.model,
|
|
4869
|
-
dryRun: opts.dryRun,
|
|
4870
|
-
failOn: opts.failOn,
|
|
4871
|
-
output: opts.output,
|
|
4872
|
-
reportFormat: opts.reportFormat
|
|
4873
|
-
});
|
|
4874
|
-
}
|
|
4799
|
+
auditRequirements: (opts) => commandAuditRequirements({
|
|
4800
|
+
config: opts.config,
|
|
4801
|
+
adapter: opts.adapter,
|
|
4802
|
+
model: opts.model,
|
|
4803
|
+
showPrompt: opts.showPrompt,
|
|
4804
|
+
failOn: opts.failOn,
|
|
4805
|
+
output: opts.output,
|
|
4806
|
+
reportFormat: opts.reportFormat
|
|
4807
|
+
}),
|
|
4808
|
+
proposeTraceLinks: (opts) => commandProposeTraceLinks({
|
|
4809
|
+
config: opts.config,
|
|
4810
|
+
adapter: opts.adapter,
|
|
4811
|
+
model: opts.model,
|
|
4812
|
+
showPrompt: opts.showPrompt,
|
|
4813
|
+
failOn: opts.failOn,
|
|
4814
|
+
output: opts.output,
|
|
4815
|
+
reportFormat: opts.reportFormat
|
|
4816
|
+
}),
|
|
4817
|
+
explainImpact: (opts) => commandExplainImpact({
|
|
4818
|
+
adapter: opts.adapter,
|
|
4819
|
+
model: opts.model,
|
|
4820
|
+
showPrompt: opts.showPrompt,
|
|
4821
|
+
failOn: opts.failOn,
|
|
4822
|
+
output: opts.output,
|
|
4823
|
+
reportFormat: opts.reportFormat
|
|
4824
|
+
}),
|
|
4825
|
+
proposeAcceptanceCriteria: (specIds, opts) => commandProposeAcceptanceCriteria(specIds, {
|
|
4826
|
+
config: opts.config,
|
|
4827
|
+
adapter: opts.adapter,
|
|
4828
|
+
model: opts.model,
|
|
4829
|
+
showPrompt: opts.showPrompt,
|
|
4830
|
+
failOn: opts.failOn,
|
|
4831
|
+
output: opts.output,
|
|
4832
|
+
reportFormat: opts.reportFormat
|
|
4833
|
+
})
|
|
4875
4834
|
};
|
|
4876
4835
|
createProgram(handlers, getVersion()).parse();
|
|
4877
4836
|
//# sourceMappingURL=cli.js.map
|