engineering-intelligence 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +5 -0
  2. package/dist/adapters/index.js +9 -9
  3. package/dist/adapters/index.js.map +1 -1
  4. package/dist/templates.d.ts +1 -1
  5. package/dist/templates.d.ts.map +1 -1
  6. package/dist/templates.js +70 -0
  7. package/dist/templates.js.map +1 -1
  8. package/dist/visualizer/index.d.ts.map +1 -1
  9. package/dist/visualizer/index.js +107 -0
  10. package/dist/visualizer/index.js.map +1 -1
  11. package/package.json +1 -1
  12. package/templates/canonical/rules/engineering-intelligence.md +9 -2
  13. package/templates/canonical/skills/adr-compliance-checker/SKILL.md +43 -0
  14. package/templates/canonical/skills/aidlc-lifecycle-engine/SKILL.md +39 -0
  15. package/templates/canonical/skills/api-backward-compatibility-engine/SKILL.md +80 -0
  16. package/templates/canonical/skills/api-snapshot-testing-engine/SKILL.md +75 -0
  17. package/templates/canonical/skills/context-budget-optimizer/SKILL.md +97 -0
  18. package/templates/canonical/skills/context-sync-engine/SKILL.md +26 -4
  19. package/templates/canonical/skills/contract-test-generator/SKILL.md +40 -0
  20. package/templates/canonical/skills/convention-detector/SKILL.md +16 -2
  21. package/templates/canonical/skills/database-migration-safety-engine/SKILL.md +79 -0
  22. package/templates/canonical/skills/dead-code-detector/SKILL.md +34 -0
  23. package/templates/canonical/skills/engineering-change-review/SKILL.md +17 -2
  24. package/templates/canonical/skills/engineering-intelligence-skill/SKILL.md +92 -8
  25. package/templates/canonical/skills/environment-variable-auditor/SKILL.md +47 -0
  26. package/templates/canonical/skills/graph-engine/SKILL.md +22 -5
  27. package/templates/canonical/skills/impact-analysis-engine/SKILL.md +30 -9
  28. package/templates/canonical/skills/knowledge-base-validator/SKILL.md +19 -3
  29. package/templates/canonical/skills/llm-prompt-injection-guard/SKILL.md +47 -0
  30. package/templates/canonical/skills/memory-sync-engine/SKILL.md +20 -0
  31. package/templates/canonical/skills/operations-readiness-engine/SKILL.md +17 -4
  32. package/templates/canonical/skills/requirement-scoper/SKILL.md +9 -0
  33. package/templates/canonical/skills/security-audit-engine/SKILL.md +30 -3
  34. package/templates/canonical/skills/staleness-detector/SKILL.md +19 -0
  35. package/templates/canonical/skills/testing-intelligence-engine/SKILL.md +37 -1
  36. package/templates/canonical/skills/type-safety-engine/SKILL.md +81 -0
  37. package/templates/canonical/workflows/engineering-intelligence.md +6 -4
  38. package/templates/canonical/workflows/initialize-engineering-intelligence.md +3 -2
@@ -32,8 +32,13 @@ Identify security risks through systematic, evidence-backed analysis of dependen
32
32
  - Check version against known CVE databases (cite CVE IDs)
33
33
  - Flag dependencies with no updates in >12 months (abandonment risk)
34
34
  - Identify transitive dependencies with known vulnerabilities
35
+ - Check license compatibility against the project license
36
+ - Check maintenance health (days since last release/commit when available)
37
+ - For frontend packages, estimate bundle size impact or require a bundle-size check
35
38
  - Note severity: critical, high, medium, low
36
39
 
40
+ Trigger this targeted dependency risk review whenever manifests add a new package. Critical CVEs block completion before commit. Unknown license or maintenance data must be recorded as risk, not ignored.
41
+
37
42
  2. **Auth/Authz Pattern Review** — Analyze authentication and authorization:
38
43
 
39
44
  | Check | What to Look For |
@@ -90,6 +95,14 @@ Identify security risks through systematic, evidence-backed analysis of dependen
90
95
 
91
96
  6. **Generate Assessment** — Write findings to `knowledge-base/20-security-assessment.md`.
92
97
 
