@neurcode-ai/governance-runtime 0.1.3 → 0.1.5

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 (49) hide show
  1. package/dist/admission-provenance.d.ts +111 -0
  2. package/dist/admission-provenance.d.ts.map +1 -0
  3. package/dist/admission-provenance.js +735 -0
  4. package/dist/admission-provenance.js.map +1 -0
  5. package/dist/agent-guard-posture.d.ts +40 -0
  6. package/dist/agent-guard-posture.d.ts.map +1 -0
  7. package/dist/agent-guard-posture.js +117 -0
  8. package/dist/agent-guard-posture.js.map +1 -0
  9. package/dist/agent-invocation-observability.d.ts +47 -0
  10. package/dist/agent-invocation-observability.d.ts.map +1 -0
  11. package/dist/agent-invocation-observability.js +229 -0
  12. package/dist/agent-invocation-observability.js.map +1 -0
  13. package/dist/agent-plan.d.ts +119 -0
  14. package/dist/agent-plan.d.ts.map +1 -0
  15. package/dist/agent-plan.js +590 -0
  16. package/dist/agent-plan.js.map +1 -0
  17. package/dist/agent-runtime-adapter.d.ts +69 -0
  18. package/dist/agent-runtime-adapter.d.ts.map +1 -0
  19. package/dist/agent-runtime-adapter.js +274 -0
  20. package/dist/agent-runtime-adapter.js.map +1 -0
  21. package/dist/ai-change-record.d.ts +185 -0
  22. package/dist/ai-change-record.d.ts.map +1 -0
  23. package/dist/ai-change-record.js +580 -0
  24. package/dist/ai-change-record.js.map +1 -0
  25. package/dist/architecture-graph.d.ts +153 -0
  26. package/dist/architecture-graph.d.ts.map +1 -0
  27. package/dist/architecture-graph.js +646 -0
  28. package/dist/architecture-graph.js.map +1 -0
  29. package/dist/architecture-obligations.d.ts +161 -0
  30. package/dist/architecture-obligations.d.ts.map +1 -0
  31. package/dist/architecture-obligations.js +553 -0
  32. package/dist/architecture-obligations.js.map +1 -0
  33. package/dist/index.d.ts +10 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +104 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/profile.d.ts +159 -0
  38. package/dist/profile.d.ts.map +1 -0
  39. package/dist/profile.js +611 -0
  40. package/dist/profile.js.map +1 -0
  41. package/dist/session.d.ts +428 -0
  42. package/dist/session.d.ts.map +1 -0
  43. package/dist/session.js +2206 -0
  44. package/dist/session.js.map +1 -0
  45. package/package.json +13 -2
  46. package/src/constraints.ts +0 -828
  47. package/src/index.test.ts +0 -502
  48. package/src/index.ts +0 -463
  49. package/tsconfig.json +0 -19
