@neurcode-ai/cli 0.19.0 ā 0.19.2
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/dist/commands/brain.d.ts.map +1 -1
- package/dist/commands/brain.js +87 -7
- package/dist/commands/brain.js.map +1 -1
- package/dist/commands/ops.d.ts +5 -0
- package/dist/commands/ops.d.ts.map +1 -1
- package/dist/commands/ops.js +32 -2
- package/dist/commands/ops.js.map +1 -1
- package/dist/commands/policy.d.ts.map +1 -1
- package/dist/commands/policy.js +50 -0
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/quickstart.d.ts.map +1 -1
- package/dist/commands/quickstart.js +11 -6
- package/dist/commands/quickstart.js.map +1 -1
- package/dist/commands/session.d.ts +5 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +328 -53
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/verify-output.d.ts +2 -0
- package/dist/commands/verify-output.d.ts.map +1 -1
- package/dist/commands/verify-output.js +4 -0
- package/dist/commands/verify-output.js.map +1 -1
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +108 -24
- package/dist/commands/verify.js.map +1 -1
- package/dist/governance/structural-on-diff.d.ts +11 -0
- package/dist/governance/structural-on-diff.d.ts.map +1 -1
- package/dist/governance/structural-on-diff.js +38 -5
- package/dist/governance/structural-on-diff.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/runtime-build.json +5 -5
- package/dist/utils/brain-context.d.ts.map +1 -1
- package/dist/utils/brain-context.js +11 -2
- package/dist/utils/brain-context.js.map +1 -1
- package/dist/utils/local-repo-brain.d.ts.map +1 -1
- package/dist/utils/local-repo-brain.js +4 -0
- package/dist/utils/local-repo-brain.js.map +1 -1
- package/dist/utils/proposed-change-analysis.d.ts.map +1 -1
- package/dist/utils/proposed-change-analysis.js +7 -5
- package/dist/utils/proposed-change-analysis.js.map +1 -1
- package/dist/utils/repo-intelligence-v2.d.ts.map +1 -1
- package/dist/utils/repo-intelligence-v2.js +41 -0
- package/dist/utils/repo-intelligence-v2.js.map +1 -1
- package/dist/utils/structural-understanding.d.ts +2 -2
- package/dist/utils/structural-understanding.d.ts.map +1 -1
- package/dist/utils/structural-understanding.js +1 -1
- package/dist/utils/structural-understanding.js.map +1 -1
- package/dist/utils/team-memory-path-hygiene.d.ts +4 -0
- package/dist/utils/team-memory-path-hygiene.d.ts.map +1 -0
- package/dist/utils/team-memory-path-hygiene.js +50 -0
- package/dist/utils/team-memory-path-hygiene.js.map +1 -0
- package/dist/utils/v0-governance.d.ts +7 -0
- package/dist/utils/v0-governance.d.ts.map +1 -1
- package/dist/utils/v0-governance.js +47 -0
- package/dist/utils/v0-governance.js.map +1 -1
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain.d.ts","sourceRoot":"","sources":["../../src/commands/brain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"brain.d.ts","sourceRoot":"","sources":["../../src/commands/brain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyfpC,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAy/DnD"}
|
package/dist/commands/brain.js
CHANGED
|
@@ -59,6 +59,7 @@ const brain_context_1 = require("../utils/brain-context");
|
|
|
59
59
|
const semantic_1 = require("../semantic");
|
|
60
60
|
const ask_cache_1 = require("../utils/ask-cache");
|
|
61
61
|
const proposed_change_analysis_1 = require("../utils/proposed-change-analysis");
|
|
62
|
+
const team_memory_path_hygiene_1 = require("../utils/team-memory-path-hygiene");
|
|
62
63
|
// Import chalk with fallback
|
|
63
64
|
let chalk;
|
|
64
65
|
try {
|
|
@@ -126,6 +127,9 @@ function scanFiles(dir, baseDir, maxFiles = 600) {
|
|
|
126
127
|
continue;
|
|
127
128
|
}
|
|
128
129
|
const full = join(current, entry);
|
|
130
|
+
const relativePath = normalizeFsPath(relative(baseDir, full));
|
|
131
|
+
if (!(0, team_memory_path_hygiene_1.isTeamMemoryProjectPath)(relativePath))
|
|
132
|
+
continue;
|
|
129
133
|
let st;
|
|
130
134
|
try {
|
|
131
135
|
st = statSync(full);
|
|
@@ -144,7 +148,7 @@ function scanFiles(dir, baseDir, maxFiles = 600) {
|
|
|
144
148
|
const ext = entry.split('.').pop()?.toLowerCase();
|
|
145
149
|
if (ext && ignoreExts.has(ext))
|
|
146
150
|
continue;
|
|
147
|
-
files.push(
|
|
151
|
+
files.push(relativePath);
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
walk(dir);
|
|
@@ -228,7 +232,7 @@ function collectGitAuthorship(cwd, sinceDays) {
|
|
|
228
232
|
if (!currentAuthor)
|
|
229
233
|
continue;
|
|
230
234
|
const path = normalizeFsPath(line);
|
|
231
|
-
if (!path || path.startsWith('.git/') || path.startsWith('node_modules/'))
|
|
235
|
+
if (!path || path.startsWith('.git/') || path.startsWith('node_modules/') || !(0, team_memory_path_hygiene_1.isTeamMemoryProjectPath)(path))
|
|
232
236
|
continue;
|
|
233
237
|
authorTouches.set(currentAuthor, (authorTouches.get(currentAuthor) || 0) + 1);
|
|
234
238
|
const byAuthor = fileTouches.get(path) || new Map();
|
|
@@ -621,6 +625,13 @@ function brainCommand(program) {
|
|
|
621
625
|
.option('--json', 'Output as JSON')
|
|
622
626
|
.action(async (options) => {
|
|
623
627
|
const scope = getBrainScope();
|
|
628
|
+
const canonical = await (0, brain_1.indexRepositoryGraph)({
|
|
629
|
+
repoRoot: scope.cwd,
|
|
630
|
+
limits: {
|
|
631
|
+
...(Number.isFinite(options.maxFiles) ? { maxFiles: options.maxFiles } : {}),
|
|
632
|
+
...(Number.isFinite(options.maxBytesPerFile) ? { maxBytesPerFile: options.maxBytesPerFile } : {}),
|
|
633
|
+
},
|
|
634
|
+
});
|
|
624
635
|
const artifact = (0, local_repo_brain_1.buildLocalRepoBrain)(scope.cwd, {
|
|
625
636
|
maxFiles: options.maxFiles,
|
|
626
637
|
maxBytesPerFile: options.maxBytesPerFile,
|
|
@@ -629,6 +640,24 @@ function brainCommand(program) {
|
|
|
629
640
|
const paths = (0, local_repo_brain_1.writeLocalRepoBrain)(scope.cwd, artifact);
|
|
630
641
|
const payload = {
|
|
631
642
|
repoRoot: scope.cwd,
|
|
643
|
+
repositoryIntelligenceModel: {
|
|
644
|
+
canonicalLifecycle: 'repository_graph_v2',
|
|
645
|
+
surface: 'legacy_brain_compatibility_projection',
|
|
646
|
+
compatibilityOnly: true,
|
|
647
|
+
},
|
|
648
|
+
canonicalGraph: {
|
|
649
|
+
path: (0, brain_1.repositoryGraphPath)(scope.cwd),
|
|
650
|
+
graphId: canonical.graph.graphId,
|
|
651
|
+
schemaVersion: canonical.graph.schemaVersion,
|
|
652
|
+
freshness: canonical.graph.freshness,
|
|
653
|
+
coverage: canonical.graph.coverage,
|
|
654
|
+
nodeCount: canonical.graph.nodes.length,
|
|
655
|
+
edgeCount: canonical.graph.edges.length,
|
|
656
|
+
},
|
|
657
|
+
compatibilityProjection: {
|
|
658
|
+
artifactHash: artifact.artifactHash,
|
|
659
|
+
summary: artifact.summary,
|
|
660
|
+
},
|
|
632
661
|
jsonPath: paths.jsonPath,
|
|
633
662
|
markdownPath: paths.markdownPath,
|
|
634
663
|
artifactHash: artifact.artifactHash,
|
|
@@ -641,8 +670,14 @@ function brainCommand(program) {
|
|
|
641
670
|
console.log(JSON.stringify(payload, null, 2));
|
|
642
671
|
return;
|
|
643
672
|
}
|
|
644
|
-
await (0, messages_1.printSuccessBanner)('
|
|
673
|
+
await (0, messages_1.printSuccessBanner)('Canonical Repository Intelligence Indexed');
|
|
674
|
+
(0, messages_1.printSection)('Canonical lifecycle', 'š§');
|
|
675
|
+
console.log(chalk.dim(`Repository Graph: ${payload.canonicalGraph.graphId}`));
|
|
676
|
+
console.log(chalk.dim(`Posture: ${canonical.graph.freshness.posture ?? canonical.graph.freshness.state}`));
|
|
677
|
+
console.log(chalk.dim(`Analyzed/skipped: ${canonical.graph.coverage.filesAnalyzed}/${canonical.graph.coverage.filesSkipped}`));
|
|
678
|
+
console.log(chalk.dim(`Recovery: neurcode brain repo-recover`));
|
|
645
679
|
(0, messages_1.printSection)('Artifact', 'š§ ');
|
|
680
|
+
console.log(chalk.yellow('Legacy Brain is a compatibility projection; its counts are not canonical lifecycle health.'));
|
|
646
681
|
console.log(chalk.dim(`Repo Root: ${scope.cwd}`));
|
|
647
682
|
console.log(chalk.dim(`JSON: ${paths.jsonPath}`));
|
|
648
683
|
console.log(chalk.dim(`Summary: ${paths.markdownPath}`));
|
|
@@ -856,9 +891,13 @@ function brainCommand(program) {
|
|
|
856
891
|
return;
|
|
857
892
|
}
|
|
858
893
|
console.log(chalk.bold('\nš§ Repository Graph V2 Query\n'));
|
|
894
|
+
console.log(chalk.dim(`Total matches: ${result.totalMatches} | Returned: ${result.returnedMatches} | Limit: ${result.limit} | Truncated: ${result.truncated}`));
|
|
859
895
|
console.log(chalk.dim(`Seeds: ${result.seeds.length} | Nodes: ${result.nodes.length} | Edges: ${result.edges.length}`));
|
|
860
896
|
result.edges.forEach((edge) => {
|
|
861
|
-
|
|
897
|
+
const posture = edge.enforcementEligible === false
|
|
898
|
+
? 'advisory/non-enforcement'
|
|
899
|
+
: 'enforcement-eligible';
|
|
900
|
+
console.log(chalk.dim(` ${edge.type}: ${edge.fromId} -> ${edge.toId} [${posture}]`));
|
|
862
901
|
});
|
|
863
902
|
});
|
|
864
903
|
brain
|
|
@@ -1059,6 +1098,11 @@ function brainCommand(program) {
|
|
|
1059
1098
|
const limit = Number.isFinite(options.limit) ? Math.max(1, Math.min(50, options.limit)) : 12;
|
|
1060
1099
|
let artifact = options.rebuild ? null : (0, local_repo_brain_1.readLocalRepoBrain)(scope.cwd);
|
|
1061
1100
|
let rebuilt = false;
|
|
1101
|
+
let canonicalGraph = (0, brain_1.readRepositoryGraph)(scope.cwd);
|
|
1102
|
+
if (!canonicalGraph || options.rebuild) {
|
|
1103
|
+
canonicalGraph = (await (0, brain_1.indexRepositoryGraph)({ repoRoot: scope.cwd, forceRebuild: options.rebuild === true })).graph;
|
|
1104
|
+
}
|
|
1105
|
+
const canonicalFreshness = await (0, brain_1.repositoryGraphStatus)(scope.cwd);
|
|
1062
1106
|
if (!artifact) {
|
|
1063
1107
|
artifact = (0, local_repo_brain_1.buildLocalRepoBrain)(scope.cwd, { experimentalFingerprintReuse: options.experimentalFingerprintReuse });
|
|
1064
1108
|
(0, local_repo_brain_1.writeLocalRepoBrain)(scope.cwd, artifact);
|
|
@@ -1068,6 +1112,17 @@ function brainCommand(program) {
|
|
|
1068
1112
|
const results = query ? (0, local_repo_brain_1.searchLocalRepoBrain)(artifact, query, limit) : [];
|
|
1069
1113
|
const payload = {
|
|
1070
1114
|
repoRoot: scope.cwd,
|
|
1115
|
+
repositoryIntelligenceModel: {
|
|
1116
|
+
canonicalLifecycle: 'repository_graph_v2',
|
|
1117
|
+
surface: 'legacy_brain_compatibility_projection',
|
|
1118
|
+
compatibilityOnly: true,
|
|
1119
|
+
},
|
|
1120
|
+
canonicalGraph: {
|
|
1121
|
+
graphId: canonicalGraph.graphId,
|
|
1122
|
+
schemaVersion: canonicalGraph.schemaVersion,
|
|
1123
|
+
freshness: canonicalFreshness,
|
|
1124
|
+
coverage: canonicalGraph.coverage,
|
|
1125
|
+
},
|
|
1071
1126
|
jsonPath: (0, local_repo_brain_1.localRepoBrainPath)(scope.cwd),
|
|
1072
1127
|
markdownPath: (0, local_repo_brain_1.localRepoBrainMarkdownPath)(scope.cwd),
|
|
1073
1128
|
rebuilt,
|
|
@@ -1089,6 +1144,7 @@ function brainCommand(program) {
|
|
|
1089
1144
|
console.log(chalk.dim(`Repo Root: ${scope.cwd}`));
|
|
1090
1145
|
console.log(chalk.dim(`Artifact: ${(0, local_repo_brain_1.localRepoBrainPath)(scope.cwd)}`));
|
|
1091
1146
|
console.log(chalk.dim(`Artifact Hash: ${artifact.artifactHash}`));
|
|
1147
|
+
console.log(chalk.yellow('Compatibility projection: use `brain repo-status` for canonical freshness and completeness.'));
|
|
1092
1148
|
if (rebuilt) {
|
|
1093
1149
|
(0, messages_1.printInfo)('Brain index created', 'No existing local repo brain was found, so Neurcode built one first.');
|
|
1094
1150
|
}
|
|
@@ -1165,13 +1221,34 @@ function brainCommand(program) {
|
|
|
1165
1221
|
process.exit(1);
|
|
1166
1222
|
}
|
|
1167
1223
|
if (options.rebuild) {
|
|
1224
|
+
await (0, brain_1.indexRepositoryGraph)({ repoRoot: scope.cwd, forceRebuild: true });
|
|
1168
1225
|
const rebuilt = (0, local_repo_brain_1.buildLocalRepoBrain)(scope.cwd);
|
|
1169
1226
|
(0, local_repo_brain_1.writeLocalRepoBrain)(scope.cwd, rebuilt);
|
|
1170
1227
|
}
|
|
1228
|
+
else if (options.index !== false && !(0, brain_1.readRepositoryGraph)(scope.cwd)) {
|
|
1229
|
+
await (0, brain_1.indexRepositoryGraph)({ repoRoot: scope.cwd });
|
|
1230
|
+
}
|
|
1171
1231
|
const report = (0, repo_brain_impact_1.buildRepoBrainImpactForRepo)(scope.cwd, paths, { autoBuild: options.index !== false });
|
|
1172
1232
|
const summary = (0, repo_brain_impact_1.summarizeImpact)(report);
|
|
1233
|
+
const canonicalGraph = (0, brain_1.readRepositoryGraph)(scope.cwd);
|
|
1234
|
+
const canonicalFreshness = canonicalGraph ? await (0, brain_1.repositoryGraphStatus)(scope.cwd) : null;
|
|
1173
1235
|
if (options.json) {
|
|
1174
|
-
console.log(JSON.stringify({
|
|
1236
|
+
console.log(JSON.stringify({
|
|
1237
|
+
repoRoot: scope.cwd,
|
|
1238
|
+
repositoryIntelligenceModel: {
|
|
1239
|
+
canonicalLifecycle: 'repository_graph_v2',
|
|
1240
|
+
surface: 'legacy_impact_compatibility_projection',
|
|
1241
|
+
compatibilityOnly: true,
|
|
1242
|
+
},
|
|
1243
|
+
canonicalGraph: canonicalGraph ? {
|
|
1244
|
+
graphId: canonicalGraph.graphId,
|
|
1245
|
+
schemaVersion: canonicalGraph.schemaVersion,
|
|
1246
|
+
freshness: canonicalFreshness,
|
|
1247
|
+
coverage: canonicalGraph.coverage,
|
|
1248
|
+
} : null,
|
|
1249
|
+
report,
|
|
1250
|
+
summary,
|
|
1251
|
+
}, null, 2));
|
|
1175
1252
|
return;
|
|
1176
1253
|
}
|
|
1177
1254
|
if (options.summary) {
|
|
@@ -1198,6 +1275,7 @@ function brainCommand(program) {
|
|
|
1198
1275
|
(0, messages_1.printInfo)('Brain index created', 'No existing local repo brain was found, so Neurcode built one first.');
|
|
1199
1276
|
}
|
|
1200
1277
|
console.log(chalk.dim(`Repo Root: ${scope.cwd}\n`));
|
|
1278
|
+
console.log(chalk.yellow('Impact is a compatibility projection; Repository Graph V2 owns canonical freshness/completeness.'));
|
|
1201
1279
|
console.log((0, repo_brain_impact_1.renderRepoBrainImpactText)(report));
|
|
1202
1280
|
(0, messages_1.printInfo)('Labels', 'Deterministic = compiled path/CODEOWNERS/import-graph facts. Advisory = heuristic reuse/proximity/reviewer guidance.');
|
|
1203
1281
|
});
|
|
@@ -1562,7 +1640,7 @@ function brainCommand(program) {
|
|
|
1562
1640
|
updatedAt: entry.updatedAt,
|
|
1563
1641
|
lastSeenAt: entry.lastSeenAt,
|
|
1564
1642
|
}))
|
|
1565
|
-
.filter((entry) => Boolean(entry.path));
|
|
1643
|
+
.filter((entry) => Boolean(entry.path) && (0, team_memory_path_hygiene_1.isTeamMemoryProjectPath)(entry.path));
|
|
1566
1644
|
const scopedFiles = scopedFilesRaw.length > 0
|
|
1567
1645
|
? scopedFilesRaw
|
|
1568
1646
|
: scanFiles(scope.cwd, scope.cwd, 300).map((path) => ({
|
|
@@ -1612,7 +1690,9 @@ function brainCommand(program) {
|
|
|
1612
1690
|
const effectiveAuthorTouches = focusAuthorTouches.size > 0 ? focusAuthorTouches : authorTouches;
|
|
1613
1691
|
const topContributors = rankTopEntries(effectiveAuthorTouches.entries(), ([, count]) => count, limit)
|
|
1614
1692
|
.map(([author, touches]) => ({ author, touches }));
|
|
1615
|
-
const events = Array.isArray(scopeStore.events)
|
|
1693
|
+
const events = Array.isArray(scopeStore.events)
|
|
1694
|
+
? scopeStore.events.filter((event) => !event.filePath || (0, team_memory_path_hygiene_1.isTeamMemoryProjectPath)(event.filePath))
|
|
1695
|
+
: [];
|
|
1616
1696
|
const recentDecisions = [...events]
|
|
1617
1697
|
.sort((a, b) => sortIsoDesc(a.timestamp, b.timestamp))
|
|
1618
1698
|
.slice(0, Math.max(limit, 12))
|