@captain_z/zsk 1.8.3 → 1.8.5

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.
Files changed (143) hide show
  1. package/dist/bin.js +13 -0
  2. package/dist/bin.js.map +1 -1
  3. package/dist/commands/add-flow.d.ts +3 -7
  4. package/dist/commands/add-flow.js +7 -59
  5. package/dist/commands/add-flow.js.map +1 -1
  6. package/dist/commands/add.js +25 -104
  7. package/dist/commands/add.js.map +1 -1
  8. package/dist/commands/check.js +14 -575
  9. package/dist/commands/check.js.map +1 -1
  10. package/dist/commands/config.js +1 -1
  11. package/dist/commands/config.js.map +1 -1
  12. package/dist/commands/demo.d.ts +5 -0
  13. package/dist/commands/demo.js +70 -297
  14. package/dist/commands/demo.js.map +1 -1
  15. package/dist/commands/doctor.js +9 -4
  16. package/dist/commands/doctor.js.map +1 -1
  17. package/dist/commands/gate.d.ts +1 -0
  18. package/dist/commands/gate.js +8 -2
  19. package/dist/commands/gate.js.map +1 -1
  20. package/dist/commands/prepare.js +7 -1
  21. package/dist/commands/prepare.js.map +1 -1
  22. package/dist/commands/project-init.js +30 -8
  23. package/dist/commands/project-init.js.map +1 -1
  24. package/dist/core/config.d.ts +68 -0
  25. package/dist/core/config.js +198 -15
  26. package/dist/core/config.js.map +1 -1
  27. package/dist/core/demo-auth.d.ts +30 -0
  28. package/dist/core/demo-auth.js +213 -0
  29. package/dist/core/demo-auth.js.map +1 -0
  30. package/dist/core/demo-scenarios.d.ts +62 -0
  31. package/dist/core/demo-scenarios.js +276 -0
  32. package/dist/core/demo-scenarios.js.map +1 -0
  33. package/dist/core/demo-sources.d.ts +37 -0
  34. package/dist/core/demo-sources.js +198 -0
  35. package/dist/core/demo-sources.js.map +1 -0
  36. package/dist/core/mcp-registry-discovery.d.ts +16 -0
  37. package/dist/core/mcp-registry-discovery.js +187 -0
  38. package/dist/core/mcp-registry-discovery.js.map +1 -0
  39. package/dist/core/origin-detection.js +1 -1
  40. package/dist/core/origin-detection.js.map +1 -1
  41. package/dist/core/prepare-artifacts.d.ts +16 -0
  42. package/dist/core/prepare-artifacts.js +25 -0
  43. package/dist/core/prepare-artifacts.js.map +1 -0
  44. package/dist/core/prepare-auth-helper.d.ts +8 -0
  45. package/dist/core/prepare-auth-helper.js +32 -0
  46. package/dist/core/prepare-auth-helper.js.map +1 -0
  47. package/dist/core/prepare-materialization.d.ts +8 -0
  48. package/dist/core/prepare-materialization.js +26 -0
  49. package/dist/core/prepare-materialization.js.map +1 -0
  50. package/dist/core/prepare-migration.d.ts +6 -0
  51. package/dist/core/prepare-migration.js +57 -0
  52. package/dist/core/prepare-migration.js.map +1 -0
  53. package/dist/core/prepare-reporting.d.ts +5 -0
  54. package/dist/core/prepare-reporting.js +106 -0
  55. package/dist/core/prepare-reporting.js.map +1 -0
  56. package/dist/core/prepare-routing.d.ts +12 -0
  57. package/dist/core/prepare-routing.js +182 -0
  58. package/dist/core/prepare-routing.js.map +1 -0
  59. package/dist/core/prepare-sync.d.ts +13 -53
  60. package/dist/core/prepare-sync.js +878 -359
  61. package/dist/core/prepare-sync.js.map +1 -1
  62. package/dist/core/prepare-utils.d.ts +6 -0
  63. package/dist/core/prepare-utils.js +35 -0
  64. package/dist/core/prepare-utils.js.map +1 -0
  65. package/dist/core/profile-bundle-installation.d.ts +55 -0
  66. package/dist/core/profile-bundle-installation.js +170 -0
  67. package/dist/core/profile-bundle-installation.js.map +1 -0
  68. package/dist/core/provider-policy.d.ts +26 -0
  69. package/dist/core/provider-policy.js +180 -0
  70. package/dist/core/provider-policy.js.map +1 -0
  71. package/dist/core/provider-readiness.d.ts +39 -0
  72. package/dist/core/provider-readiness.js +78 -0
  73. package/dist/core/provider-readiness.js.map +1 -0
  74. package/dist/core/source-adapter-normalization.d.ts +31 -0
  75. package/dist/core/source-adapter-normalization.js +235 -0
  76. package/dist/core/source-adapter-normalization.js.map +1 -0
  77. package/dist/core/source-snapshot-adapters.d.ts +59 -0
  78. package/dist/core/source-snapshot-adapters.js +60 -0
  79. package/dist/core/source-snapshot-adapters.js.map +1 -0
  80. package/dist/core/staffing-plan.d.ts +1 -0
  81. package/dist/core/staffing-plan.js +113 -21
  82. package/dist/core/staffing-plan.js.map +1 -1
  83. package/dist/core/stage-clarity-verification.d.ts +31 -0
  84. package/dist/core/stage-clarity-verification.js +316 -0
  85. package/dist/core/stage-clarity-verification.js.map +1 -0
  86. package/dist/core/stage-output-quality.d.ts +3 -0
  87. package/dist/core/stage-output-quality.js +122 -0
  88. package/dist/core/stage-output-quality.js.map +1 -0
  89. package/dist/core/stage-quality-artifacts.d.ts +15 -0
  90. package/dist/core/stage-quality-artifacts.js +421 -0
  91. package/dist/core/stage-quality-artifacts.js.map +1 -0
  92. package/dist/core/stage-quality-contracts.d.ts +105 -0
  93. package/dist/core/stage-quality-contracts.js +2 -0
  94. package/dist/core/stage-quality-contracts.js.map +1 -0
  95. package/dist/core/stage-quality-criteria.d.ts +9 -0
  96. package/dist/core/stage-quality-criteria.js +286 -0
  97. package/dist/core/stage-quality-criteria.js.map +1 -0
  98. package/dist/core/stage-quality-rendering.d.ts +15 -0
  99. package/dist/core/stage-quality-rendering.js +240 -0
  100. package/dist/core/stage-quality-rendering.js.map +1 -0
  101. package/dist/core/stage-quality.d.ts +4 -59
  102. package/dist/core/stage-quality.js +54 -795
  103. package/dist/core/stage-quality.js.map +1 -1
  104. package/dist/core/template-registry.js +12 -15
  105. package/dist/core/template-registry.js.map +1 -1
  106. package/dist/core/workspace-conformance.d.ts +39 -0
  107. package/dist/core/workspace-conformance.js +603 -0
  108. package/dist/core/workspace-conformance.js.map +1 -0
  109. package/package.json +2 -2
  110. package/schemas/providers.schema.json +74 -0
  111. package/schemas/zsk-config.schema.json +417 -1
  112. package/templates/module/frontend-module/design.md +10 -0
  113. package/templates/module/frontend-module/proposal.md +8 -0
  114. package/templates/module/frontend-module/spec.md +7 -0
  115. package/templates/project-init/.zsk/README.md +48 -0
  116. package/templates/project-init/.zsk/config.yaml +37 -0
  117. package/templates/project-init/.zsk/docs/CONFIG-SCHEMA.md +127 -0
  118. package/templates/project-init/.zsk/docs/PROJECT-CONFIG.md +53 -5
  119. package/templates/project-init/.zsk/docs/README.md +10 -0
  120. package/templates/project-init/.zsk/docs/SECURITY.md +34 -0
  121. package/templates/project-init/.zsk/docs/SYSTEM-SPEC.md +39 -7
  122. package/templates/project-init/.zsk/evidence/README.md +15 -0
  123. package/templates/project-init/.zsk/issues/README.md +10 -0
  124. package/templates/project-init/.zsk/modules/README.md +19 -0
  125. package/templates/project-init/.zsk/modules/index.md +9 -5
  126. package/templates/project-init/.zsk/raws/README.md +34 -0
  127. package/templates/project-init/.zsk/roles.yaml +36 -105
  128. package/templates/project-init/.zsk/templates/config.examples.yaml +83 -0
  129. package/templates/project-init/.zsk/templates/issue-card.md +23 -0
  130. package/templates/project-init/.zsk/templates/module/README.md +13 -0
  131. package/templates/project-init/.zsk/templates/module/design.md +22 -0
  132. package/templates/project-init/.zsk/templates/module/module.yaml +15 -0
  133. package/templates/project-init/.zsk/templates/module/proposal.md +20 -0
  134. package/templates/project-init/.zsk/templates/module/spec.md +22 -0
  135. package/templates/project-init/.zsk/templates/module/tasks.md +16 -0
  136. package/templates/project-init/.zsk/raws/index.md +0 -18
  137. package/templates/project-init/.zsk/raws/manifest.json +0 -4
  138. package/templates/project-init/.zsk/raws/prepare/backend/index.md +0 -4
  139. package/templates/project-init/.zsk/raws/prepare/design/index.md +0 -3
  140. package/templates/project-init/.zsk/raws/prepare/index.md +0 -4
  141. package/templates/project-init/.zsk/raws/prepare/product/index.md +0 -4
  142. package/templates/project-init/.zsk/raws/prepare/qa/index.md +0 -4
  143. package/templates/project-init/.zsk/raws/prepare/ux/index.md +0 -3
