speccrew 0.6.6 → 0.6.9

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.
@@ -29,7 +29,9 @@ Detect business knowledge base availability and completeness status. Scans the s
29
29
 
30
30
  | Variable | Type | Description | Required |
31
31
  |----------|------|-------------|----------|
32
- | `workspace_path` | string | Path to speccrew workspace (e.g., `speccrew-workspace`) | **Yes** |
32
+ | `workspace_path` | string | Absolute path to speccrew workspace (e.g., `speccrew-workspace`) | **Yes** |
33
+ | `sync_state_bizs_dir` | string | Absolute path to `knowledges/base/sync-state/knowledge-bizs/` directory | **Yes** |
34
+ | `configs_dir` | string | Absolute path to `docs/configs/` directory | **Yes** |
33
35
 
34
36
  ## Output JSON
35
37
 
@@ -72,7 +74,7 @@ flowchart TD
72
74
 
73
75
  Check if the system overview file exists:
74
76
 
75
- 1. Construct path: `{workspace_path}/knowledges/bizs/system-overview.md`
77
+ 1. Path: `{workspace_path}/knowledges/bizs/system-overview.md`
76
78
  2. Attempt to read the file
77
79
  3. Set `has_system_overview` = true if exists, false otherwise
78
80
  4. Set `system_overview_path` = path if exists, null otherwise
@@ -83,7 +85,7 @@ Check if the system overview file exists:
83
85
 
84
86
  Scan the sync-state directory for feature inventory files:
85
87
 
86
- 1. Construct path: `{workspace_path}/knowledges/base/sync-state/knowledge-bizs/`
88
+ 1. Use provided path: `{sync_state_bizs_dir}/`
87
89
  2. Glob pattern: `features-*.json`
88
90
  3. Collect all matching files into `features_files` array
89
91
  4. Set `has_features` = true if any files found
@@ -94,7 +96,7 @@ Scan the sync-state directory for feature inventory files:
94
96
 
95
97
  Scan for entry directory configuration files:
96
98
 
97
- 1. Use same sync-state path
99
+ 1. Use provided path: `{sync_state_bizs_dir}/`
98
100
  2. Glob pattern: `entry-dirs-*.json`
99
101
  3. Collect all matching files into `entry_dirs_files` array
100
102
  4. Set `has_entry_dirs` = true if any files found
@@ -137,6 +139,8 @@ Return the complete JSON output.
137
139
  3. **Graceful handling**: Return empty arrays if directories don't exist
138
140
  4. **Path format**: All returned paths should be relative to workspace_path
139
141
 
142
+ > **MANDATORY**: Use the provided absolute paths directly. DO NOT construct or derive paths yourself.
143
+
140
144
  ## Task Completion Report
141
145
 
142
146
  When the task is complete, report:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.6.6",
3
+ "version": "0.6.9",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -0,0 +1,134 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+
5
+ /**
6
+ * Path utility functions for speccrew workspace.
7
+ * All functions expect absolute paths as input.
8
+ */
9
+
10
+ /**
11
+ * Get the sync-state bizs directory path.
12
+ * @param {string} workspacePath - Absolute path to speccrew-workspace
13
+ * @returns {string} Absolute path to knowledges/base/sync-state/knowledge-bizs/
14
+ */
15
+ function getSyncStateBizsDir(workspacePath) {
16
+ return path.join(workspacePath, 'knowledges', 'base', 'sync-state', 'knowledge-bizs');
17
+ }
18
+
19
+ /**
20
+ * Get the sync-state techs directory path.
21
+ * @param {string} workspacePath - Absolute path to speccrew-workspace
22
+ * @returns {string} Absolute path to knowledges/base/sync-state/knowledge-techs/
23
+ */
24
+ function getSyncStateTechsDir(workspacePath) {
25
+ return path.join(workspacePath, 'knowledges', 'base', 'sync-state', 'knowledge-techs');
26
+ }
27
+
28
+ /**
29
+ * Get the features JSON file path for a platform.
30
+ * @param {string} syncStateBizsDir - Absolute path to sync-state/knowledge-bizs/
31
+ * @param {string} platformId - Platform identifier (e.g., 'backend-spring')
32
+ * @returns {string} Absolute path to features-{platformId}.json
33
+ */
34
+ function getFeaturesFilePath(syncStateBizsDir, platformId) {
35
+ return path.join(syncStateBizsDir, `features-${platformId}.json`);
36
+ }
37
+
38
+ /**
39
+ * Get the entry-dirs JSON file path for a platform.
40
+ * @param {string} syncStateBizsDir - Absolute path to sync-state/knowledge-bizs/
41
+ * @param {string} platformId - Platform identifier
42
+ * @returns {string} Absolute path to entry-dirs-{platformId}.json
43
+ */
44
+ function getEntryDirsFilePath(syncStateBizsDir, platformId) {
45
+ return path.join(syncStateBizsDir, `entry-dirs-${platformId}.json`);
46
+ }
47
+
48
+ /**
49
+ * Get the feature document path in bizs knowledge base.
50
+ * @param {string} workspacePath - Absolute path to speccrew-workspace
51
+ * @param {string} platformId - Platform identifier
52
+ * @param {string} moduleName - Business module name
53
+ * @param {string} fileName - Document file name (without extension)
54
+ * @returns {string} Absolute path to the feature document
55
+ */
56
+ function getFeatureDocPath(workspacePath, platformId, moduleName, fileName) {
57
+ return path.join(workspacePath, 'knowledges', 'bizs', platformId, moduleName, `${fileName}.md`);
58
+ }
59
+
60
+ /**
61
+ * Get the graph knowledge file path.
62
+ * @param {string} workspacePath - Absolute path to speccrew-workspace
63
+ * @param {string} platformId - Platform identifier
64
+ * @param {string} moduleName - Business module name
65
+ * @param {string} fileName - Graph file name (e.g., 'knowledge-graph.json')
66
+ * @returns {string} Absolute path to the graph file
67
+ */
68
+ function getGraphFilePath(workspacePath, platformId, moduleName, fileName) {
69
+ return path.join(workspacePath, 'knowledges', 'bizs', platformId, moduleName, fileName);
70
+ }
71
+
72
+ /**
73
+ * Generate a standardized marker file name for dispatch tracking.
74
+ * Format: {module}-{subpath}-{fileName}.{type}.json
75
+ * @param {string} moduleName - Business module name
76
+ * @param {string} subpath - Sub-path within module (use '-' separator, empty string if none)
77
+ * @param {string} fileName - Source file name (without extension)
78
+ * @param {string} [type='done'] - Marker type ('done', 'error', 'skip')
79
+ * @returns {string} Marker file name
80
+ */
81
+ function getMarkerFileName(moduleName, subpath, fileName, type = 'done') {
82
+ const subpathPart = subpath ? `-${subpath.replace(/[\/\\]/g, '-')}` : '';
83
+ return `${moduleName}${subpathPart}-${fileName}.${type}.json`;
84
+ }
85
+
86
+ /**
87
+ * Get the completed markers directory path.
88
+ * @param {string} syncStateBizsDir - Absolute path to sync-state/knowledge-bizs/
89
+ * @returns {string} Absolute path to completed/ directory
90
+ */
91
+ function getCompletedDir(syncStateBizsDir) {
92
+ return path.join(syncStateBizsDir, 'completed');
93
+ }
94
+
95
+ /**
96
+ * Get the iterations directory path.
97
+ * @param {string} workspacePath - Absolute path to speccrew-workspace
98
+ * @returns {string} Absolute path to iterations/
99
+ */
100
+ function getIterationsDir(workspacePath) {
101
+ return path.join(workspacePath, 'iterations');
102
+ }
103
+
104
+ /**
105
+ * Get the configs directory path.
106
+ * @param {string} workspacePath - Absolute path to speccrew-workspace
107
+ * @returns {string} Absolute path to docs/configs/
108
+ */
109
+ function getConfigsDir(workspacePath) {
110
+ return path.join(workspacePath, 'docs', 'configs');
111
+ }
112
+
113
+ /**
114
+ * Get the update-progress.js script path.
115
+ * @param {string} workspacePath - Absolute path to speccrew-workspace
116
+ * @returns {string} Absolute path to scripts/update-progress.js
117
+ */
118
+ function getUpdateProgressScript(workspacePath) {
119
+ return path.join(workspacePath, 'scripts', 'update-progress.js');
120
+ }
121
+
122
+ module.exports = {
123
+ getSyncStateBizsDir,
124
+ getSyncStateTechsDir,
125
+ getFeaturesFilePath,
126
+ getEntryDirsFilePath,
127
+ getFeatureDocPath,
128
+ getGraphFilePath,
129
+ getMarkerFileName,
130
+ getCompletedDir,
131
+ getIterationsDir,
132
+ getConfigsDir,
133
+ getUpdateProgressScript
134
+ };