98
+ 7. **Targeted Dependency-Risk Output** — During implementation runs triggered by new or upgraded packages, write a lighter unit artifact instead of conflating the result with a full audit:
99
+
100
+ ```text
101
+ .engineering-intelligence/aidlc/construction/<unit>/dependency-risk-summary.md
102
+ ```
103
+
104
+ This summary must include CVE, license, maintenance, and bundle impact findings for changed dependencies. Critical CVEs block completion.
105
+
93
106
  ## Output Format
94
107
 
95
108
  Write `knowledge-base/20-security-assessment.md`:
@@ -104,9 +117,9 @@ Write `knowledge-base/20-security-assessment.md`:
104
117
  - Overall risk: low | medium | high | critical
105
118
 
106
119
  ## Dependency Vulnerabilities
107
- | Dependency | Version | CVE | Severity | Fix Available |
108
- |---|---|---|---|---|
109
- | lodash | 4.17.15 | CVE-2020-8203 | High | Yes (4.17.21) |
120
+ | Dependency | Version | CVE | Severity | Fix Available | License | Maintenance | Bundle Impact |
121
+ |---|---|---|---|---|---|---|---|
122
+ | lodash | 4.17.15 | CVE-2020-8203 | High | Yes (4.17.21) | MIT | maintained | n/a |
110
123
 
111
124
  ## Auth/Authz Assessment
112
125
  - Mechanism: <description>
@@ -138,6 +151,18 @@ Write `knowledge-base/20-security-assessment.md`:
138
151
  *This security assessment did not modify product code.*
139
152
  ```
140
153
 
154
+ ### Targeted Dependency Risk Summary
155
+
156
+ ```markdown
157
+ # Dependency Risk Summary: <unit>
158
+
159
+ | Package | Change | CVE Risk | License | Maintenance | Bundle Impact | Decision |
160
+ |---|---|---|---|---|---|---|
161
+
162
+ ## Blocking Findings
163
+ - <critical CVE or policy violation>
164
+ ```
165
+
141
166
  ## Rules
142
167
 
143
168
  - Never assume a vulnerability exists without evidence — cite file paths and line numbers
@@ -149,6 +174,8 @@ Write `knowledge-base/20-security-assessment.md`:
149
174
  ## Quality Gates
150
175
 
151
176
  - [ ] All dependency vulnerabilities cite CVE IDs and affected versions
177
+ - [ ] New package additions include CVE, license, maintenance, and bundle-size risk where applicable
178
+ - [ ] Critical CVEs block completion
152
179
  - [ ] Auth/authz review covers both authentication and authorization
153
180
  - [ ] Secrets scan does not expose actual secret values in the report
154
181
  - [ ] OWASP Top 10 items each have a status with evidence or rationale
@@ -96,6 +96,15 @@ This capability does not modify product code.
96
96
  - If no freshness comment exists, add it after the document title (first `#` heading)
97
97
  - Never modify document content — only metadata comments
98
98
 
99
+ Also add section-level confidence metadata to each H2 section when evidence can be resolved:
100
+
101
+ ```markdown
102
+ ## Authentication Flow
103
+ <!-- section-confidence: level=high, score=91, verified_at=2026-06-04T10:00:00Z, evidence=src/auth/middleware.ts -->
104
+ ```
105
+
106
+ Agents must prefer high/medium confidence sections and skip low-confidence sections unless they verify the section against source first.
107
+
99
108
  6. **Determine sync actions** — Based on freshness scores, determine required actions:
100
109
 
101
110
  | Condition | Action |
@@ -161,6 +170,14 @@ This capability does not modify product code.
161
170
  - The list of changed source files
162
171
  - The staleness reason (file modified, file deleted, file moved, age)
163
172
 
173
+ 9. **Pre-Implementation Drift Trigger** — When invoked by `engineering-intelligence-skill`, return a blocking drift decision:
174
+
175
+ | Condition | Decision |
176
+ |---|---|
177
+ | All scoped artifacts >= 60 | Proceed |
178
+ | Any scoped artifact 50-59 | Sync before implementation or mark stale risk in impact report |
179
+ | Any scoped artifact < 50 | Block implementation until incremental sync or explicit user risk acceptance |
180
+
164
181
  ## Quality Gates
165
182
 
166
183
  - [ ] All knowledge base, memory, and context documents are inventoried
@@ -169,10 +186,12 @@ This capability does not modify product code.
169
186
  - [ ] Freshness scores follow the defined calculation formula
170
187
  - [ ] Score interpretation matches the defined status table
