instar 1.3.467 → 1.3.468

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 (39) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +11 -1
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  5. package/dist/config/ConfigDefaults.js +6 -0
  6. package/dist/config/ConfigDefaults.js.map +1 -1
  7. package/dist/core/CartographerTree.d.ts +124 -0
  8. package/dist/core/CartographerTree.d.ts.map +1 -0
  9. package/dist/core/CartographerTree.js +360 -0
  10. package/dist/core/CartographerTree.js.map +1 -0
  11. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  12. package/dist/core/PostUpdateMigrator.js +8 -0
  13. package/dist/core/PostUpdateMigrator.js.map +1 -1
  14. package/dist/core/ProjectMapper.d.ts.map +1 -1
  15. package/dist/core/ProjectMapper.js +3 -5
  16. package/dist/core/ProjectMapper.js.map +1 -1
  17. package/dist/core/skipDirs.d.ts +9 -0
  18. package/dist/core/skipDirs.d.ts.map +1 -0
  19. package/dist/core/skipDirs.js +13 -0
  20. package/dist/core/skipDirs.js.map +1 -0
  21. package/dist/scaffold/templates.d.ts.map +1 -1
  22. package/dist/scaffold/templates.js +1 -0
  23. package/dist/scaffold/templates.js.map +1 -1
  24. package/dist/server/AgentServer.d.ts +1 -0
  25. package/dist/server/AgentServer.d.ts.map +1 -1
  26. package/dist/server/AgentServer.js +1 -0
  27. package/dist/server/AgentServer.js.map +1 -1
  28. package/dist/server/CapabilityIndex.d.ts.map +1 -1
  29. package/dist/server/CapabilityIndex.js +16 -0
  30. package/dist/server/CapabilityIndex.js.map +1 -1
  31. package/dist/server/routes.d.ts +2 -0
  32. package/dist/server/routes.d.ts.map +1 -1
  33. package/dist/server/routes.js +58 -0
  34. package/dist/server/routes.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/data/builtin-manifest.json +65 -65
  37. package/src/scaffold/templates.ts +1 -0
  38. package/upgrades/1.3.468.md +25 -0
  39. package/upgrades/side-effects/cartographer-doc-tree-schema.md +82 -0
@@ -0,0 +1,82 @@
1
+ # Side-Effects Review — Cartographer Doc-Tree Schema (spec #1)
2
+
3
+ **Version / slug:** `cartographer-doc-tree-schema`
4
+ **Date:** `2026-06-09`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `external Gemini cross-model (convergence round 2) — no material findings`
7
+
8
+ ## Summary of the change
9
+
10
+ Adds the substrate of the `cartographer-conformance` project: a new
11
+ `CartographerTree` core module (hierarchical semantic doc-tree of the codebase,
12
+ per-node git-object-id staleness derived from ONE batched `git ls-tree`), a shared
13
+ `skipDirs.ts` (extracted from `ProjectMapper`, which now imports it), four
14
+ read-only HTTP routes `GET /cartographer/{tree,node,stale,health}` gated behind a
15
+ dark-by-default `cartographer.enabled` config, the config default + CLAUDE.md
16
+ template/migration (Migration Parity + Agent Awareness), and 3-tier tests.
17
+
18
+ ## Decision-point inventory
19
+
20
+ One gate: the routes return **503** when `cartographer.enabled` is false (or the
21
+ context holds no tree). No block/allow logic beyond the enable gate and the
22
+ `/cartographer/node?path=` validation (reject leading `/` or a `..` segment → 400).
23
+
24
+ ## 1. Over-block
25
+ The `?path=` validation rejects only traversal-shaped inputs (`/`-prefixed or
26
+ containing a `..` segment) and unknown nodes (404). Legitimate repo-relative paths
27
+ pass. The leaf-selection default (source extensions, excluding `*.test.*`) omits
28
+ non-source files from leaf nodes by design; directories always get a node, so no
29
+ directory is "over-blocked" out of the map.
30
+
31
+ ## 2. Under-block
32
+ Staleness compares committed git oids by default, so uncommitted working-tree
33
+ edits are not flagged unless the opt-in dirty mode is used — intentional (committed
34
+ state is deterministic across machines). Summaries are stored verbatim and
35
+ semantically unverified; the map never asserts a summary is *true* — downstream
36
+ specs (#3/#5) must re-ground against code. The map only covers what `scaffold()`
37
+ walks (skip-set + maxDepth bounded).
38
+
39
+ ## 3. Level-of-abstraction fit
40
+ Right layer. `CartographerTree` is a `src/core` data-structure module like
41
+ `ProjectMapper`; routes mount via the existing `createRoutes` context pattern; the
42
+ gate + instantiation live beside `projectMapper` in `server.ts`; the config default
43
+ rides the existing `applyDefaults` migration path (no bespoke migrator). The
44
+ skip-set is one shared export, not duplicated.
45
+
46
+ ## 4. Blast radius / reversibility
47
+ Self-contained and dark by default — a fresh agent gets `cartographer.enabled:
48
+ false`, so the feature is inert (routes 503) until explicitly enabled. The only
49
+ change to existing code paths is `ProjectMapper` importing `DEFAULT_SKIP_DIRS` from
50
+ the new shared module (identical set; covered by ProjectMapper's existing tests,
51
+ which stay green). Removing the feature is deleting the module + routes; no schema
52
+ migration to undo. State lives under `.instar/cartographer/` (gitignored).
53
+
54
+ ## 5. State / migration / multi-machine
55
+ New runtime state dir `.instar/cartographer/` (per-machine, gitignored, never
56
+ committed). Config default flows to existing agents via `migrateConfig` →
57
+ `applyDefaults` (existence-checked, idempotent). CLAUDE.md awareness flows via a
58
+ content-sniffed `migrateClaudeMd` block (idempotent). No cross-machine sync surface
59
+ — the tree is a local derived index, regenerable by `scaffold()` on any machine.
60
+
61
+ ## 6. Security / abuse
62
+ `?path=` never builds a filesystem path — it indexes the in-memory node store; the
63
+ on-disk node filename is a sha256 slug, collision-free and not derived from request
64
+ input. All git access is read-only via `SafeGitExecutor.readSync` (arg-form, no
65
+ shell interpolation). Routes are Bearer-auth'd like all instar routes; writes have
66
+ no open route (in-process only). Summaries served as JSON (consumers escape before
67
+ any HTML render). `scaffold()` is bounded by maxDepth + a symlink-loop guard
68
+ (visited realpaths) so a pathological repo cannot hang it. The one destructive fs
69
+ path — pruning stale node files in `rewriteAll()` — is funneled through
70
+ `SafeFsExecutor.safeUnlinkSync` (operation-tagged `cartographer-prune-stale-node`,
71
+ source-tree-guarded with the agent-runtime-state carveout for `.instar/`), never a
72
+ raw `fs.unlinkSync`, so the destructive-fs lint and audit trail both cover it.
73
+
74
+ ## 7. Observability / failure modes
75
+ `GET /cartographer/health` exposes node/authored/stale counts (the Tier-3 "alive"
76
+ surface). Absent git/HEAD degrades to "no current oids" → nodes read as
77
+ `never-authored`/`path-gone` rather than crashing (try/caught, `@silent-fallback-ok`).
78
+ `setSummary`'s node-then-index write is non-transactional: a crash between the two
79
+ leaves the index one version behind that node — a benign lag, self-healed by the
80
+ next `setSummary`/`scaffold`, never corruption. Tests cover all of: 14 unit + 8
81
+ integration (route contract) + 2 e2e (alive lifecycle), all green; `tsc --noEmit`
82
+ clean; ProjectMapper's existing tests stay green after the skip-set extraction.