@peterxiaoyang/superspec 0.1.37 → 0.1.39
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.js +45 -6
- package/dist/code_review.d.ts +18 -2
- package/dist/code_review.js +473 -81
- package/dist/format.d.ts +46 -4
- package/dist/format.js +311 -26
- package/dist/git_state.d.ts +36 -0
- package/dist/git_state.js +174 -0
- package/dist/job_validity.d.ts +16 -0
- package/dist/job_validity.js +37 -0
- package/dist/next.js +45 -355
- package/dist/phase_plan.d.ts +97 -0
- package/dist/phase_plan.js +582 -0
- package/dist/record.d.ts +2 -2
- package/dist/record.js +67 -31
- package/dist/review.d.ts +3 -2
- package/dist/review.js +66 -33
- package/dist/review_job_gates.d.ts +20 -0
- package/dist/review_job_gates.js +85 -0
- package/dist/store.d.ts +10 -0
- package/dist/store.js +53 -3
- package/dist/sync.js +7 -9
- package/dist/task.js +87 -9
- package/dist/task_evidence.d.ts +10 -0
- package/dist/task_evidence.js +126 -0
- package/dist/transition.d.ts +1 -1
- package/dist/transition.js +449 -337
- package/dist/types.d.ts +81 -1
- package/dist/workflow_profile.d.ts +11 -0
- package/dist/workflow_profile.js +39 -0
- package/package.json +1 -1
- package/templates/workflow/prompts/architect.md +17 -27
- package/templates/workflow/prompts/code-reviewer.md +13 -2
- package/templates/workflow/prompts/critic.md +62 -61
- package/templates/workflow/prompts/executor.md +1 -1
- package/templates/workflow/prompts/explore.md +38 -26
- package/templates/workflow/prompts/test-engineer.md +18 -32
- package/templates/workflow/prompts/verifier.md +5 -3
- package/templates/workflow/skills/superspec-apply/SKILL.md +34 -11
- package/templates/workflow/skills/superspec-explore/SKILL.md +65 -64
- package/templates/workflow/skills/superspec-propose/SKILL.md +64 -43
- package/templates/workflow/skills/superspec-review/SKILL.md +1 -1
package/dist/cli.js
CHANGED
|
@@ -66,6 +66,20 @@ function proposeReadyExitCode(result) {
|
|
|
66
66
|
return 0;
|
|
67
67
|
return result.events_written === 0 && result.message.includes("不能") ? 1 : 0;
|
|
68
68
|
}
|
|
69
|
+
function parseReviewRisk(value) {
|
|
70
|
+
if (value == null)
|
|
71
|
+
return "strict";
|
|
72
|
+
if (value === "minimal" || value === "normal" || value === "strict")
|
|
73
|
+
return value;
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
function readReviewRisk(opts) {
|
|
77
|
+
const risk = parseReviewRisk(opts.risk);
|
|
78
|
+
if (!risk) {
|
|
79
|
+
console.error("--risk 只能是 minimal、normal 或 strict");
|
|
80
|
+
}
|
|
81
|
+
return risk;
|
|
82
|
+
}
|
|
69
83
|
function parseVersion(version) {
|
|
70
84
|
const match = version.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/);
|
|
71
85
|
if (!match)
|
|
@@ -500,7 +514,7 @@ async function main(argv) {
|
|
|
500
514
|
|
|
501
515
|
transition 子命令:
|
|
502
516
|
init / explore / sync / next / propose-ready / start-apply
|
|
503
|
-
task-start --task <T> / task-complete --task <T>
|
|
517
|
+
task-start --task <T> / task-complete --task <T> [--input -]
|
|
504
518
|
reopen --to apply --reason <TEXT> [--review-fix <JOB#FINDING>]
|
|
505
519
|
reopen --to propose --reason <TEXT> --review-finding <JOB#FINDING>
|
|
506
520
|
review-ready / accept / archive
|
|
@@ -631,7 +645,9 @@ jobs 子命令:
|
|
|
631
645
|
return 0;
|
|
632
646
|
case "explore":
|
|
633
647
|
{
|
|
634
|
-
const risk = opts
|
|
648
|
+
const risk = readReviewRisk(opts);
|
|
649
|
+
if (!risk)
|
|
650
|
+
return 1;
|
|
635
651
|
console.log(JSON.stringify(transitionExplore(projectRoot, change, cr, risk), null, 2));
|
|
636
652
|
}
|
|
637
653
|
return 0;
|
|
@@ -647,13 +663,17 @@ jobs 子命令:
|
|
|
647
663
|
return 0;
|
|
648
664
|
}
|
|
649
665
|
case "next": {
|
|
650
|
-
const risk = opts
|
|
666
|
+
const risk = readReviewRisk(opts);
|
|
667
|
+
if (!risk)
|
|
668
|
+
return 1;
|
|
651
669
|
const result = nextCmd(projectRoot, change, cr, risk);
|
|
652
670
|
console.log(JSON.stringify(result, null, 2));
|
|
653
671
|
return 0;
|
|
654
672
|
}
|
|
655
673
|
case "propose-ready": {
|
|
656
|
-
const risk = opts
|
|
674
|
+
const risk = readReviewRisk(opts);
|
|
675
|
+
if (!risk)
|
|
676
|
+
return 1;
|
|
657
677
|
const result = proposeReady(projectRoot, change, cr, risk);
|
|
658
678
|
console.log(JSON.stringify(result, null, 2));
|
|
659
679
|
return proposeReadyExitCode(result);
|
|
@@ -679,7 +699,24 @@ jobs 子命令:
|
|
|
679
699
|
console.error("task-complete 需要 --task");
|
|
680
700
|
return 1;
|
|
681
701
|
}
|
|
682
|
-
|
|
702
|
+
let inputContent = null;
|
|
703
|
+
if (opts.input) {
|
|
704
|
+
if (opts.input !== "-") {
|
|
705
|
+
console.error("task-complete 只接受 --input -");
|
|
706
|
+
return 1;
|
|
707
|
+
}
|
|
708
|
+
try {
|
|
709
|
+
inputContent = readStdinRecordContent("--input");
|
|
710
|
+
}
|
|
711
|
+
catch (err) {
|
|
712
|
+
if (err instanceof StdinRecordInputError) {
|
|
713
|
+
console.error(err.message);
|
|
714
|
+
return 1;
|
|
715
|
+
}
|
|
716
|
+
throw err;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
const result = taskComplete(projectRoot, change, cr, taskId, inputContent);
|
|
683
720
|
console.log(JSON.stringify(result, null, 2));
|
|
684
721
|
return transitionExitCode(result);
|
|
685
722
|
}
|
|
@@ -702,7 +739,9 @@ jobs 子命令:
|
|
|
702
739
|
return transitionExitCode(result);
|
|
703
740
|
}
|
|
704
741
|
case "review-ready": {
|
|
705
|
-
const risk = opts
|
|
742
|
+
const risk = readReviewRisk(opts);
|
|
743
|
+
if (!risk)
|
|
744
|
+
return 1;
|
|
706
745
|
const result = reviewReady(projectRoot, change, cr, risk);
|
|
707
746
|
console.log(JSON.stringify(result, null, 2));
|
|
708
747
|
return transitionExitCode(result);
|
package/dist/code_review.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { CodeReviewResultKind, Event, Job, Ref } from "./types.ts";
|
|
1
|
+
import type { CodeReviewResultKind, CodeReviewScope, CodeStateCheck, CoverageExemptionRef, Event, Job, JobPacketContext, Ref } from "./types.ts";
|
|
2
2
|
export declare const CODE_REVIEW_REPAIR_SCOPE_PREFIX = "code_reviewer_report_repair:";
|
|
3
3
|
export declare const CODE_REVIEW_DECISION_SCOPE_PREFIX = "code_review_decision:";
|
|
4
|
+
export declare const TEST_COVERAGE_EXEMPTION_SCOPE_PREFIX = "test_coverage_exemption:";
|
|
4
5
|
export type CodeReviewDecisionAnswer = "reopen_propose" | "reopen_apply" | "dismiss";
|
|
5
6
|
export declare const CODE_REVIEW_DECISION_ANSWER_LABELS: Record<CodeReviewDecisionAnswer, string>;
|
|
6
7
|
export interface CodeChangeScan {
|
|
@@ -8,6 +9,7 @@ export interface CodeChangeScan {
|
|
|
8
9
|
hasCodeChanges: boolean;
|
|
9
10
|
paths: string[];
|
|
10
11
|
reason: string;
|
|
12
|
+
scope?: CodeReviewScope;
|
|
11
13
|
}
|
|
12
14
|
export interface CodeReviewTerminalResult {
|
|
13
15
|
job: Job;
|
|
@@ -42,21 +44,34 @@ export interface CodeReviewGateFacts {
|
|
|
42
44
|
latestRejected: CodeReviewTerminalResult | null;
|
|
43
45
|
consecutiveRejected: number;
|
|
44
46
|
}
|
|
45
|
-
export declare function isCodeLikePath(path: string): boolean;
|
|
46
47
|
export declare function scanCodeChanges(projectRoot: string): CodeChangeScan;
|
|
48
|
+
export declare function currentCodeReviewWorkingPaths(projectRoot: string, events: Event[], extraIgnoredPaths?: string[]): string[];
|
|
49
|
+
export declare function knownCodeReviewReportPaths(projectRoot: string, events: Event[]): Set<string>;
|
|
50
|
+
export declare function selectCodeReviewBase(events: Event[]): {
|
|
51
|
+
base_head: string | null;
|
|
52
|
+
kind: "reviewed" | "start_apply" | "empty_tree" | "history_missing";
|
|
53
|
+
reason: string;
|
|
54
|
+
};
|
|
55
|
+
export declare function scanCodeReviewScope(projectRoot: string, events: Event[]): CodeReviewScope;
|
|
56
|
+
export declare function scanCodeChangesForReview(projectRoot: string, events: Event[]): CodeChangeScan;
|
|
47
57
|
export declare function codeReviewBoundFiles(projectRoot: string, paths: string[]): Ref[];
|
|
48
58
|
export declare function codeReviewJobStaleReason(projectRoot: string, job: Job, currentPaths?: string[]): string | null;
|
|
49
59
|
export declare function codeReviewPacketDigest(input: {
|
|
50
60
|
role: "code-reviewer";
|
|
61
|
+
gate_id?: "review.code_review";
|
|
51
62
|
boundFiles: Ref[];
|
|
52
63
|
checkedDocs: string[];
|
|
53
64
|
created_from_transition: string;
|
|
65
|
+
packet_context?: JobPacketContext;
|
|
54
66
|
previous_rejection?: {
|
|
55
67
|
result_kind: CodeReviewResultKind;
|
|
56
68
|
reason: string;
|
|
57
69
|
job_id: string;
|
|
58
70
|
};
|
|
59
71
|
}): string;
|
|
72
|
+
export declare function codeReviewPacketContext(changeRoot: string, projectRoot: string, scope: CodeReviewScope, events: Event[]): JobPacketContext;
|
|
73
|
+
export declare function effectiveCoverageExemptionRefsFromEvents(events: Event[]): CoverageExemptionRef[];
|
|
74
|
+
export declare function missingCoverageExemptionTestIds(changeRoot: string, events: Event[]): string[];
|
|
60
75
|
export declare function codeReviewDecisionScope(jobId: string, findingId: string): string;
|
|
61
76
|
export declare function isCodeReviewDecisionAnswer(value: unknown): value is CodeReviewDecisionAnswer;
|
|
62
77
|
export declare function codeReviewDecisionAnswerLabel(answer: CodeReviewDecisionAnswer): string;
|
|
@@ -72,3 +87,4 @@ export declare function latestApplyDoneToReviewGate(events: Event[]): {
|
|
|
72
87
|
reason?: string;
|
|
73
88
|
} | null;
|
|
74
89
|
export declare function requiresFinalVerifierForCurrentReview(events: Event[]): boolean;
|
|
90
|
+
export declare function computeCodeStateCheck(projectRoot: string, events: Event[], ignoredCodePaths?: string[]): CodeStateCheck;
|