171
188
  - [ ] Freshness metadata is injected without modifying document content
189
+ - [ ] Section-level confidence metadata is added for H2 sections where evidence can be resolved
172
190
  - [ ] FRESHNESS-report.md exists at `.engineering-intelligence/reports/FRESHNESS-report.md`
173
191
  - [ ] Structural changes (deleted/moved files) are detected and reported
174
192
  - [ ] Documents below threshold are queued for incremental sync
175
193
  - [ ] Module-level aggregation is included in the report
194
+ - [ ] Pre-implementation drift decision is returned when scoped to a planned change
176
195
 
177
196
  ## Cross-References
178
197
 
@@ -13,6 +13,8 @@ Determine the minimum sufficient test coverage for a change based on risk assess
13
13
  - Impact report (`.engineering-intelligence/reports/IMP-XXX-*.md`)
14
14
  - Existing test patterns in the repository
15
15
  - Change classification (feature, bugfix, refactor, etc.)
16
+ - Coverage reports when available (`coverage-final.json`, `coverage.xml`, `lcov.info`, `go test -cover`, pytest coverage output)
17
+ - Agile acceptance criteria from `.engineering-intelligence/aidlc/agile/acceptance-criteria.md`
16
18
 
17
19
  ## Risk-Based Test Selection Matrix
18
20
 
@@ -29,11 +31,18 @@ Determine the minimum sufficient test coverage for a change based on risk assess
29
31
  - Identify test framework(s) in use (Jest, Mocha, pytest, Go testing, etc.)
30
32
  - Locate test directories and naming patterns
31
33
  - Map tests to source files (by convention or configuration)
32
- - Identify untested critical paths
34
+ - Parse real coverage reports where available:
35
+ - Jest/Vitest/Istanbul JSON (`coverage-final.json`)
36
+ - LCOV (`lcov.info`)
37
+ - pytest `coverage.xml`
38
+ - Go `go test -cover` output
39
+ - Map uncovered lines to modules and critical paths
33
40
 
34
41
  2. **Map Change to Tests** — Using the impact report:
35
42
  - List source files/functions changed
36
43
  - Find existing tests covering those files
44
+ - Build a source-line to test-file map from coverage where possible
45
+ - Run or recommend targeted impacted tests first, then broader validation
37
46
  - Identify tests that should exist but don't (coverage gaps)
38
47
 
39
48
  3. **Determine Required Tests** — Using the risk matrix above:
@@ -56,6 +65,15 @@ Determine the minimum sufficient test coverage for a change based on risk assess
56
65
  - Negative-path and permission tests for security changes
57
66
  - Data migration and rollback tests for schema changes
58
67
 
68
+ **For API/service integration changes**:
69
+ - Generate integration test stubs from `knowledge-base/04-api-documentation.md` and `service-graph.json`
70
+ - Cover happy path, auth failure, downstream timeout, and validation error
71
+ - Match existing test framework, describe/it nesting, mock setup, assertion library, and factory style
72
+
73
+ **For complex validators or combinatorial logic**:
74
+ - Recommend property-based tests (`fast-check`, `hypothesis`, `proptest`, or project equivalent)
75
+ - Include seed examples and rationale
76
+
59
77
  4. **Identify Coverage Gaps** — Report:
60
78
  - Critical paths with no test coverage
61
79
  - Changed behavior with no corresponding test
@@ -66,6 +84,10 @@ Determine the minimum sufficient test coverage for a change based on risk assess
66
84
  - Test cases to write (describe what, not write the test code)
67
85
  - Validation commands to run
68
86
 
87
+ 6. **Verify Acceptance Criteria** — Produce an Acceptance Criteria Verification Matrix mapping every criterion to automated tests, manual verification, or an unavailable check. Missing mappings block Definition of Done.
88
+
89
+ 7. **Propose Regression Patterns** — For bugfixes, compare against `.engineering-intelligence/memory/regression-patterns.md`. Reuse matching templates. If a new recurring bug category is found, propose a durable pattern to `memory-sync-engine`; Memory Sync owns durable persistence.
90
+
69
91
  ## Output
70
92
 
71
93
  ### Per-Change Testing (in `.changes/CHG-XXX-*.md`)
@@ -99,6 +121,14 @@ Only update when documenting project-wide testing posture:
99
121
  ## Coverage Gaps
