@s_s/harmonia 1.2.0 → 1.4.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.
Files changed (180) hide show
  1. package/README.md +140 -392
  2. package/build/cli/setup.d.ts +4 -2
  3. package/build/cli/setup.js +44 -18
  4. package/build/cli/setup.js.map +1 -1
  5. package/build/core/action-registry.d.ts +36 -0
  6. package/build/core/action-registry.js +53 -0
  7. package/build/core/action-registry.js.map +1 -0
  8. package/build/core/artifacts.d.ts +66 -0
  9. package/build/core/artifacts.js +178 -0
  10. package/build/core/artifacts.js.map +1 -0
  11. package/build/core/dispatch.d.ts +18 -11
  12. package/build/core/dispatch.js +43 -33
  13. package/build/core/dispatch.js.map +1 -1
  14. package/build/core/issues.d.ts +37 -0
  15. package/build/core/issues.js +100 -0
  16. package/build/core/issues.js.map +1 -0
  17. package/build/core/overrides.d.ts +19 -26
  18. package/build/core/overrides.js +32 -98
  19. package/build/core/overrides.js.map +1 -1
  20. package/build/core/plugin.d.ts +86 -0
  21. package/build/core/plugin.js +332 -0
  22. package/build/core/plugin.js.map +1 -0
  23. package/build/core/registry.d.ts +36 -3
  24. package/build/core/registry.js +63 -5
  25. package/build/core/registry.js.map +1 -1
  26. package/build/core/reviews.d.ts +13 -13
  27. package/build/core/reviews.js +31 -32
  28. package/build/core/reviews.js.map +1 -1
  29. package/build/core/schema.d.ts +43 -15
  30. package/build/core/schema.js +124 -20
  31. package/build/core/schema.js.map +1 -1
  32. package/build/core/state.d.ts +29 -22
  33. package/build/core/state.js +49 -81
  34. package/build/core/state.js.map +1 -1
  35. package/build/core/steps.d.ts +15 -15
  36. package/build/core/steps.js +32 -33
  37. package/build/core/steps.js.map +1 -1
  38. package/build/core/tree-utils.d.ts +52 -0
  39. package/build/core/tree-utils.js +226 -0
  40. package/build/core/tree-utils.js.map +1 -0
  41. package/build/core/types.d.ts +417 -117
  42. package/build/core/types.js +15 -1
  43. package/build/core/types.js.map +1 -1
  44. package/build/core/workflow-engine.d.ts +68 -0
  45. package/build/core/workflow-engine.js +821 -0
  46. package/build/core/workflow-engine.js.map +1 -0
  47. package/build/core/workflow-validator.d.ts +22 -0
  48. package/build/core/workflow-validator.js +489 -0
  49. package/build/core/workflow-validator.js.map +1 -0
  50. package/build/index.js +28 -25
  51. package/build/index.js.map +1 -1
  52. package/build/setup/inject.d.ts +4 -4
  53. package/build/setup/inject.js +6 -6
  54. package/build/setup/inject.js.map +1 -1
  55. package/build/setup/templates.d.ts +9 -7
  56. package/build/setup/templates.js +68 -103
  57. package/build/setup/templates.js.map +1 -1
  58. package/build/tools/artifact-approve.d.ts +8 -0
  59. package/build/tools/artifact-approve.js +94 -0
  60. package/build/tools/artifact-approve.js.map +1 -0
  61. package/build/tools/artifact-schema.d.ts +12 -0
  62. package/build/tools/artifact-schema.js +148 -0
  63. package/build/tools/artifact-schema.js.map +1 -0
  64. package/build/tools/artifact-tools.d.ts +18 -0
  65. package/build/tools/artifact-tools.js +465 -0
  66. package/build/tools/artifact-tools.js.map +1 -0
  67. package/build/tools/{report-dispatch.d.ts → dispatch-report.d.ts} +7 -3
  68. package/build/tools/dispatch-report.js +261 -0
  69. package/build/tools/dispatch-report.js.map +1 -0
  70. package/build/tools/engine-helpers.d.ts +41 -0
  71. package/build/tools/engine-helpers.js +182 -0
  72. package/build/tools/engine-helpers.js.map +1 -0
  73. package/build/tools/get-project-status.d.ts +6 -4
  74. package/build/tools/get-project-status.js +308 -246
  75. package/build/tools/get-project-status.js.map +1 -1
  76. package/build/tools/get-role-prompt.d.ts +1 -1
  77. package/build/tools/get-role-prompt.js +7 -41
  78. package/build/tools/get-role-prompt.js.map +1 -1
  79. package/build/tools/issue-tools.d.ts +10 -0
  80. package/build/tools/issue-tools.js +169 -0
  81. package/build/tools/issue-tools.js.map +1 -0
  82. package/build/tools/iteration-start.d.ts +7 -4
  83. package/build/tools/iteration-start.js +51 -20
  84. package/build/tools/iteration-start.js.map +1 -1
  85. package/build/tools/loop-done.d.ts +11 -0
  86. package/build/tools/loop-done.js +109 -0
  87. package/build/tools/loop-done.js.map +1 -0
  88. package/build/tools/patch-start.d.ts +16 -0
  89. package/build/tools/patch-start.js +122 -0
  90. package/build/tools/patch-start.js.map +1 -0
  91. package/build/tools/project-init.d.ts +5 -5
  92. package/build/tools/project-init.js +47 -18
  93. package/build/tools/project-init.js.map +1 -1
  94. package/build/tools/role-dispatch.d.ts +55 -0
  95. package/build/tools/role-dispatch.js +508 -0
  96. package/build/tools/role-dispatch.js.map +1 -0
  97. package/build/tools/utils.d.ts +40 -0
  98. package/build/tools/utils.js +97 -0
  99. package/build/tools/utils.js.map +1 -0
  100. package/package.json +1 -1
  101. package/{build/hooks/claude-code.js → workflows/dev/hooks/claude.js} +34 -23
  102. package/{build → workflows/dev}/hooks/content.js +27 -18
  103. package/workflows/dev/hooks/index.js +52 -0
  104. package/{build → workflows/dev}/hooks/openclaw.js +31 -20
  105. package/{build → workflows/dev}/hooks/opencode.js +31 -20
  106. package/workflows/dev/roles/architect.md +68 -28
  107. package/workflows/dev/roles/coordinator.md +103 -0
  108. package/workflows/dev/roles/developer.md +5 -5
  109. package/workflows/dev/roles/tester.md +19 -19
  110. package/workflows/dev/schemas/api-contract.json +42 -0
  111. package/workflows/dev/schemas/api-design.json +30 -13
  112. package/workflows/dev/schemas/data-model.json +20 -7
  113. package/workflows/dev/schemas/prd.completeness-check.json +6 -5
  114. package/workflows/dev/schemas/prd.draft.json +13 -5
  115. package/workflows/dev/schemas/prd.final.json +34 -11
  116. package/workflows/dev/schemas/prd.json +29 -11
  117. package/workflows/dev/schemas/prd.requirements.json +6 -5
  118. package/workflows/dev/schemas/prototype.json +6 -2
  119. package/workflows/dev/schemas/task-breakdown.coarse.json +4 -3
  120. package/workflows/dev/schemas/task-breakdown.dependencies.json +5 -4
  121. package/workflows/dev/schemas/task-breakdown.detailed.json +8 -3
  122. package/workflows/dev/schemas/task-breakdown.final.json +8 -3
  123. package/workflows/dev/schemas/task-breakdown.json +8 -3
  124. package/workflows/dev/schemas/tech-design.analysis.json +6 -5
  125. package/workflows/dev/schemas/tech-design.draft.json +14 -5
  126. package/workflows/dev/schemas/tech-design.final.json +39 -13
  127. package/workflows/dev/schemas/tech-design.json +34 -13
  128. package/workflows/dev/schemas/tech-design.research.json +21 -0
  129. package/workflows/dev/schemas/test-plan.json +17 -7
  130. package/workflows/dev/schemas/test-report.json +26 -9
  131. package/workflows/dev/schemas/user-stories.json +7 -3
  132. package/workflows/dev/tools/index.js +23 -0
  133. package/workflows/dev/workflow.json +234 -101
  134. package/build/core/docs.d.ts +0 -32
  135. package/build/core/docs.js +0 -91
  136. package/build/core/docs.js.map +0 -1
  137. package/build/core/workflow.d.ts +0 -33
  138. package/build/core/workflow.js +0 -140
  139. package/build/core/workflow.js.map +0 -1
  140. package/build/hooks/claude-code.d.ts +0 -20
  141. package/build/hooks/claude-code.js.map +0 -1
  142. package/build/hooks/content.d.ts +0 -43
  143. package/build/hooks/content.js.map +0 -1
  144. package/build/hooks/install.d.ts +0 -40
  145. package/build/hooks/install.js +0 -63
  146. package/build/hooks/install.js.map +0 -1
  147. package/build/hooks/openclaw.d.ts +0 -24
  148. package/build/hooks/openclaw.js.map +0 -1
  149. package/build/hooks/opencode.d.ts +0 -29
  150. package/build/hooks/opencode.js.map +0 -1
  151. package/build/tools/approve-doc.d.ts +0 -6
  152. package/build/tools/approve-doc.js +0 -108
  153. package/build/tools/approve-doc.js.map +0 -1
  154. package/build/tools/dispatch-role.d.ts +0 -16
  155. package/build/tools/dispatch-role.js +0 -277
  156. package/build/tools/dispatch-role.js.map +0 -1
  157. package/build/tools/doc-tools.d.ts +0 -16
  158. package/build/tools/doc-tools.js +0 -389
  159. package/build/tools/doc-tools.js.map +0 -1
  160. package/build/tools/override-tools.d.ts +0 -6
  161. package/build/tools/override-tools.js +0 -129
  162. package/build/tools/override-tools.js.map +0 -1
  163. package/build/tools/report-dispatch.js +0 -194
  164. package/build/tools/report-dispatch.js.map +0 -1
  165. package/build/tools/set-scale.d.ts +0 -6
  166. package/build/tools/set-scale.js +0 -107
  167. package/build/tools/set-scale.js.map +0 -1
  168. package/build/tools/setup-project.d.ts +0 -8
  169. package/build/tools/setup-project.js +0 -116
  170. package/build/tools/setup-project.js.map +0 -1
  171. package/build/tools/update-phase.d.ts +0 -12
  172. package/build/tools/update-phase.js +0 -159
  173. package/build/tools/update-phase.js.map +0 -1
  174. package/workflows/dev/roles/pm.md +0 -99
  175. package/workflows/dev/schemas/deploy.json +0 -20
  176. package/workflows/dev/schemas/fsd.json +0 -25
  177. package/workflows/dev/schemas/project-plan.json +0 -20
  178. package/workflows/dev/schemas/retrospective.json +0 -20
  179. package/workflows/dev/schemas/risk-assessment.json +0 -15
  180. package/workflows/dev/schemas/tech-design.api-contract.json +0 -20
@@ -0,0 +1,148 @@
1
+ /**
2
+ * MCP Tool: artifact_schema
3
+ *
4
+ * Query artifact structure requirements and writing guidance before writing.
5
+ * Returns human-readable schema guidance including required sections/fields,
6
+ * content boundaries, format requirements, and step-by-step constraints.
7
+ *
8
+ * Primarily used by coordinator (who is not dispatched and thus doesn't receive
9
+ * Artifact Requirements automatically via role_dispatch).
10
+ */
11
+ import { z } from 'zod';
12
+ import { loadArtifactSchema, formatSchemaGuidance } from '../core/schema.js';
13
+ import { loadWorkflowForContext } from './engine-helpers.js';
14
+ import { resolveActive, isError } from './utils.js';
15
+ export function registerArtifactSchema(server, workflowsDir) {
16
+ server.tool('artifact_schema', 'Query artifact structure requirements and writing guidance. Call this before writing an artifact to understand required sections, content boundaries, and format constraints.', {
17
+ project_name: z.string().describe('Project name'),
18
+ artifact_id: z
19
+ .string()
20
+ .describe('Artifact ID (e.g. prd, user-stories, fsd, prototype, tech-design, task-breakdown, etc.)'),
21
+ step: z
22
+ .string()
23
+ .optional()
24
+ .describe("Step ID (e.g. requirements, draft, final). If specified, returns only that step's schema. If omitted, returns the full artifact schema including all steps."),
25
+ }, async ({ project_name, artifact_id, step }) => {
26
+ try {
27
+ const ctx = await resolveActive(project_name);
28
+ if (isError(ctx))
29
+ return ctx;
30
+ const { wf, state } = await loadWorkflowForContext(workflowsDir, project_name, ctx);
31
+ // Validate artifact_id exists in workflow
32
+ const artifactDef = wf.artifactDefinitions[artifact_id];
33
+ if (!artifactDef) {
34
+ const available = Object.keys(wf.artifactDefinitions).join(', ');
35
+ return {
36
+ content: [
37
+ {
38
+ type: 'text',
39
+ text: `Artifact "${artifact_id}" not found in workflow. Available: ${available}`,
40
+ },
41
+ ],
42
+ isError: true,
43
+ };
44
+ }
45
+ // If a specific step is requested, return only that step's schema
46
+ if (step) {
47
+ // Validate step exists in artifact definition
48
+ if (!artifactDef.steps || !artifactDef.steps.find((s) => s.id === step)) {
49
+ const availableSteps = artifactDef.steps?.map((s) => s.id).join(', ') ?? '(无分步)';
50
+ return {
51
+ content: [
52
+ {
53
+ type: 'text',
54
+ text: `Step "${step}" not found for artifact "${artifact_id}". Available steps: ${availableSteps}`,
55
+ },
56
+ ],
57
+ isError: true,
58
+ };
59
+ }
60
+ const stepSchema = await loadArtifactSchema(workflowsDir, state.workflow, `${artifact_id}.${step}`);
61
+ const stepDefFound = artifactDef.steps.find((s) => s.id === step);
62
+ const lines = [];
63
+ lines.push(`## Step 要求: ${artifact_id}.${step}(${stepDefFound.name})`);
64
+ lines.push('');
65
+ lines.push(`格式: ${stepDefFound.format === 'json' ? 'JSON' : 'Markdown'}`);
66
+ lines.push(`描述: ${stepDefFound.description}`);
67
+ if (stepSchema) {
68
+ if (stepSchema.guidance) {
69
+ lines.push(`内容指引: ${stepSchema.guidance}`);
70
+ }
71
+ if (stepSchema.minLength) {
72
+ lines.push(`最小长度: ${stepSchema.minLength} 字符`);
73
+ }
74
+ if (stepSchema.jsonFields) {
75
+ const reqFields = stepSchema.jsonFields.filter((f) => f.required);
76
+ if (reqFields.length > 0) {
77
+ lines.push('');
78
+ lines.push('### 必需 JSON 字段');
79
+ for (const field of reqFields) {
80
+ let desc = `- ${field.field}`;
81
+ if (field.type)
82
+ desc += ` (${field.type})`;
83
+ if (field.minItems)
84
+ desc += `, ≥${field.minItems} 项`;
85
+ lines.push(desc);
86
+ }
87
+ }
88
+ }
89
+ if (stepSchema.sections) {
90
+ const reqSections = stepSchema.sections.filter((s) => s.required);
91
+ if (reqSections.length > 0) {
92
+ lines.push('');
93
+ lines.push('### 必需章节');
94
+ for (const section of reqSections) {
95
+ const heading = section.heading.replace(/^#+\s*/, '');
96
+ lines.push(`- ${heading}`);
97
+ }
98
+ }
99
+ }
100
+ }
101
+ else {
102
+ lines.push('');
103
+ lines.push('(此 step 无 schema 约束)');
104
+ }
105
+ return {
106
+ content: [{ type: 'text', text: lines.join('\n') }],
107
+ };
108
+ }
109
+ // Full artifact schema
110
+ const schema = await loadArtifactSchema(workflowsDir, state.workflow, artifact_id);
111
+ // Load step schemas if artifact has steps
112
+ let stepSchemas;
113
+ if (artifactDef.steps && artifactDef.steps.length > 0) {
114
+ stepSchemas = [];
115
+ for (const s of artifactDef.steps) {
116
+ const stepSchema = await loadArtifactSchema(workflowsDir, state.workflow, `${artifact_id}.${s.id}`);
117
+ stepSchemas.push({ step: s, schema: stepSchema });
118
+ }
119
+ }
120
+ if (!schema && (!stepSchemas || stepSchemas.every((s) => !s.schema))) {
121
+ return {
122
+ content: [
123
+ {
124
+ type: 'text',
125
+ text: `Artifact "${artifact_id}" 无 schema 定义。`,
126
+ },
127
+ ],
128
+ };
129
+ }
130
+ const guidance = formatSchemaGuidance(artifact_id, artifactDef, schema, stepSchemas);
131
+ return {
132
+ content: [{ type: 'text', text: guidance }],
133
+ };
134
+ }
135
+ catch (err) {
136
+ return {
137
+ content: [
138
+ {
139
+ type: 'text',
140
+ text: `Error: ${err instanceof Error ? err.message : String(err)}`,
141
+ },
142
+ ],
143
+ isError: true,
144
+ };
145
+ }
146
+ });
147
+ }
148
+ //# sourceMappingURL=artifact-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-schema.js","sourceRoot":"","sources":["../../src/tools/artifact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AAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;gBACtD,CAAC;YACL,CAAC;YAED,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;gBACnE,OAAO;oBACH,OAAO,EAAE;wBACL;4BACI,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,aAAa,WAAW,gBAAgB;yBACjD;qBACJ;iBACJ,CAAC;YACN,CAAC;YAED,MAAM,QAAQ,GAAG,oBAAoB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;YAErF,OAAO;gBACH,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;aACvD,CAAC;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;qBACrE;iBACJ;gBACD,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * MCP Tools: artifact_write / artifact_read / artifact_list
3
+ * Read and write project artifacts. Output paths are resolved per artifact
4
+ *
5
+ * artifact_write validates content against artifact schemas and checks review
6
+ * configuration. If validation fails, the write is rejected with specific
7
+ * error details. If review is required, the artifact is submitted for
8
+ * user approval.
9
+ *
10
+ * Sequential mode: When an artifact has `steps` defined in workflow.json,
11
+ * artifact_write requires a `step` parameter. Each step is validated
12
+ * independently, and the final step automatically writes the formal
13
+ * artifact and triggers the review flow.
14
+ *
15
+ * After writing, triggers engine event `artifact_written` to evaluate gates.
16
+ */
17
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
18
+ export declare function registerArtifactTools(server: McpServer, workflowsDir: string): void;
@@ -0,0 +1,465 @@
1
+ /**
2
+ * MCP Tools: artifact_write / artifact_read / artifact_list
3
+ * Read and write project artifacts. Output paths are resolved per artifact
4
+ *
5
+ * artifact_write validates content against artifact schemas and checks review
6
+ * configuration. If validation fails, the write is rejected with specific
7
+ * error details. If review is required, the artifact is submitted for
8
+ * user approval.
9
+ *
10
+ * Sequential mode: When an artifact has `steps` defined in workflow.json,
11
+ * artifact_write requires a `step` parameter. Each step is validated
12
+ * independently, and the final step automatically writes the formal
13
+ * artifact and triggers the review flow.
14
+ *
15
+ * After writing, triggers engine event `artifact_written` to evaluate gates.
16
+ */
17
+ import { z } from 'zod';
18
+ import { writeArtifact, readArtifact, listArtifacts, writeStepArtifact } from '../core/artifacts.js';
19
+ import { readState } from '../core/state.js';
20
+ import { loadWorkflow } from '../core/plugin.js';
21
+ import { getMergedOverrides, resolveArtifactReview } from '../core/overrides.js';
22
+ import { submitForReview } from '../core/reviews.js';
23
+ import { loadArtifactSchema, validateArtifact, formatValidationErrors } from '../core/schema.js';
24
+ import { getArtifactStepState, getCompletedStepIds, recordStepCompletion, markFinalized } from '../core/steps.js';
25
+ import { resolveActive, isError } from './utils.js';
26
+ import { processWorkflowEvent, loadWorkflowForContext, formatNextAction } from './engine-helpers.js';
27
+ import { getProject, resolveContextDir } from '../core/registry.js';
28
+ /**
29
+ * Check if sequential mode is active for a given artifact definition.
30
+ * Sequential mode is active whenever the artifact has steps defined.
31
+ */
32
+ function isSequentialActive(artifactDef) {
33
+ return !!artifactDef.steps?.length;
34
+ }
35
+ export function registerArtifactTools(server, workflowsDir) {
36
+ server.tool('artifact_write', 'Write or update a project artifact. For artifacts with sequential steps (PRD, tech-design, task-breakdown), you MUST specify the step parameter. Automatically checks review configuration — if review is required, the artifact is submitted for user approval.', {
37
+ project_name: z.string().describe('Project name'),
38
+ artifact_id: z
39
+ .string()
40
+ .describe('Artifact ID (e.g. prd, user-stories, fsd, prototype, tech-design, task-breakdown, etc.)'),
41
+ content: z
42
+ .string()
43
+ .describe('Artifact content (markdown, HTML, or JSON depending on artifact type and step)'),
44
+ step: z
45
+ .string()
46
+ .optional()
47
+ .describe('Sequential step ID (required for artifacts with steps). Use project_status to see available steps.'),
48
+ }, async ({ project_name, artifact_id, content, step }) => {
49
+ const ctx = await resolveActive(project_name);
50
+ if (isError(ctx))
51
+ return ctx;
52
+ // Load workflow to get artifact definition (format, review defaults)
53
+ const { wf, state } = await loadWorkflowForContext(workflowsDir, project_name, ctx);
54
+ const artifactDef = wf.artifactDefinitions[artifact_id];
55
+ const isHtml = artifactDef?.format === 'html';
56
+ // Guard: artifact_id must be defined in workflow
57
+ if (!artifactDef) {
58
+ const validIds = Object.keys(wf.artifactDefinitions)
59
+ .filter((id) => !wf.artifactDefinitions[id].unmanaged)
60
+ .join(', ');
61
+ return {
62
+ content: [
63
+ {
64
+ type: 'text',
65
+ text: `Artifact "${artifact_id}" 未在工作流中定义。可用的 artifact 类型: ${validIds}`,
66
+ },
67
+ ],
68
+ isError: true,
69
+ };
70
+ }
71
+ // Guard: reject unmanaged artifact types (should be produced outside artifact_write)
72
+ if (artifactDef.unmanaged) {
73
+ return {
74
+ content: [
75
+ {
76
+ type: 'text',
77
+ text: `Artifact "${artifact_id}" 是非托管(unmanaged)产出类型,不应通过 artifact_write 写入。`,
78
+ },
79
+ ],
80
+ isError: true,
81
+ };
82
+ }
83
+ // Guard: empty content
84
+ if (!content.trim()) {
85
+ return {
86
+ content: [
87
+ {
88
+ type: 'text',
89
+ text: 'Artifact 内容为空,请提供实际内容后重新提交。',
90
+ },
91
+ ],
92
+ isError: true,
93
+ };
94
+ }
95
+ // ─── Sequential Mode ───
96
+ if (isSequentialActive(artifactDef)) {
97
+ return handleSequentialWrite(workflowsDir, state.workflow, project_name, ctx, artifact_id, content, step, artifactDef);
98
+ }
99
+ // ─── Normal Mode (no steps) ───
100
+ // Schema validation — reject write if content doesn't meet requirements
101
+ const schema = await loadArtifactSchema(workflowsDir, state.workflow, artifact_id);
102
+ if (schema) {
103
+ const result = validateArtifact(content, schema, isHtml);
104
+ if (!result.valid) {
105
+ return {
106
+ content: [
107
+ {
108
+ type: 'text',
109
+ text: formatValidationErrors(result.errors),
110
+ },
111
+ ],
112
+ isError: true,
113
+ };
114
+ }
115
+ }
116
+ // Write the artifact with correct extension
117
+ const writeIoCtx = {
118
+ contextDir: ctx.dir,
119
+ projectDir: ctx.entry.dir,
120
+ contextLabel: ctx.activeContext,
121
+ };
122
+ const filePath = await writeArtifact(artifact_id, content, writeIoCtx, artifactDef);
123
+ // Trigger engine event: artifact_written
124
+ const engineResult = await processWorkflowEvent(workflowsDir, project_name, ctx, {
125
+ type: 'artifact_written',
126
+ artifactId: artifact_id,
127
+ });
128
+ // Check if review is required
129
+ const overrides = await getMergedOverrides(project_name);
130
+ const needsReview = resolveArtifactReview(artifact_id, artifactDef, overrides);
131
+ if (needsReview) {
132
+ await submitForReview(project_name, ctx.number, artifact_id, ctx.dir);
133
+ const artifactName = artifactDef.name ?? artifact_id;
134
+ return {
135
+ content: [
136
+ {
137
+ type: 'text',
138
+ text: [
139
+ `Artifact "${artifact_id}" (${artifactName}) written to ${filePath}`,
140
+ ``,
141
+ `** REVIEW REQUIRED **`,
142
+ `This artifact requires user approval before the workflow can proceed.`,
143
+ `Please present the artifact content to the user and ask for their confirmation.`,
144
+ `After user approval, call artifact_approve with project_name="${project_name}" and artifact_id="${artifact_id}".`,
145
+ `If the user requests changes, revise the artifact and call artifact_write again.`,
146
+ formatNextAction(engineResult.nextAction),
147
+ ].join('\n'),
148
+ },
149
+ ],
150
+ };
151
+ }
152
+ return {
153
+ content: [
154
+ {
155
+ type: 'text',
156
+ text: `Artifact "${artifact_id}" written to ${filePath}` +
157
+ formatNextAction(engineResult.nextAction),
158
+ },
159
+ ],
160
+ };
161
+ });
162
+ server.tool('artifact_read', 'Read a project artifact. By default reads from the active context. Use the optional `context` parameter (e.g. "iter-1", "patch-2") to read from a different context.', {
163
+ project_name: z.string().describe('Project name'),
164
+ artifact_id: z.string().describe('Artifact ID to read'),
165
+ context: z
166
+ .string()
167
+ .optional()
168
+ .describe('Context to read from (e.g. "iter-1", "patch-2"). Defaults to active context.'),
169
+ }, async ({ project_name, artifact_id, context }) => {
170
+ try {
171
+ let contextNumber;
172
+ let contextDir;
173
+ let contextLabel;
174
+ let projectDir;
175
+ if (context) {
176
+ // Cross-context read: resolve the specified context
177
+ const entry = await getProject(project_name);
178
+ if (!entry) {
179
+ return {
180
+ content: [{ type: 'text', text: `项目 "${project_name}" 未注册。` }],
181
+ isError: true,
182
+ };
183
+ }
184
+ const resolved = resolveContextDir(project_name, context);
185
+ if (!resolved) {
186
+ return {
187
+ content: [
188
+ {
189
+ type: 'text',
190
+ text: `无法解析上下文 "${context}"。格式示例: iter-1, patch-2`,
191
+ },
192
+ ],
193
+ isError: true,
194
+ };
195
+ }
196
+ contextNumber = resolved.number;
197
+ contextDir = resolved.dir;
198
+ contextLabel = context;
199
+ projectDir = entry.dir;
200
+ }
201
+ else {
202
+ // Default: active context
203
+ const ctx = await resolveActive(project_name);
204
+ if (isError(ctx))
205
+ return ctx;
206
+ contextNumber = ctx.number;
207
+ contextDir = ctx.dir;
208
+ contextLabel = ctx.activeContext;
209
+ projectDir = ctx.entry.dir;
210
+ }
211
+ // Load workflow to get artifact definition for output path resolution
212
+ const state = await readState(project_name, contextNumber, contextDir);
213
+ const wf = await loadWorkflow(workflowsDir, state.workflow);
214
+ const artifactDef = wf.artifactDefinitions[artifact_id];
215
+ const ioCtx = { contextDir, projectDir, contextLabel };
216
+ const artifactContent = await readArtifact(artifact_id, ioCtx, artifactDef);
217
+ return {
218
+ content: [
219
+ {
220
+ type: 'text',
221
+ text: artifactContent,
222
+ },
223
+ ],
224
+ };
225
+ }
226
+ catch {
227
+ return {
228
+ content: [
229
+ {
230
+ type: 'text',
231
+ text: `Artifact "${artifact_id}" not found. Use artifact_list to see available artifacts.`,
232
+ },
233
+ ],
234
+ isError: true,
235
+ };
236
+ }
237
+ });
238
+ server.tool('artifact_list', 'List all project artifacts. By default lists from the active context. Use the optional `context` parameter (e.g. "iter-1", "patch-2") to list from a different context.', {
239
+ project_name: z.string().describe('Project name'),
240
+ context: z
241
+ .string()
242
+ .optional()
243
+ .describe('Context to list from (e.g. "iter-1", "patch-2"). Defaults to active context.'),
244
+ }, async ({ project_name, context }) => {
245
+ let contextNumber;
246
+ let contextDir;
247
+ let contextLabel;
248
+ let projectDir;
249
+ if (context) {
250
+ const entry = await getProject(project_name);
251
+ if (!entry) {
252
+ return {
253
+ content: [{ type: 'text', text: `项目 "${project_name}" 未注册。` }],
254
+ isError: true,
255
+ };
256
+ }
257
+ const resolved = resolveContextDir(project_name, context);
258
+ if (!resolved) {
259
+ return {
260
+ content: [
261
+ { type: 'text', text: `无法解析上下文 "${context}"。格式示例: iter-1, patch-2` },
262
+ ],
263
+ isError: true,
264
+ };
265
+ }
266
+ contextNumber = resolved.number;
267
+ contextDir = resolved.dir;
268
+ contextLabel = context;
269
+ projectDir = entry.dir;
270
+ }
271
+ else {
272
+ const ctx = await resolveActive(project_name);
273
+ if (isError(ctx))
274
+ return ctx;
275
+ contextNumber = ctx.number;
276
+ contextDir = ctx.dir;
277
+ contextLabel = ctx.activeContext;
278
+ projectDir = ctx.entry.dir;
279
+ }
280
+ // Load workflow for artifact definitions and output path resolution
281
+ const state = await readState(project_name, contextNumber, contextDir);
282
+ const wf = await loadWorkflow(workflowsDir, state.workflow);
283
+ const ioCtx = { contextDir, projectDir, contextLabel };
284
+ const artifacts = await listArtifacts(ioCtx, wf.artifactDefinitions);
285
+ return {
286
+ content: [
287
+ {
288
+ type: 'text',
289
+ text: artifacts.length > 0
290
+ ? `Artifacts (${contextLabel}):\n${artifacts.map((d) => `- ${d}`).join('\n')}`
291
+ : `No artifacts found for ${contextLabel}.`,
292
+ },
293
+ ],
294
+ };
295
+ });
296
+ }
297
+ async function handleSequentialWrite(workflowsDir, workflowName, projectName, ctx, artifactId, content, step, artifactDef) {
298
+ const steps = artifactDef.steps;
299
+ const stepIds = steps.map((s) => s.id);
300
+ const stepNames = steps.map((s) => `${s.id} (${s.name})`).join(', ');
301
+ // Guard: step parameter is required in sequential mode
302
+ if (!step) {
303
+ return {
304
+ content: [
305
+ {
306
+ type: 'text',
307
+ text: [
308
+ `Artifact "${artifactId}" 需要分步写入。`,
309
+ `请指定 step 参数。可用的步骤: ${stepNames}`,
310
+ ``,
311
+ `步骤说明:`,
312
+ ...steps.map((s, i) => ` ${i + 1}. ${s.id} — ${s.description}`),
313
+ ].join('\n'),
314
+ },
315
+ ],
316
+ isError: true,
317
+ };
318
+ }
319
+ // Guard: step must be valid
320
+ const stepDef = steps.find((s) => s.id === step);
321
+ if (!stepDef) {
322
+ return {
323
+ content: [
324
+ {
325
+ type: 'text',
326
+ text: `未知的步骤 "${step}"。可用的步骤: ${stepNames}`,
327
+ },
328
+ ],
329
+ isError: true,
330
+ };
331
+ }
332
+ const stepIndex = stepIds.indexOf(step);
333
+ const stepState = await getArtifactStepState(projectName, ctx.number, artifactId, ctx.dir);
334
+ const completedIds = getCompletedStepIds(stepState);
335
+ // Guard: prerequisite steps must be completed (hard enforcement)
336
+ for (let i = 0; i < stepIndex; i++) {
337
+ if (!completedIds.has(stepIds[i])) {
338
+ const missingStep = steps[i];
339
+ return {
340
+ content: [
341
+ {
342
+ type: 'text',
343
+ text: `无法写入步骤 "${step}":前置步骤 "${missingStep.id}" (${missingStep.name}) 尚未完成。请先完成该步骤。`,
344
+ },
345
+ ],
346
+ isError: true,
347
+ };
348
+ }
349
+ }
350
+ // Step schema validation
351
+ const isJson = stepDef.format === 'json';
352
+ const stepSchemaId = `${artifactId}.${step}`;
353
+ const stepSchema = await loadArtifactSchema(workflowsDir, workflowName, stepSchemaId);
354
+ if (stepSchema) {
355
+ const result = validateArtifact(content, stepSchema, false, isJson);
356
+ if (!result.valid) {
357
+ return {
358
+ content: [
359
+ {
360
+ type: 'text',
361
+ text: formatValidationErrors(result.errors),
362
+ },
363
+ ],
364
+ isError: true,
365
+ };
366
+ }
367
+ }
368
+ // Write the step artifact
369
+ const ioCtx = {
370
+ contextDir: ctx.dir,
371
+ projectDir: ctx.entry.dir,
372
+ contextLabel: ctx.activeContext,
373
+ };
374
+ const artifactPath = await writeStepArtifact(artifactId, step, content, stepDef.format, ioCtx, artifactDef);
375
+ // Record step completion (handles rollback if overwriting)
376
+ await recordStepCompletion(projectName, ctx.number, artifactId, step, artifactPath, stepIds, ctx.dir);
377
+ const isLastStep = stepIndex === steps.length - 1;
378
+ if (isLastStep) {
379
+ // Auto-merge: validate against final artifact schema, write formal artifact, trigger review
380
+ return handleFinalStep(workflowsDir, workflowName, projectName, ctx, artifactId, content, artifactDef, stepDef, ioCtx);
381
+ }
382
+ // Not the last step — return progress info
383
+ const nextStep = steps[stepIndex + 1];
384
+ return {
385
+ content: [
386
+ {
387
+ type: 'text',
388
+ text: [
389
+ `步骤 "${step}" (${stepDef.name}) 完成,产物已写入 ${artifactPath}`,
390
+ ``,
391
+ `下一步: ${nextStep.id} — ${nextStep.description}`,
392
+ `请调用 artifact_write(project_name="${projectName}", artifact_id="${artifactId}", step="${nextStep.id}", content=...)`,
393
+ ].join('\n'),
394
+ },
395
+ ],
396
+ };
397
+ }
398
+ async function handleFinalStep(workflowsDir, workflowName, projectName, ctx, artifactId, content, artifactDef, stepDef, ioCtx) {
399
+ const isHtml = artifactDef.format === 'html';
400
+ // Validate against the final artifact schema (e.g. prd.json)
401
+ const finalSchema = await loadArtifactSchema(workflowsDir, workflowName, artifactId);
402
+ if (finalSchema) {
403
+ const isJson = artifactDef.format === 'json';
404
+ const result = validateArtifact(content, finalSchema, isHtml, isJson);
405
+ if (!result.valid) {
406
+ return {
407
+ content: [
408
+ {
409
+ type: 'text',
410
+ text: [
411
+ '最终 artifact 校验失败:',
412
+ formatValidationErrors(result.errors),
413
+ '',
414
+ `请修正后重新提交步骤 "${stepDef.id}"。`,
415
+ ].join('\n'),
416
+ },
417
+ ],
418
+ isError: true,
419
+ };
420
+ }
421
+ }
422
+ // Write the formal artifact
423
+ const filePath = await writeArtifact(artifactId, content, ioCtx, artifactDef);
424
+ // Mark as finalized
425
+ await markFinalized(projectName, ctx.number, artifactId, ctx.dir);
426
+ // Trigger engine event: artifact_written
427
+ const engineResult = await processWorkflowEvent(workflowsDir, projectName, ctx, {
428
+ type: 'artifact_written',
429
+ artifactId,
430
+ });
431
+ // Check if review is required
432
+ const overrides = await getMergedOverrides(projectName);
433
+ const needsReview = resolveArtifactReview(artifactId, artifactDef, overrides);
434
+ if (needsReview) {
435
+ await submitForReview(projectName, ctx.number, artifactId, ctx.dir);
436
+ const artifactName = artifactDef.name ?? artifactId;
437
+ return {
438
+ content: [
439
+ {
440
+ type: 'text',
441
+ text: [
442
+ `所有步骤完成!Artifact "${artifactId}" (${artifactName}) 已写入 ${filePath}`,
443
+ ``,
444
+ `** REVIEW REQUIRED **`,
445
+ `This artifact requires user approval before the workflow can proceed.`,
446
+ `Please present the artifact content to the user and ask for their confirmation.`,
447
+ `After user approval, call artifact_approve with project_name="${projectName}" and artifact_id="${artifactId}".`,
448
+ `If the user requests changes, revise the artifact and call artifact_write again with the appropriate step.`,
449
+ formatNextAction(engineResult.nextAction),
450
+ ].join('\n'),
451
+ },
452
+ ],
453
+ };
454
+ }
455
+ return {
456
+ content: [
457
+ {
458
+ type: 'text',
459
+ text: `所有步骤完成!Artifact "${artifactId}" 已写入 ${filePath}` +
460
+ formatNextAction(engineResult.nextAction),
461
+ },
462
+ ],
463
+ };
464
+ }
465
+ //# sourceMappingURL=artifact-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-tools.js","sourceRoot":"","sources":["../../src/tools/artifact-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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