Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,14 @@ JS source is plain JavaScript (ES modules) in `src/`. No transpilation step. The
| `features/snapshot.js` | SQLite DB backup and restore |
| `features/structure.js` | Codebase structure analysis |
| `features/triage.js` | Risk-ranked audit priority queue (delegates scoring to `graph/classifiers/`) |
| **`presentation/`** | **Pure output formatting** |
| `presentation/` | `viewer.js` (HTML renderer), `export.js` (DOT/Mermaid/GraphML/Neo4j serializers), `sequence-renderer.js` (Mermaid sequence diagrams), `table.js` (CLI table formatting), `result-formatter.js` (JSON/NDJSON output) |
| `features/graph-enrichment.js` | Data enrichment for HTML viewer (complexity, communities, fan-in/out) |
| **`presentation/`** | **Pure output formatting + CLI command wrappers** |
| `presentation/viewer.js` | Interactive HTML renderer with vis-network |
| `presentation/queries-cli/` | CLI display wrappers for query functions, split by concern: `path.js`, `overview.js`, `inspect.js`, `impact.js`, `exports.js` |
| `presentation/*.js` | Command formatters (audit, batch, check, communities, complexity, etc.) — call `features/*.js`, format output, set exit codes |
| `presentation/export.js` | DOT/Mermaid/GraphML/Neo4j serializers |
| `presentation/sequence-renderer.js` | Mermaid sequence diagram rendering |
| `presentation/table.js`, `result-formatter.js`, `colors.js` | CLI table formatting, JSON/NDJSON output, color constants |
| **`graph/`** | **Unified graph model** |
| `graph/` | `CodeGraph` class (`model.js`), algorithms (Tarjan SCC, Louvain, BFS, shortest path, centrality), classifiers (role, risk), builders (dependency, structure, temporal) |
| **`mcp/`** | **MCP server** |
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/audit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { audit } from '../../commands/audit.js';
import { EVERY_SYMBOL_KIND } from '../../domain/queries.js';
import { audit } from '../../presentation/audit.js';
import { explain } from '../../presentation/queries-cli.js';