@@ -0,0 +1,611 @@
1
+ "use strict";
2
+ /**
3
+ * Repo Governance Profile — V0 composer.
4
+ *
5
+ * Derives a deterministic, metadata-only profile from:
6
+ * - the repo file tree (paths only, no content)
7
+ * - CODEOWNERS content (optional)
8
+ * - manifest content snippets (package.json / pyproject.toml / etc.)
9
+ *
10
+ * No source files are read. No network calls. Same inputs → same profileHash.
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.DEFAULT_PLAN_COHERENCE_MODE = void 0;
17
+ exports.ownersForPath = ownersForPath;
18
+ exports.buildRepoGovernanceProfile = buildRepoGovernanceProfile;
19
+ exports.checkFileBoundary = checkFileBoundary;
20
+ const node_crypto_1 = require("node:crypto");
21
+ const micromatch_1 = __importDefault(require("micromatch"));
22
+ const architecture_obligations_1 = require("./architecture-obligations");
23
+ const architecture_graph_1 = require("./architecture-graph");
24
+ exports.DEFAULT_PLAN_COHERENCE_MODE = 'warn';
25
+ // ── Security token map ────────────────────────────────────────────────────────
26
+ //
27
+ // Conservative: tokens are matched WHOLE against path-segment parts only.
28
+ // A segment like "auth_service" splits into ["auth","service"] → "auth" matches.
29
+ // A segment like "tokenizer" splits into ["tokenizer"] → no token matches.
30
+ //
31
+ // Deliberately excluded (too noisy as filename stems):
32
+ // session — common across non-auth code (session_store, session_manager…)
33
+ // token — tokenizer, tokenize, access_token in non-auth paths
34
+ // login — login_form in UI code; not always a sensitive boundary
35
+ // signin — same reason as login
36
+ // charge — electrical charge, no-charge, surcharge
37
+ // invoice — document generation, not always payments
38
+ //
39
+ // These are still caught when they appear as DIRECTORY names or as part of
40
+ // a recognized sensitive directory prefix (e.g. src/auth/ → auth boundary).
41
+ const SENSITIVE_TOKENS = {
42
+ // auth
43
+ auth: 'auth',
44
+ oauth: 'auth',
45
+ oidc: 'auth',
46
+ sso: 'auth',
47
+ jwt: 'auth',
48
+ // crypto
49
+ crypto: 'crypto',
50
+ cryptography: 'crypto',
51
+ encryption: 'crypto',
52
+ cipher: 'crypto',
53
+ // secrets
54
+ secret: 'secrets',
55
+ secrets: 'secrets',
56
+ credential: 'secrets',
57
+ credentials: 'secrets',
58
+ vault: 'secrets',
59
+ keystore: 'secrets',
60
+ // payments
61
+ payment: 'payments',
62
+ payments: 'payments',
63
+ billing: 'payments',
64
+ checkout: 'payments',
65
+ stripe: 'payments',
66
+ // migrations
67
+ migration: 'migrations',
68
+ migrations: 'migrations',
69
+ alembic: 'migrations',
70
+ flyway: 'migrations',
71
+ // security
72
+ security: 'security',
73
+ };
74
+ /**
75
+ * Return the security tag for a raw path segment using CONSERVATIVE matching.
76
+ *
77
+ * Rules:
78
+ * 1. Split the segment by [-_] separators (after stripping file extension).
79
+ * 2. Require an EXACT match of a part against a known token.
80
+ * 3. No substring/includes matching — "tokenizer" must not match "token".
81
+ *
82
+ * Examples:
83
+ * "auth" → 'auth' ✓ (exact)
84
+ * "auth_service" → 'auth' ✓ (split: ["auth","service"])
85
+ * "oauth2" → null ✓ (split: ["oauth2"] — no exact match; "oauth2"≠"oauth")
86
+ * "tokenizer.py" → null ✓ (split: ["tokenizer"] — no exact match)
87
+ * "session_manager" → null ✓ (split: ["session","manager"] — "session" not in map)
88
+ * "billing" → 'payments' ✓
89
+ * "charge.py" → null ✓ (excluded from map)
90
+ */
91
+ function tagForSegment(rawSeg) {
92
+ // Strip file extension, lowercase
93
+ const stem = rawSeg.replace(/\.[^.]+$/, '').toLowerCase();
94
+ // Split by separators; each part must exactly match a token
95
+ const parts = stem.split(/[-_]/);
96
+ for (const part of parts) {
97
+ const tag = SENSITIVE_TOKENS[part];
98
+ if (tag)
99
+ return tag;
100
+ }
101
+ return null;
102
+ }
103
+ /**
104
+ * Walk each segment of a path and return the first security tag found.
105
+ * Checks directory segments first (they are higher-signal), then filename.
106
+ */
107
+ function securityTagForPath(rawPath) {
108
+ const segments = rawPath.split('/');
109
+ for (const seg of segments) {
110
+ const tag = tagForSegment(seg);
111
+ if (tag)
112
+ return tag;
113
+ }
114
+ return null;
115
+ }
116
+ function detectStack(paths, manifestContent) {
117
+ const ext = {};
118
+ for (const p of paths) {
119
+ const m = p.match(/\.([a-z0-9]+)$/i);
120
+ if (m)
121
+ ext[m[1].toLowerCase()] = (ext[m[1].toLowerCase()] || 0) + 1;
122
+ }
123
+ const total = paths.length || 1;
124
+ const tsCount = (ext['ts'] || 0) + (ext['tsx'] || 0);
125
+ const jsCount = (ext['js'] || 0) + (ext['jsx'] || 0);
126
+ const pyCount = ext['py'] || 0;
127
+ const goCount = ext['go'] || 0;
128
+ const rsCount = ext['rs'] || 0;
129
+ const javaCount = (ext['java'] || 0) + (ext['kt'] || 0);
130
+ let lang = 'unknown';
131
+ let framework = 'generic';
132
+ let confidence = 0.5;
133
+ const dominant = Math.max(tsCount, jsCount, pyCount, goCount, rsCount, javaCount);
134
+ if (dominant === 0) {
135
+ return { primaryLanguage: 'unknown', frameworkEcosystem: 'generic', confidence: 0.2 };
136
+ }
137
+ if (dominant === tsCount || dominant === jsCount) {
138
+ lang = tsCount > jsCount ? 'TypeScript' : 'JavaScript';
139
+ confidence = Math.min(0.95, (tsCount + jsCount) / total + 0.4);
140
+ if (manifestContent) {
141
+ if (manifestContent.includes('"next"') || manifestContent.includes('"nextjs"'))
142
+ framework = 'Next.js';
143
+ else if (manifestContent.includes('"react"'))
144
+ framework = 'React';
145
+ else if (manifestContent.includes('"fastify"'))
146
+ framework = 'Fastify';
147
+ else if (manifestContent.includes('"express"'))
148
+ framework = 'Express';
149
+ else if (manifestContent.includes('"@nestjs'))
150
+ framework = 'NestJS';
151
+ else
152
+ framework = 'Node.js';
153
+ }
154
+ else {
155
+ framework = 'Node.js';
156
+ }
157
+ }
158
+ else if (dominant === pyCount) {
159
+ lang = 'Python';
160
+ confidence = Math.min(0.95, pyCount / total + 0.4);
161
+ if (manifestContent) {
162
+ if (manifestContent.includes('fastapi') || manifestContent.includes('FastAPI'))
163
+ framework = 'FastAPI';
164
+ else if (manifestContent.includes('django'))
165
+ framework = 'Django';
166
+ else if (manifestContent.includes('flask'))
167
+ framework = 'Flask';
168
+ else if (manifestContent.includes('celery'))
169
+ framework = 'Celery';
170
+ else if (manifestContent.includes('airflow'))
171
+ framework = 'Airflow';
172
+ else
173
+ framework = 'Python';
174
+ }
175
+ else {
176
+ framework = 'Python';
177
+ }
178
+ }
179
+ else if (dominant === goCount) {
180
+ lang = 'Go';
181
+ confidence = Math.min(0.95, goCount / total + 0.4);
182
+ framework = 'Go';
183
+ }
184
+ else if (dominant === rsCount) {
185
+ lang = 'Rust';
186
+ confidence = Math.min(0.95, rsCount / total + 0.4);
187
+ framework = 'Rust';
188
+ }
189
+ else if (dominant === javaCount) {
190
+ lang = (ext['kt'] ?? 0) > (ext['java'] ?? 0) ? 'Kotlin' : 'Java';
191
+ confidence = Math.min(0.95, javaCount / total + 0.4);
192
+ framework = 'JVM';
193
+ }
194
+ return { primaryLanguage: lang, frameworkEcosystem: framework, confidence };
195
+ }
196
+ // ── CODEOWNERS parser ─────────────────────────────────────────────────────────
197
+ function parseCodeowners(content) {
198
+ const rules = [];
199
+ for (const raw of content.split('\n')) {
200
+ const line = raw.replace(/#.*$/, '').trim();
201
+ if (!line)
202
+ continue;
203
+ const parts = line.split(/\s+/);
204
+ const glob = parts[0];
205
+ const owners = parts.slice(1).filter((o) => o.startsWith('@') || o.includes('@'));
206
+ if (glob && owners.length > 0)
207
+ rules.push({ glob, owners });
208
+ }
209
+ return rules;
210
+ }
211
+ /** Return the owners for a path, applying GitHub CODEOWNERS semantics (last rule wins). */
212
+ function ownersForPath(path, rules) {
213
+ let matched = [];
214
+ for (const rule of rules) {
215
+ let pattern = rule.glob.startsWith('/') ? rule.glob.slice(1) : rule.glob;
216
+ if (pattern.endsWith('/'))
217
+ pattern += '**';
218
+ if (!pattern.includes('*')) {
219
+ if (path === pattern || path.startsWith(pattern + '/')) {
220
+ matched = rule.owners;
221
+ continue;
222
+ }
223
+ }
224
+ if (micromatch_1.default.isMatch(path, pattern, { dot: true, nocase: true })) {
225
+ matched = rule.owners;
226
+ }
227
+ }
228
+ return matched;
229
+ }
230
+ // ── Sensitive boundary extraction ────────────────────────────────────────────
231
+ function deriveSensitiveBoundaries(paths) {
232
+ const seen = new Map();
233
+ for (const p of paths) {
234
+ const segments = p.split('/');
235
+ for (let i = 0; i < segments.length; i++) {
236
+ const seg = segments[i];
237
+ const tag = tagForSegment(seg);
238
+ if (!tag)
239
+ continue;
240
+ // Anchor to the directory containing the triggering segment.
241
+ // If the triggering segment is the filename (last), use its parent directory.
242
+ const isFilename = i === segments.length - 1 && seg.includes('.');
243
+ const dirEnd = isFilename ? i : i + 1;
244
+ const dir = segments.slice(0, dirEnd).join('/');
245
+ const dirGlob = dir ? dir + '/**' : isFilename ? p : '**';
246
+ if (!seen.has(dirGlob))
247
+ seen.set(dirGlob, tag);
248
+ break; // stop at the first (shallowest) match per path
249
+ }
250
+ }
251
+ return Array.from(seen.entries())
252
+ .map(([glob, tag]) => ({ glob, tag }))
253
+ .sort((a, b) => a.glob.localeCompare(b.glob));
254
+ }
255
+ // ── Approval-required derivation ─────────────────────────────────────────────
256
+ //
257
+ // V0 rule: a path is approval-required when it is sensitive AND (owned OR
258
+ // is a migration). Sensitive-but-unowned paths are still sensitive (warn/block
259
+ // based on scope) but don't require the approval gate.
260
+ function deriveApprovalRequired(sensitive, ownership, paths) {
261
+ const required = new Set();
262
+ if (ownership.length === 0) {
263
+ // No CODEOWNERS — all sensitive paths require approval (nobody to delegate to)
264
+ for (const s of sensitive)
265
+ required.add(s.glob);
266
+ }
267
+ else {
268
+ for (const sb of sensitive) {
269
+ const prefix = sb.glob.replace('/**', '');
270
+ const underBoundary = paths.filter((p) => p.startsWith(prefix + '/') || p === prefix);
271
+ const anyOwned = underBoundary.some((p) => ownersForPath(p, ownership).length > 0);
272
+ if (anyOwned)
273
+ required.add(sb.glob);
274
+ }
275
+ }
276
+ // Migrations are always approval-required regardless of ownership
277
+ for (const p of paths) {
278
+ if (/migrat/i.test(p)) {
279
+ const dir = p.split('/').slice(0, -1).join('/');
280
+ if (dir)
281
+ required.add(dir + '/**');
282
+ }
283
+ }
284
+ return Array.from(required).sort();
285
+ }
286
+ // ── Unowned percentage ────────────────────────────────────────────────────────
287
+ function computeUnownedPercent(paths, ownership) {
288
+ if (ownership.length === 0)
289
+ return 100;
290
+ const sourcePaths = paths.filter((p) => /\.(ts|tsx|js|jsx|py|go|rs|java|kt|rb|php|cs|cpp|c|h)$/.test(p));
291
+ if (sourcePaths.length === 0)
292
+ return 0;
293
+ const unowned = sourcePaths.filter((p) => ownersForPath(p, ownership).length === 0);
294
+ return Math.round((unowned.length / sourcePaths.length) * 100);
295
+ }
296
+ // ── Readiness ─────────────────────────────────────────────────────────────────
297
+ function computeReadiness(stack, ownership, sensitive, paths) {
298
+ const reasons = [];
299
+ let score = 0;
300
+ score += Math.round(stack.confidence * 40);
301
+ if (stack.confidence < 0.4)
302
+ reasons.push('stack confidence low — add a manifest file');
303
+ if (ownership.length > 0) {
304
+ score += 30;
305
+ }
306
+ else {
307
+ reasons.push('no CODEOWNERS — add one to enable ownership-based governance');
308
+ }
309
+ if (sensitive.length > 0) {
310
+ score += 20;
311
+ }
312
+ else if (paths.length > 0) {
313
+ reasons.push('no sensitive boundaries detected — profile may be incomplete for this repo');
314
+ }
315
+ if (paths.length >= 5)
316
+ score += 10;
317
+ else
318
+ reasons.push('very few files found — run in a populated repo directory');
319
+ const status = score >= 70 ? 'READY' : score >= 40 ? 'PARTIAL' : 'LOW';
320
+ return { status, score: Math.min(100, score), reasons };
321
+ }
322
+ // ── Profile hash ──────────────────────────────────────────────────────────────
323
+ function computeProfileHash(paths, sensitive, ownership, runtimeConfig, architectureHash) {
324
+ const canonical = JSON.stringify({
325
+ paths: [...paths].sort(),
326
+ sensitive: sensitive.map((s) => `${s.glob}:${s.tag}`).sort(),
327
+ ownership: ownership.map((o) => `${o.glob}:${o.owners.sort().join(',')}`).sort(),
328
+ runtimeConfig: canonicalRuntimeConfig(runtimeConfig),
329
+ // Only present when a dependency graph was derived, so legacy
330
+ // (no-imports) profiles keep a byte-identical canonical form + hash.
331
+ ...(architectureHash ? { architecture: architectureHash } : {}),
332
+ });
333
+ return (0, node_crypto_1.createHash)('sha256').update(canonical).digest('hex').slice(0, 24);
334
+ }
335
+ function digestNullable(content) {
336
+ if (content === null || content === undefined)
337
+ return null;
338
+ return (0, node_crypto_1.createHash)('sha256').update(content).digest('hex').slice(0, 24);
339
+ }
340
+ function normalizeGlobList(values) {
341
+ if (!Array.isArray(values))
342
+ return [];
343
+ return Array.from(new Set(values
344
+ .filter((value) => typeof value === 'string')
345
+ .map((value) => value.trim().replace(/^\.\//, '').replace(/\/+$/, ''))
346
+ .filter(Boolean))).sort();
347
+ }
348
+ function normalizePlanCoherenceMode(value) {
349
+ if (value === undefined || value === null || value === '') {
350
+ return exports.DEFAULT_PLAN_COHERENCE_MODE;
351
+ }
352
+ return value === 'off' || value === 'warn' || value === 'block'
353
+ ? value
354
+ : exports.DEFAULT_PLAN_COHERENCE_MODE;
355
+ }
356
+ function normalizeRuntimeConfig(input) {
357
+ return {
358
+ approvalRequiredGlobs: normalizeGlobList(input?.approvalRequiredGlobs),
359
+ sensitiveGlobs: normalizeGlobList(input?.sensitiveGlobs),
360
+ safeSupportGlobs: normalizeGlobList(input?.safeSupportGlobs),
361
+ ignoredGlobs: normalizeGlobList(input?.ignoredGlobs),
362
+ planCoherence: normalizePlanCoherenceMode(input?.planCoherence),
363
+ architectureObligations: (0, architecture_obligations_1.normalizeArchitectureObligationPolicy)(input?.architectureObligations),
364
+ };
365
+ }
366
+ function canonicalRuntimeConfig(config) {
367
+ const normalized = normalizeRuntimeConfig(config);
368
+ return {
369
+ approvalRequiredGlobs: normalized.approvalRequiredGlobs,
370
+ sensitiveGlobs: normalized.sensitiveGlobs,
371
+ safeSupportGlobs: normalized.safeSupportGlobs,
372
+ ignoredGlobs: normalized.ignoredGlobs,
373
+ ...(normalized.planCoherence && normalized.planCoherence !== exports.DEFAULT_PLAN_COHERENCE_MODE
374
+ ? { planCoherence: normalized.planCoherence }
375
+ : {}),
376
+ ...(normalized.architectureObligations
377
+ && (normalized.architectureObligations.mode !== 'warn'
378
+ || Object.keys(normalized.architectureObligations.ruleModes).length > 0)
379
+ ? { architectureObligations: normalized.architectureObligations }
380
+ : {}),
381
+ };
382
+ }
383
+ function runtimeConfigDigest(config) {
384
+ const canonical = canonicalRuntimeConfig(config);
385
+ const hasEntries = Object.values(canonical).some((value) => Array.isArray(value) ? value.length > 0 : Boolean(value));
386
+ if (!hasEntries)
387
+ return null;
388
+ return (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(canonical)).digest('hex').slice(0, 24);
389
+ }
390
+ function computeTopology(paths, codeownersContent, manifestContent, runtimeConfig, architectureHash) {
391
+ const canonical = JSON.stringify({
392
+ paths: [...paths].sort(),
393
+ codeownersContent: codeownersContent ?? null,
394
+ manifestContent: manifestContent ?? null,
395
+ runtimeConfig: canonicalRuntimeConfig(runtimeConfig),
396
+ // Conditional so legacy (no-imports) profiles keep the same topology hash;
397
+ // when imports are supplied, changing the dependency graph invalidates it.
398
+ ...(architectureHash ? { architecture: architectureHash } : {}),
399
+ });
400
+ return {
401
+ hash: (0, node_crypto_1.createHash)('sha256').update(canonical).digest('hex').slice(0, 24),
402
+ trackedFileCount: paths.length,
403
+ codeownersHash: digestNullable(codeownersContent),
404
+ manifestHash: digestNullable(manifestContent),
405
+ governanceConfigHash: runtimeConfigDigest(runtimeConfig),
406
+ ...(architectureHash ? { architectureHash } : {}),
407
+ };
408
+ }
409
+ function mergeConfiguredSensitiveBoundaries(detected, config) {
410
+ const byGlob = new Map();
411
+ for (const boundary of detected)
412
+ byGlob.set(boundary.glob, boundary);
413
+ for (const glob of config.sensitiveGlobs) {
414
+ if (!byGlob.has(glob))
415
+ byGlob.set(glob, { glob, tag: 'custom' });
416
+ }
417
+ return Array.from(byGlob.values()).sort((a, b) => a.glob.localeCompare(b.glob));
418
+ }
419
+ function mergeConfiguredApprovalPaths(detected, config) {
420
+ return Array.from(new Set([...detected, ...config.approvalRequiredGlobs])).sort();
421
+ }
422
+ // ── Main composer ─────────────────────────────────────────────────────────────
423
+ function buildRepoGovernanceProfile(input) {
424
+ const { paths, codeownersContent, manifestContent, repoName, source } = input;
425
+ const runtimeConfig = normalizeRuntimeConfig(input.runtimeConfig);
426
+ const stack = detectStack(paths, manifestContent);
427
+ const sensitiveBoundaries = mergeConfiguredSensitiveBoundaries(deriveSensitiveBoundaries(paths), runtimeConfig);
428
+ const ownershipBoundaries = codeownersContent ? parseCodeowners(codeownersContent) : [];
429
+ const approvalRequiredPaths = mergeConfiguredApprovalPaths(deriveApprovalRequired(sensitiveBoundaries, ownershipBoundaries, paths), runtimeConfig);
430
+ const unownedPercent = computeUnownedPercent(paths, ownershipBoundaries);
431
+ const readiness = computeReadiness(stack, ownershipBoundaries, sensitiveBoundaries, paths);
432
+ // V2: derive the architecture dependency graph when import metadata is
433
+ // supplied (source-free — only specifiers are passed in).
434
+ const architecture = input.imports && input.imports.length > 0
435
+ ? (0, architecture_graph_1.buildArchitectureGraph)({
436
+ paths,
437
+ ownershipBoundaries,
438
+ sensitiveBoundaries,
439
+ approvalRequiredGlobs: approvalRequiredPaths,
440
+ imports: input.imports,
441
+ })
442
+ : undefined;
443
+ const architectureHash = architecture?.architectureHash ?? null;
444
+ const profileHash = computeProfileHash(paths, sensitiveBoundaries, ownershipBoundaries, runtimeConfig, architectureHash);
445
+ const topology = computeTopology(paths, codeownersContent, manifestContent, runtimeConfig, architectureHash);
446
+ const agentCompat = stack.confidence >= 0.5
447
+ ? 'supported'
448
+ : stack.primaryLanguage !== 'unknown'
449
+ ? 'best-effort'
450
+ : 'unsupported';
451
+ return {
452
+ schemaVersion: 1,
453
+ repo: { name: repoName, source },
454
+ topology,
455
+ runtimeConfig,
456
+ stack: {
457
+ primaryLanguage: stack.primaryLanguage,
458
+ frameworkEcosystem: stack.frameworkEcosystem,
459
+ confidence: Math.round(stack.confidence * 100) / 100,
460
+ },
461
+ sensitiveBoundaries,
462
+ ownershipBoundaries,
463
+ approvalRequiredPaths,
464
+ unownedPercent,
465
+ agentCompatibility: { claudeCode: agentCompat },
466
+ ...(architecture ? { architecture } : {}),
467
+ profileHash,
468
+ readiness,
469
+ generatedAt: new Date().toISOString(),
470
+ };
471
+ }
472
+ function checkFileBoundary(input) {
473
+ const { filePath, allowedGlobs, ownershipRules, sensitiveGlobs, approvalRequiredGlobs, approvedPaths = [], approvalGrants = [], checkedAt, scopeMode = 'inferred', } = input;
474
+ // ── Scope check ──────────────────────────────────────────────────────────────
475
+ const inScope = allowedGlobs.length === 0
476
+ ? true
477
+ : allowedGlobs.some((g) => micromatch_1.default.isMatch(filePath, g, { dot: true, matchBase: true }) ||
478
+ filePath.startsWith(g.replace('/**', '').replace('/*', '') + '/') ||
479
+ filePath === g.replace('/**', '').replace('/*', ''));
480
+ const isSensitive = sensitiveGlobs.some((g) => matchesGlob(filePath, g));
481
+ const isApprovalRequired = approvalRequiredGlobs.some((g) => matchesGlob(filePath, g));
482
+ const owners = ownersForPath(filePath, ownershipRules);
483
+ // ── Approval gate ────────────────────────────────────────────────────────────
484
+ //
485
+ // Approval-required paths ALWAYS block unless the session holds explicit approval.
486
+ // When the path IS approved, treat it as effectively in-scope so the remainder
487
+ // of the decision matrix can apply (sensitive warn / ok).
488
+ const checkedAtMs = Date.parse(checkedAt || new Date().toISOString());
489
+ const effectiveCheckedAtMs = Number.isFinite(checkedAtMs) ? checkedAtMs : Date.now();
490
+ const activeGrantPaths = approvalGrants
491
+ .filter((grant) => {
492
+ if (!grant || typeof grant.path !== 'string' || !grant.path.trim())
493
+ return false;
494
+ if (grant.revokedAt)
495
+ return false;
496
+ if (!grant.expiresAt)
497
+ return true;
498
+ const expiresAtMs = Date.parse(grant.expiresAt);
499
+ return Number.isFinite(expiresAtMs) && expiresAtMs > effectiveCheckedAtMs;
500
+ })
501
+ .map((grant) => grant.path);
502
+ const candidateApprovedPaths = approvalGrants.length > 0 ? activeGrantPaths : approvedPaths;
503
+ const expiredGrant = approvalGrants.find((grant) => {
504
+ if (!grant || typeof grant.path !== 'string' || !grant.path.trim() || !grant.expiresAt || grant.revokedAt) {
505
+ return false;
506
+ }
507
+ const expiresAtMs = Date.parse(grant.expiresAt);
508
+ if (!Number.isFinite(expiresAtMs) || expiresAtMs > effectiveCheckedAtMs)
509
+ return false;
510
+ return (matchesGlob(filePath, grant.path) ||
511
+ filePath.startsWith(grant.path.replace('/**', '').replace('/*', '') + '/') ||
512
+ filePath === grant.path.replace('/**', '').replace('/*', ''));
513
+ });
514
+ const isApproved = isApprovalRequired &&
515
+ candidateApprovedPaths.length > 0 &&
516
+ candidateApprovedPaths.some((ap) => matchesGlob(filePath, ap) ||
517
+ filePath.startsWith(ap.replace('/**', '').replace('/*', '') + '/') ||
518
+ filePath === ap.replace('/**', '').replace('/*', ''));
519
+ if (isApprovalRequired && !isApproved) {
520
+ const ownerNote = owners.length ? ` (owned by ${owners.join(', ')})` : '';
521
+ const expiredNote = expiredGrant?.expiresAt ? ` Previous approval expired at ${expiredGrant.expiresAt}.` : '';
522
+ return {
523
+ verdict: 'block',
524
+ inScope,
525
+ isSensitive,
526
+ isApprovalRequired,
527
+ owners,
528
+ message: `⏸ Neurcode: ${filePath} is in an approval-required boundary${ownerNote}. ` +
529
+ `No approval on record for this session. ` +
530
+ `Use neurcode_session_approve to approve this path, or narrow the task.` +
531
+ expiredNote,
532
+ options: ['narrow', 'replan'],
533
+ approvalContext: {
534
+ blockedPath: filePath,
535
+ approvalRequired: true,
536
+ owners,
537
+ // Suggest the exact file path as the tightest possible approval scope.
538
+ // The human can approve a broader glob (e.g. src/billing/**) if they choose to.
539
+ suggestedApprovalPath: filePath,
540
+ },
541
+ };
542
+ }
543
+ // When isApproved=true, the path is cleared to proceed — treat it as in-scope
544
+ // for the remaining checks regardless of the allowedGlobs set.
545
+ const effectivelyInScope = inScope || isApproved;
546
+ // ── Scope violations (non-approval-required) ─────────────────────────────────
547
+ if (!effectivelyInScope && owners.length > 0) {
548
+ return {
549
+ verdict: 'block',
550
+ inScope,
551
+ isSensitive,
552
+ isApprovalRequired,
553
+ owners,
554
+ message: `⏸ Neurcode: ${filePath} is owned by ${owners.join(', ')} and outside the declared scope.`,
555
+ options: ['narrow', 'replan'],
556
+ };
557
+ }
558
+ if (!effectivelyInScope && isSensitive) {
559
+ const matchedGlob = sensitiveGlobs.find((g) => matchesGlob(filePath, g));
560
+ return {
561
+ verdict: 'block',
562
+ inScope,
563
+ isSensitive,
564
+ isApprovalRequired,
565
+ owners,
566
+ message: `⏸ Neurcode: ${filePath} is a sensitive boundary (${matchedGlob}) and outside the declared scope.`,
567
+ options: ['narrow', 'replan'],
568
+ };
569
+ }
570
+ if (!effectivelyInScope) {
571
+ return {
572
+ verdict: 'block',
573
+ inScope,
574
+ isSensitive,
575
+ isApprovalRequired,
576
+ owners,
577
+ message: `⏸ Neurcode: ${filePath} is outside the declared scope for this task.`,
578
+ options: ['narrow', 'replan'],
579
+ };
580
+ }
581
+ // ── In-scope but sensitive — advisory warning ─────────────────────────────
582
+ if (isSensitive) {
583
+ const ownerNote = owners.length ? ` (owned by ${owners.join(', ')})` : '';
584
+ return {
585
+ verdict: 'warn',
586
+ inScope,
587
+ isSensitive,
588
+ isApprovalRequired,
589
+ owners,
590
+ message: `⚠️ Neurcode: ${filePath} is sensitive${ownerNote}. Proceeding — recorded in session.`,
591
+ options: ['continue'],
592
+ };
593
+ }
594
+ // ── Clean pass ───────────────────────────────────────────────────────────────
595
+ return {
596
+ verdict: 'ok',
597
+ inScope,
598
+ isSensitive,
599
+ isApprovalRequired,
600
+ owners,
601
+ message: '',
602
+ options: ['continue'],
603
+ };
604
+ }
605
+ function matchesGlob(filePath, glob) {
606
+ const prefix = glob.replace('/**', '').replace('/*', '');
607
+ if (filePath.startsWith(prefix + '/') || filePath === prefix)
608
+ return true;
609
+ return micromatch_1.default.isMatch(filePath, glob, { dot: true });
610
+ }
611
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AA+RH,sCAgBC;AAmPD,gEAyEC;AA6DD,8CAiKC;AAv0BD,6CAAyC;AACzC,4DAAoC;AACpC,yEAGoC;AACpC,6DAI8B;AAwFjB,QAAA,2BAA2B,GAAsB,MAAM,CAAC;AAErE,iFAAiF;AACjF,EAAE;AACF,0EAA0E;AAC1E,iFAAiF;AACjF,2EAA2E;AAC3E,EAAE;AACF,uDAAuD;AACvD,6EAA6E;AAC7E,mEAAmE;AACnE,sEAAsE;AACtE,oCAAoC;AACpC,uDAAuD;AACvD,wDAAwD;AACxD,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAE5E,MAAM,gBAAgB,GAA6C;IACjE,OAAO;IACP,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,SAAS;IACT,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,QAAQ;IACtB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,QAAQ;IAChB,UAAU;IACV,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,SAAS;IACtB,KAAK,EAAE,SAAS;IAChB,QAAQ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