100
122
  - <critical untested areas>
101
123
 
124
+ ## Evidence-Based Coverage
125
+ | Source File | Changed Lines | Covering Tests | Uncovered Lines |
126
+ |---|---|---|---|
127
+
128
+ ## Acceptance Criteria Verification Matrix
129
+ | Criterion | Covering Test / Manual Check | Result |
130
+ |---|---|---|
131
+
102
132
  ## Running Tests
103
133
  - All tests: `<command>`
104
134
  - Specific suite: `<command>`
@@ -110,6 +140,9 @@ Only update when documenting project-wide testing posture:
110
140
  - Recommend tests proportional to risk — don't mandate full-suite runs for low-risk changes
111
141
  - Always note when validation was not actually run (only recommended)
112
142
  - Never claim test coverage without checking existing tests
143
+ - Prefer real coverage reports over proximity estimates when reports exist
144
+ - Target impacted tests first, then run broader suites according to risk
145
+ - Missing acceptance-criteria mappings block Definition of Done
113
146
  - Record test results honestly, including failures
114
147
 
115
148
  ## Quality Gates
@@ -117,7 +150,10 @@ Only update when documenting project-wide testing posture:
117
150
  - [ ] Impact report was consulted for risk level
118
151
  - [ ] Test recommendations match the risk level
119
152
  - [ ] Existing test coverage was checked before recommending new tests
153
+ - [ ] Coverage reports were parsed when available
154
+ - [ ] Impacted tests were identified separately from full-suite validation
120
155
  - [ ] Coverage gaps in critical paths are flagged
156
+ - [ ] Acceptance criteria are mapped to validation evidence
121
157
 
122
158
  ## Cross-References
123
159
 
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: type-safety-engine
3
+ description: Validates generated code against the project type system, traces type-level dependencies, and loops on compiler errors until clean or blocked.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Type Safety Engine
8
+
9
+ Use this skill for TypeScript, Python, Go, Rust, Java, Kotlin, C#, or any project with a declared type checker. It is a blocking gate for generated code in typed projects.
10
+
11
+ ## Inputs
12
+
13
+ - Changed files from the impact report or current diff
14
+ - Project manifests and type-check configuration
15
+ - Existing graph artifacts under `.engineering-intelligence/graph/`
16
+
17
+ ## Procedure
18
+
19
+ 1. **Detect Type System**
20
+ - TypeScript: `tsconfig.json`, `package.json`, `tsc`
21
+ - Python: `mypy.ini`, `pyproject.toml`, `pyrightconfig.json`, annotations
22
+ - Go: `go.mod`
23
+ - Rust: `Cargo.toml`
24
+ - Java/Kotlin/C#: project build files
25
+
26
+ 2. **Trace Type Dependencies**
27
+ - TypeScript: run or recommend `tsc --listFilesOnly` and use the TypeScript compiler API when available to identify interface, type alias, enum, generic, declaration, and ambient type dependencies.
28
+ - Python: run or recommend `mypy --show-column-numbers` or `pyright` and trace annotation/import relationships.
29
+ - Add high-confidence `imports-type` edges to `.engineering-intelligence/graph/dependency-graph.json` for type-only dependencies, with evidence paths.
30
+
31
+ 3. **Run Type Check**
32
+ - Use the project’s existing command first (`npm run typecheck`, `pnpm typecheck`, `mypy`, `pyright`, `go test`, `cargo check`, etc.).
33
+ - If no command exists, use the safest detected command and record that it was inferred.
34
+
35
+ 4. **Map Errors**
36
+ Write a Type Error Map in the active unit build/test summary:
37
+
38
+ ```markdown
39
+ ## Type Error Map
40
+ | File | Line | Column | Symbol | Error | Proposed Fix | Status |
41
+ |---|---:|---:|---|---|---|---|
42
+ ```
43
+
44
+ 5. **Fix Loop**
45
+ - Fix targeted type errors only.
46
+ - Rerun the relevant type check.
47
+ - Continue until clean or a blocker is recorded.
48
+
49
+ ## Output
50
+
51
+ Write or update `.engineering-intelligence/aidlc/construction/<unit>/build-and-test/type-safety-summary.md`:
52
+
53
+ ```markdown
54
+ # Type Safety Summary: <unit>
55
+
56
+ ## Commands
57
+ - `<command>`: <passed|failed|unavailable>
58
+
59
+ ## Type Dependency Edges
60
+ - `imports-type`: <from> -> <to> (evidence: <path>)
61
+
62
+ ## Type Error Map
63
+ <table>
64
+
65
+ ## Result
66
+ <clean|blocked|not applicable>
67
+ ```
68
+
69
+ ## Rules
70
+
71
+ - Never mark typed code complete while type errors remain unaddressed.
72
+ - If a type checker is unavailable, record `not applicable` with evidence rather than silently skipping.
73
+ - Type-only dependencies must be included in impact analysis for typed languages.
74
+
75
+ ## Quality Gates
76
+
77
+ - [ ] Type checker command was detected or explicitly unavailable
78
+ - [ ] Type-level dependencies were traced for shared types/interfaces
79
+ - [ ] `imports-type` graph edges were added or confirmed unnecessary
80
+ - [ ] Type Error Map exists for failures
81
+ - [ ] Final type status is clean, blocked with evidence, or not applicable
@@ -14,10 +14,11 @@ Use the `engineering-intelligence-skill` capability for the user's accompanying
14
14
  4. **Plan Agile + AI-DLC Work** — Update backlog, acceptance criteria, Definition of Ready, `.engineering-intelligence/aidlc/execution-plan.md`, and `aidlc-state.md`