export const command = {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/batch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import { batch } from '../../commands/batch.js';
import { EVERY_SYMBOL_KIND } from '../../domain/queries.js';
import { BATCH_COMMANDS, multiBatchData, splitTargets } from '../../features/batch.js';
import { batch } from '../../presentation/batch.js';
import { ConfigError } from '../../shared/errors.js';

export const command = {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/branch-compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const command = {
['-f, --format <format>', 'Output format: text, mermaid, json', 'text'],
],
async execute([base, target], opts, ctx) {
const { branchCompare } = await import('../../commands/branch-compare.js');
const { branchCompare } = await import('../../presentation/branch-compare.js');
await branchCompare(base, target, {
engine: ctx.program.opts().engine,
depth: parseInt(opts.depth, 10),
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/cfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const command = {
}
},
async execute([name], opts, ctx) {
const { cfg } = await import('../../commands/cfg.js');
const { cfg } = await import('../../presentation/cfg.js');
cfg(name, opts.db, {
format: opts.format,
file: opts.file,
Expand Down
6 changes: 3 additions & 3 deletions src/cli/commands/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const command = {
`Invalid kind "${opts.kind}". Valid: ${EVERY_SYMBOL_KIND.join(', ')}`,
);
}
const { manifesto } = await import('../../commands/manifesto.js');
const { manifesto } = await import('../../presentation/manifesto.js');
manifesto(opts.db, {
file: opts.file,
kind: opts.kind,
Expand All @@ -45,7 +45,7 @@ export const command = {
return;
}

const { check } = await import('../../commands/check.js');
const { check } = await import('../../presentation/check.js');
check(opts.db, {
ref,
staged: opts.staged,
Expand All @@ -64,7 +64,7 @@ export const command = {
`Invalid kind "${opts.kind}". Valid: ${EVERY_SYMBOL_KIND.join(', ')}`,
);
}
const { manifesto } = await import('../../commands/manifesto.js');
const { manifesto } = await import('../../presentation/manifesto.js');
manifesto(opts.db, {
file: opts.file,
kind: opts.kind,
Expand Down
6 changes: 4 additions & 2 deletions src/cli/commands/co-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ export const command = {
['--ndjson', 'Newline-delimited JSON output'],
],
async execute([file], opts, ctx) {
const { analyzeCoChanges, coChangeData, coChangeTopData } = await import('../../cochange.js');
const { formatCoChange, formatCoChangeTop } = await import('../../commands/cochange.js');
const { analyzeCoChanges, coChangeData, coChangeTopData } = await import(
'../../features/cochange.js'
);
const { formatCoChange, formatCoChangeTop } = await import('../../presentation/cochange.js');

if (opts.analyze) {
const result = analyzeCoChanges(opts.db, {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/communities.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const command = {
['--drift', 'Show only drift analysis'],
],
async execute(_args, opts, ctx) {
const { communities } = await import('../../commands/communities.js');
const { communities } = await import('../../presentation/communities.js');
communities(opts.db, {
functions: opts.functions,
resolution: parseFloat(opts.resolution),
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/complexity.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const command = {
}
},
async execute([target], opts, ctx) {
const { complexity } = await import('../../commands/complexity.js');
const { complexity } = await import('../../presentation/complexity.js');
complexity(opts.db, {
target,
limit: parseInt(opts.limit, 10),
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/dataflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const command = {
}
},
async execute([name], opts, ctx) {
const { dataflow } = await import('../../commands/dataflow.js');
const { dataflow } = await import('../../presentation/dataflow.js');
dataflow(name, opts.db, {
file: opts.file,
kind: opts.kind,
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const command = {
}
},
async execute([name], opts, ctx) {
const { flow } = await import('../../commands/flow.js');
const { flow } = await import('../../presentation/flow.js');
flow(name, opts.db, {
list: opts.list,
depth: parseInt(opts.depth, 10),
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/owners.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const command = {
['-j, --json', 'Output as JSON'],
],
async execute([target], opts, ctx) {
const { owners } = await import('../../commands/owners.js');
const { owners } = await import('../../presentation/owners.js');
owners(opts.db, {
owner: opts.owner,
boundary: opts.boundary,
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const command = {
['--color-by <mode>', 'Color nodes by: kind | role | community | complexity'],
],
async execute(_args, opts, ctx) {
const { generatePlotHTML, loadPlotConfig } = await import('../../viewer.js');
const { generatePlotHTML, loadPlotConfig } = await import('../../features/graph-enrichment.js');
const os = await import('node:os');
const db = openReadonlyOrFail(opts.db);

Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/sequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const command = {
}
},
async execute([name], opts, ctx) {
const { sequence } = await import('../../commands/sequence.js');
const { sequence } = await import('../../presentation/sequence.js');
sequence(name, opts.db, {
depth: parseInt(opts.depth, 10),
file: opts.file,
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/structure.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const command = {
['--ndjson', 'Newline-delimited JSON output'],
],
async execute([dir], opts, ctx) {
const { structureData, formatStructure } = await import('../../commands/structure.js');
const { structureData, formatStructure } = await import('../../presentation/structure.js');
const data = structureData(opts.db, {
directory: dir,
depth: opts.depth ? parseInt(opts.depth, 10) : undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/triage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const command = {
],
async execute(_args, opts, ctx) {
if (opts.level === 'file' || opts.level === 'directory') {
const { hotspotsData, formatHotspots } = await import('../../commands/structure.js');
const { hotspotsData, formatHotspots } = await import('../../presentation/structure.js');
const metric = opts.sort === 'risk' ? 'fan-in' : opts.sort;
const data = hotspotsData(opts.db, {
metric,
Expand Down Expand Up @@ -60,7 +60,7 @@ export const command = {
throw new ConfigError('Invalid --weights JSON', { cause: err });
}
}
const { triage } = await import('../../commands/triage.js');
const { triage } = await import('../../presentation/triage.js');
triage(opts.db, {
limit: parseInt(opts.limit, 10),
offset: opts.offset ? parseInt(opts.offset, 10) : undefined,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading