@neurcode-ai/cli 0.9.50 → 0.9.59

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 (61) hide show
  1. package/dist/commands/fix.d.ts.map +1 -1
  2. package/dist/commands/fix.js +307 -31
  3. package/dist/commands/fix.js.map +1 -1
  4. package/dist/commands/verify.d.ts.map +1 -1
  5. package/dist/commands/verify.js +264 -13
  6. package/dist/commands/verify.js.map +1 -1
  7. package/dist/daemon/server.d.ts +23 -0
  8. package/dist/daemon/server.d.ts.map +1 -0
  9. package/dist/daemon/server.js +222 -0
  10. package/dist/daemon/server.js.map +1 -0
  11. package/dist/index.js +8 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/intent-engine/coverage.d.ts +69 -0
  14. package/dist/intent-engine/coverage.d.ts.map +1 -0
  15. package/dist/intent-engine/coverage.js +140 -0
  16. package/dist/intent-engine/coverage.js.map +1 -0
  17. package/dist/intent-engine/flow-rules.d.ts +21 -0
  18. package/dist/intent-engine/flow-rules.d.ts.map +1 -0
  19. package/dist/intent-engine/flow-rules.js +83 -0
  20. package/dist/intent-engine/flow-rules.js.map +1 -0
  21. package/dist/intent-engine/flow-validator.d.ts +29 -0
  22. package/dist/intent-engine/flow-validator.d.ts.map +1 -0
  23. package/dist/intent-engine/flow-validator.js +202 -0
  24. package/dist/intent-engine/flow-validator.js.map +1 -0
  25. package/dist/intent-engine/graph.d.ts +33 -0
  26. package/dist/intent-engine/graph.d.ts.map +1 -0
  27. package/dist/intent-engine/graph.js +67 -0
  28. package/dist/intent-engine/graph.js.map +1 -0
  29. package/dist/intent-engine/index.d.ts +35 -0
  30. package/dist/intent-engine/index.d.ts.map +1 -0
  31. package/dist/intent-engine/index.js +94 -0
  32. package/dist/intent-engine/index.js.map +1 -0
  33. package/dist/intent-engine/indexer.d.ts +18 -0
  34. package/dist/intent-engine/indexer.d.ts.map +1 -0
  35. package/dist/intent-engine/indexer.js +100 -0
  36. package/dist/intent-engine/indexer.js.map +1 -0
  37. package/dist/intent-engine/matcher.d.ts +35 -0
  38. package/dist/intent-engine/matcher.d.ts.map +1 -0
  39. package/dist/intent-engine/matcher.js +522 -0
  40. package/dist/intent-engine/matcher.js.map +1 -0
  41. package/dist/intent-engine/parser.d.ts +12 -0
  42. package/dist/intent-engine/parser.d.ts.map +1 -0
  43. package/dist/intent-engine/parser.js +93 -0
  44. package/dist/intent-engine/parser.js.map +1 -0
  45. package/dist/intent-engine/regression.d.ts +32 -0
  46. package/dist/intent-engine/regression.d.ts.map +1 -0
  47. package/dist/intent-engine/regression.js +166 -0
  48. package/dist/intent-engine/regression.js.map +1 -0
  49. package/dist/intent-engine/requirements.d.ts +22 -0
  50. package/dist/intent-engine/requirements.d.ts.map +1 -0
  51. package/dist/intent-engine/requirements.js +147 -0
  52. package/dist/intent-engine/requirements.js.map +1 -0
  53. package/dist/intent-engine/state.d.ts +44 -0
  54. package/dist/intent-engine/state.d.ts.map +1 -0
  55. package/dist/intent-engine/state.js +83 -0
  56. package/dist/intent-engine/state.js.map +1 -0
  57. package/dist/utils/ai-debt-budget.d.ts +3 -2
  58. package/dist/utils/ai-debt-budget.d.ts.map +1 -1
  59. package/dist/utils/ai-debt-budget.js +83 -2
  60. package/dist/utils/ai-debt-budget.js.map +1 -1
  61. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Regression Detector — compares the current intent engine result against
