@optave/codegraph 3.1.0 → 3.1.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/README.md +5 -5
- package/grammars/tree-sitter-go.wasm +0 -0
- package/package.json +8 -9
- package/src/ast-analysis/engine.js +365 -0
- package/src/ast-analysis/metrics.js +118 -0
- package/src/ast-analysis/rules/csharp.js +201 -0
- package/src/ast-analysis/rules/go.js +182 -0
- package/src/ast-analysis/rules/index.js +82 -0
- package/src/ast-analysis/rules/java.js +175 -0
- package/src/ast-analysis/rules/javascript.js +246 -0
- package/src/ast-analysis/rules/php.js +219 -0
- package/src/ast-analysis/rules/python.js +196 -0
- package/src/ast-analysis/rules/ruby.js +204 -0
- package/src/ast-analysis/rules/rust.js +173 -0
- package/src/ast-analysis/shared.js +223 -0
- package/src/ast-analysis/visitor-utils.js +176 -0
- package/src/ast-analysis/visitor.js +162 -0
- package/src/ast-analysis/visitors/ast-store-visitor.js +150 -0
- package/src/ast-analysis/visitors/cfg-visitor.js +792 -0
- package/src/ast-analysis/visitors/complexity-visitor.js +243 -0
- package/src/ast-analysis/visitors/dataflow-visitor.js +358 -0
- package/src/ast.js +26 -166
- package/src/audit.js +2 -88
- package/src/batch.js +0 -25
- package/src/boundaries.js +1 -1
- package/src/branch-compare.js +82 -172
- package/src/builder.js +48 -184
- package/src/cfg.js +148 -1174
- package/src/check.js +1 -84
- package/src/cli.js +118 -197
- package/src/cochange.js +1 -39
- package/src/commands/audit.js +88 -0
- package/src/commands/batch.js +26 -0
- package/src/commands/branch-compare.js +97 -0
- package/src/commands/cfg.js +55 -0
- package/src/commands/check.js +82 -0
- package/src/commands/cochange.js +37 -0
- package/src/commands/communities.js +69 -0
- package/src/commands/complexity.js +77 -0
- package/src/commands/dataflow.js +110 -0
- package/src/commands/flow.js +70 -0
- package/src/commands/manifesto.js +77 -0
- package/src/commands/owners.js +52 -0
- package/src/commands/query.js +21 -0
- package/src/commands/sequence.js +33 -0
- package/src/commands/structure.js +64 -0
- package/src/commands/triage.js +49 -0
- package/src/communities.js +22 -96
- package/src/complexity.js +234 -1591
- package/src/cycles.js +1 -1
- package/src/dataflow.js +274 -1352
- package/src/db/connection.js +88 -0
- package/src/db/migrations.js +312 -0
- package/src/db/query-builder.js +280 -0
- package/src/db/repository/build-stmts.js +104 -0
- package/src/db/repository/cfg.js +83 -0
- package/src/db/repository/cochange.js +41 -0
- package/src/db/repository/complexity.js +15 -0
- package/src/db/repository/dataflow.js +12 -0
- package/src/db/repository/edges.js +259 -0
- package/src/db/repository/embeddings.js +40 -0
- package/src/db/repository/graph-read.js +39 -0
- package/src/db/repository/index.js +42 -0
- package/src/db/repository/nodes.js +236 -0
- package/src/db.js +58 -399
- package/src/embedder.js +158 -174
- package/src/export.js +1 -1
- package/src/extractors/javascript.js +130 -5
- package/src/flow.js +153 -222
- package/src/index.js +53 -16
- package/src/infrastructure/result-formatter.js +21 -0
- package/src/infrastructure/test-filter.js +7 -0
- package/src/kinds.js +50 -0
- package/src/manifesto.js +1 -82
- package/src/mcp.js +37 -20
- package/src/owners.js +127 -182
- package/src/queries-cli.js +866 -0
- package/src/queries.js +1271 -2416
- package/src/sequence.js +179 -223
- package/src/structure.js +211 -269
- package/src/triage.js +117 -212
- package/src/viewer.js +1 -1
- package/src/watcher.js +7 -4
package/src/check.js
CHANGED
|
@@ -4,8 +4,8 @@ import path from 'node:path';
|
|
|
4
4
|
import { loadConfig } from './config.js';
|
|
5
5
|
import { findCycles } from './cycles.js';
|
|
6
6
|
import { findDbPath, openReadonlyOrFail } from './db.js';
|
|
7
|
+
import { isTestFile } from './infrastructure/test-filter.js';
|
|
7
8
|
import { matchOwners, parseCodeowners } from './owners.js';
|
|
8
|
-
import { isTestFile } from './queries.js';
|
|
9
9
|
|
|
10
10
|
// ─── Diff Parser ──────────────────────────────────────────────────────
|
|
11
11
|
|
|
@@ -347,86 +347,3 @@ export function checkData(customDbPath, opts = {}) {
|
|
|
347
347
|
db.close();
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
|
|
351
|
-
// ─── CLI Display ──────────────────────────────────────────────────────
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* CLI formatter — prints check results and exits with code 1 on failure.
|
|
355
|
-
*/
|
|
356
|
-
export function check(customDbPath, opts = {}) {
|
|
357
|
-
const data = checkData(customDbPath, opts);
|
|
358
|
-
|
|
359
|
-
if (data.error) {
|
|
360
|
-
console.error(data.error);
|
|
361
|
-
process.exit(1);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
if (opts.json) {
|
|
365
|
-
console.log(JSON.stringify(data, null, 2));
|
|
366
|
-
if (!data.passed) process.exit(1);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
console.log('\n# Check Results\n');
|
|
371
|
-
|
|
372
|
-
if (data.predicates.length === 0) {
|
|
373
|
-
console.log(' No changes detected.\n');
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
console.log(
|
|
378
|
-
` Changed files: ${data.summary.changedFiles} New files: ${data.summary.newFiles}\n`,
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
for (const pred of data.predicates) {
|
|
382
|
-
const icon = pred.passed ? 'PASS' : 'FAIL';
|
|
383
|
-
console.log(` [${icon}] ${pred.name}`);
|
|
384
|
-
|
|
385
|
-
if (!pred.passed) {
|
|
386
|
-
if (pred.name === 'cycles' && pred.cycles) {
|
|
387
|
-
for (const cycle of pred.cycles.slice(0, 10)) {
|
|
388
|
-
console.log(` ${cycle.join(' -> ')}`);
|
|
389
|
-
}
|
|
390
|
-
if (pred.cycles.length > 10) {
|
|
391
|
-
console.log(` ... and ${pred.cycles.length - 10} more`);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (pred.name === 'blast-radius' && pred.violations) {
|
|
395
|
-
for (const v of pred.violations.slice(0, 10)) {
|
|
396
|
-
console.log(
|
|
397
|
-
` ${v.name} (${v.kind}) at ${v.file}:${v.line} — ${v.transitiveCallers} callers (max: ${pred.threshold})`,
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
if (pred.violations.length > 10) {
|
|
401
|
-
console.log(` ... and ${pred.violations.length - 10} more`);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
if (pred.name === 'signatures' && pred.violations) {
|
|
405
|
-
for (const v of pred.violations.slice(0, 10)) {
|
|
406
|
-
console.log(` ${v.name} (${v.kind}) at ${v.file}:${v.line}`);
|
|
407
|
-
}
|
|
408
|
-
if (pred.violations.length > 10) {
|
|
409
|
-
console.log(` ... and ${pred.violations.length - 10} more`);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
if (pred.name === 'boundaries' && pred.violations) {
|
|
413
|
-
for (const v of pred.violations.slice(0, 10)) {
|
|
414
|
-
console.log(` ${v.from} -> ${v.to} (${v.edgeKind})`);
|
|
415
|
-
}
|
|
416
|
-
if (pred.violations.length > 10) {
|
|
417
|
-
console.log(` ... and ${pred.violations.length - 10} more`);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
if (pred.note) {
|
|
422
|
-
console.log(` ${pred.note}`);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
const s = data.summary;
|
|
427
|
-
console.log(`\n ${s.total} predicates | ${s.passed} passed | ${s.failed} failed\n`);
|
|
428
|
-
|
|
429
|
-
if (!data.passed) {
|
|
430
|
-
process.exit(1);
|
|
431
|
-
}
|
|
432
|
-
}
|