mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-12-06 04:56:45 +08:00
Imports the CodeAtlasWeb companion frontend verbatim from BernhardJackiewicz/CodeAtlasWeb at commit 1825f9c850ac794066e02606012508b9d393c6aa as the new graph-ui and removes the previous React frontend. This is Bernhard Jackiewicz's work, contributed with his agreement and squashed here from his development history (41 commits, cycles W0 through W15). The maintainer only relocates it: every product decision, line of code and test below graph-ui/ is his. The seven galaxy files that originate in this repository's previous graph-ui, and the pinned 3D libraries, are listed in graph-ui/THIRD_PARTY.md. What it is: a local reading IDE on the CBM read surface. A read-only Monaco source reader, a semantic twin that follows the caret, entry, bug-hunt, change-scope and flow reading modes, deterministic source-cited explanations with an optional local-model wording pass (llama-server sidecar, off unless the reader starts one; no model or binary ships), a persistent galaxy with focus following in both directions, a live-agent overlay fed by a loopback bridge, explicit air-gap, provenance and index-limit messaging, and an offline acceptance and browser verification harness. It consumes POST /rpc (the read-only tool allowlist), GET /api/layout, and the atlas routes /api/tree, /api/trace, /api/flows and /api/flow, plus the real ingest_traces store for observed calls; all of these are on feat/atlas-r1 (#1860), which this change stacks on. Not imported: CLAUDE.md (an agent-instruction file, which stays local-only in this repository), and the recorded proof artifacts under graph-ui/verification/, which follow in a separate commit so they can be reviewed and dropped on their own. Build wiring, the dev-proxy port contract, the CSP allowance for the sidecar and bridge ports, and the control surfaces the previous frontend had (project indexing, ADR editor, logs) follow in separate maintainer commits. Design and tracking: #1964. Co-authored-by: Bernhard Jackiewicz <bj@techport.io> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
100 lines
3.5 KiB
JavaScript
100 lines
3.5 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Die zweite Quelle: Schreibvorgaenge auf der Platte.
|
|
*
|
|
* Sie ist der Rueckfall fuer alles, was keine Werkzeug-Hooks kennt. Ein Agent,
|
|
* der mit einem Editor oder einem Skript arbeitet, ruft keinen Hook auf; was
|
|
* dabei trotzdem sichtbar ist, ist die Datei, die sich aendert.
|
|
*
|
|
* ## Was sie sieht, und was nicht
|
|
*
|
|
* Sie sieht **nur Schreibvorgaenge**. Kein Lesen, kein Suchen, kein Testlauf,
|
|
* kein Befehl. Genau so ist jedes Ereignis gekennzeichnet (`source: "fs"`), und
|
|
* das ist keine Formalie: wer spaeter eine Aufzeichnung ansieht, muss wissen,
|
|
* dass die Ruhe zwischen zwei Schreibvorgaengen nicht Ruhe bedeutet, sondern
|
|
* Arbeit, die hier nicht ankommt. Ein Protokoll, das seine eigene Blindheit
|
|
* verschweigt, ist schlimmer als keines.
|
|
*
|
|
* Sie schreibt **keine Dateiinhalte**, so wenig wie der Hook daneben: ein
|
|
* Ereignis nennt den Pfad und die Zeit, mehr nicht. Einen Zeilenbereich kann
|
|
* sie nicht nennen, denn ein Dateisystem meldet keine Zeilen; das Feld fehlt
|
|
* darum, statt eine Zahl zu erfinden.
|
|
*
|
|
* ## Aufruf
|
|
*
|
|
* node agents/hooks/atlas-trace-watch.mjs <verzeichnis>
|
|
*
|
|
* Wohin geschrieben wird, sagt ATLAS_TRACE_FILE; ohne die Variable ist es
|
|
* ~/.atlas-trace/events.jsonl. Wie der Agent heisst, sagt ATLAS_AGENT_NAME;
|
|
* ohne sie steht dort "file-writes", weil das die Wahrheit ueber diese Quelle
|
|
* ist: sie kennt keinen Agenten, sie kennt eine Datei, die sich geaendert hat.
|
|
*
|
|
* Kein Paket, nur node:fs.
|
|
*/
|
|
import { appendFileSync, mkdirSync, watch } from 'node:fs';
|
|
import { dirname, join, relative } from 'node:path';
|
|
import { homedir } from 'node:os';
|
|
|
|
const ROOT = process.argv[2] ?? process.cwd();
|
|
const OUT = process.env['ATLAS_TRACE_FILE']
|
|
?? join(homedir(), '.atlas-trace', 'events.jsonl');
|
|
const AGENT = process.env['ATLAS_AGENT_NAME'] ?? 'file-writes';
|
|
|
|
/** Der Lauf. Acht Zeichen, wie die Kennung des Hooks daneben. */
|
|
const RUN = String(Date.now()).slice(-8);
|
|
|
|
/** Was nie interessiert: Bauwerk, Fremdcode, Beweisbilder, das Protokoll selbst. */
|
|
const IGNORE = /(^|\/)(node_modules|\.git|dist|cbm|vendor|models|verification|coverage)(\/|$)/;
|
|
|
|
/**
|
|
* Derselbe Pfad zweimal in dieser Zeitspanne ist ein Ereignis, nicht zwei.
|
|
*
|
|
* Ein Editor schreibt gern mehrfach (Datei anlegen, Inhalt schreiben, Rechte
|
|
* setzen), und ein Bild soll die Handlung zeigen und nicht die Schreibtechnik.
|
|
*/
|
|
const COALESCE_MS = 400;
|
|
|
|
const lastSeen = new Map();
|
|
let seq = 0;
|
|
|
|
function record(path) {
|
|
const now = Date.now();
|
|
if (now - (lastSeen.get(path) ?? 0) < COALESCE_MS) {
|
|
return;
|
|
}
|
|
lastSeen.set(path, now);
|
|
seq += 1;
|
|
const line = {
|
|
ts: now,
|
|
agent: AGENT,
|
|
run: RUN,
|
|
seq,
|
|
phase: 'end',
|
|
tool: 'Write',
|
|
path,
|
|
source: 'fs',
|
|
detail: 'seen as a write on disk; reads, searches and test runs are invisible here',
|
|
};
|
|
try {
|
|
appendFileSync(OUT, JSON.stringify(line) + '\n', 'utf8');
|
|
process.stdout.write(`${new Date(now).toISOString()} ${path}\n`);
|
|
} catch {
|
|
/* Ein volles Dateisystem kostet das Protokoll, nicht die Arbeit. */
|
|
}
|
|
}
|
|
|
|
try {
|
|
mkdirSync(dirname(OUT), { recursive: true });
|
|
} catch {
|
|
/* Steht es schon da, ist alles gut; steht es nicht, meldet der erste Schreibversuch es. */
|
|
}
|
|
|
|
watch(ROOT, { recursive: true }, (_event, name) => {
|
|
if (typeof name !== 'string' || IGNORE.test(name)) {
|
|
return;
|
|
}
|
|
record(relative('.', name) || name);
|
|
});
|
|
|
|
process.stdout.write(`watching ${ROOT}, appending to ${OUT}\n`);
|