@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
@@ -1,26 +1,26 @@
1
1
  /**
2
- * Document review state management — <data_dir>/<project_name>/iter-<n>/reviews.json
2
+ * Artifact review state management — <context_dir>/reviews.json
3
3
  *
4
- * Tracks which documents are pending review, approved, or rejected.
4
+ * Tracks which artifacts are pending review, approved, or rejected.
5
5
  */
6
- import type { DocReviewState } from './types.js';
6
+ import type { ReviewState } from './types.js';
7
7
  /**
8
- * Read the reviews state for a project iteration.
8
+ * Read the reviews state for a project context.
9
9
  */
10
- export declare function readReviews(projectName: string, iteration: number): Promise<Record<string, DocReviewState>>;
10
+ export declare function readReviews(projectName: string, iteration: number, contextDir?: string): Promise<Record<string, ReviewState>>;
11
11
  /**
12
- * Submit a document for review. Sets status to "pending".
12
+ * Submit an artifact for review. Sets status to "pending".
13
13
  */
14
- export declare function submitForReview(projectName: string, iteration: number, docId: string): Promise<DocReviewState>;
14
+ export declare function submitForReview(projectName: string, iteration: number, artifactId: string, contextDir?: string): Promise<ReviewState>;
15
15
  /**
16
- * Approve or reject a document review.
16
+ * Approve or reject an artifact review.
17
17
  */
18
- export declare function resolveReview(projectName: string, iteration: number, docId: string, status: 'approved' | 'rejected', comment?: string): Promise<DocReviewState>;
18
+ export declare function resolveReview(projectName: string, iteration: number, artifactId: string, status: 'approved' | 'rejected', comment?: string, contextDir?: string): Promise<ReviewState>;
19
19
  /**
20
- * Get the review state for a specific document.
20
+ * Get the review state for a specific artifact.
21
21
  */
22
- export declare function getDocReview(projectName: string, iteration: number, docId: string): Promise<DocReviewState | null>;
22
+ export declare function getArtifactReview(projectName: string, iteration: number, artifactId: string, contextDir?: string): Promise<ReviewState | null>;
23
23
  /**
24
- * Get all pending reviews for a project iteration.
24
+ * Get all pending reviews for a project context.
25
25
  */
26
- export declare function getPendingReviews(projectName: string, iteration: number): Promise<DocReviewState[]>;
26
+ export declare function getPendingReviews(projectName: string, iteration: number, contextDir?: string): Promise<ReviewState[]>;
@@ -1,23 +1,22 @@
1
1
  /**
2
- * Document review state management — <data_dir>/<project_name>/iter-<n>/reviews.json
2
+ * Artifact review state management — <context_dir>/reviews.json
3
3
  *
4
- * Tracks which documents are pending review, approved, or rejected.
4
+ * Tracks which artifacts are pending review, approved, or rejected.
5
5
  */
6
6
  import { readFile, writeFile, mkdir } from 'node:fs/promises';
7
7
  import { join, dirname } from 'node:path';
8
- import { getIterationDir } from './registry.js';
9
8
  const REVIEWS_FILE = 'reviews.json';
10
- function reviewsPath(projectName, iteration) {
11
- return join(getIterationDir(projectName, iteration), REVIEWS_FILE);
9
+ function reviewsPath(projectName, iteration, contextDir) {
10
+ return join(contextDir, REVIEWS_FILE);
12
11
  }
13
12
  /**
14
- * Read the reviews state for a project iteration.
13
+ * Read the reviews state for a project context.
15
14
  */
16
- export async function readReviews(projectName, iteration) {
15
+ export async function readReviews(projectName, iteration, contextDir) {
17
16
  try {
18
- const content = await readFile(reviewsPath(projectName, iteration), 'utf-8');
17
+ const content = await readFile(reviewsPath(projectName, iteration, contextDir), 'utf-8');
19
18
  const data = JSON.parse(content);
20
- return data.docs ?? {};
19
+ return data.artifacts ?? {};
21
20
  }
22
21
  catch {
23
22
  return {};
@@ -26,58 +25,58 @@ export async function readReviews(projectName, iteration) {
26
25
  /**
27
26
  * Write reviews state to disk.
28
27
  */
29
- async function writeReviews(projectName, iteration, docs) {
30
- const filePath = reviewsPath(projectName, iteration);
28
+ async function writeReviews(projectName, iteration, artifacts, contextDir) {
29
+ const filePath = reviewsPath(projectName, iteration, contextDir);
31
30
  await mkdir(dirname(filePath), { recursive: true });
32
- const data = { docs };
31
+ const data = { artifacts };
33
32
  await writeFile(filePath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
34
33
  }
35
34
  /**
36
- * Submit a document for review. Sets status to "pending".
35
+ * Submit an artifact for review. Sets status to "pending".
37
36
  */
38
- export async function submitForReview(projectName, iteration, docId) {
39
- const reviews = await readReviews(projectName, iteration);
37
+ export async function submitForReview(projectName, iteration, artifactId, contextDir) {
38
+ const reviews = await readReviews(projectName, iteration, contextDir);
40
39
  const state = {
41
- docId,
40
+ artifactId,
42
41
  status: 'pending',
43
42
  submittedAt: new Date().toISOString(),
44
43
  };
45
- reviews[docId] = state;
46
- await writeReviews(projectName, iteration, reviews);
44
+ reviews[artifactId] = state;
45
+ await writeReviews(projectName, iteration, reviews, contextDir);
47
46
  return state;
48
47
  }
49
48
  /**
50
- * Approve or reject a document review.
49
+ * Approve or reject an artifact review.
51
50
  */
52
- export async function resolveReview(projectName, iteration, docId, status, comment) {
53
- const reviews = await readReviews(projectName, iteration);
54
- const existing = reviews[docId];
51
+ export async function resolveReview(projectName, iteration, artifactId, status, comment, contextDir) {
52
+ const reviews = await readReviews(projectName, iteration, contextDir);
53
+ const existing = reviews[artifactId];
55
54
  if (!existing) {
56
- throw new Error(`No review pending for document "${docId}". Submit it for review first.`);
55
+ throw new Error(`No review pending for artifact "${artifactId}". Submit it for review first.`);
57
56
  }
58
57
  if (existing.status !== 'pending') {
59
- throw new Error(`Document "${docId}" review is already ${existing.status}.`);
58
+ throw new Error(`Artifact "${artifactId}" review is already ${existing.status}.`);
60
59
  }
61
60
  existing.status = status;
62
61
  existing.reviewedAt = new Date().toISOString();
63
62
  if (comment) {
64
63
  existing.comment = comment;
65
64
  }
66
- await writeReviews(projectName, iteration, reviews);
65
+ await writeReviews(projectName, iteration, reviews, contextDir);
67
66
  return existing;
68
67
  }
69
68
  /**
70
- * Get the review state for a specific document.
69
+ * Get the review state for a specific artifact.
71
70
  */
72
- export async function getDocReview(projectName, iteration, docId) {
73
- const reviews = await readReviews(projectName, iteration);
74
- return reviews[docId] ?? null;
71
+ export async function getArtifactReview(projectName, iteration, artifactId, contextDir) {
72
+ const reviews = await readReviews(projectName, iteration, contextDir);
73
+ return reviews[artifactId] ?? null;
75
74
  }
76
75
  /**
77
- * Get all pending reviews for a project iteration.
76
+ * Get all pending reviews for a project context.
78
77
  */
79
- export async function getPendingReviews(projectName, iteration) {
80
- const reviews = await readReviews(projectName, iteration);
78
+ export async function getPendingReviews(projectName, iteration, contextDir) {
79
+ const reviews = await readReviews(projectName, iteration, contextDir);
81
80
  return Object.values(reviews).filter((r) => r.status === 'pending');
82
81
  }
83
82
  //# sourceMappingURL=reviews.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reviews.js","sourceRoot":"","sources":["../../src/core/reviews.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,YAAY,GAAG,cAAc,CAAC;AAMpC,SAAS,WAAW,CAAC,WAAmB,EAAE,SAAiB;IACvD,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,YAAY,CAAC,CAAC;AACvE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,WAAmB,EAAE,SAAiB;IACpE,IAAI,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,WAAW,EA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AED,MAAM,YAAY,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAChE,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,WAAmB,EACnB,SAAiB,EACjB,UAAkB,EAClB,UAAmB;IAEnB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACtE,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,WAAmB,EACnB,SAAiB,EACjB,UAAmB;IAEnB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;AACxE,CAAC"}
@@ -1,18 +1,18 @@
1
1
  /**
2
- * Document schema loader and validator.
2
+ * Artifact schema loader and validator.
3
3
  *
4
4
  * Loads schema definitions from the resolved workflow directory's schemas/ subdirectory
5
- * and validates document content against them before writing.
5
+ * and validates artifact content against them before writing.
6
6
  */
7
- import type { DocSchema, ProjectScale } from './types.js';
7
+ import type { ArtifactSchema } from './types.js';
8
8
  /**
9
- * Load a document schema from the workflow's schemas directory.
10
- * Returns undefined if no schema file exists for this doc_id.
9
+ * Load an artifact schema from the workflow's schemas directory.
10
+ * Returns undefined if no schema file exists for this artifact_id.
11
11
  *
12
12
  * For step schemas, pass a composite id like "prd.requirements".
13
13
  */
14
- export declare function loadDocSchema(builtinDir: string, customDir: string, workflowName: string, docId: string): Promise<DocSchema | undefined>;
15
- export interface ValidationError {
14
+ export declare function loadArtifactSchema(workflowsDir: string, workflowName: string, artifactId: string): Promise<ArtifactSchema | undefined>;
15
+ export interface ArtifactValidationError {
16
16
  /** Error type */
17
17
  type: 'missing_section' | 'missing_html_tag' | 'content_too_short' | 'empty_content' | 'missing_json_field' | 'invalid_json' | 'wrong_json_type' | 'json_array_too_short';
18
18
  /** Human-readable message */
@@ -20,19 +20,47 @@ export interface ValidationError {
20
20
  }
21
21
  export interface ValidationResult {
22
22
  valid: boolean;
23
- errors: ValidationError[];
23
+ errors: ArtifactValidationError[];
24
24
  }
25
25
  /**
26
- * Validate document content against a schema.
26
+ * Validate artifact content against a schema.
27
27
  *
28
- * @param content - Document content (markdown, HTML, or JSON)
28
+ * @param content - Artifact content (markdown, HTML, or JSON)
29
29
  * @param schema - Schema definition
30
- * @param scale - Project scale (affects which sections are required). When null, scale-dependent checks are skipped.
31
- * @param isHtml - Whether the document is HTML format
32
- * @param isJson - Whether the document is JSON format (for step artifacts)
30
+ * @param isHtml - Whether the artifact is HTML format
31
+ * @param isJson - Whether the artifact is JSON format (for step artifacts)
33
32
  */
34
- export declare function validateDoc(content: string, schema: DocSchema, scale: ProjectScale | null, isHtml?: boolean, isJson?: boolean): ValidationResult;
33
+ export declare function validateArtifact(content: string, schema: ArtifactSchema, isHtml?: boolean, isJson?: boolean): ValidationResult;
34
+ /**
35
+ * Step schema entry for formatSchemaGuidance.
36
+ * Each entry pairs a step definition with its loaded schema (if any).
37
+ */
38
+ export interface StepSchemaEntry {
39
+ step: {
40
+ id: string;
41
+ name: string;
42
+ format: 'json' | 'md';
43
+ description: string;
44
+ };
45
+ schema: ArtifactSchema | undefined;
46
+ }
47
+ /**
48
+ * Format an artifact schema into human-readable writing guidance.
49
+ *
50
+ * Used by:
51
+ * - role_dispatch: inject Artifact Requirements into the dispatch data package
52
+ * - artifact_schema tool: return guidance on demand for coordinator
53
+ *
54
+ * @param artifactId Artifact ID (e.g. "prd", "tech-design")
55
+ * @param artifactDef Artifact definition from workflow.json
56
+ * @param schema Main artifact schema (may be undefined if no schema file exists)
57
+ * @param stepSchemas Step schemas (only relevant when artifact has steps)
58
+ */
59
+ export declare function formatSchemaGuidance(artifactId: string, artifactDef: {
60
+ name: string;
61
+ format?: 'md' | 'html' | 'json';
62
+ }, schema: ArtifactSchema | undefined, stepSchemas?: StepSchemaEntry[]): string;
35
63
  /**
36
64
  * Format validation errors into a human-readable string for tool response.
37
65
  */
38
- export declare function formatValidationErrors(errors: ValidationError[]): string;
66
+ export declare function formatValidationErrors(errors: ArtifactValidationError[]): string;
@@ -1,22 +1,22 @@
1
1
  /**
2
- * Document schema loader and validator.
2
+ * Artifact schema loader and validator.
3
3
  *
4
4
  * Loads schema definitions from the resolved workflow directory's schemas/ subdirectory
5
- * and validates document content against them before writing.
5
+ * and validates artifact content against them before writing.
6
6
  */
7
7
  import { readFile } from 'node:fs/promises';
8
8
  import { join } from 'node:path';
9
- import { resolveWorkflowDir } from './workflow.js';
9
+ import { resolveWorkflowDir } from './plugin.js';
10
10
  // ─── Schema Loading ───
11
11
  /**
12
- * Load a document schema from the workflow's schemas directory.
13
- * Returns undefined if no schema file exists for this doc_id.
12
+ * Load an artifact schema from the workflow's schemas directory.
13
+ * Returns undefined if no schema file exists for this artifact_id.
14
14
  *
15
15
  * For step schemas, pass a composite id like "prd.requirements".
16
16
  */
17
- export async function loadDocSchema(builtinDir, customDir, workflowName, docId) {
18
- const workflowDir = await resolveWorkflowDir(builtinDir, customDir, workflowName);
19
- const schemaPath = join(workflowDir, 'schemas', `${docId}.json`);
17
+ export async function loadArtifactSchema(workflowsDir, workflowName, artifactId) {
18
+ const workflowDir = await resolveWorkflowDir(workflowsDir, workflowName);
19
+ const schemaPath = join(workflowDir, 'schemas', `${artifactId}.json`);
20
20
  try {
21
21
  const raw = await readFile(schemaPath, 'utf-8');
22
22
  return JSON.parse(raw);
@@ -69,15 +69,14 @@ function sectionPresent(section, headings) {
69
69
  return false;
70
70
  }
71
71
  /**
72
- * Validate document content against a schema.
72
+ * Validate artifact content against a schema.
73
73
  *
74
- * @param content - Document content (markdown, HTML, or JSON)
74
+ * @param content - Artifact content (markdown, HTML, or JSON)
75
75
  * @param schema - Schema definition
76
- * @param scale - Project scale (affects which sections are required). When null, scale-dependent checks are skipped.
77
- * @param isHtml - Whether the document is HTML format
78
- * @param isJson - Whether the document is JSON format (for step artifacts)
76
+ * @param isHtml - Whether the artifact is HTML format
77
+ * @param isJson - Whether the artifact is JSON format (for step artifacts)
79
78
  */
80
- export function validateDoc(content, schema, scale, isHtml = false, isJson = false) {
79
+ export function validateArtifact(content, schema, isHtml = false, isJson = false) {
81
80
  const errors = [];
82
81
  // Empty content check
83
82
  const trimmed = content.trim();
@@ -98,9 +97,7 @@ export function validateDoc(content, schema, scale, isHtml = false, isJson = fal
98
97
  if (schema.sections && !isHtml && !isJson) {
99
98
  const headings = extractHeadings(content);
100
99
  for (const section of schema.sections) {
101
- // When scale is null, skip scale-dependent section requirements
102
- const isRequired = scale !== null ? section.required[scale] : false;
103
- if (isRequired && !sectionPresent(section, headings)) {
100
+ if (section.required && !sectionPresent(section, headings)) {
104
101
  const aliasList = section.aliases?.length ? `(或: ${section.aliases.join(', ')})` : '';
105
102
  errors.push({
106
103
  type: 'missing_section',
@@ -136,9 +133,7 @@ export function validateDoc(content, schema, scale, isHtml = false, isJson = fal
136
133
  }
137
134
  if (parsed) {
138
135
  for (const fieldDef of schema.jsonFields) {
139
- // When scale is null, skip scale-dependent field requirements
140
- const isRequired = scale !== null ? fieldDef.required[scale] : false;
141
- if (!isRequired)
136
+ if (!fieldDef.required)
142
137
  continue;
143
138
  const value = parsed[fieldDef.field];
144
139
  if (value === undefined || value === null) {
@@ -174,6 +169,115 @@ export function validateDoc(content, schema, scale, isHtml = false, isJson = fal
174
169
  errors,
175
170
  };
176
171
  }
172
+ /**
173
+ * Format an artifact schema into human-readable writing guidance.
174
+ *
175
+ * Used by:
176
+ * - role_dispatch: inject Artifact Requirements into the dispatch data package
177
+ * - artifact_schema tool: return guidance on demand for coordinator
178
+ *
179
+ * @param artifactId Artifact ID (e.g. "prd", "tech-design")
180
+ * @param artifactDef Artifact definition from workflow.json
181
+ * @param schema Main artifact schema (may be undefined if no schema file exists)
182
+ * @param stepSchemas Step schemas (only relevant when artifact has steps)
183
+ */
184
+ export function formatSchemaGuidance(artifactId, artifactDef, schema, stepSchemas) {
185
+ const lines = [];
186
+ lines.push(`## 文档要求: ${artifactDef.name} (${artifactId})`);
187
+ lines.push('');
188
+ // Format
189
+ const format = artifactDef.format === 'html' ? 'HTML' : artifactDef.format === 'json' ? 'JSON' : 'Markdown';
190
+ lines.push(`格式: ${format}`);
191
+ // Min length
192
+ if (schema?.minLength) {
193
+ lines.push(`最小长度: ${schema.minLength} 字符`);
194
+ }
195
+ // Guidance
196
+ if (schema?.guidance) {
197
+ lines.push(`内容指引: ${schema.guidance}`);
198
+ }
199
+ // Required sections (markdown docs)
200
+ if (schema?.sections) {
201
+ const required = schema.sections.filter((s) => s.required);
202
+ if (required.length > 0) {
203
+ lines.push('');
204
+ lines.push('### 必需章节');
205
+ for (const section of required) {
206
+ // Strip leading ## from heading for display
207
+ const heading = section.heading.replace(/^#+\s*/, '');
208
+ lines.push(`- ${heading}`);
209
+ }
210
+ }
211
+ }
212
+ // Required HTML tags
213
+ if (schema?.htmlTags && schema.htmlTags.length > 0) {
214
+ lines.push('');
215
+ lines.push('### 必需 HTML 标签');
216
+ for (const tag of schema.htmlTags) {
217
+ lines.push(`- <${tag}>`);
218
+ }
219
+ }
220
+ // Required JSON fields (for top-level JSON docs without steps)
221
+ if (schema?.jsonFields) {
222
+ const required = schema.jsonFields.filter((f) => f.required);
223
+ if (required.length > 0) {
224
+ lines.push('');
225
+ lines.push('### 必需 JSON 字段');
226
+ for (const field of required) {
227
+ let desc = `- ${field.field}`;
228
+ if (field.type)
229
+ desc += ` (${field.type})`;
230
+ if (field.minItems)
231
+ desc += `, ≥${field.minItems} 项`;
232
+ lines.push(desc);
233
+ }
234
+ }
235
+ }
236
+ // Step schemas
237
+ if (stepSchemas && stepSchemas.length > 0) {
238
+ lines.push('');
239
+ lines.push('### 分步写入');
240
+ for (let i = 0; i < stepSchemas.length; i++) {
241
+ const { step, schema: stepSchema } = stepSchemas[i];
242
+ const formatLabel = step.format === 'json' ? 'JSON 格式' : 'Markdown 格式';
243
+ lines.push(`${i + 1}. ${step.id}(${step.name})— ${formatLabel}`);
244
+ if (stepSchema) {
245
+ // Step-level required JSON fields
246
+ if (stepSchema.jsonFields) {
247
+ const reqFields = stepSchema.jsonFields.filter((f) => f.required);
248
+ if (reqFields.length > 0) {
249
+ const fieldDescs = reqFields.map((f) => {
250
+ let d = f.field;
251
+ if (f.type)
252
+ d += ` (${f.type})`;
253
+ if (f.minItems)
254
+ d += `, ≥${f.minItems} 项`;
255
+ return d;
256
+ });
257
+ lines.push(` 必需字段: ${fieldDescs.join(', ')}`);
258
+ }
259
+ }
260
+ // Step-level required sections
261
+ if (stepSchema.sections) {
262
+ const reqSections = stepSchema.sections.filter((s) => s.required);
263
+ if (reqSections.length > 0) {
264
+ const sectionNames = reqSections.map((s) => s.heading.replace(/^#+\s*/, ''));
265
+ lines.push(` 必需章节: ${sectionNames.join(', ')}`);
266
+ }
267
+ }
268
+ // Step-level min length
269
+ if (stepSchema.minLength) {
270
+ lines.push(` 最小长度: ${stepSchema.minLength} 字符`);
271
+ }
272
+ // Step-level guidance
273
+ if (stepSchema.guidance) {
274
+ lines.push(` 指引: ${stepSchema.guidance}`);
275
+ }
276
+ }
277
+ }
278
+ }
279
+ return lines.join('\n');
280
+ }
177
281
  /**
178
282
  * Format validation errors into a human-readable string for tool response.
179
283
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;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AC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
@@ -1,36 +1,43 @@
1
1
  /**
2
- * Project state management — manages <data_dir>/<project_name>/iter-<n>/state.json
2
+ * Workflow state management — manages state.json within iteration/patch directories.
3
+ *
4
+ * Rewritten for the new node-based architecture. State now tracks individual
5
+ * workflow nodes instead of linear phases.
3
6
  */
4
- import type { PhaseStatus, ProjectScale, ProjectState, LoadedWorkflow } from './types.js';
7
+ import type { ContextType, WorkflowState, WorkflowPlugin, NodeState } from './types.js';
5
8
  /**
6
- * Error thrown when a tool requires scale but it hasn't been set yet.
9
+ * Initialize a new workflow state file.
10
+ *
11
+ * Creates initial NodeState records for all nodes in the workflow definition.
12
+ * All nodes start as 'pending'.
13
+ *
14
+ * @param contextDir - Directory containing state.json
7
15
  */
8
- export declare class ScaleNotSetError extends Error {
9
- constructor(projectName: string);
10
- }
16
+ export declare function initWorkflowState(projectName: string, projectDir: string, workflow: WorkflowPlugin, iteration: number, type?: ContextType, contextDir?: string): Promise<WorkflowState>;
11
17
  /**
12
- * Initialize a new project state file for a specific iteration.
13
- * Note: directory creation is handled by registry.startIteration().
14
- * This only writes the state.json.
18
+ * Read the current workflow state.
15
19
  */
16
- export declare function initProjectState(projectName: string, projectDir: string, workflow: LoadedWorkflow, iteration: number): Promise<ProjectState>;
20
+ export declare function readState(projectName: string, iteration: number, contextDir?: string): Promise<WorkflowState>;
17
21
  /**
18
- * Read the current project state for a specific iteration.
22
+ * Write workflow state to disk.
19
23
  */
20
- export declare function readState(projectName: string, iteration: number): Promise<ProjectState>;
24
+ export declare function writeState(projectName: string, iteration: number, state: WorkflowState, contextDir?: string): Promise<void>;
21
25
  /**
22
- * Write project state to disk for a specific iteration.
26
+ * Update a specific node's state. Reads current state, applies the partial update,
27
+ * and writes back.
28
+ *
29
+ * @returns The updated full WorkflowState
23
30
  */
24
- export declare function writeState(projectName: string, iteration: number, state: ProjectState): Promise<void>;
31
+ export declare function updateNodeState(projectName: string, iteration: number, nodeId: string, update: Partial<NodeState>, contextDir?: string): Promise<WorkflowState>;
25
32
  /**
26
- * Update a specific phase's status.
33
+ * Persist engine-computed state changes. After the workflow engine computes
34
+ * a new state (via computeNextAction or startWorkflow), call this to persist it.
35
+ *
36
+ * This is the preferred way to save state changes from the engine,
37
+ * as it replaces the entire state atomically.
27
38
  */
28
- export declare function updatePhaseStatus(projectName: string, iteration: number, phaseId: string, status: PhaseStatus, blockedReason?: string): Promise<ProjectState>;
39
+ export declare function persistState(projectName: string, iteration: number, state: WorkflowState, contextDir?: string): Promise<void>;
29
40
  /**
30
- * Check if a project state file exists for a specific iteration.
41
+ * Check if a workflow state file exists.
31
42
  */
32
- export declare function projectStateExists(projectName: string, iteration: number): Promise<boolean>;
33
- /**
34
- * Set the project scale. Scale is immutable once set.
35
- */
36
- export declare function setScale(projectName: string, iteration: number, scale: ProjectScale): Promise<ProjectState>;
43
+ export declare function stateExists(projectName: string, iteration: number, contextDir?: string): Promise<boolean>;