@hongmaple0820/scale-engine 0.25.0 → 0.26.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 +368 -346
- package/README.md +548 -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 +133 -47
- 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 +45 -45
- package/dist/context/AntiPatternRegistry.js +20 -20
- package/dist/context/ContextBuilder.js +155 -155
- 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/hooks/HookGeneratorEnhanced.js +218 -218
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -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/skills/SkillDiscovery.js +12 -1
- package/dist/skills/SkillDiscovery.js.map +1 -1
- package/dist/skills/routing/SkillPlanner.js +40 -40
- 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/docs/ACTIVE_SECURITY_VISUAL_GATES.md +87 -87
- package/docs/BACKGROUND_HUNTER.md +62 -62
- package/docs/CODE_INTELLIGENCE.md +138 -138
- package/docs/CONTEXT_BUDGET.md +113 -113
- package/docs/DEPENDENCY_AUDIT.md +89 -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 +134 -134
- package/docs/README.md +101 -92
- package/docs/RUNTIME_EVIDENCE.md +101 -101
- package/docs/SKILL-REPOSITORY.md +57 -57
- package/docs/SKILL_RADAR.md +122 -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 +88 -78
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
# Active Security And Visual Gates
|
|
2
|
-
|
|
3
|
-
SCALE V2 adds two optional verification layers for projects that can provide a runnable local target:
|
|
4
|
-
|
|
5
|
-
- `ActiveRedTeam`: bounded dynamic security probes for configured HTTP targets.
|
|
6
|
-
- `VisualGate`: structured visual review evidence for UI routes and UI specs.
|
|
7
|
-
|
|
8
|
-
Both are conditional. A library or backend project with no runtime target should not pay the cost.
|
|
9
|
-
|
|
10
|
-
## Active Security
|
|
11
|
-
|
|
12
|
-
Active security is configured under `.scale/verification.json`:
|
|
13
|
-
|
|
14
|
-
```json
|
|
15
|
-
{
|
|
16
|
-
"security": {
|
|
17
|
-
"active": {
|
|
18
|
-
"enabled": true,
|
|
19
|
-
"baseUrl": "http://localhost:3000",
|
|
20
|
-
"startCommand": "npm run dev",
|
|
21
|
-
"targets": ["/api/login", "/api/users"],
|
|
22
|
-
"timeoutMs": 5000,
|
|
23
|
-
"maxRequests": 20
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Behavior:
|
|
30
|
-
|
|
31
|
-
- missing or disabled config returns `SKIPPED`
|
|
32
|
-
- invalid enabled config returns `FAILED` before sending probes
|
|
33
|
-
- probes are capped by `maxRequests`
|
|
34
|
-
- every request has a timeout
|
|
35
|
-
- reflected probe payloads are `HIGH` findings and block
|
|
36
|
-
- request errors and server errors are recorded as findings, but only configured blocker severity should fail the gate
|
|
37
|
-
|
|
38
|
-
The first implementation exposes `runActiveRedTeam()` as a library API. It does not start a server by itself yet. CLI orchestration can wire `startCommand` later, but startup failure must become a `FAILED` result when that runner is added.
|
|
39
|
-
|
|
40
|
-
## Visual Gate
|
|
41
|
-
|
|
42
|
-
Visual verification is configured under `.scale/verification.json`:
|
|
43
|
-
|
|
44
|
-
```json
|
|
45
|
-
{
|
|
46
|
-
"visual": {
|
|
47
|
-
"enabled": true,
|
|
48
|
-
"baseUrl": "http://localhost:5173",
|
|
49
|
-
"specPath": "docs/ui/UI-SPEC.md",
|
|
50
|
-
"routes": ["/", "/settings"],
|
|
51
|
-
"reportPath": "docs/worklog/tasks/TASK-123/visual-report.json",
|
|
52
|
-
"blockingSeverities": ["critical", "high"]
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
`VisualGate` consumes a structured report:
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"screenshots": [
|
|
62
|
-
{ "route": "/", "path": "screenshots/home.png" }
|
|
63
|
-
],
|
|
64
|
-
"findings": [
|
|
65
|
-
{
|
|
66
|
-
"severity": "high",
|
|
67
|
-
"route": "/",
|
|
68
|
-
"message": "Primary action overlaps the navigation bar.",
|
|
69
|
-
"evidence": "overlap ratio 0.42"
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Behavior:
|
|
76
|
-
|
|
77
|
-
- missing or disabled config passes with a `Visual gate skipped` evidence item
|
|
78
|
-
- enabled config requires `baseUrl`, `specPath`, `routes`, and `reportPath`
|
|
79
|
-
- missing or invalid visual report fails
|
|
80
|
-
- default blockers are `critical` and `high`
|
|
81
|
-
- VLM comments may be recorded in the report, but the gate blocks only on structured severity thresholds
|
|
82
|
-
|
|
83
|
-
## Gate Numbering
|
|
84
|
-
|
|
85
|
-
`VisualGate` uses `G9` when explicitly registered. It is not registered by default because meta governance also uses the G9-G15 range. Projects should register it only in UI verification profiles or dedicated task flows.
|
|
86
|
-
|
|
87
|
-
Active security remains a security sub-check instead of a fractional gate number. It belongs under the broader G7 security lifecycle when wired into a concrete workflow.
|
|
1
|
+
# Active Security And Visual Gates
|
|
2
|
+
|
|
3
|
+
SCALE V2 adds two optional verification layers for projects that can provide a runnable local target:
|
|
4
|
+
|
|
5
|
+
- `ActiveRedTeam`: bounded dynamic security probes for configured HTTP targets.
|
|
6
|
+
- `VisualGate`: structured visual review evidence for UI routes and UI specs.
|
|
7
|
+
|
|
8
|
+
Both are conditional. A library or backend project with no runtime target should not pay the cost.
|
|
9
|
+
|
|
10
|
+
## Active Security
|
|
11
|
+
|
|
12
|
+
Active security is configured under `.scale/verification.json`:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"security": {
|
|
17
|
+
"active": {
|
|
18
|
+
"enabled": true,
|
|
19
|
+
"baseUrl": "http://localhost:3000",
|
|
20
|
+
"startCommand": "npm run dev",
|
|
21
|
+
"targets": ["/api/login", "/api/users"],
|
|
22
|
+
"timeoutMs": 5000,
|
|
23
|
+
"maxRequests": 20
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Behavior:
|
|
30
|
+
|
|
31
|
+
- missing or disabled config returns `SKIPPED`
|
|
32
|
+
- invalid enabled config returns `FAILED` before sending probes
|
|
33
|
+
- probes are capped by `maxRequests`
|
|
34
|
+
- every request has a timeout
|
|
35
|
+
- reflected probe payloads are `HIGH` findings and block
|
|
36
|
+
- request errors and server errors are recorded as findings, but only configured blocker severity should fail the gate
|
|
37
|
+
|
|
38
|
+
The first implementation exposes `runActiveRedTeam()` as a library API. It does not start a server by itself yet. CLI orchestration can wire `startCommand` later, but startup failure must become a `FAILED` result when that runner is added.
|
|
39
|
+
|
|
40
|
+
## Visual Gate
|
|
41
|
+
|
|
42
|
+
Visual verification is configured under `.scale/verification.json`:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"visual": {
|
|
47
|
+
"enabled": true,
|
|
48
|
+
"baseUrl": "http://localhost:5173",
|
|
49
|
+
"specPath": "docs/ui/UI-SPEC.md",
|
|
50
|
+
"routes": ["/", "/settings"],
|
|
51
|
+
"reportPath": "docs/worklog/tasks/TASK-123/visual-report.json",
|
|
52
|
+
"blockingSeverities": ["critical", "high"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`VisualGate` consumes a structured report:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"screenshots": [
|
|
62
|
+
{ "route": "/", "path": "screenshots/home.png" }
|
|
63
|
+
],
|
|
64
|
+
"findings": [
|
|
65
|
+
{
|
|
66
|
+
"severity": "high",
|
|
67
|
+
"route": "/",
|
|
68
|
+
"message": "Primary action overlaps the navigation bar.",
|
|
69
|
+
"evidence": "overlap ratio 0.42"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Behavior:
|
|
76
|
+
|
|
77
|
+
- missing or disabled config passes with a `Visual gate skipped` evidence item
|
|
78
|
+
- enabled config requires `baseUrl`, `specPath`, `routes`, and `reportPath`
|
|
79
|
+
- missing or invalid visual report fails
|
|
80
|
+
- default blockers are `critical` and `high`
|
|
81
|
+
- VLM comments may be recorded in the report, but the gate blocks only on structured severity thresholds
|
|
82
|
+
|
|
83
|
+
## Gate Numbering
|
|
84
|
+
|
|
85
|
+
`VisualGate` uses `G9` when explicitly registered. It is not registered by default because meta governance also uses the G9-G15 range. Projects should register it only in UI verification profiles or dedicated task flows.
|
|
86
|
+
|
|
87
|
+
Active security remains a security sub-check instead of a fractional gate number. It belongs under the broader G7 security lifecycle when wired into a concrete workflow.
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
# Background Hunter
|
|
2
|
-
|
|
3
|
-
Background Hunter is the readonly proactive scan layer for SCALE Engine V2.
|
|
4
|
-
It turns existing governance signals into an actionable hunt queue without editing application code.
|
|
5
|
-
|
|
6
|
-
## Boundary
|
|
7
|
-
|
|
8
|
-
Default behavior is intentionally conservative:
|
|
9
|
-
|
|
10
|
-
- scan only, no automatic code changes
|
|
11
|
-
- no automatic LLM repair
|
|
12
|
-
- no automatic commit or pull request
|
|
13
|
-
- no release bypass
|
|
14
|
-
- ignore decisions are explicit and written to `.scale/hunt/ignored-findings.json`
|
|
15
|
-
|
|
16
|
-
The hunter reuses existing checks instead of creating a second rule system. The first implementation consumes:
|
|
17
|
-
|
|
18
|
-
- `EngineeringStandards`
|
|
19
|
-
- `ReviewAnalyzer` when status and diff input are provided by callers
|
|
20
|
-
|
|
21
|
-
## Commands
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
scale hunt scan
|
|
25
|
-
scale hunt scan --json
|
|
26
|
-
scale hunt report
|
|
27
|
-
scale hunt diagnose <finding-id>
|
|
28
|
-
scale hunt ignore <finding-id> --reason "Accepted legacy debt tracked elsewhere"
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
`hunt scan` and `hunt report` do not modify source files. They classify findings as `open` or `ignored`.
|
|
32
|
-
|
|
33
|
-
`hunt diagnose <finding-id>` creates a normal `DiagnosticLoop` from the finding. This keeps the debugging workflow evidence-first:
|
|
34
|
-
|
|
35
|
-
- reproducible command
|
|
36
|
-
- expected failure
|
|
37
|
-
- changed files
|
|
38
|
-
- verification commands
|
|
39
|
-
- hypotheses and cleanup checklist
|
|
40
|
-
|
|
41
|
-
`hunt ignore` records the finding id and stable fingerprint. The same finding will remain visible in the report as `ignored`, but it is removed from the open queue.
|
|
42
|
-
|
|
43
|
-
## Finding Identity
|
|
44
|
-
|
|
45
|
-
Every finding gets:
|
|
46
|
-
|
|
47
|
-
- `id`: short deterministic SHA-256 id derived from the fingerprint
|
|
48
|
-
- `fingerprint`: stable source/rule/path/line/message tuple
|
|
49
|
-
- `source`: currently `engineering-standards` or `review-analyzer`
|
|
50
|
-
- `diagnosticInput`: ready-to-use `DiagnosticLoopInput`
|
|
51
|
-
|
|
52
|
-
This allows repeated scans to avoid noisy duplicates and lets teams explicitly accept or defer known debt.
|
|
53
|
-
|
|
54
|
-
## Recommended Flow
|
|
55
|
-
|
|
56
|
-
1. Run `scale hunt scan --json`.
|
|
57
|
-
2. Triage open findings.
|
|
58
|
-
3. For real issues, run `scale hunt diagnose <finding-id> --json`.
|
|
59
|
-
4. Fix through the normal plan/TDD/verify workflow.
|
|
60
|
-
5. For accepted legacy debt, run `scale hunt ignore <finding-id> --reason "..."`
|
|
61
|
-
|
|
62
|
-
Do not promote Background Hunter to automatic repair until the project has enough evidence that its findings are stable and low-noise.
|
|
1
|
+
# Background Hunter
|
|
2
|
+
|
|
3
|
+
Background Hunter is the readonly proactive scan layer for SCALE Engine V2.
|
|
4
|
+
It turns existing governance signals into an actionable hunt queue without editing application code.
|
|
5
|
+
|
|
6
|
+
## Boundary
|
|
7
|
+
|
|
8
|
+
Default behavior is intentionally conservative:
|
|
9
|
+
|
|
10
|
+
- scan only, no automatic code changes
|
|
11
|
+
- no automatic LLM repair
|
|
12
|
+
- no automatic commit or pull request
|
|
13
|
+
- no release bypass
|
|
14
|
+
- ignore decisions are explicit and written to `.scale/hunt/ignored-findings.json`
|
|
15
|
+
|
|
16
|
+
The hunter reuses existing checks instead of creating a second rule system. The first implementation consumes:
|
|
17
|
+
|
|
18
|
+
- `EngineeringStandards`
|
|
19
|
+
- `ReviewAnalyzer` when status and diff input are provided by callers
|
|
20
|
+
|
|
21
|
+
## Commands
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
scale hunt scan
|
|
25
|
+
scale hunt scan --json
|
|
26
|
+
scale hunt report
|
|
27
|
+
scale hunt diagnose <finding-id>
|
|
28
|
+
scale hunt ignore <finding-id> --reason "Accepted legacy debt tracked elsewhere"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`hunt scan` and `hunt report` do not modify source files. They classify findings as `open` or `ignored`.
|
|
32
|
+
|
|
33
|
+
`hunt diagnose <finding-id>` creates a normal `DiagnosticLoop` from the finding. This keeps the debugging workflow evidence-first:
|
|
34
|
+
|
|
35
|
+
- reproducible command
|
|
36
|
+
- expected failure
|
|
37
|
+
- changed files
|
|
38
|
+
- verification commands
|
|
39
|
+
- hypotheses and cleanup checklist
|
|
40
|
+
|
|
41
|
+
`hunt ignore` records the finding id and stable fingerprint. The same finding will remain visible in the report as `ignored`, but it is removed from the open queue.
|
|
42
|
+
|
|
43
|
+
## Finding Identity
|
|
44
|
+
|
|
45
|
+
Every finding gets:
|
|
46
|
+
|
|
47
|
+
- `id`: short deterministic SHA-256 id derived from the fingerprint
|
|
48
|
+
- `fingerprint`: stable source/rule/path/line/message tuple
|
|
49
|
+
- `source`: currently `engineering-standards` or `review-analyzer`
|
|
50
|
+
- `diagnosticInput`: ready-to-use `DiagnosticLoopInput`
|
|
51
|
+
|
|
52
|
+
This allows repeated scans to avoid noisy duplicates and lets teams explicitly accept or defer known debt.
|
|
53
|
+
|
|
54
|
+
## Recommended Flow
|
|
55
|
+
|
|
56
|
+
1. Run `scale hunt scan --json`.
|
|
57
|
+
2. Triage open findings.
|
|
58
|
+
3. For real issues, run `scale hunt diagnose <finding-id> --json`.
|
|
59
|
+
4. Fix through the normal plan/TDD/verify workflow.
|
|
60
|
+
5. For accepted legacy debt, run `scale hunt ignore <finding-id> --reason "..."`
|
|
61
|
+
|
|
62
|
+
Do not promote Background Hunter to automatic repair until the project has enough evidence that its findings are stable and low-noise.
|
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
# Code Intelligence
|
|
2
|
-
|
|
3
|
-
SCALE uses an adapter-first code intelligence layer. It can consume external code graph tools when they exist, read graph artifacts such as Graphify outputs, and fall back to a scoped internal source scan when no provider is available.
|
|
4
|
-
|
|
5
|
-
The goal is not to replace IDE indexing. The goal is to make exploration measurable:
|
|
6
|
-
|
|
7
|
-
- which provider answered the query
|
|
8
|
-
- whether fallback was used
|
|
9
|
-
- which files are likely relevant
|
|
10
|
-
- how many file reads were avoided
|
|
11
|
-
- what confidence the result has
|
|
12
|
-
|
|
13
|
-
## Quick Start
|
|
14
|
-
|
|
15
|
-
Create the optional provider configuration:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
scale codegraph init
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Inspect provider availability:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
scale codegraph status
|
|
25
|
-
scale codegraph status --json
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Query code intelligence:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
scale codegraph query "UserService.create"
|
|
32
|
-
scale codegraph impact --symbol UserService.create
|
|
33
|
-
scale codegraph context --symbol UserService.create --budget 2000
|
|
34
|
-
scale codegraph roi --symbol UserService.create
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Configuration
|
|
38
|
-
|
|
39
|
-
The configuration file lives at:
|
|
40
|
-
|
|
41
|
-
```text
|
|
42
|
-
.scale/code-intelligence.json
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Default shape:
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
{
|
|
49
|
-
"version": "1.0",
|
|
50
|
-
"providers": [
|
|
51
|
-
{
|
|
52
|
-
"id": "codegraph",
|
|
53
|
-
"type": "external-cli",
|
|
54
|
-
"enabled": true,
|
|
55
|
-
"command": "codegraph",
|
|
56
|
-
"capabilities": ["symbols", "callers", "callees", "impact", "context"]
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"id": "graphify",
|
|
60
|
-
"type": "artifact",
|
|
61
|
-
"enabled": true,
|
|
62
|
-
"manifest": "graphify-out/GRAPH_REPORT.md",
|
|
63
|
-
"capabilities": ["summary", "module-map", "context"]
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
"fallback": {
|
|
67
|
-
"enabled": true,
|
|
68
|
-
"tools": ["internal-scan", "rg", "read"]
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Provider Types
|
|
74
|
-
|
|
75
|
-
| Type | Use |
|
|
76
|
-
| --- | --- |
|
|
77
|
-
| `external-cli` | Detects an installed external code graph command. SCALE does not auto-install it. The first version treats this as availability evidence until a stable command contract is configured. |
|
|
78
|
-
| `artifact` | Reads a local graph manifest or report file. JSON manifests can provide symbol impact data. |
|
|
79
|
-
| fallback | Uses a bounded internal source scan when providers are unavailable or return no hits. |
|
|
80
|
-
|
|
81
|
-
## JSON Artifact Provider
|
|
82
|
-
|
|
83
|
-
Artifact providers can point at a JSON manifest:
|
|
84
|
-
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"symbols": [
|
|
88
|
-
{
|
|
89
|
-
"name": "UserService.create",
|
|
90
|
-
"file": "src/user.ts",
|
|
91
|
-
"callers": ["src/api.ts"],
|
|
92
|
-
"callees": ["src/db.ts"]
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
"files": [
|
|
96
|
-
{
|
|
97
|
-
"path": "src/user.ts",
|
|
98
|
-
"symbols": ["UserService.create"]
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
This allows SCALE to answer impact queries without reading the whole repository.
|
|
105
|
-
|
|
106
|
-
## ROI Metrics
|
|
107
|
-
|
|
108
|
-
Code intelligence reports include:
|
|
109
|
-
|
|
110
|
-
| Metric | Meaning |
|
|
111
|
-
| --- | --- |
|
|
112
|
-
| `graphHits` | Number of hits from graph providers. |
|
|
113
|
-
| `fallbackCount` | Whether fallback was needed. |
|
|
114
|
-
| `baselineFileReads` | Estimated broad exploration file reads. |
|
|
115
|
-
| `recommendedFileReads` | Scoped file reads recommended by the query result. |
|
|
116
|
-
| `fileReadsSaved` | Estimated avoided reads. |
|
|
117
|
-
| `toolCallsSaved` | Estimated avoided exploration tool calls. |
|
|
118
|
-
|
|
119
|
-
These numbers are deliberately conservative. They are a local signal for whether graph-assisted exploration is worth keeping default for a task class.
|
|
120
|
-
|
|
121
|
-
## Governance ROI
|
|
122
|
-
|
|
123
|
-
`scale governance roi` can include code intelligence:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
scale governance roi --symbol UserService.create
|
|
127
|
-
scale governance roi --code-query createUser
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
When a graph provider answers, the module is reported as measured evidence. When fallback is used, the module is reported as estimated and needs more evidence before becoming a stronger default.
|
|
131
|
-
|
|
132
|
-
## Policy
|
|
133
|
-
|
|
134
|
-
- SCALE must run when no code graph provider is installed.
|
|
135
|
-
- Missing providers must produce explicit fallback, not silent success.
|
|
136
|
-
- External tools are detected but not installed automatically.
|
|
137
|
-
- Source files are read only through a bounded fallback scan.
|
|
138
|
-
- Large generated graph outputs should stay outside default prompt context; use summaries and file paths.
|
|
1
|
+
# Code Intelligence
|
|
2
|
+
|
|
3
|
+
SCALE uses an adapter-first code intelligence layer. It can consume external code graph tools when they exist, read graph artifacts such as Graphify outputs, and fall back to a scoped internal source scan when no provider is available.
|
|
4
|
+
|
|
5
|
+
The goal is not to replace IDE indexing. The goal is to make exploration measurable:
|
|
6
|
+
|
|
7
|
+
- which provider answered the query
|
|
8
|
+
- whether fallback was used
|
|
9
|
+
- which files are likely relevant
|
|
10
|
+
- how many file reads were avoided
|
|
11
|
+
- what confidence the result has
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Create the optional provider configuration:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
scale codegraph init
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Inspect provider availability:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
scale codegraph status
|
|
25
|
+
scale codegraph status --json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Query code intelligence:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
scale codegraph query "UserService.create"
|
|
32
|
+
scale codegraph impact --symbol UserService.create
|
|
33
|
+
scale codegraph context --symbol UserService.create --budget 2000
|
|
34
|
+
scale codegraph roi --symbol UserService.create
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
The configuration file lives at:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
.scale/code-intelligence.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Default shape:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"version": "1.0",
|
|
50
|
+
"providers": [
|
|
51
|
+
{
|
|
52
|
+
"id": "codegraph",
|
|
53
|
+
"type": "external-cli",
|
|
54
|
+
"enabled": true,
|
|
55
|
+
"command": "codegraph",
|
|
56
|
+
"capabilities": ["symbols", "callers", "callees", "impact", "context"]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "graphify",
|
|
60
|
+
"type": "artifact",
|
|
61
|
+
"enabled": true,
|
|
62
|
+
"manifest": "graphify-out/GRAPH_REPORT.md",
|
|
63
|
+
"capabilities": ["summary", "module-map", "context"]
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"fallback": {
|
|
67
|
+
"enabled": true,
|
|
68
|
+
"tools": ["internal-scan", "rg", "read"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Provider Types
|
|
74
|
+
|
|
75
|
+
| Type | Use |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `external-cli` | Detects an installed external code graph command. SCALE does not auto-install it. The first version treats this as availability evidence until a stable command contract is configured. |
|
|
78
|
+
| `artifact` | Reads a local graph manifest or report file. JSON manifests can provide symbol impact data. |
|
|
79
|
+
| fallback | Uses a bounded internal source scan when providers are unavailable or return no hits. |
|
|
80
|
+
|
|
81
|
+
## JSON Artifact Provider
|
|
82
|
+
|
|
83
|
+
Artifact providers can point at a JSON manifest:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"symbols": [
|
|
88
|
+
{
|
|
89
|
+
"name": "UserService.create",
|
|
90
|
+
"file": "src/user.ts",
|
|
91
|
+
"callers": ["src/api.ts"],
|
|
92
|
+
"callees": ["src/db.ts"]
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"files": [
|
|
96
|
+
{
|
|
97
|
+
"path": "src/user.ts",
|
|
98
|
+
"symbols": ["UserService.create"]
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This allows SCALE to answer impact queries without reading the whole repository.
|
|
105
|
+
|
|
106
|
+
## ROI Metrics
|
|
107
|
+
|
|
108
|
+
Code intelligence reports include:
|
|
109
|
+
|
|
110
|
+
| Metric | Meaning |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `graphHits` | Number of hits from graph providers. |
|
|
113
|
+
| `fallbackCount` | Whether fallback was needed. |
|
|
114
|
+
| `baselineFileReads` | Estimated broad exploration file reads. |
|
|
115
|
+
| `recommendedFileReads` | Scoped file reads recommended by the query result. |
|
|
116
|
+
| `fileReadsSaved` | Estimated avoided reads. |
|
|
117
|
+
| `toolCallsSaved` | Estimated avoided exploration tool calls. |
|
|
118
|
+
|
|
119
|
+
These numbers are deliberately conservative. They are a local signal for whether graph-assisted exploration is worth keeping default for a task class.
|
|
120
|
+
|
|
121
|
+
## Governance ROI
|
|
122
|
+
|
|
123
|
+
`scale governance roi` can include code intelligence:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
scale governance roi --symbol UserService.create
|
|
127
|
+
scale governance roi --code-query createUser
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
When a graph provider answers, the module is reported as measured evidence. When fallback is used, the module is reported as estimated and needs more evidence before becoming a stronger default.
|
|
131
|
+
|
|
132
|
+
## Policy
|
|
133
|
+
|
|
134
|
+
- SCALE must run when no code graph provider is installed.
|
|
135
|
+
- Missing providers must produce explicit fallback, not silent success.
|
|
136
|
+
- External tools are detected but not installed automatically.
|
|
137
|
+
- Source files are read only through a bounded fallback scan.
|
|
138
|
+
- Large generated graph outputs should stay outside default prompt context; use summaries and file paths.
|