3
+ * the previously saved state to identify system degradation.
4
+ *
5
+ * This is NOT about detecting new problems. It answers:
6
+ * "What was working before but is now broken?"
7
+ *
8
+ * All checks are deterministic. No LLM calls. No disk I/O — that is
9
+ * handled by state.ts; this module receives pre-loaded data.
10
+ */
11
+ import type { IntentState } from './state';
12
+ import type { IntentSummary } from './coverage';
13
+ import type { FlowIssue } from './flow-validator';
14
+ export type RegressionType = 'component-regression' | 'critical-regression' | 'flow-regression' | 'coverage-regression';
15
+ export interface RegressionIssue {
16
+ type: RegressionType;
17
+ message: string;
18
+ /** Always 'high' — all regressions are blocking. */
19
+ severity: 'high';
20
+ /** Rule id for deduplication and fix mapping. */
21
+ rule: string;
22
+ }
23
+ /**
24
+ * Compare the previous saved state against the current engine output and return
25
+ * a deduplicated list of regression issues.
26
+ *
27
+ * Returns [] when:
28
+ * - previousState is null (first run, nothing to compare)
29
+ * - intent text changed significantly (different feature, not a regression)
30
+ */
31
+ export declare function detectRegressions(previousState: IntentState | null, currentIntentSummary: IntentSummary | null, currentFlowIssues: FlowIssue[], currentComponentMap: Record<string, string[]>, currentIntentText: string): RegressionIssue[];
32
+ //# sourceMappingURL=regression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regression.d.ts","sourceRoot":"","sources":["../../src/intent-engine/regression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,MAAM,MAAM,cAAc,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,iBAAiB,GACjB,qBAAqB,CAAC;AAE1B,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;CACd;AAuGD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,WAAW,GAAG,IAAI,EACjC,oBAAoB,EAAE,aAAa,GAAG,IAAI,EAC1C,iBAAiB,EAAE,SAAS,EAAE,EAC9B,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC7C,iBAAiB,EAAE,MAAM,GACxB,eAAe,EAAE,CAoDnB"}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ /**
3
+ * Regression Detector — compares the current intent engine result against
4
+ * the previously saved state to identify system degradation.
5
+ *
6
+ * This is NOT about detecting new problems. It answers:
7
+ * "What was working before but is now broken?"
8
+ *
9
+ * All checks are deterministic. No LLM calls. No disk I/O — that is
10
+ * handled by state.ts; this module receives pre-loaded data.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.detectRegressions = detectRegressions;
14
+ // ── Thresholds ────────────────────────────────────────────────────────────────
15
+ /** Minimum weighted-coverage drop (absolute, 0–1) that triggers a regression. */
16
+ const COVERAGE_DROP_THRESHOLD = 0.10;
17
+ // ── Detection rules ───────────────────────────────────────────────────────────
18
+ /**
19
+ * A. Component regression — component was detected before, is absent now.
20
+ */
21
+ function detectComponentRegressions(previousComponentMap, currentComponentMap) {
22
+ const issues = [];
23
+ for (const component of Object.keys(previousComponentMap)) {
24
+ if (previousComponentMap[component].length > 0 && !currentComponentMap[component]) {
25
+ issues.push({
26
+ type: 'component-regression',
27
+ message: `Component '${component}' was previously implemented but is now missing`,
28
+ severity: 'high',
29
+ rule: `regression:component:${component}`,
30
+ });
31
+ }
32
+ }
33
+ return issues;
34
+ }
35
+ /**
36
+ * B. Critical regression — component was present, now appears in criticalMissing.
37
+ */
38
+ function detectCriticalRegressions(previousComponentMap, currentCriticalMissing) {
39
+ const issues = [];
40
+ for (const component of currentCriticalMissing) {
41
+ // It's a regression only if it was previously implemented
42
+ if (previousComponentMap[component] && previousComponentMap[component].length > 0) {
43
+ issues.push({
44
+ type: 'critical-regression',
45
+ message: `Critical component '${component}' regressed — it was implemented before but is now missing`,
46
+ severity: 'high',
47
+ rule: `regression:critical:${component}`,
48
+ });
49
+ }
50
+ }
51
+ return issues;
52
+ }
53
+ /**
54
+ * C. Flow regression — a flow issue exists now that did NOT exist before.
55
+ */
56
+ function detectFlowRegressions(previousFlowIssueIds, currentFlowIssues) {
57
+ const prevSet = new Set(previousFlowIssueIds);
58
+ return currentFlowIssues
59
+ .filter((fi) => !prevSet.has(fi.rule))
60
+ .map((fi) => ({
61
+ type: 'flow-regression',
62
+ message: `New flow issue introduced: ${fi.message}`,
63
+ severity: 'high',
64
+ rule: `regression:flow:${fi.rule}`,
65
+ }));
66
+ }
67
+ /**
68
+ * D. Coverage regression — weighted coverage dropped by more than the threshold.
69
+ */
70
+ function detectCoverageRegression(previousSummary, currentSummary) {
71
+ if (!previousSummary || !currentSummary)
72
+ return null;
73
+ const prev = previousSummary.weightedCoverage;
74
+ const curr = currentSummary.weightedCoverage;
75
+ if (typeof prev !== 'number' || typeof curr !== 'number')
76
+ return null;
77
+ const drop = prev - curr;
78
+ if (drop <= COVERAGE_DROP_THRESHOLD)
79
+ return null;
80
+ const prevPct = Math.round(prev * 100);
81
+ const currPct = Math.round(curr * 100);
82
+ return {
83
+ type: 'coverage-regression',
84
+ message: `System coverage dropped from ${prevPct}% → ${currPct}% (−${Math.round(drop * 100)}pp)`,
85
+ severity: 'high',
86
+ rule: 'regression:coverage-drop',
87
+ };
88
+ }
89
+ // ── Public API ────────────────────────────────────────────────────────────────
90
+ /**
91
+ * Compare the previous saved state against the current engine output and return
92
+ * a deduplicated list of regression issues.
93
+ *
94
+ * Returns [] when:
95
+ * - previousState is null (first run, nothing to compare)
96
+ * - intent text changed significantly (different feature, not a regression)
97
+ */
98
+ function detectRegressions(previousState, currentIntentSummary, currentFlowIssues, currentComponentMap, currentIntentText) {
99
+ if (!previousState)
100
+ return [];
101
+ // If the intent changed substantially, skip regression analysis to avoid
102
+ // false positives (different feature = different component expectations).
103
+ const intentChanged = !intentsSimilar(previousState.intent, currentIntentText);
104
+ if (intentChanged)
105
+ return [];
106
+ const issues = [];
107
+ const seen = new Set();
108
+ const add = (list) => {
109
+ for (const issue of list) {
110
+ if (!seen.has(issue.rule)) {
111
+ seen.add(issue.rule);
112
+ issues.push(issue);
113
+ }
114
+ }
115
+ };
116
+ // A — component regressions (superset of B, so run B separately to give richer message)
117
+ const componentRegressions = detectComponentRegressions(previousState.componentMap, currentComponentMap);
118
+ // B — critical regressions (subset of A with different label; skip if already in A)
119
+ const criticalMissing = currentIntentSummary?.criticalMissing ?? [];
120
+ const criticalRegressions = detectCriticalRegressions(previousState.componentMap, criticalMissing);
121
+ // Prefer the critical-regression message over the generic component-regression
122
+ // message when the same component triggers both.
123
+ const criticalComponents = new Set(criticalRegressions.map((r) => r.rule.replace('regression:critical:', '')));
124
+ const filteredComponentRegressions = componentRegressions.filter((r) => !criticalComponents.has(r.rule.replace('regression:component:', '')));
125
+ add(criticalRegressions);
126
+ add(filteredComponentRegressions);
127
+ // C — flow regressions
128
+ add(detectFlowRegressions(previousState.flowIssueIds, currentFlowIssues));
129
+ // D — coverage regression (at most one)
130
+ const coverageReg = detectCoverageRegression(previousState.intentSummary, currentIntentSummary);
131
+ if (coverageReg)
132
+ add([coverageReg]);
133
+ return issues;
134
+ }
135
+ // ── Helpers ───────────────────────────────────────────────────────────────────
136
+ /**
137
+ * Rough similarity check: two intents are considered "similar" if they share
138
+ * at least 60% of their distinctive words (ignoring stop words).
139
+ * This prevents false-positive regressions when the developer changes feature.
140
+ */
141
+ const STOP_WORDS = new Set([
142
+ 'a', 'an', 'the', 'and', 'or', 'in', 'on', 'for', 'with', 'to', 'of',
143
+ 'is', 'are', 'was', 'be', 'that', 'this', 'it', 'as', 'at', 'by', 'from',
144
+ 'implement', 'add', 'create', 'build', 'update', 'fix', 'change', 'refactor',
145
+ ]);
146
+ function tokenise(text) {
147
+ return new Set(text.toLowerCase()
148
+ .split(/\W+/)
149
+ .filter((w) => w.length > 2 && !STOP_WORDS.has(w)));
150
+ }
151
+ function intentsSimilar(a, b) {
152
+ if (!a || !b)
153
+ return false;
154
+ const ta = tokenise(a);
155
+ const tb = tokenise(b);
156
+ if (ta.size === 0 || tb.size === 0)
157
+ return false;
158
+ let shared = 0;
159
+ for (const word of ta) {
160
+ if (tb.has(word))
161
+ shared++;
162
+ }
163
+ const similarity = shared / Math.max(ta.size, tb.size);
164
+ return similarity >= 0.4; // 40% word overlap = same intent domain
165
+ }
166
+ //# sourceMappingURL=regression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regression.js","sourceRoot":"","sources":["../../src/intent-engine/regression.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAoIH,8CA0DC;AAvKD,iFAAiF;AAEjF,iFAAiF;AACjF,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC,iFAAiF;AAEjF;;GAEG;AACH,SAAS,0BAA0B,CACjC,oBAA8C,EAC9C,mBAA6C;IAE7C,MAAM,MAAM,GAAsB,EAAE,CAAC;IAErC,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC1D,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,CAAC;YAClF,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,sBAAsB;gBAC5B,OAAO,EAAE,cAAc,SAAS,iDAAiD;gBACjF,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,wBAAwB,SAAS,EAAE;aAC1C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,yBAAyB,CAChC,oBAA8C,EAC9C,sBAAgC;IAEhC,MAAM,MAAM,GAAsB,EAAE,CAAC;IAErC,KAAK,MAAM,SAAS,IAAI,sBAAsB,EAAE,CAAC;QAC/C,0DAA0D;QAC1D,IAAI,oBAAoB,CAAC,SAAS,CAAC,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClF,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,qBAAqB;gBAC3B,OAAO,EAAE,uBAAuB,SAAS,4DAA4D;gBACrG,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,uBAAuB,SAAS,EAAE;aAC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CACZ,IAAI,CAAC,WAAW,EAAE;SACf,KAAK,CAAC,KAAK,CAAC;SACZ,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACrD,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,CAAS,EAAE,CAAS;IAC1C,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,EAAE,EAAE,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,MAAM,EAAE,CAAC;IAAC,CAAC;IACtD,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACvD,OAAO,UAAU,IAAI,GAAG,CAAC,CAAC,wCAAwC;AACpE,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Domain Requirements Map — declares the set of components expected for each
3
+ * implementation domain, their weights, and which ones are security-critical.
4
+ *
5
+ * Keep keys lowercase-kebab. They are used as-is in user-facing output so
6
+ * they should be readable without further transformation.
7
+ */
8
+ export type ComponentKey = string;
9
+ export declare const DOMAIN_REQUIREMENTS: Record<string, ComponentKey[]>;
10
+ export declare const COMPONENT_WEIGHTS: Record<string, number>;
11
+ export declare const CRITICAL_COMPONENTS: Set<string>;
12
+ export declare function weightOf(key: ComponentKey): number;
13
+ export declare function isCritical(key: ComponentKey): boolean;
14
+ /**
15
+ * Human-readable label for a component key, used in CLI output.
16
+ */
17
+ export declare function labelForComponent(key: ComponentKey): string;
18
+ /**
19
+ * Returns the requirements list for a domain, or [] if the domain is unknown.
20
+ */
21
+ export declare function requirementsForDomain(domain: string): ComponentKey[];
22
+ //# sourceMappingURL=requirements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirements.d.ts","sourceRoot":"","sources":["../../src/intent-engine/requirements.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAIlC,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAgD9D,CAAC;AAQF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqCpD,CAAC;AAOF,eAAO,MAAM,mBAAmB,aAY9B,CAAC;AAIH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAElD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAK3D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,CAEpE"}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ /**
3
+ * Domain Requirements Map — declares the set of components expected for each
4
+ * implementation domain, their weights, and which ones are security-critical.
5
+ *
6
+ * Keep keys lowercase-kebab. They are used as-is in user-facing output so
7
+ * they should be readable without further transformation.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.CRITICAL_COMPONENTS = exports.COMPONENT_WEIGHTS = exports.DOMAIN_REQUIREMENTS = void 0;
11
+ exports.weightOf = weightOf;
12
+ exports.isCritical = isCritical;
13
+ exports.labelForComponent = labelForComponent;
14
+ exports.requirementsForDomain = requirementsForDomain;
15
+ // ── Domain requirements ───────────────────────────────────────────────────────
16
+ exports.DOMAIN_REQUIREMENTS = {
17
+ auth: [
18
+ 'input-validation',
19
+ 'token-generation',
20
+ 'token-expiry',
21
+ 'role-check',
22
+ 'middleware-protection',
23
+ 'password-hashing',
24
+ ],
25
+ api: [
26
+ 'input-validation',
27
+ 'error-handling',
28
+ 'service-layer-separation',
29
+ 'auth-middleware',
30
+ 'response-schema',
31
+ ],
32
+ payment: [
33
+ 'input-validation',
34
+ 'idempotency',
35
+ 'webhook-verification',
36
+ 'error-handling',
37
+ 'secure-data-handling',
38
+ ],
39
+ database: [
40
+ 'transaction-handling',
41
+ 'migration-safety',
42
+ 'connection-pooling',
43
+ 'input-sanitization',
44
+ ],
45
+ security: [
46
+ 'input-sanitization',
47
+ 'output-encoding',
48
+ 'secret-management',
49
+ 'cors-policy',
50
+ 'https-enforcement',
51
+ ],
52
+ notification: [
53
+ 'recipient-validation',
54
+ 'retry-logic',
55
+ 'template-validation',
56
+ 'rate-limiting',
57
+ ],
58
+ file: [
59
+ 'file-type-validation',
60
+ 'size-limit-enforcement',
61
+ 'filename-sanitization',
62
+ 'access-control',
63
+ ],
64
+ };
65
+ // ── Component weights ─────────────────────────────────────────────────────────
66
+ //
67
+ // Higher = more important for weighted coverage calculation.
68
+ // Components with a weight of 3 are security-critical gates.
69
+ // Default weight for any unlisted component is 1.
70
+ exports.COMPONENT_WEIGHTS = {
71
+ // auth
72
+ 'input-validation': 3,
73
+ 'token-generation': 2,
74
+ 'token-expiry': 3,
75
+ 'role-check': 2,
76
+ 'middleware-protection': 2,
77
+ 'password-hashing': 3,
78
+ // api
79
+ 'error-handling': 2,
80
+ 'service-layer-separation': 1,
81
+ 'auth-middleware': 2,
82
+ 'response-schema': 1,
83
+ // payment
84
+ 'idempotency': 2,
85
+ 'webhook-verification': 3,
86
+ 'secure-data-handling': 3,
87
+ // database
88
+ 'transaction-handling': 2,
89
+ 'migration-safety': 3,
90
+ 'connection-pooling': 1,
91
+ 'input-sanitization': 3,
92
+ // security
93
+ 'output-encoding': 3,
94
+ 'secret-management': 3,
95
+ 'cors-policy': 2,
96
+ 'https-enforcement': 3,
97
+ // notification
98
+ 'recipient-validation': 2,
99
+ 'retry-logic': 1,
100
+ 'template-validation': 1,
101
+ 'rate-limiting': 2,
102
+ // file
103
+ 'file-type-validation': 3,
104
+ 'size-limit-enforcement': 2,
105
+ 'filename-sanitization': 2,
106
+ 'access-control': 3,
107
+ };
108
+ // ── Critical components ───────────────────────────────────────────────────────
109
+ //
110
+ // If any critical component is absent the system is classified CRITICAL
111
+ // regardless of overall coverage percentage.
112
+ exports.CRITICAL_COMPONENTS = new Set([
113
+ 'input-validation',
114
+ 'token-expiry',
115
+ 'password-hashing',
116
+ 'webhook-verification',
117
+ 'migration-safety',
118
+ 'input-sanitization',
119
+ 'output-encoding',
120
+ 'secret-management',
121
+ 'https-enforcement',
122
+ 'file-type-validation',
123
+ 'access-control',
124
+ ]);
125
+ // ── Helpers ───────────────────────────────────────────────────────────────────
126
+ function weightOf(key) {
127
+ return exports.COMPONENT_WEIGHTS[key] ?? 1;
128
+ }
129
+ function isCritical(key) {
130
+ return exports.CRITICAL_COMPONENTS.has(key);
131
+ }
132
+ /**
133
+ * Human-readable label for a component key, used in CLI output.
134
+ */
135
+ function labelForComponent(key) {
136
+ return key
137
+ .split('-')
138
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
139
+ .join(' ');
140
+ }
141
+ /**
142
+ * Returns the requirements list for a domain, or [] if the domain is unknown.
143
+ */
144
+ function requirementsForDomain(domain) {
145
+ return exports.DOMAIN_REQUIREMENTS[domain.toLowerCase()] ?? [];
146
+ }
147
+ //# sourceMappingURL=requirements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirements.js","sourceRoot":"","sources":["../../src/intent-engine/requirements.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA0HH,4BAEC;AAED,gCAEC;AAKD,8CAKC;A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O,2BAAmB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;AACzD,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Intent State — lightweight persistence layer for the regression engine.
3
+ *
4
+ * Reads/writes a single JSON file at .neurcode/intent-state.json.
5
+ * All functions are safe: they never throw and never crash verification.
6
+ */
7
+ export interface IntentStateSummary {
8
+ domain: string;
9
+ coverage: number;
10
+ weightedCoverage: number;
11
+ status: string;
12
+ criticalMissing: string[];
13
+ }
14
+ export interface IntentState {
15
+ intent: string;
16
+ timestamp: string;
17
+ intentSummary: IntentStateSummary | null;
18
+ /** Flow rule IDs that were active in the previous run. */
19
+ flowIssueIds: string[];
20
+ /** Component key → file paths where the component was detected. */
21
+ componentMap: Record<string, string[]>;
22
+ }
23
+ /**
24
+ * Load the saved intent state from the previous verify run.
25
+ * Returns null if the file is absent, unreadable, or has an invalid schema.
26
+ */
27
+ export declare function loadPreviousState(projectRoot: string): IntentState | null;
28
+ /**
29
+ * Persist the current intent engine state so the next verify run can detect
30
+ * regressions. Silently no-ops if any I/O error occurs.
31
+ */
32
+ export declare function saveCurrentState(projectRoot: string, state: IntentState): void;
33
+ /**
34
+ * Build an IntentState from the current engine run results.
35
+ * Called just before saveCurrentState.
36
+ */
37
+ export declare function buildCurrentState(intentText: string, intentSummary: {
38
+ domain: string;
39
+ coverage: number;
40
+ weightedCoverage?: number;
41
+ status?: string;
42
+ criticalMissing?: string[];
43
+ } | null, flowIssueIds: string[], componentMap: Record<string, string[]>): IntentState;
44
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/intent-engine/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,0DAA0D;IAC1D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACxC;AA2BD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CASzE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAQ9E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,GAAG,IAAI,EACR,YAAY,EAAE,MAAM,EAAE,EACtB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GACrC,WAAW,CAgBb"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /**
3
+ * Intent State — lightweight persistence layer for the regression engine.
4
+ *
5
+ * Reads/writes a single JSON file at .neurcode/intent-state.json.
6
+ * All functions are safe: they never throw and never crash verification.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.loadPreviousState = loadPreviousState;
10
+ exports.saveCurrentState = saveCurrentState;
11
+ exports.buildCurrentState = buildCurrentState;
12
+ const fs_1 = require("fs");
13
+ const path_1 = require("path");
14
+ // ── Constants ─────────────────────────────────────────────────────────────────
15
+ const STATE_FILENAME = 'intent-state.json';
16
+ const NEURCODE_DIR = '.neurcode';
17
+ // ── Helpers ───────────────────────────────────────────────────────────────────
18
+ function statePath(projectRoot) {
19
+ return (0, path_1.join)(projectRoot, NEURCODE_DIR, STATE_FILENAME);
20
+ }
21
+ function isValidState(v) {
22
+ if (typeof v !== 'object' || v === null)
23
+ return false;
24
+ const obj = v;
25
+ return (typeof obj.intent === 'string' &&
26
+ typeof obj.timestamp === 'string' &&
27
+ Array.isArray(obj.flowIssueIds) &&
28
+ typeof obj.componentMap === 'object' &&
29
+ obj.componentMap !== null);
30
+ }
31
+ // ── Public API ────────────────────────────────────────────────────────────────
32
+ /**
33
+ * Load the saved intent state from the previous verify run.
34
+ * Returns null if the file is absent, unreadable, or has an invalid schema.
35
+ */
36
+ function loadPreviousState(projectRoot) {
37
+ try {
38
+ const raw = (0, fs_1.readFileSync)(statePath(projectRoot), 'utf8');
39
+ const parsed = JSON.parse(raw);
40
+ if (!isValidState(parsed))
41
+ return null;
42
+ return parsed;
43
+ }
44
+ catch {
45
+ return null;
46
+ }
47
+ }
48
+ /**
49
+ * Persist the current intent engine state so the next verify run can detect
50
+ * regressions. Silently no-ops if any I/O error occurs.
51
+ */
52
+ function saveCurrentState(projectRoot, state) {
53
+ try {
54
+ const dir = (0, path_1.join)(projectRoot, NEURCODE_DIR);
55
+ (0, fs_1.mkdirSync)(dir, { recursive: true });
56
+ (0, fs_1.writeFileSync)(statePath(projectRoot), JSON.stringify(state, null, 2), 'utf8');
57
+ }
58
+ catch {
59
+ // Non-fatal: state write failure must never break verification
60
+ }
61
+ }
62
+ /**
63
+ * Build an IntentState from the current engine run results.
64
+ * Called just before saveCurrentState.
65
+ */
66
+ function buildCurrentState(intentText, intentSummary, flowIssueIds, componentMap) {
67
+ return {
68
+ intent: intentText,
69
+ timestamp: new Date().toISOString(),
70
+ intentSummary: intentSummary
71
+ ? {
72
+ domain: intentSummary.domain,
73
+ coverage: intentSummary.coverage,
74
+ weightedCoverage: intentSummary.weightedCoverage ?? intentSummary.coverage,
75
+ status: intentSummary.status ?? 'SECURE',
76
+ criticalMissing: intentSummary.criticalMissing ?? [],
77
+ }
78
+ : null,
79
+ flowIssueIds,
80
+ componentMap,
81
+ };
82
+ }
83
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/intent-engine/state.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAsDH,8CASC;AAMD,4CAQC;AAMD,8CA2BC;AA5GD,2BAA4D;AAC5D,+BAA4B;AAsB5B,iFAAiF;AAEjF,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAC3C,MAAM,YAAY,GAAG,WAAW,CAAC;AAEjC,iFAAiF;AAEjF,SAAS,SAAS,CAAC,WAAmB;IACpC,OAAO,IAAA,WAAI,EAAC,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,YAAY,CAAC,CAAU;IAC9B,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,GAAG,GAAG,CAA4B,CAAC;IACzC,OAAO,CACL,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ;QAC9B,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ;QACjC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QAC/B,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ;QACpC,GAAG,CAAC,YAAY,KAAK,IAAI,CAC1B,CAAC;AACJ,CAAC;AAED,iFAAiF;AAEjF;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,WAAmB;IACnD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,iBAAY,EAAC,SAAS,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;QACzD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,G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iDebtViolation {
19
- code: 'added_todo_fixme' | 'added_console_logs' | 'added_any_types' | 'large_files_touched' | 'bloat_files';
20
- metric: keyof AiDebtMetrics;
19
+ code: 'added_todo_fixme' | 'added_console_logs' | 'added_any_types' | 'large_files_touched' | 'bloat_files' | 'db_in_ui' | 'missing_validation';
20
+ metric: keyof AiDebtMetrics | 'architectural';
21
21
  observed: number;
22
22
  budget: number;
23
23
  message: string;
24
+ files?: string[];
24
25
  }
25
26
  export interface AiDebtBudgetConfig {
26
27
  mode: AiDebtMode;
@@ -1 +1 @@
1
- {"version":3,"file":"ai-debt-budget.d.ts","sourceRoot":"","sources":["../../src/utils/ai-debt-budget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzD,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EACA,kBAAkB,GAClB,oBAAoB,GACpB,iBAAiB,GACjB,qBAAqB,GACrB,aAAa,CAAC;IAClB,MAAM,EAAE,MAAM,aAAa,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAA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