@@ -0,0 +1,105 @@
1
+ export type GateAssessmentOptions = {
2
+ stage: string;
3
+ module?: string;
4
+ issue?: string;
5
+ reviewTarget?: string;
6
+ threshold?: number;
7
+ acceptRisk?: string;
8
+ verbose?: boolean;
9
+ };
10
+ export type GateStatus = "READY" | "NEEDS_CONFIRMATION" | "BLOCKED" | "WAIVED";
11
+ export type OutputQualityStatus = "PASS" | "NEEDS_CLARIFICATION" | "NEEDS_REPAIR" | "BLOCKED" | "WAIVED";
12
+ export type OutputQualityCheck = {
13
+ artifactKey: string;
14
+ path: string;
15
+ present: boolean;
16
+ valid: boolean;
17
+ status?: OutputQualityStatus;
18
+ owner?: string;
19
+ sourceBasis: string[];
20
+ blockingItems: string[];
21
+ nextAction?: string;
22
+ waiver?: string[];
23
+ updatedAt?: string;
24
+ gap?: string;
25
+ };
26
+ export type GateCriterion = {
27
+ id: string;
28
+ label: string;
29
+ weight: number;
30
+ passed: boolean;
31
+ required: boolean;
32
+ evidence: string[];
33
+ gap?: string;
34
+ };
35
+ export type GateArtifact = {
36
+ key: string;
37
+ path: string;
38
+ exists: boolean;
39
+ bytes: number;
40
+ children?: GateArtifactChild[];
41
+ };
42
+ export type GateArtifactChild = {
43
+ path: string;
44
+ status: "included" | "unreadable";
45
+ bytes: number;
46
+ };
47
+ export type GateAssessment = {
48
+ version: 1;
49
+ runId: string;
50
+ stage: string;
51
+ module?: string;
52
+ reviewTarget?: string;
53
+ reviewMode?: ReviewGateMode;
54
+ threshold: number;
55
+ score: number;
56
+ status: GateStatus;
57
+ decision: "proceed" | "human-confirmation-required" | "blocked";
58
+ artifacts: GateArtifact[];
59
+ criteria: GateCriterion[];
60
+ outputQualityChecks: OutputQualityCheck[];
61
+ blockers: string[];
62
+ gaps: string[];
63
+ waiver?: {
64
+ reason: string;
65
+ appliedAt: string;
66
+ };
67
+ nextAction: string;
68
+ };
69
+ export type GateAssessmentBundle = {
70
+ assessment: GateAssessment;
71
+ artifacts: {
72
+ dir: string;
73
+ jsonPath: string;
74
+ markdownPath: string;
75
+ detailJsonPath?: string;
76
+ detailMarkdownPath?: string;
77
+ waiverPath?: string;
78
+ };
79
+ markdown: string;
80
+ waiverMarkdown?: string;
81
+ };
82
+ export type StageQualityArtifactSpec = {
83
+ key: string;
84
+ moduleStage?: string;
85
+ path?: (config: import("./config.js").ProjectConfig, moduleId?: string) => string;
86
+ };
87
+ export type StageQualityCriterionSpec = {
88
+ id: string;
89
+ label: string;
90
+ weight: number;
91
+ required?: boolean;
92
+ artifactKeys?: string[];
93
+ test: (ctx: StageQualityCriterionContext) => boolean;
94
+ evidence: (ctx: StageQualityCriterionContext) => string[];
95
+ gap: string;
96
+ };
97
+ export type StageQualityCriterionContext = {
98
+ stage: string;
99
+ reviewTarget?: string;
100
+ reviewMode?: ReviewGateMode;
101
+ artifacts: GateArtifact[];
102
+ contentByKey: Map<string, string>;
103
+ };
104
+ export type ReviewGateMode = "implementation" | "preproposal" | "raw-source" | "zsk-workspace" | "stage-doc" | "design-source" | "code-target" | "target-path";
105
+ export declare const DEFAULT_STAGE_QUALITY_THRESHOLD = 9;
@@ -0,0 +1,2 @@
1
+ export const DEFAULT_STAGE_QUALITY_THRESHOLD = 9;
2
+ //# sourceMappingURL=stage-quality-contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage-quality-contracts.js","sourceRoot":"","sources":["../../src/core/stage-quality-contracts.ts"],"names":[],"mappings":"AAqHA,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { GateArtifact, GateCriterion, StageQualityCriterionContext } from "./stage-quality-contracts.js";
2
+ export declare function evaluateStageQualityCriteria(input: {
3
+ stage: string;
4
+ reviewTarget: string | undefined;
5
+ reviewMode: StageQualityCriterionContext["reviewMode"];
6
+ artifacts: GateArtifact[];
7
+ contentByKey: Map<string, string>;
8
+ knownStages: string[];
9
+ }): GateCriterion[];
@@ -0,0 +1,286 @@
1
+ const COMMON_CRITERIA = [
2
+ {
3
+ id: "GATE-INPUT-01",
4
+ label: "Required upstream artifacts exist and are non-empty.",
5
+ weight: 2,
6
+ required: true,
7
+ test: (ctx) => ctx.artifacts.every((artifact) => artifact.exists && artifact.bytes > 0),
8
+ evidence: (ctx) => ctx.artifacts.map((artifact) => `${artifact.key}: ${artifact.exists ? `${artifact.bytes} bytes` : "missing"} (${artifact.path})`),
9
+ gap: "One or more required upstream artifacts are missing or empty.",
10
+ },
11
+ {
12
+ id: "GATE-RULES-01",
13
+ label: "PROJECT-CONFIG.md and SYSTEM-SPEC.md constraints are available or explicitly not required for this stage.",
14
+ weight: 1,
15
+ required: true,
16
+ test: (ctx) => {
17
+ if (["preproposal", "coding", "fix", "smoke", "review", "ready", "verify", "acceptance", "archive"].includes(ctx.stage))
18
+ return true;
19
+ return hasContent(ctx, "project-config") && hasContent(ctx, "system-spec");
20
+ },
21
+ evidence: (ctx) => ["project-config", "system-spec"].map((key) => `${key}: ${hasContent(ctx, key) ? "present" : "missing"}`),
22
+ gap: "Project/system rules are not available for a stage that must obey them before handoff.",
23
+ },
24
+ {
25
+ id: "GATE-TEMPLATE-01",
26
+ label: "Upstream content is not placeholder-only or template filler.",
27
+ weight: 1,
28
+ required: true,
29
+ test: (ctx) => allPrimaryContent(ctx, (content) => {
30
+ const text = content.toLowerCase();
31
+ const placeholders = ["<fill-me>", "<project", "<module", "todo:", "tbd", "lorem ipsum"];
32
+ return !placeholders.some((placeholder) => text.includes(placeholder));
33
+ }),
34
+ evidence: (ctx) => primaryArtifacts(ctx).map((artifact) => `${artifact.key}: ${artifact.bytes} bytes`),
35
+ gap: "At least one upstream artifact still looks like a placeholder or template filler.",
36
+ },
37
+ {
38
+ id: "GATE-CONTENT-01",
39
+ label: "Upstream content has enough detail for reliable handoff.",
40
+ weight: 1,
41
+ test: (ctx) => {
42
+ const artifacts = primaryArtifacts(ctx);
43
+ if (artifacts.length === 0)
44
+ return true;
45
+ return artifacts.every((artifact) => wordCount(ctx.contentByKey.get(artifact.key) ?? "") >= 40);
46
+ },
47
+ evidence: (ctx) => primaryArtifacts(ctx).map((artifact) => `${artifact.key}: ${wordCount(ctx.contentByKey.get(artifact.key) ?? "")} words`),
48
+ gap: "At least one upstream artifact is very short; treat this as a quality gap unless the project explicitly accepts the risk.",
49
+ },
50
+ {
51
+ id: "GATE-TRACE-01",
52
+ label: "Claims trace to source, requirement, acceptance, design, task, issue, or evidence identifiers.",
53
+ weight: 1,
54
+ test: (ctx) => combinedContent(ctx).match(/\b(FR|NFR|AC|SPEC|DES|TASK|ISSUE|EVIDENCE|ADR|REQ)-?\d+\b/i) !== null ||
55
+ (ctx.stage === "preproposal" && ctx.artifacts.length === 0) ||
56
+ /traceability|source|evidence|acceptance|scenario/i.test(combinedContent(ctx)),
57
+ evidence: (ctx) => [`trace terms found: ${/traceability|source|evidence|acceptance|scenario/i.test(combinedContent(ctx)) ? "yes" : "no"}`],
58
+ gap: "Traceability is weak; the next stage may rely on chat memory instead of source-backed IDs or evidence.",
59
+ },
60
+ {
61
+ id: "GATE-UNCERTAINTY-01",
62
+ label: "Open questions, assumptions, risks, or blockers are explicit instead of silently resolved.",
63
+ weight: 1,
64
+ test: (ctx) => (ctx.stage === "preproposal" && ctx.artifacts.length === 0) ||
65
+ /open questions?|assumptions?|risks?|blockers?|constraints?|unknowns?|n\/a|none/i.test(combinedContent(ctx)),
66
+ evidence: (ctx) => [`uncertainty section marker found: ${/open questions?|assumptions?|risks?|blockers?|constraints?|unknowns?/i.test(combinedContent(ctx)) ? "yes" : "n/a or none marker required"}`],
67
+ gap: "Uncertainty handling is not explicit enough for a downstream stage to decide whether to continue or ask.",
68
+ },
69
+ ];
70
+ const STAGE_CRITERIA = {
71
+ design: [
72
+ {
73
+ id: "DESIGN-ENTRY-SPEC-01",
74
+ label: "Spec contains observable acceptance criteria.",
75
+ weight: 1,
76
+ required: true,
77
+ artifactKeys: ["spec"],
78
+ test: (ctx) => hasPattern(ctx, ["spec"], /acceptance criteria|验收|given\s+.*when\s+.*then|AC-?\d+/is),
79
+ evidence: () => ["spec acceptance marker required"],
80
+ gap: "Design cannot safely start until the spec exposes observable acceptance criteria.",
81
+ },
82
+ {
83
+ id: "DESIGN-ENTRY-SPEC-02",
84
+ label: "Spec covers edge, negative, boundary, or error scenarios.",
85
+ weight: 1,
86
+ artifactKeys: ["spec"],
87
+ test: (ctx) => hasPattern(ctx, ["spec"], /edge cases?|negative|boundary|error|failure|异常|边界/is),
88
+ evidence: () => ["spec edge/negative/boundary marker required"],
89
+ gap: "Spec lacks explicit non-happy-path coverage.",
90
+ },
91
+ {
92
+ id: "DESIGN-ENTRY-SPEC-03",
93
+ label: "Spec names NFR or quality attributes, with missing thresholds marked as 未指定 when needed.",
94
+ weight: 1,
95
+ artifactKeys: ["spec"],
96
+ test: (ctx) => hasPattern(ctx, ["spec"], /NFR|non-functional|performance|security|reliability|accessibility|observability|未指定|质量/is),
97
+ evidence: () => ["spec NFR/quality marker required"],
98
+ gap: "Spec does not expose quality attributes enough for design tradeoffs.",
99
+ },
100
+ {
101
+ id: "DESIGN-ENTRY-CONTROL-01",
102
+ label: "Permission/auth/privacy/data-access behavior has a behavior-level control matrix before design starts.",
103
+ weight: 2,
104
+ required: true,
105
+ artifactKeys: ["spec"],
106
+ test: (ctx) => !touchesControlConcern(ctx, ["spec"]) || hasControlMatrix(ctx, ["spec"]),
107
+ evidence: (ctx) => [`control concern: ${touchesControlConcern(ctx, ["spec"]) ? "triggered" : "not triggered"}`],
108
+ gap: "Spec touches a control concern but lacks a behavior-level control matrix.",
109
+ },
110
+ ],
111
+ task: [
112
+ {
113
+ id: "TASK-ENTRY-DES-01",
114
+ label: "Design includes useful diagrams or explicitly states why diagrams are N/A.",
115
+ weight: 1,
116
+ artifactKeys: ["design"],
117
+ test: (ctx) => hasPattern(ctx, ["design"], /```mermaid|diagram|C4|sequence|state|data flow|flowchart|图|N\/A/is),
118
+ evidence: () => ["design diagram or N/A rationale marker required"],
119
+ gap: "Task breakdown needs a reviewable design view or explicit diagram N/A rationale.",
120
+ },
121
+ {
122
+ id: "TASK-ENTRY-DES-02",
123
+ label: "Design records ADR/decision-record entries for task planning.",
124
+ weight: 1,
125
+ required: true,
126
+ artifactKeys: ["design"],
127
+ test: (ctx) => hasPattern(ctx, ["design"], /ADR-?\d+|Architecture Decision Record|Decision Record|ADR\s*\/|##\s*ADR|决策记录/is),
128
+ evidence: () => ["design ADR/decision-record marker required"],
129
+ gap: "Design lacks ADR/decision-record entries required for task planning.",
130
+ },
131
+ {
132
+ id: "TASK-ENTRY-CONTROL-01",
133
+ label: "Triggered permission/auth/privacy/data-access behavior has a design control traceability matrix.",
134
+ weight: 2,
135
+ required: true,
136
+ artifactKeys: ["spec", "design"],
137
+ test: (ctx) => !touchesControlConcern(ctx, ["spec", "design"]) || hasControlMatrix(ctx, ["design"]),
138
+ evidence: (ctx) => [`control concern: ${touchesControlConcern(ctx, ["spec", "design"]) ? "triggered" : "not triggered"}`],
139
+ gap: "Spec or design touches a control concern but design lacks a control traceability matrix.",
140
+ },
141
+ ],
142
+ coding: [
143
+ {
144
+ id: "CODING-ENTRY-TASK-01",
145
+ label: "Tasks use Kiro-style nested checkbox groups and subtasks.",
146
+ weight: 2,
147
+ required: true,
148
+ artifactKeys: ["tasks"],
149
+ test: (ctx) => hasPattern(ctx, ["tasks"], /^- \[ \] \d+\. .+$/m) && hasPattern(ctx, ["tasks"], /^\s+- \[ \] \d+\.\d+ .+$/m),
150
+ evidence: () => ["task list must contain '- [ ] 1.' and indented '- [ ] 1.1' items"],
151
+ gap: "Coding should not start from flat or vague tasks; use Kiro-style groups and subtasks.",
152
+ },
153
+ {
154
+ id: "CODING-ENTRY-TASK-02",
155
+ label: "Each implementation slice has verification or evidence hooks.",
156
+ weight: 1,
157
+ required: true,
158
+ artifactKeys: ["tasks"],
159
+ test: (ctx) => hasPattern(ctx, ["tasks"], /verification|evidence|test command|pnpm|npm|pytest|vitest|playwright|验证|证据/is),
160
+ evidence: () => ["task verification/evidence marker required"],
161
+ gap: "Tasks do not define how each slice proves completion.",
162
+ },
163
+ ],
164
+ fix: [
165
+ {
166
+ id: "FIX-ENTRY-ISSUE-01",
167
+ label: "Issue anchor exposes expected behavior, actual behavior, and evidence.",
168
+ weight: 2,
169
+ required: true,
170
+ artifactKeys: ["issue-record"],
171
+ test: (ctx) => hasPattern(ctx, ["issue-record"], /expected|actual|evidence|repro|steps|root cause|fix route|预期|实际|证据|复现/is),
172
+ evidence: () => ["issue record must expose expected/actual/evidence markers"],
173
+ gap: "Fix should not start without an issue anchor that records expected/actual behavior and evidence.",
174
+ },
175
+ ],
176
+ smoke: [
177
+ {
178
+ id: "SMOKE-ENTRY-TEST-01",
179
+ label: "Test basis is traceable before local smoke claims pass.",
180
+ weight: 2,
181
+ required: true,
182
+ artifactKeys: ["tasks"],
183
+ test: (ctx) => hasPattern(ctx, ["tasks"], /test basis|acceptance|AC-?\d+|FR-?\d+|scenario|regression|验收|回归/is),
184
+ evidence: () => ["tasks must link tests to acceptance/scenario/regression basis"],
185
+ gap: "Smoke cannot treat passing commands as meaningful without a traceable test basis.",
186
+ },
187
+ ],
188
+ review: [
189
+ {
190
+ id: "REVIEW-TARGET-01",
191
+ label: "Explicit review target exists and is treated as the review contract when supplied.",
192
+ weight: 2,
193
+ required: true,
194
+ artifactKeys: ["review-target"],
195
+ test: (ctx) => !ctx.reviewTarget || hasContent(ctx, "review-target"),
196
+ evidence: (ctx) => [
197
+ `review target: ${ctx.reviewTarget ?? "module implementation review"}`,
198
+ `review mode: ${ctx.reviewMode ?? "implementation"}`,
199
+ ],
200
+ gap: "The explicit review target is missing or has no reviewable content.",
201
+ },
202
+ {
203
+ id: "REVIEW-ENTRY-TEST-01",
204
+ label: "Smoke evidence distinguishes passed, failed, skipped, and unrun checks.",
205
+ weight: 1,
206
+ required: true,
207
+ artifactKeys: ["smoke"],
208
+ test: (ctx) => ctx.reviewMode !== "implementation" || hasPattern(ctx, ["smoke"], /passed|failed|skipped|unrun|exit status|command|evidence|通过|失败|跳过/is),
209
+ evidence: (ctx) => [ctx.reviewMode === "implementation" ? "smoke pass/fail/skipped/unrun markers required" : "explicit target review does not require module smoke input"],
210
+ gap: "Review needs precise test result status, not only a generic all-passed claim.",
211
+ },
212
+ {
213
+ id: "REVIEW-PREPROPOSAL-01",
214
+ label: "Preproposal/raw-source reviews check product, roadmap, UX, assumptions, or readiness evidence instead of module spec artifacts.",
215
+ weight: 1,
216
+ artifactKeys: ["review-target"],
217
+ test: (ctx) => !["preproposal", "raw-source"].includes(ctx.reviewMode ?? "implementation") ||
218
+ hasPattern(ctx, ["review-target"], /product|problem|user|persona|journey|roadmap|mvp|phase|ux|flow|assumption|risk|blocker|source|evidence|产品|用户|路线图|阶段|流程|假设|风险|证据/is),
219
+ evidence: (ctx) => [`target-aware raw review: ${["preproposal", "raw-source"].includes(ctx.reviewMode ?? "implementation") ? "required" : "n/a"}`],
220
+ gap: "Raw/preproposal review target lacks product, roadmap, UX, assumption, risk, source, or evidence markers.",
221
+ },
222
+ ],
223
+ };
224
+ export function evaluateStageQualityCriteria(input) {
225
+ const { stage, reviewTarget, reviewMode, artifacts, contentByKey, knownStages } = input;
226
+ const ctx = { stage, ...(reviewTarget ? { reviewTarget, reviewMode } : {}), artifacts, contentByKey };
227
+ const specs = [
228
+ ...(!knownStages.includes(stage) ? [unknownStageCriterion(stage, knownStages)] : []),
229
+ ...COMMON_CRITERIA,
230
+ ...(STAGE_CRITERIA[stage] ?? []),
231
+ ];
232
+ return specs.map((spec) => {
233
+ const passed = spec.test(ctx);
234
+ return {
235
+ id: spec.id,
236
+ label: spec.label,
237
+ weight: spec.weight,
238
+ passed,
239
+ required: spec.required === true,
240
+ evidence: spec.evidence(ctx),
241
+ ...(passed ? {} : { gap: spec.gap }),
242
+ };
243
+ });
244
+ }
245
+ function unknownStageCriterion(stage, knownStages) {
246
+ return {
247
+ id: "GATE-STAGE-00",
248
+ label: `Stage '${stage}' is known to the gate assessment contract.`,
249
+ weight: 2,
250
+ required: true,
251
+ test: () => false,
252
+ evidence: () => [`known stages: ${knownStages.join(", ")}`],
253
+ gap: "Unknown stage; define its required inputs before using gate assessment.",
254
+ };
255
+ }
256
+ function hasContent(ctx, key) {
257
+ return (ctx.contentByKey.get(key)?.trim().length ?? 0) > 0;
258
+ }
259
+ function primaryArtifacts(ctx) {
260
+ return ctx.artifacts.filter((artifact) => !["project-config", "system-spec", "raw-manifest"].includes(artifact.key));
261
+ }
262
+ function allPrimaryContent(ctx, test) {
263
+ const artifacts = primaryArtifacts(ctx);
264
+ if (artifacts.length === 0)
265
+ return ctx.artifacts.every((artifact) => artifact.exists && artifact.bytes > 0);
266
+ return artifacts.every((artifact) => {
267
+ const content = ctx.contentByKey.get(artifact.key);
268
+ return typeof content === "string" && test(content);
269
+ });
270
+ }
271
+ function combinedContent(ctx) {
272
+ return [...ctx.contentByKey.values()].join("\n\n");
273
+ }
274
+ function hasPattern(ctx, keys, pattern) {
275
+ return keys.some((key) => pattern.test(ctx.contentByKey.get(key) ?? ""));
276
+ }
277
+ function touchesControlConcern(ctx, keys) {
278
+ return hasPattern(ctx, keys, /auth(?:entication|orization)?|permission|access control|role|tenant|privacy|data access|compliance|audit|credential|PII|RBAC|ABAC|权限|认证|授权|角色|租户|隐私|审计|合规|凭证/is);
279
+ }
280
+ function hasControlMatrix(ctx, keys) {
281
+ return hasPattern(ctx, keys, /control (?:traceability )?matrix|control matrix|permission matrix|access control matrix|权限(?:追踪|控制)?矩阵|Source Rule|Subject \/ Actor|Action \/ Capability|Resource \/ Data|Enforcement Point/is);
282
+ }
283
+ function wordCount(content) {
284
+ return content.split(/\s+/).filter(Boolean).length;
285
+ }
286
+ //# sourceMappingURL=stage-quality-criteria.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage-quality-criteria.js","sourceRoot":"","sources":["../../src/core/stage-quality-criteria.ts"],"names":[],"mappings":"AAOA,MAAM,eAAe,GAAgC;IACnD;QACE,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,sDAAsD;QAC7D,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,Q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AC,GAAiC,EAAE,IAAc;IAC9E,OAAO,UAAU,CACf,GAAG,EACH,IAAI,EACJ,gKAAgK,CACjK,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAiC,EAAE,IAAc;IACzE,OAAO,UAAU,CACf,GAAG,EACH,IAAI,EACJ,+LAA+L,CAChM,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AACrD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { GateAssessment, GateCriterion, GateStatus, OutputQualityCheck } from "./stage-quality-contracts.js";
2
+ export type StageQualityDecisionSummary = {
3
+ score: number;
4
+ status: GateStatus;
5
+ decision: GateAssessment["decision"];
6
+ blockers: string[];
7
+ gaps: string[];
8
+ waiver?: GateAssessment["waiver"];
9
+ nextAction: string;
10
+ };
11
+ export declare function summarizeStageQualityDecision(criteria: GateCriterion[], threshold: number, acceptRisk: string | undefined, outputQualityChecks?: OutputQualityCheck[]): StageQualityDecisionSummary;
12
+ export declare function renderGateAssessmentMarkdown(assessment: GateAssessment): string;
13
+ export declare function renderGateAssessmentSummaryMarkdown(assessment: GateAssessment): string;
14
+ export declare function summarizeGateAssessmentJson(assessment: GateAssessment): Record<string, unknown>;
15
+ export declare function renderWaiverMarkdown(assessment: GateAssessment): string;