15
15
  5. **Implement** — Make the requested code changes following established patterns
16
16
  6. **Test** — Add/update tests proportional to risk; execute and record results
17
- 7. **Validate** — Run available linters, type checks, test suites, scans, and architecture checks as environmental backpressure
18
- 8. **Sync Intelligence** — Incrementally update only affected knowledge, memory, context, event, graph artifacts, and AI-DLC artifacts
19
- 9. **Record Change** — Write `.changes/CHG-XXX-<summary>.md` referencing related reports
20
- 10. **Review Gate** — For high-risk changes, run engineering-change review before completion
17
+ 7. **Safety Gates** — Run freshness, type safety, API compatibility, API snapshot replay, migration safety, convention, acceptance-mapping, dependency-risk, env-var, ADR compliance, LLM prompt-injection, and rollback gates when applicable
18
+ 8. **Validate** — Run available linters, type checks, test suites, scans, and architecture checks as environmental backpressure
19
+ 9. **Sync Intelligence** — Incrementally update only affected knowledge, memory, context, event, graph artifacts, and AI-DLC artifacts
20
+ 10. **Record Change** — Write `.changes/CHG-XXX-<summary>.md` referencing related reports and acceptance verification
21
+ 11. **Review Gate** — For high-risk changes, run engineering-change review before completion
21
22
 
22
23
  ## Completion Report
23
24
 
@@ -28,5 +29,6 @@ Finish with:
28
29
  - Synchronized intelligence artifacts
29
30
  - Related reports (IMP-XXX, REV-XXX)
30
31
  - Agile artifacts updated (backlog, stories, acceptance criteria, Definition of Done)
32
+ - Safety gates run (freshness, type, API, snapshots, migration, dependency, env, ADR, LLM, acceptance mapping, rollback)
31
33
  - Unresolved risks or follow-ups
32
34
  - AI-DLC breadcrumb (`AI-DLC: <phase> -> <stage> -> <status>`)
@@ -30,8 +30,9 @@ Analyzes this repository thoroughly without changing product code. Produces a co
30
30
  4. **Generate Memory** — Extract durable decisions and patterns
31
31
  5. **Generate Context** — Create concise AI navigation maps
32
32
  6. **Build Graphs** — Generate evidence-backed architecture graphs
33
- 7. **Initialize AI-DLC + Agile** — Create `aidlc-state.md`, `audit.md`, `open-questions.md`, `execution-plan.md`, Agile delivery artifacts, and `construction/cross-unit-discoveries.md`
34
- 8. **Record** — Write initialization change record
33
+ 7. **Initialize AI-DLC + Agile** — Create `aidlc-state.md`, `audit.md`, `open-questions.md`, `execution-plan.md`, `checkpoints.md`, Agile delivery artifacts, and `construction/cross-unit-discoveries.md`
34
+ 8. **Audit Memory** — Run memory pruning audit and initialize `.engineering-intelligence/memory/regression-patterns.md`
35
+ 9. **Record** — Write initialization change record
35
36
 
36
37
  ## Important
37
38