@hongmaple0820/scale-engine 0.25.0 → 0.27.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/LICENSE +15 -15
- package/README.en.md +384 -346
- package/README.md +564 -529
- package/dist/adapters/AiderAdapter.js +52 -52
- package/dist/adapters/AntigravityAdapter.d.ts +4 -0
- package/dist/adapters/AntigravityAdapter.js +21 -0
- package/dist/adapters/AntigravityAdapter.js.map +1 -0
- package/dist/adapters/ClaudeCodeAdapter.d.ts +4 -1
- package/dist/adapters/ClaudeCodeAdapter.js +34 -34
- package/dist/adapters/ClaudeCodeAdapter.js.map +1 -1
- package/dist/adapters/ClineAdapter.d.ts +4 -0
- package/dist/adapters/ClineAdapter.js +20 -0
- package/dist/adapters/ClineAdapter.js.map +1 -0
- package/dist/adapters/CodexAdapter.js +28 -28
- package/dist/adapters/CursorAdapter.js +26 -26
- package/dist/adapters/DeepSeekTuiAdapter.js +97 -97
- package/dist/adapters/DoubaoAdapter.js +33 -33
- package/dist/adapters/GeminiAdapter.js +26 -26
- package/dist/adapters/GenericProjectAgentAdapter.d.ts +29 -0
- package/dist/adapters/GenericProjectAgentAdapter.js +204 -0
- package/dist/adapters/GenericProjectAgentAdapter.js.map +1 -0
- package/dist/adapters/HermesAdapter.js +26 -26
- package/dist/adapters/JCodeAdapter.d.ts +4 -0
- package/dist/adapters/JCodeAdapter.js +19 -0
- package/dist/adapters/JCodeAdapter.js.map +1 -0
- package/dist/adapters/KiloCodeAdapter.d.ts +4 -0
- package/dist/adapters/KiloCodeAdapter.js +20 -0
- package/dist/adapters/KiloCodeAdapter.js.map +1 -0
- package/dist/adapters/KimiAdapter.js +32 -32
- package/dist/adapters/KiroAdapter.js +26 -26
- package/dist/adapters/OpenClawAdapter.js +26 -26
- package/dist/adapters/OpenCodeAdapter.js +26 -26
- package/dist/adapters/QCoderAdapter.js +26 -26
- package/dist/adapters/QoderAdapter.d.ts +4 -0
- package/dist/adapters/QoderAdapter.js +21 -0
- package/dist/adapters/QoderAdapter.js.map +1 -0
- package/dist/adapters/TraeAdapter.js +26 -26
- package/dist/adapters/VSCAdapter.js +26 -26
- package/dist/adapters/WindsurfAdapter.js +32 -32
- package/dist/adapters/WorkBuddyAdapter.js +26 -26
- package/dist/adapters/index.d.ts +5 -0
- package/dist/adapters/index.js +15 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/api/cli.js +190 -56
- package/dist/api/cli.js.map +1 -1
- package/dist/api/doctor.js +10 -3
- package/dist/api/doctor.js.map +1 -1
- package/dist/api/quickstart.js +7 -1
- package/dist/api/quickstart.js.map +1 -1
- package/dist/artifact/sqliteStore.js +89 -89
- package/dist/artifact/types.d.ts +1 -1
- package/dist/cli/phaseCommands.js +53 -53
- package/dist/cli/phaseCommands.js.map +1 -1
- package/dist/context/AntiPatternRegistry.js +20 -20
- package/dist/context/ContextBudget.d.ts +14 -0
- package/dist/context/ContextBudget.js +50 -14
- package/dist/context/ContextBudget.js.map +1 -1
- package/dist/context/ContextBuilder.js +155 -155
- package/dist/context/ContextCompiler.d.ts +34 -0
- package/dist/context/ContextCompiler.js +120 -0
- package/dist/context/ContextCompiler.js.map +1 -0
- package/dist/eval/WorkflowEval.js +4 -6
- package/dist/eval/WorkflowEval.js.map +1 -1
- package/dist/evolution/EvolutionEngine.js +31 -31
- package/dist/evolution/EvolutionEvaluator.d.ts +2 -0
- package/dist/evolution/EvolutionEvaluator.js +7 -1
- package/dist/evolution/EvolutionEvaluator.js.map +1 -1
- package/dist/fsm/FSMAgentBridge.js +11 -11
- package/dist/governance/GovernanceRoi.d.ts +6 -1
- package/dist/governance/GovernanceRoi.js +32 -0
- package/dist/governance/GovernanceRoi.js.map +1 -1
- package/dist/guardrails/DependencyAuditor.js +38 -0
- package/dist/guardrails/DependencyAuditor.js.map +1 -1
- package/dist/hooks/HookGeneratorEnhanced.js +218 -218
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/knowledge/SQLiteKnowledgeBase.js +28 -28
- package/dist/memory/MemoryBrain.js +52 -52
- package/dist/output/GovernanceDashboard.js +44 -44
- package/dist/output/HTMLArtifactLayer.js +31 -31
- package/dist/prompts/VibeTemplateGallery.js +121 -121
- package/dist/runtime/AiOsRuntime.d.ts +53 -0
- package/dist/runtime/AiOsRuntime.js +142 -0
- package/dist/runtime/AiOsRuntime.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/skills/SkillDiscovery.js +12 -1
- package/dist/skills/SkillDiscovery.js.map +1 -1
- package/dist/skills/routing/SkillPlanner.js +128 -40
- package/dist/skills/routing/SkillPlanner.js.map +1 -1
- package/dist/skills/routing/SkillRoutingTypes.d.ts +17 -0
- package/dist/tools/SafeCommandRunner.d.ts +16 -0
- package/dist/tools/SafeCommandRunner.js +83 -0
- package/dist/tools/SafeCommandRunner.js.map +1 -0
- package/dist/workflow/EngineeringStandards.js +62 -62
- package/dist/workflow/GovernanceTemplatePacks.d.ts +1 -1
- package/dist/workflow/GovernanceTemplatePacks.js +1990 -162
- package/dist/workflow/GovernanceTemplatePacks.js.map +1 -1
- package/dist/workflow/GovernanceTemplates.d.ts +2 -0
- package/dist/workflow/GovernanceTemplates.js +1012 -1001
- package/dist/workflow/GovernanceTemplates.js.map +1 -1
- package/dist/workflow/ResourceGovernance.js +16 -16
- package/dist/workflow/TaskArtifactScaffolder.js +10 -10
- package/dist/workflow/UpgradeManager.d.ts +3 -2
- package/dist/workflow/UpgradeManager.js +134 -49
- package/dist/workflow/UpgradeManager.js.map +1 -1
- package/dist/workflow/WorkspaceTopology.js +18 -15
- package/dist/workflow/WorkspaceTopology.js.map +1 -1
- package/dist/workflow/gates/GateSystem.js +3 -9
- package/dist/workflow/gates/GateSystem.js.map +1 -1
- package/docs/ACTIVE_SECURITY_VISUAL_GATES.md +87 -87
- package/docs/AI_ENGINEERING_OS_POSITIONING.md +462 -0
- package/docs/BACKGROUND_HUNTER.md +62 -62
- package/docs/CODE_INTELLIGENCE.md +138 -138
- package/docs/CONTEXT_BUDGET.md +155 -113
- package/docs/DEPENDENCY_AUDIT.md +118 -89
- package/docs/EVOLUTION_SHADOW_MODE.md +63 -63
- package/docs/EXTERNAL_REFERENCES.md +63 -58
- package/docs/GITLAB_FLOW.md +125 -125
- package/docs/GOVERNANCE_DASHBOARD.md +85 -85
- package/docs/MEMORY_BRAIN.md +104 -104
- package/docs/MEMORY_FABRIC.md +136 -134
- package/docs/README.md +102 -92
- package/docs/RUNTIME_EVIDENCE.md +101 -101
- package/docs/SKILL-REPOSITORY.md +57 -57
- package/docs/SKILL_RADAR.md +135 -122
- package/docs/THIRD_PARTY_SKILLS.md +57 -57
- package/docs/WORKFLOW_EVAL.md +151 -151
- package/docs/guides/DEVELOPMENT_WORKFLOW.md +80 -0
- package/docs/guides/GETTING_STARTED.md +50 -0
- package/docs/start/README.md +78 -72
- package/docs/start/agent-governance-demo.md +107 -107
- package/docs/start/quickstart.md +137 -127
- package/docs/start/workflow-upgrade.md +32 -8
- package/docs/workflow/README.md +67 -0
- package/docs/workflow/node-library.md +52 -0
- package/docs/workflow/templates/api-contract.md +29 -0
- package/docs/workflow/templates/architecture-review.md +23 -0
- package/docs/workflow/templates/db-change-plan.md +20 -0
- package/docs/workflow/templates/docs-impact.md +17 -0
- package/docs/workflow/templates/e2e-plan.md +20 -0
- package/docs/workflow/templates/explore.md +16 -0
- package/docs/workflow/templates/github-actions-scale-preflight.yml +32 -0
- package/docs/workflow/templates/mini-prd.md +16 -0
- package/docs/workflow/templates/plan.md +37 -0
- package/docs/workflow/templates/pre-push-scale-preflight.sh +8 -0
- package/docs/workflow/templates/product-smoke.md +61 -0
- package/docs/workflow/templates/reality-check.md +28 -0
- package/docs/workflow/templates/resource-cleanup.md +17 -0
- package/docs/workflow/templates/resource-impact.md +25 -0
- package/docs/workflow/templates/review.md +12 -0
- package/docs/workflow/templates/runtime.md +23 -0
- package/docs/workflow/templates/security-review.md +26 -0
- package/docs/workflow/templates/skill-evidence.md +33 -0
- package/docs/workflow/templates/skill-plan.md +39 -0
- package/docs/workflow/templates/spec.md +17 -0
- package/docs/workflow/templates/standards-impact.md +28 -0
- package/docs/workflow/templates/summary.md +16 -0
- package/docs/workflow/templates/tasks.md +8 -0
- package/docs/workflow/templates/ui-spec.md +29 -0
- package/docs/workflow/templates/verification.md +20 -0
- package/docs/workflow/templates/visual-review.md +20 -0
- package/examples/demo-projects/agent-governance-demo/CONTEXT.md +14 -14
- package/examples/demo-projects/agent-governance-demo/README.md +48 -48
- package/examples/demo-projects/agent-governance-demo/docs/CONTEXT-MAP.md +14 -14
- package/examples/demo-projects/agent-governance-demo/package.json +22 -21
- package/examples/demo-projects/agent-governance-demo/src/oauth-state.ts +39 -39
- package/examples/demo-projects/agent-governance-demo/tests/oauth-state.test.ts +52 -52
- package/package.json +95 -78
|
@@ -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) {
|
|
@@ -76,32 +76,32 @@ export class GeminiAdapter {
|
|
|
76
76
|
const stackLine = techStack.length > 0
|
|
77
77
|
? `\n## Tech Stack\n${techStack.map((t) => `- ${t}`).join('\n')}\n`
|
|
78
78
|
: '';
|
|
79
|
-
return `# ${projectName}
|
|
80
|
-
${stackLine}
|
|
81
|
-
## SCALE Engine Integration (Gemini)
|
|
82
|
-
|
|
83
|
-
This project uses SCALE Engine for AI engineering governance via Gemini CLI.
|
|
84
|
-
|
|
85
|
-
### Commands
|
|
86
|
-
- \`scale create <type> <title>\` — Create artifact
|
|
87
|
-
- \`scale transition <id> <action>\` — Transition artifact state
|
|
88
|
-
- \`scale list --type Spec\` — List artifacts
|
|
89
|
-
- \`scale role activate <role>\` — Switch role
|
|
90
|
-
- \`scale doctor\` — Health check
|
|
91
|
-
|
|
92
|
-
### Workflow
|
|
93
|
-
1. **Explore** → Role: explorer (Read/Grep only)
|
|
94
|
-
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
95
|
-
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
96
|
-
4. **Verify** → Must run tests before claiming done
|
|
97
|
-
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
98
|
-
|
|
99
|
-
### Rules
|
|
100
|
-
- 🔴 Dangerous commands are physically blocked
|
|
101
|
-
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
102
|
-
- 🟡 3 identical retries triggers brute-retry detection
|
|
103
|
-
- 🟡 Claiming done without running tests is blocked
|
|
104
|
-
- 🟢 All tool calls are tracked in .scale/events/
|
|
79
|
+
return `# ${projectName}
|
|
80
|
+
${stackLine}
|
|
81
|
+
## SCALE Engine Integration (Gemini)
|
|
82
|
+
|
|
83
|
+
This project uses SCALE Engine for AI engineering governance via Gemini CLI.
|
|
84
|
+
|
|
85
|
+
### Commands
|
|
86
|
+
- \`scale create <type> <title>\` — Create artifact
|
|
87
|
+
- \`scale transition <id> <action>\` — Transition artifact state
|
|
88
|
+
- \`scale list --type Spec\` — List artifacts
|
|
89
|
+
- \`scale role activate <role>\` — Switch role
|
|
90
|
+
- \`scale doctor\` — Health check
|
|
91
|
+
|
|
92
|
+
### Workflow
|
|
93
|
+
1. **Explore** → Role: explorer (Read/Grep only)
|
|
94
|
+
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
95
|
+
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
96
|
+
4. **Verify** → Must run tests before claiming done
|
|
97
|
+
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
98
|
+
|
|
99
|
+
### Rules
|
|
100
|
+
- 🔴 Dangerous commands are physically blocked
|
|
101
|
+
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
102
|
+
- 🟡 3 identical retries triggers brute-retry detection
|
|
103
|
+
- 🟡 Claiming done without running tests is blocked
|
|
104
|
+
- 🟢 All tool calls are tracked in .scale/events/
|
|
105
105
|
`;
|
|
106
106
|
}
|
|
107
107
|
async init(config) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentPlatform } from '../artifact/types.js';
|
|
2
|
+
import type { AdapterConfig, IAgentAdapter, InitResult, SettingsJson } from './ClaudeCodeAdapter.js';
|
|
3
|
+
export type SettingsShape = 'scale-hooks' | 'qoder-hooks';
|
|
4
|
+
export interface GenericProjectAgentOptions {
|
|
5
|
+
agentType: AgentPlatform;
|
|
6
|
+
displayName: string;
|
|
7
|
+
settingsPath: string;
|
|
8
|
+
knowledgeDocPath: string;
|
|
9
|
+
skillsDir: string;
|
|
10
|
+
installedPaths?: string[];
|
|
11
|
+
extraDirs?: string[];
|
|
12
|
+
settingsShape?: SettingsShape;
|
|
13
|
+
notes?: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare class GenericProjectAgentAdapter implements IAgentAdapter {
|
|
16
|
+
readonly agentType: AgentPlatform;
|
|
17
|
+
protected projectDir: string;
|
|
18
|
+
protected scaleDir: string;
|
|
19
|
+
protected readonly options: GenericProjectAgentOptions;
|
|
20
|
+
constructor(options: GenericProjectAgentOptions);
|
|
21
|
+
getSettingsPath(): string;
|
|
22
|
+
getKnowledgeDocPath(): string;
|
|
23
|
+
getSkillsDir(): string;
|
|
24
|
+
isInstalled(): boolean;
|
|
25
|
+
generateSettings(): SettingsJson;
|
|
26
|
+
mergeSettings(existing: SettingsJson): SettingsJson;
|
|
27
|
+
generateKnowledgeDoc(projectName: string, techStack?: string[]): string;
|
|
28
|
+
init(config: AdapterConfig): Promise<InitResult>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// SCALE Engine - Generic project-level agent adapter
|
|
2
|
+
// Used for platforms that accept project-local rule files and optional JSON settings.
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { logger } from '../core/logger.js';
|
|
6
|
+
function hasScaleCommand(entry) {
|
|
7
|
+
if (entry.command?.includes('scale '))
|
|
8
|
+
return true;
|
|
9
|
+
return entry.hooks?.some(hasScaleCommand) ?? false;
|
|
10
|
+
}
|
|
11
|
+
export class GenericProjectAgentAdapter {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.projectDir = '.';
|
|
14
|
+
this.scaleDir = '.scale';
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.agentType = options.agentType;
|
|
17
|
+
}
|
|
18
|
+
getSettingsPath() {
|
|
19
|
+
return join(this.projectDir, this.options.settingsPath);
|
|
20
|
+
}
|
|
21
|
+
getKnowledgeDocPath() {
|
|
22
|
+
return join(this.projectDir, this.options.knowledgeDocPath);
|
|
23
|
+
}
|
|
24
|
+
getSkillsDir() {
|
|
25
|
+
return join(this.projectDir, this.options.skillsDir);
|
|
26
|
+
}
|
|
27
|
+
isInstalled() {
|
|
28
|
+
const paths = this.options.installedPaths ?? [this.options.settingsPath];
|
|
29
|
+
return paths.some(path => existsSync(join(this.projectDir, path)));
|
|
30
|
+
}
|
|
31
|
+
generateSettings() {
|
|
32
|
+
if (this.options.settingsShape === 'qoder-hooks') {
|
|
33
|
+
return {
|
|
34
|
+
hooks: {
|
|
35
|
+
PreToolUse: [
|
|
36
|
+
{
|
|
37
|
+
matcher: 'Bash',
|
|
38
|
+
command: '',
|
|
39
|
+
hooks: [{ matcher: '', type: 'command', command: 'scale gate pre-tool Bash --args-json "$ARGS" --session-id "$SESSION_ID"' }],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
matcher: 'Edit|Write',
|
|
43
|
+
command: '',
|
|
44
|
+
hooks: [{ matcher: '', type: 'command', command: 'scale gate pre-tool Edit --args-json "$ARGS" --session-id "$SESSION_ID"' }],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
PostToolUse: [
|
|
48
|
+
{
|
|
49
|
+
matcher: 'Edit|Write',
|
|
50
|
+
command: '',
|
|
51
|
+
hooks: [{ matcher: '', type: 'command', command: 'scale gate post-tool Edit --args-json "$ARGS" --exit-code "$EXIT_CODE" --session-id "$SESSION_ID"' }],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
matcher: 'Bash',
|
|
55
|
+
command: '',
|
|
56
|
+
hooks: [{ matcher: '', type: 'command', command: 'scale gate post-tool Bash --args-json "$ARGS" --exit-code "$EXIT_CODE" --session-id "$SESSION_ID"' }],
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
Stop: [
|
|
60
|
+
{
|
|
61
|
+
matcher: '',
|
|
62
|
+
command: '',
|
|
63
|
+
hooks: [{ matcher: '', type: 'command', command: 'scale gate before-stop --session-id "$SESSION_ID"' }],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
permissions: { allow: ['scale:*'] },
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
hooks: {
|
|
72
|
+
'pre-exec': [
|
|
73
|
+
{ matcher: 'Bash', command: 'scale gate pre-tool Bash --args-json "$ARGS" --session-id "$SESSION_ID"' },
|
|
74
|
+
{ matcher: 'Edit|Write', command: 'scale gate pre-tool Edit --args-json "$ARGS" --session-id "$SESSION_ID"' },
|
|
75
|
+
],
|
|
76
|
+
'post-exec': [
|
|
77
|
+
{ matcher: 'Edit|Write', command: 'scale gate post-tool Edit --args-json "$ARGS" --exit-code "$EXIT_CODE" --session-id "$SESSION_ID"' },
|
|
78
|
+
{ matcher: 'Bash', command: 'scale gate post-tool Bash --args-json "$ARGS" --exit-code "$EXIT_CODE" --session-id "$SESSION_ID"' },
|
|
79
|
+
],
|
|
80
|
+
'before-stop': [
|
|
81
|
+
{ matcher: '', command: 'scale gate before-stop --session-id "$SESSION_ID"' },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
permissions: { allow: ['scale:*'] },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
mergeSettings(existing) {
|
|
88
|
+
const generated = this.generateSettings();
|
|
89
|
+
const merged = { ...existing };
|
|
90
|
+
if (!merged.hooks)
|
|
91
|
+
merged.hooks = {};
|
|
92
|
+
for (const [hookType, entries] of Object.entries(generated.hooks ?? {})) {
|
|
93
|
+
if (!merged.hooks[hookType])
|
|
94
|
+
merged.hooks[hookType] = [];
|
|
95
|
+
const alreadyExists = merged.hooks[hookType].some(hasScaleCommand);
|
|
96
|
+
if (!alreadyExists)
|
|
97
|
+
merged.hooks[hookType].push(...entries);
|
|
98
|
+
}
|
|
99
|
+
if (!merged.permissions)
|
|
100
|
+
merged.permissions = {};
|
|
101
|
+
if (!merged.permissions.allow)
|
|
102
|
+
merged.permissions.allow = [];
|
|
103
|
+
for (const permission of generated.permissions?.allow ?? []) {
|
|
104
|
+
if (!merged.permissions.allow.includes(permission))
|
|
105
|
+
merged.permissions.allow.push(permission);
|
|
106
|
+
}
|
|
107
|
+
return merged;
|
|
108
|
+
}
|
|
109
|
+
generateKnowledgeDoc(projectName, techStack = []) {
|
|
110
|
+
const stackLine = techStack.length > 0
|
|
111
|
+
? `\n## Tech Stack\n${techStack.map(t => `- ${t}`).join('\n')}\n`
|
|
112
|
+
: '';
|
|
113
|
+
const notes = this.options.notes?.length
|
|
114
|
+
? `\n### ${this.options.displayName}-Specific Notes\n${this.options.notes.map(note => `- ${note}`).join('\n')}\n`
|
|
115
|
+
: '';
|
|
116
|
+
return `# ${projectName}
|
|
117
|
+
${stackLine}
|
|
118
|
+
## SCALE Engine Integration (${this.options.displayName})
|
|
119
|
+
|
|
120
|
+
This project uses SCALE Engine for AI engineering governance via ${this.options.displayName}.
|
|
121
|
+
|
|
122
|
+
### Commands
|
|
123
|
+
- \`scale create <type> <title>\` - Create artifact
|
|
124
|
+
- \`scale transition <id> <action>\` - Transition artifact state
|
|
125
|
+
- \`scale list --type Spec\` - List artifacts
|
|
126
|
+
- \`scale role activate <role>\` - Switch role
|
|
127
|
+
- \`scale doctor\` - Health check
|
|
128
|
+
|
|
129
|
+
### Workflow
|
|
130
|
+
1. Explore - Role: explorer (Read/Grep only)
|
|
131
|
+
2. Plan - Create Spec, refine, approve
|
|
132
|
+
3. Implement - Role: implementer
|
|
133
|
+
4. Verify - Must run tests before claiming done
|
|
134
|
+
5. Learn - Defects become lessons, rules, and hooks
|
|
135
|
+
|
|
136
|
+
### Rules
|
|
137
|
+
- Dangerous commands are blocked through SCALE gates where the platform supports executable hooks.
|
|
138
|
+
- Hardcoded secrets must be rejected before edits are committed.
|
|
139
|
+
- Repeated retries should be treated as diagnostic evidence, not brute force.
|
|
140
|
+
- Claims of completion require verification evidence.
|
|
141
|
+
- Runtime evidence is tracked under .scale/.
|
|
142
|
+
${notes}`;
|
|
143
|
+
}
|
|
144
|
+
async init(config) {
|
|
145
|
+
this.projectDir = config.projectDir;
|
|
146
|
+
this.scaleDir = config.scaleDir ?? join(config.projectDir, '.scale');
|
|
147
|
+
const created = [];
|
|
148
|
+
const skipped = [];
|
|
149
|
+
for (const dir of ['events', 'artifacts', 'rules', 'hooks', 'checkpoints']) {
|
|
150
|
+
const fullDir = join(this.scaleDir, dir);
|
|
151
|
+
if (!existsSync(fullDir)) {
|
|
152
|
+
mkdirSync(fullDir, { recursive: true });
|
|
153
|
+
created.push(fullDir);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
skipped.push(fullDir);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const settingsPath = this.getSettingsPath();
|
|
160
|
+
mkdirSync(dirname(settingsPath), { recursive: true });
|
|
161
|
+
if (existsSync(settingsPath)) {
|
|
162
|
+
const existing = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
163
|
+
writeFileSync(settingsPath, JSON.stringify(this.mergeSettings(existing), null, 2), 'utf-8');
|
|
164
|
+
skipped.push(`${settingsPath} (merged)`);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
writeFileSync(settingsPath, JSON.stringify(this.generateSettings(), null, 2), 'utf-8');
|
|
168
|
+
created.push(settingsPath);
|
|
169
|
+
}
|
|
170
|
+
for (const dir of [this.getSkillsDir(), ...(this.options.extraDirs ?? []).map(dir => join(this.projectDir, dir))]) {
|
|
171
|
+
if (!existsSync(dir)) {
|
|
172
|
+
mkdirSync(dir, { recursive: true });
|
|
173
|
+
created.push(dir);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
skipped.push(dir);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const knowledgeDocPath = this.getKnowledgeDocPath();
|
|
180
|
+
mkdirSync(dirname(knowledgeDocPath), { recursive: true });
|
|
181
|
+
if (!existsSync(knowledgeDocPath)) {
|
|
182
|
+
const projectName = config.projectDir.split(/[/\\]/).pop() ?? 'Project';
|
|
183
|
+
writeFileSync(knowledgeDocPath, this.generateKnowledgeDoc(projectName), 'utf-8');
|
|
184
|
+
created.push(knowledgeDocPath);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
skipped.push(knowledgeDocPath);
|
|
188
|
+
}
|
|
189
|
+
const gitignorePath = join(this.scaleDir, '.gitignore');
|
|
190
|
+
if (!existsSync(gitignorePath)) {
|
|
191
|
+
writeFileSync(gitignorePath, `*.db\n*.db-journal\nevents/\ncheckpoints/\nevidence/\nstate/\nhooks/*.sh\n`, 'utf-8');
|
|
192
|
+
created.push(gitignorePath);
|
|
193
|
+
}
|
|
194
|
+
logger.info({ created: created.length, skipped: skipped.length }, `SCALE init (${this.agentType}) completed`);
|
|
195
|
+
return {
|
|
196
|
+
settingsPath,
|
|
197
|
+
knowledgeDocPath,
|
|
198
|
+
scaleDir: this.scaleDir,
|
|
199
|
+
created,
|
|
200
|
+
skipped,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=GenericProjectAgentAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericProjectAgentAdapter.js","sourceRoot":"","sources":["../../src/adapters/GenericProjectAgentAdapter.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,sFAAsF;AAEtF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,m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O,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,eAAe,IAAI,CAAC,SAAS,aAAa,CAAC,CAAA;QAE7G,OAAO;YACL,YAAY;YACZ,gBAAgB;YAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO;YACP,OAAO;SACR,CAAA;IACH,CAAC;CACF"}
|
|
@@ -76,32 +76,32 @@ export class HermesAdapter {
|
|
|
76
76
|
const stackLine = techStack.length > 0
|
|
77
77
|
? `\n## Tech Stack\n${techStack.map((t) => `- ${t}`).join('\n')}\n`
|
|
78
78
|
: '';
|
|
79
|
-
return `# ${projectName}
|
|
80
|
-
${stackLine}
|
|
81
|
-
## SCALE Engine Integration (Hermes)
|
|
82
|
-
|
|
83
|
-
This project uses SCALE Engine for AI engineering governance via Hermes.
|
|
84
|
-
|
|
85
|
-
### Commands
|
|
86
|
-
- \`scale create <type> <title>\` — Create artifact
|
|
87
|
-
- \`scale transition <id> <action>\` — Transition artifact state
|
|
88
|
-
- \`scale list --type Spec\` — List artifacts
|
|
89
|
-
- \`scale role activate <role>\` — Switch role
|
|
90
|
-
- \`scale doctor\` — Health check
|
|
91
|
-
|
|
92
|
-
### Workflow
|
|
93
|
-
1. **Explore** → Role: explorer (Read/Grep only)
|
|
94
|
-
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
95
|
-
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
96
|
-
4. **Verify** → Must run tests before claiming done
|
|
97
|
-
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
98
|
-
|
|
99
|
-
### Rules
|
|
100
|
-
- 🔴 Dangerous commands are physically blocked
|
|
101
|
-
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
102
|
-
- 🟡 3 identical retries triggers brute-retry detection
|
|
103
|
-
- 🟡 Claiming done without running tests is blocked
|
|
104
|
-
- 🟢 All tool calls are tracked in .scale/events/
|
|
79
|
+
return `# ${projectName}
|
|
80
|
+
${stackLine}
|
|
81
|
+
## SCALE Engine Integration (Hermes)
|
|
82
|
+
|
|
83
|
+
This project uses SCALE Engine for AI engineering governance via Hermes.
|
|
84
|
+
|
|
85
|
+
### Commands
|
|
86
|
+
- \`scale create <type> <title>\` — Create artifact
|
|
87
|
+
- \`scale transition <id> <action>\` — Transition artifact state
|
|
88
|
+
- \`scale list --type Spec\` — List artifacts
|
|
89
|
+
- \`scale role activate <role>\` — Switch role
|
|
90
|
+
- \`scale doctor\` — Health check
|
|
91
|
+
|
|
92
|
+
### Workflow
|
|
93
|
+
1. **Explore** → Role: explorer (Read/Grep only)
|
|
94
|
+
2. **Plan** → Create Spec → refine → approve (guard: ambiguity ≤ 0.2)
|
|
95
|
+
3. **Implement** → Role: implementer (Edit/Write/Bash unlocked)
|
|
96
|
+
4. **Verify** → Must run tests before claiming done
|
|
97
|
+
5. **Learn** → Defects → Lessons → Rules → Hooks
|
|
98
|
+
|
|
99
|
+
### Rules
|
|
100
|
+
- 🔴 Dangerous commands are physically blocked
|
|
101
|
+
- 🔴 Hardcoded secrets are blocked on Edit/Write
|
|
102
|
+
- 🟡 3 identical retries triggers brute-retry detection
|
|
103
|
+
- 🟡 Claiming done without running tests is blocked
|
|
104
|
+
- 🟢 All tool calls are tracked in .scale/events/
|
|
105
105
|
`;
|
|
106
106
|
}
|
|
107
107
|
async init(config) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SCALE Engine - JCode Adapter
|
|
2
|
+
import { GenericProjectAgentAdapter } from './GenericProjectAgentAdapter.js';
|
|
3
|
+
export class JCodeAdapter extends GenericProjectAgentAdapter {
|
|
4
|
+
constructor() {
|
|
5
|
+
super({
|
|
6
|
+
agentType: 'jcode',
|
|
7
|
+
displayName: 'JCode',
|
|
8
|
+
settingsPath: '.jcode/settings.json',
|
|
9
|
+
knowledgeDocPath: 'JCODE.md',
|
|
10
|
+
skillsDir: '.jcode/skills',
|
|
11
|
+
installedPaths: ['.jcode/settings.json', 'JCODE.md'],
|
|
12
|
+
notes: [
|
|
13
|
+
'JCode is treated as a project-local agent surface because no stable public hook contract is assumed.',
|
|
14
|
+
'The adapter records SCALE rules and conservative command boundaries without claiming native hook execution.',
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=JCodeAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JCodeAdapter.js","sourceRoot":"","sources":["../../src/adapters/JCodeAdapter.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAE5E,MAAM,OAAO,YAAa,SAAQ,0BAA0B;IAC1D;QACE,KAAK,CAAC;YACJ,SAAS,EAAE,OAAO;YAClB,WAAW,EAAE,OAAO;YACpB,YAAY,EAAE,sBAAsB;YACpC,gBAAgB,EAAE,UAAU;YAC5B,SAAS,EAAE,eAAe;YAC1B,cAAc,EAAE,CAAC,sBAAsB,EAAE,UAAU,CAAC;YACpD,KAAK,EAAE;gBACL,sGAAsG;gBACtG,6GAA6G;aAC9G;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SCALE Engine - Kilo Code Adapter
|
|
2
|
+
import { GenericProjectAgentAdapter } from './GenericProjectAgentAdapter.js';
|
|
3
|
+
export class KiloCodeAdapter extends GenericProjectAgentAdapter {
|
|
4
|
+
constructor() {
|
|
5
|
+
super({
|
|
6
|
+
agentType: 'kilocode',
|
|
7
|
+
displayName: 'Kilo Code',
|
|
8
|
+
settingsPath: '.kilocode/settings.json',
|
|
9
|
+
knowledgeDocPath: 'AGENTS.md',
|
|
10
|
+
skillsDir: '.kilocode/skills',
|
|
11
|
+
extraDirs: ['.kilocode/rules'],
|
|
12
|
+
installedPaths: ['.kilocode/settings.json', 'AGENTS.md'],
|
|
13
|
+
notes: [
|
|
14
|
+
'Kilo Code can read AGENTS.md style project instructions; SCALE creates it only when absent.',
|
|
15
|
+
'Platform-local metadata is kept under .kilocode/ to avoid overwriting unrelated agent configuration.',
|
|
16
|
+
],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=KiloCodeAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KiloCodeAdapter.js","sourceRoot":"","sources":["../../src/adapters/KiloCodeAdapter.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAE5E,MAAM,OAAO,eAAgB,SAAQ,0BAA0B;IAC7D;QACE,KAAK,CAAC;YACJ,SAAS,EAAE,UAAU;YACrB,WAAW,EAAE,WAAW;YACxB,YAAY,EAAE,yBAAyB;YACvC,gBAAgB,EAAE,WAAW;YAC7B,SAAS,EAAE,kBAAkB;YAC7B,SAAS,EAAE,CAAC,iBAAiB,CAAC;YAC9B,cAAc,EAAE,CAAC,yBAAyB,EAAE,WAAW,CAAC;YACxD,KAAK,EAAE;gBACL,6FAA6F;gBAC7F,sGAAsG;aACvG;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -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) {
|