@hongmaple0820/scale-engine 0.14.0 → 0.15.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.
- package/dist/adapters/AiderAdapter.js +52 -52
- package/dist/adapters/ClaudeCodeAdapter.js +5 -5
- package/dist/adapters/DeepSeekTuiAdapter.js +5 -5
- package/dist/adapters/DoubaoAdapter.js +33 -33
- package/dist/adapters/KimiAdapter.js +32 -32
- package/dist/adapters/KiroAdapter.js +26 -26
- package/dist/adapters/WindsurfAdapter.js +32 -32
- package/dist/api/cli.js +58 -1
- package/dist/api/cli.js.map +1 -1
- package/dist/skills/routing/SkillPlanner.js +40 -40
- package/dist/workflow/GovernanceTemplatePacks.d.ts +1 -1
- package/dist/workflow/GovernanceTemplatePacks.js +56 -11
- package/dist/workflow/GovernanceTemplatePacks.js.map +1 -1
- package/dist/workflow/GovernanceTemplates.js +494 -494
- package/dist/workflow/TaskArtifactScaffolder.js +10 -10
- package/dist/workflow/WorkspaceLifecycle.d.ts +2 -0
- package/dist/workflow/WorkspaceLifecycle.js +34 -8
- package/dist/workflow/WorkspaceLifecycle.js.map +1 -1
- package/dist/workflow/WorkspaceTopology.d.ts +49 -0
- package/dist/workflow/WorkspaceTopology.js +125 -0
- package/dist/workflow/WorkspaceTopology.js.map +1 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.js +1 -0
- package/dist/workflow/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -120,58 +120,58 @@ export class AiderAdapter {
|
|
|
120
120
|
const stackLine = techStack.length > 0
|
|
121
121
|
? `\n## Tech Stack\n${techStack.map((t) => `- ${t}`).join('\n')}\n`
|
|
122
122
|
: '';
|
|
123
|
-
return `# ${projectName}
|
|
124
|
-
${stackLine}
|
|
125
|
-
## SCALE Engine Integration (Aider)
|
|
126
|
-
|
|
127
|
-
This project uses SCALE Engine for AI engineering governance via Aider CLI.
|
|
128
|
-
|
|
129
|
-
### Commands
|
|
130
|
-
- \`scale create <type> <title>\` — Create artifact
|
|
131
|
-
- \`scale transition <id> <action>\` — Transition artifact state
|
|
132
|
-
- \`scale list --type Spec\` — List artifacts
|
|
133
|
-
- \`scale role activate <role>\` — Switch role
|
|
134
|
-
- \`scale doctor\` — Health check
|
|
135
|
-
|
|
136
|
-
### Workflow
|
|
137
|
-
1. **Explore** → Role: explorer (Read/Grep only)
|
|
138
|
-
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
139
|
-
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
140
|
-
4. **Verify** → Must run tests before claiming done
|
|
141
|
-
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
142
|
-
|
|
143
|
-
### Rules
|
|
144
|
-
- 🔴 Dangerous commands are physically blocked
|
|
145
|
-
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
146
|
-
- 🟡 3 identical retries triggers brute-retry detection
|
|
147
|
-
- 🟡 Claiming done without running tests is blocked
|
|
148
|
-
- 🟢 All tool calls are tracked in .scale/events/
|
|
149
|
-
|
|
150
|
-
### Aider-Specific Notes
|
|
151
|
-
- Aider uses \`/add\` and \`/drop\` to manage context files
|
|
152
|
-
- Use \`/run\` for shell commands (SCALE hooks apply)
|
|
153
|
-
- Use \`/clear\` to reset context between phases
|
|
154
|
-
- SCALE hooks are defined in \`.aider.conf.yml\`
|
|
155
|
-
|
|
156
|
-
### Quick Reference
|
|
157
|
-
\`\`\`
|
|
158
|
-
# Start with exploration
|
|
159
|
-
> /add src/
|
|
160
|
-
> /read AIDER.md
|
|
161
|
-
|
|
162
|
-
# Plan phase
|
|
163
|
-
> scale create Spec "Feature name"
|
|
164
|
-
|
|
165
|
-
# Implement
|
|
166
|
-
> scale role activate implementer
|
|
167
|
-
> (make changes)
|
|
168
|
-
|
|
169
|
-
# Verify
|
|
170
|
-
> /run npm test
|
|
171
|
-
|
|
172
|
-
# Complete
|
|
173
|
-
> scale transition <id> approve
|
|
174
|
-
\`\`\`
|
|
123
|
+
return `# ${projectName}
|
|
124
|
+
${stackLine}
|
|
125
|
+
## SCALE Engine Integration (Aider)
|
|
126
|
+
|
|
127
|
+
This project uses SCALE Engine for AI engineering governance via Aider CLI.
|
|
128
|
+
|
|
129
|
+
### Commands
|
|
130
|
+
- \`scale create <type> <title>\` — Create artifact
|
|
131
|
+
- \`scale transition <id> <action>\` — Transition artifact state
|
|
132
|
+
- \`scale list --type Spec\` — List artifacts
|
|
133
|
+
- \`scale role activate <role>\` — Switch role
|
|
134
|
+
- \`scale doctor\` — Health check
|
|
135
|
+
|
|
136
|
+
### Workflow
|
|
137
|
+
1. **Explore** → Role: explorer (Read/Grep only)
|
|
138
|
+
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
139
|
+
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
140
|
+
4. **Verify** → Must run tests before claiming done
|
|
141
|
+
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
142
|
+
|
|
143
|
+
### Rules
|
|
144
|
+
- 🔴 Dangerous commands are physically blocked
|
|
145
|
+
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
146
|
+
- 🟡 3 identical retries triggers brute-retry detection
|
|
147
|
+
- 🟡 Claiming done without running tests is blocked
|
|
148
|
+
- 🟢 All tool calls are tracked in .scale/events/
|
|
149
|
+
|
|
150
|
+
### Aider-Specific Notes
|
|
151
|
+
- Aider uses \`/add\` and \`/drop\` to manage context files
|
|
152
|
+
- Use \`/run\` for shell commands (SCALE hooks apply)
|
|
153
|
+
- Use \`/clear\` to reset context between phases
|
|
154
|
+
- SCALE hooks are defined in \`.aider.conf.yml\`
|
|
155
|
+
|
|
156
|
+
### Quick Reference
|
|
157
|
+
\`\`\`
|
|
158
|
+
# Start with exploration
|
|
159
|
+
> /add src/
|
|
160
|
+
> /read AIDER.md
|
|
161
|
+
|
|
162
|
+
# Plan phase
|
|
163
|
+
> scale create Spec "Feature name"
|
|
164
|
+
|
|
165
|
+
# Implement
|
|
166
|
+
> scale role activate implementer
|
|
167
|
+
> (make changes)
|
|
168
|
+
|
|
169
|
+
# Verify
|
|
170
|
+
> /run npm test
|
|
171
|
+
|
|
172
|
+
# Complete
|
|
173
|
+
> scale transition <id> approve
|
|
174
|
+
\`\`\`
|
|
175
175
|
`;
|
|
176
176
|
}
|
|
177
177
|
async init(config) {
|
|
@@ -161,11 +161,11 @@ This project uses SCALE Engine for AI engineering governance.
|
|
|
161
161
|
writeFileSync(gitignorePath, `# SCALE Engine runtime data
|
|
162
162
|
*.db
|
|
163
163
|
*.db-journal
|
|
164
|
-
events/
|
|
165
|
-
checkpoints/
|
|
166
|
-
evidence/
|
|
167
|
-
state/
|
|
168
|
-
hooks/*.sh
|
|
164
|
+
events/
|
|
165
|
+
checkpoints/
|
|
166
|
+
evidence/
|
|
167
|
+
state/
|
|
168
|
+
hooks/*.sh
|
|
169
169
|
`, 'utf-8');
|
|
170
170
|
created.push(gitignorePath);
|
|
171
171
|
}
|
|
@@ -242,11 +242,11 @@ define → plan → build → verify → review → ship
|
|
|
242
242
|
*.db
|
|
243
243
|
*.db-shm
|
|
244
244
|
*.db-wal
|
|
245
|
-
events/
|
|
246
|
-
checkpoints/
|
|
247
|
-
evidence/
|
|
248
|
-
state/
|
|
249
|
-
hooks/*.sh
|
|
245
|
+
events/
|
|
246
|
+
checkpoints/
|
|
247
|
+
evidence/
|
|
248
|
+
state/
|
|
249
|
+
hooks/*.sh
|
|
250
250
|
`, 'utf-8');
|
|
251
251
|
created.push(gitignorePath);
|
|
252
252
|
}
|
|
@@ -75,39 +75,39 @@ export class DoubaoAdapter {
|
|
|
75
75
|
const stackLine = techStack.length > 0
|
|
76
76
|
? `\n## Tech Stack\n${techStack.map((t) => `- ${t}`).join('\n')}\n`
|
|
77
77
|
: '';
|
|
78
|
-
return `# ${projectName}
|
|
79
|
-
${stackLine}
|
|
80
|
-
## SCALE Engine Integration (Doubao)
|
|
81
|
-
|
|
82
|
-
This project uses SCALE Engine for AI engineering governance via Doubao (ByteDance AI).
|
|
83
|
-
|
|
84
|
-
### Commands
|
|
85
|
-
- \`scale create <type> <title>\` — Create artifact
|
|
86
|
-
- \`scale transition <id> <action>\` — Transition artifact state
|
|
87
|
-
- \`scale list --type Spec\` — List artifacts
|
|
88
|
-
- \`scale role activate <role>\` — Switch role
|
|
89
|
-
- \`scale doctor\` — Health check
|
|
90
|
-
|
|
91
|
-
### Workflow
|
|
92
|
-
1. **Explore** → Role: explorer (Read/Grep only)
|
|
93
|
-
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
94
|
-
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
95
|
-
4. **Verify** → Must run tests before claiming done
|
|
96
|
-
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
97
|
-
|
|
98
|
-
### Rules
|
|
99
|
-
- 🔴 Dangerous commands are physically blocked
|
|
100
|
-
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
101
|
-
- 🟡 3 identical retries triggers brute-retry detection
|
|
102
|
-
- 🟡 Claiming done without running tests is blocked
|
|
103
|
-
- 🟢 All tool calls are tracked in .scale/events/
|
|
104
|
-
|
|
105
|
-
### Doubao-Specific Notes
|
|
106
|
-
- Doubao supports Chinese-optimized reasoning
|
|
107
|
-
- Use Doubao for Chinese documentation and analysis
|
|
108
|
-
- This rules.md file provides AI assistant context
|
|
109
|
-
- SCALE hooks are defined in \`.doubao/settings.json\`
|
|
110
|
-
- ByteDance Trae IDE users may also use \`scale init --agent trae\`
|
|
78
|
+
return `# ${projectName}
|
|
79
|
+
${stackLine}
|
|
80
|
+
## SCALE Engine Integration (Doubao)
|
|
81
|
+
|
|
82
|
+
This project uses SCALE Engine for AI engineering governance via Doubao (ByteDance AI).
|
|
83
|
+
|
|
84
|
+
### Commands
|
|
85
|
+
- \`scale create <type> <title>\` — Create artifact
|
|
86
|
+
- \`scale transition <id> <action>\` — Transition artifact state
|
|
87
|
+
- \`scale list --type Spec\` — List artifacts
|
|
88
|
+
- \`scale role activate <role>\` — Switch role
|
|
89
|
+
- \`scale doctor\` — Health check
|
|
90
|
+
|
|
91
|
+
### Workflow
|
|
92
|
+
1. **Explore** → Role: explorer (Read/Grep only)
|
|
93
|
+
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
94
|
+
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
95
|
+
4. **Verify** → Must run tests before claiming done
|
|
96
|
+
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
97
|
+
|
|
98
|
+
### Rules
|
|
99
|
+
- 🔴 Dangerous commands are physically blocked
|
|
100
|
+
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
101
|
+
- 🟡 3 identical retries triggers brute-retry detection
|
|
102
|
+
- 🟡 Claiming done without running tests is blocked
|
|
103
|
+
- 🟢 All tool calls are tracked in .scale/events/
|
|
104
|
+
|
|
105
|
+
### Doubao-Specific Notes
|
|
106
|
+
- Doubao supports Chinese-optimized reasoning
|
|
107
|
+
- Use Doubao for Chinese documentation and analysis
|
|
108
|
+
- This rules.md file provides AI assistant context
|
|
109
|
+
- SCALE hooks are defined in \`.doubao/settings.json\`
|
|
110
|
+
- ByteDance Trae IDE users may also use \`scale init --agent trae\`
|
|
111
111
|
`;
|
|
112
112
|
}
|
|
113
113
|
async init(config) {
|
|
@@ -75,38 +75,38 @@ export class KimiAdapter {
|
|
|
75
75
|
const stackLine = techStack.length > 0
|
|
76
76
|
? `\n## Tech Stack\n${techStack.map((t) => `- ${t}`).join('\n')}\n`
|
|
77
77
|
: '';
|
|
78
|
-
return `# ${projectName}
|
|
79
|
-
${stackLine}
|
|
80
|
-
## SCALE Engine Integration (Kimi)
|
|
81
|
-
|
|
82
|
-
This project uses SCALE Engine for AI engineering governance via Kimi (Moonshot AI).
|
|
83
|
-
|
|
84
|
-
### Commands
|
|
85
|
-
- \`scale create <type> <title>\` — Create artifact
|
|
86
|
-
- \`scale transition <id> <action>\` — Transition artifact state
|
|
87
|
-
- \`scale list --type Spec\` — List artifacts
|
|
88
|
-
- \`scale role activate <role>\` — Switch role
|
|
89
|
-
- \`scale doctor\` — Health check
|
|
90
|
-
|
|
91
|
-
### Workflow
|
|
92
|
-
1. **Explore** → Role: explorer (Read/Grep only)
|
|
93
|
-
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
94
|
-
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
95
|
-
4. **Verify** → Must run tests before claiming done
|
|
96
|
-
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
97
|
-
|
|
98
|
-
### Rules
|
|
99
|
-
- 🔴 Dangerous commands are physically blocked
|
|
100
|
-
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
101
|
-
- 🟡 3 identical retries triggers brute-retry detection
|
|
102
|
-
- 🟡 Claiming done without running tests is blocked
|
|
103
|
-
- 🟢 All tool calls are tracked in .scale/events/
|
|
104
|
-
|
|
105
|
-
### Kimi-Specific Notes
|
|
106
|
-
- Kimi supports long-context reasoning (200K+ tokens)
|
|
107
|
-
- Use Kimi for complex analysis and documentation tasks
|
|
108
|
-
- This rules.md file provides AI assistant context
|
|
109
|
-
- SCALE hooks are defined in \`.kimi/settings.json\`
|
|
78
|
+
return `# ${projectName}
|
|
79
|
+
${stackLine}
|
|
80
|
+
## SCALE Engine Integration (Kimi)
|
|
81
|
+
|
|
82
|
+
This project uses SCALE Engine for AI engineering governance via Kimi (Moonshot AI).
|
|
83
|
+
|
|
84
|
+
### Commands
|
|
85
|
+
- \`scale create <type> <title>\` — Create artifact
|
|
86
|
+
- \`scale transition <id> <action>\` — Transition artifact state
|
|
87
|
+
- \`scale list --type Spec\` — List artifacts
|
|
88
|
+
- \`scale role activate <role>\` — Switch role
|
|
89
|
+
- \`scale doctor\` — Health check
|
|
90
|
+
|
|
91
|
+
### Workflow
|
|
92
|
+
1. **Explore** → Role: explorer (Read/Grep only)
|
|
93
|
+
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
94
|
+
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
95
|
+
4. **Verify** → Must run tests before claiming done
|
|
96
|
+
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
97
|
+
|
|
98
|
+
### Rules
|
|
99
|
+
- 🔴 Dangerous commands are physically blocked
|
|
100
|
+
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
101
|
+
- 🟡 3 identical retries triggers brute-retry detection
|
|
102
|
+
- 🟡 Claiming done without running tests is blocked
|
|
103
|
+
- 🟢 All tool calls are tracked in .scale/events/
|
|
104
|
+
|
|
105
|
+
### Kimi-Specific Notes
|
|
106
|
+
- Kimi supports long-context reasoning (200K+ tokens)
|
|
107
|
+
- Use Kimi for complex analysis and documentation tasks
|
|
108
|
+
- This rules.md file provides AI assistant context
|
|
109
|
+
- SCALE hooks are defined in \`.kimi/settings.json\`
|
|
110
110
|
`;
|
|
111
111
|
}
|
|
112
112
|
async init(config) {
|
|
@@ -75,32 +75,32 @@ export class KiroAdapter {
|
|
|
75
75
|
const stackLine = techStack.length > 0
|
|
76
76
|
? `\n## Tech Stack\n${techStack.map((t) => `- ${t}`).join('\n')}\n`
|
|
77
77
|
: '';
|
|
78
|
-
return `# ${projectName}
|
|
79
|
-
${stackLine}
|
|
80
|
-
## SCALE Engine Integration (Kiro)
|
|
81
|
-
|
|
82
|
-
This project uses SCALE Engine for AI engineering governance via Kiro.
|
|
83
|
-
|
|
84
|
-
### Commands
|
|
85
|
-
- \`scale create <type> <title>\` — Create artifact
|
|
86
|
-
- \`scale transition <id> <action>\` — Transition artifact state
|
|
87
|
-
- \`scale list --type Spec\` — List artifacts
|
|
88
|
-
- \`scale role activate <role>\` — Switch role
|
|
89
|
-
- \`scale doctor\` — Health check
|
|
90
|
-
|
|
91
|
-
### Workflow
|
|
92
|
-
1. **Explore** → Role: explorer (Read/Grep only)
|
|
93
|
-
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
94
|
-
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
95
|
-
4. **Verify** → Must run tests before claiming done
|
|
96
|
-
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
97
|
-
|
|
98
|
-
### Rules
|
|
99
|
-
- 🔴 Dangerous commands are physically blocked
|
|
100
|
-
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
101
|
-
- 🟡 3 identical retries triggers brute-retry detection
|
|
102
|
-
- 🟡 Claiming done without running tests is blocked
|
|
103
|
-
- 🟢 All tool calls are tracked in .scale/events/
|
|
78
|
+
return `# ${projectName}
|
|
79
|
+
${stackLine}
|
|
80
|
+
## SCALE Engine Integration (Kiro)
|
|
81
|
+
|
|
82
|
+
This project uses SCALE Engine for AI engineering governance via Kiro.
|
|
83
|
+
|
|
84
|
+
### Commands
|
|
85
|
+
- \`scale create <type> <title>\` — Create artifact
|
|
86
|
+
- \`scale transition <id> <action>\` — Transition artifact state
|
|
87
|
+
- \`scale list --type Spec\` — List artifacts
|
|
88
|
+
- \`scale role activate <role>\` — Switch role
|
|
89
|
+
- \`scale doctor\` — Health check
|
|
90
|
+
|
|
91
|
+
### Workflow
|
|
92
|
+
1. **Explore** → Role: explorer (Read/Grep only)
|
|
93
|
+
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
94
|
+
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
95
|
+
4. **Verify** → Must run tests before claiming done
|
|
96
|
+
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
97
|
+
|
|
98
|
+
### Rules
|
|
99
|
+
- 🔴 Dangerous commands are physically blocked
|
|
100
|
+
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
101
|
+
- 🟡 3 identical retries triggers brute-retry detection
|
|
102
|
+
- 🟡 Claiming done without running tests is blocked
|
|
103
|
+
- 🟢 All tool calls are tracked in .scale/events/
|
|
104
104
|
`;
|
|
105
105
|
}
|
|
106
106
|
async init(config) {
|
|
@@ -77,38 +77,38 @@ export class WindsurfAdapter {
|
|
|
77
77
|
const stackLine = techStack.length > 0
|
|
78
78
|
? `\n## Tech Stack\n${techStack.map((t) => `- ${t}`).join('\n')}\n`
|
|
79
79
|
: '';
|
|
80
|
-
return `# ${projectName}
|
|
81
|
-
${stackLine}
|
|
82
|
-
## SCALE Engine Integration (Windsurf)
|
|
83
|
-
|
|
84
|
-
This project uses SCALE Engine for AI engineering governance via Windsurf.
|
|
85
|
-
|
|
86
|
-
### Commands
|
|
87
|
-
- \`scale create <type> <title>\` — Create artifact
|
|
88
|
-
- \`scale transition <id> <action>\` — Transition artifact state
|
|
89
|
-
- \`scale list --type Spec\` — List artifacts
|
|
90
|
-
- \`scale role activate <role>\` — Switch role
|
|
91
|
-
- \`scale doctor\` — Health check
|
|
92
|
-
|
|
93
|
-
### Workflow
|
|
94
|
-
1. **Explore** → Role: explorer (Read/Grep only)
|
|
95
|
-
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
96
|
-
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
97
|
-
4. **Verify** → Must run tests before claiming done
|
|
98
|
-
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
99
|
-
|
|
100
|
-
### Rules
|
|
101
|
-
- 🔴 Dangerous commands are physically blocked
|
|
102
|
-
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
103
|
-
- 🟡 3 identical retries triggers brute-retry detection
|
|
104
|
-
- 🟡 Claiming done without running tests is blocked
|
|
105
|
-
- 🟢 All tool calls are tracked in .scale/events/
|
|
106
|
-
|
|
107
|
-
### Windsurf-Specific Notes
|
|
108
|
-
- Windsurf uses Cascade Flow for multi-file editing
|
|
109
|
-
- Use Chat mode for quick questions, Cascade for complex tasks
|
|
110
|
-
- This rules.md file provides AI assistant context
|
|
111
|
-
- SCALE hooks are defined in \`.windsurf/settings.json\`
|
|
80
|
+
return `# ${projectName}
|
|
81
|
+
${stackLine}
|
|
82
|
+
## SCALE Engine Integration (Windsurf)
|
|
83
|
+
|
|
84
|
+
This project uses SCALE Engine for AI engineering governance via Windsurf.
|
|
85
|
+
|
|
86
|
+
### Commands
|
|
87
|
+
- \`scale create <type> <title>\` — Create artifact
|
|
88
|
+
- \`scale transition <id> <action>\` — Transition artifact state
|
|
89
|
+
- \`scale list --type Spec\` — List artifacts
|
|
90
|
+
- \`scale role activate <role>\` — Switch role
|
|
91
|
+
- \`scale doctor\` — Health check
|
|
92
|
+
|
|
93
|
+
### Workflow
|
|
94
|
+
1. **Explore** → Role: explorer (Read/Grep only)
|
|
95
|
+
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
96
|
+
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
97
|
+
4. **Verify** → Must run tests before claiming done
|
|
98
|
+
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
99
|
+
|
|
100
|
+
### Rules
|
|
101
|
+
- 🔴 Dangerous commands are physically blocked
|
|
102
|
+
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
103
|
+
- 🟡 3 identical retries triggers brute-retry detection
|
|
104
|
+
- 🟡 Claiming done without running tests is blocked
|
|
105
|
+
- 🟢 All tool calls are tracked in .scale/events/
|
|
106
|
+
|
|
107
|
+
### Windsurf-Specific Notes
|
|
108
|
+
- Windsurf uses Cascade Flow for multi-file editing
|
|
109
|
+
- Use Chat mode for quick questions, Cascade for complex tasks
|
|
110
|
+
- This rules.md file provides AI assistant context
|
|
111
|
+
- SCALE hooks are defined in \`.windsurf/settings.json\`
|
|
112
112
|
`;
|
|
113
113
|
}
|
|
114
114
|
async init(config) {
|
package/dist/api/cli.js
CHANGED
|
@@ -35,6 +35,7 @@ import { TaskMetricsStore } from '../workflow/TaskMetricsStore.js';
|
|
|
35
35
|
import { checkTaskArtifactCompleteness } from '../workflow/TaskArtifactScaffolder.js';
|
|
36
36
|
import { WorkflowArtifactWriter } from '../workflow/WorkflowArtifactWriter.js';
|
|
37
37
|
import { cleanupWorkspaceLifecycle, inspectWorkspaceLifecycle, } from '../workflow/WorkspaceLifecycle.js';
|
|
38
|
+
import { resolveWorkspaceTopology, workspaceTopologyPath, workspaceTopologyTemplate, } from '../workflow/WorkspaceTopology.js';
|
|
38
39
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
39
40
|
import { join, resolve } from 'node:path';
|
|
40
41
|
// ============================================================================
|
|
@@ -826,6 +827,7 @@ const taskArtifacts = defineCommand({
|
|
|
826
827
|
});
|
|
827
828
|
function printWorkspaceLifecycle(report) {
|
|
828
829
|
console.log('\nSCALE Workspace Lifecycle');
|
|
830
|
+
console.log(` Topology: ${report.topology.topology}${report.topology.configured ? '' : ' (default)'}`);
|
|
829
831
|
console.log(` Root: ${report.root.path}`);
|
|
830
832
|
console.log(` Branch: ${report.root.branch ?? '(detached)'}`);
|
|
831
833
|
console.log(` Linked worktree: ${report.root.isLinkedWorktree ? 'yes' : 'no'}`);
|
|
@@ -852,6 +854,19 @@ function printWorkspaceLifecycle(report) {
|
|
|
852
854
|
for (const action of report.finish.nextActions)
|
|
853
855
|
console.log(` [NEXT] ${action}`);
|
|
854
856
|
}
|
|
857
|
+
function printWorkspaceTopology(topology, written) {
|
|
858
|
+
console.log('\nSCALE Workspace Topology');
|
|
859
|
+
console.log(` Topology: ${topology.topology}${topology.configured ? '' : ' (default)'}`);
|
|
860
|
+
console.log(` Config: ${topology.configPath}`);
|
|
861
|
+
if (written)
|
|
862
|
+
console.log(` Written: ${written}`);
|
|
863
|
+
console.log('\n Repositories:');
|
|
864
|
+
for (const repo of topology.repositories) {
|
|
865
|
+
console.log(` - ${repo.name}: ${repo.path} (${repo.role}) required=${repo.required !== false ? 'yes' : 'no'}`);
|
|
866
|
+
}
|
|
867
|
+
for (const warning of topology.warnings)
|
|
868
|
+
console.log(` [WARN] ${warning}`);
|
|
869
|
+
}
|
|
855
870
|
function printWorkspaceCleanup(result) {
|
|
856
871
|
printWorkspaceLifecycle(result.report);
|
|
857
872
|
console.log('\n Cleanup plan:');
|
|
@@ -885,6 +900,35 @@ const workspaceStatus = defineCommand({
|
|
|
885
900
|
process.exitCode = 1;
|
|
886
901
|
},
|
|
887
902
|
});
|
|
903
|
+
const workspaceMap = defineCommand({
|
|
904
|
+
meta: { name: 'map', description: 'Resolve or write explicit workspace topology for single, monorepo, polyrepo, submodule, or MOE projects' },
|
|
905
|
+
args: {
|
|
906
|
+
dir: { type: 'string', description: 'Project directory; defaults to current project directory' },
|
|
907
|
+
topology: { type: 'string', default: 'moe', description: 'Starter topology for --write (single/monorepo/polyrepo/submodule-workspace/moe)' },
|
|
908
|
+
write: { type: 'boolean', default: false, description: 'Create .scale/workspace.json when it does not exist' },
|
|
909
|
+
json: { type: 'boolean', default: false },
|
|
910
|
+
},
|
|
911
|
+
run({ args }) {
|
|
912
|
+
const projectDir = resolve(args.dir ?? PROJECT_DIR);
|
|
913
|
+
const target = workspaceTopologyPath(projectDir);
|
|
914
|
+
let written = null;
|
|
915
|
+
if (isTruthyFlag(args.write) && !existsSync(target)) {
|
|
916
|
+
ensureDir(join(projectDir, '.scale'));
|
|
917
|
+
writeFileSync(target, workspaceTopologyTemplate({
|
|
918
|
+
topology: normalizeWorkspaceTopologyKind(args.topology),
|
|
919
|
+
}), 'utf-8');
|
|
920
|
+
written = target;
|
|
921
|
+
}
|
|
922
|
+
const topology = resolveWorkspaceTopology({ projectDir });
|
|
923
|
+
const result = { ...topology, written };
|
|
924
|
+
if (args.json) {
|
|
925
|
+
console.log(JSON.stringify(result, null, 2));
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
printWorkspaceTopology(topology, written);
|
|
929
|
+
}
|
|
930
|
+
},
|
|
931
|
+
});
|
|
888
932
|
const workspaceFinish = defineCommand({
|
|
889
933
|
meta: { name: 'finish', description: 'Check whether a temporary worktree can be safely finished or cleaned up' },
|
|
890
934
|
args: {
|
|
@@ -896,6 +940,7 @@ const workspaceFinish = defineCommand({
|
|
|
896
940
|
const result = {
|
|
897
941
|
root: report.root,
|
|
898
942
|
childRepositories: report.childRepositories,
|
|
943
|
+
topology: report.topology,
|
|
899
944
|
finish: report.finish,
|
|
900
945
|
};
|
|
901
946
|
if (args.json) {
|
|
@@ -936,11 +981,23 @@ const workspaceCleanup = defineCommand({
|
|
|
936
981
|
const workspace = defineCommand({
|
|
937
982
|
meta: { name: 'workspace', description: 'Inspect worktree, branch, and child repository lifecycle safety' },
|
|
938
983
|
subCommands: {
|
|
984
|
+
map: workspaceMap,
|
|
939
985
|
status: workspaceStatus,
|
|
940
986
|
finish: workspaceFinish,
|
|
941
987
|
cleanup: workspaceCleanup,
|
|
942
988
|
},
|
|
943
989
|
});
|
|
990
|
+
function normalizeWorkspaceTopologyKind(value) {
|
|
991
|
+
const normalized = String(value ?? 'moe').trim();
|
|
992
|
+
if (normalized === 'single'
|
|
993
|
+
|| normalized === 'monorepo'
|
|
994
|
+
|| normalized === 'polyrepo'
|
|
995
|
+
|| normalized === 'submodule-workspace'
|
|
996
|
+
|| normalized === 'moe') {
|
|
997
|
+
return normalized;
|
|
998
|
+
}
|
|
999
|
+
return 'moe';
|
|
1000
|
+
}
|
|
944
1001
|
const preflight = defineCommand({
|
|
945
1002
|
meta: { name: 'preflight', description: 'Run service-aware verification without a task artifact' },
|
|
946
1003
|
args: {
|
|
@@ -1150,7 +1207,7 @@ const init = defineCommand({
|
|
|
1150
1207
|
'governance-pack': {
|
|
1151
1208
|
type: 'string',
|
|
1152
1209
|
default: 'standard',
|
|
1153
|
-
description: 'Governance template pack (standard/project-scaffold/go-service-matrix/node-library/frontend-app)',
|
|
1210
|
+
description: 'Governance template pack (standard/project-scaffold/moe-workspace/go-service-matrix/node-library/frontend-app)',
|
|
1154
1211
|
},
|
|
1155
1212
|
quick: { type: 'boolean', default: false, description: 'Quick start with auto-detection' },
|
|
1156
1213
|
interactive: { type: 'boolean', default: false, description: 'Interactive configuration mode with prompts' },
|