Skip to content

Ghost stack 6/6 — Sprawl sweep & cleanup#194

Draft
nahiyankhan wants to merge 7 commits into
ghost/05-node-graphfrom
ghost/06-cleanup
Draft

Ghost stack 6/6 — Sprawl sweep & cleanup#194
nahiyankhan wants to merge 7 commits into
ghost/05-node-graphfrom
ghost/06-cleanup

Conversation

@nahiyankhan

Copy link
Copy Markdown
Collaborator

Stacked PR 6 of 6 · base: `ghost/05-node-graph`

Tidy-up. Merges last.

Contents

  • Remove dead survey module (`ghost.survey/v1`)
  • Described nodes — collapse surface-as-content into the node catalog
  • Remove `resources.yml`/`patterns.yml` + dead yml residue
  • Prune dead modules and orphan exports (sprawl sweep)
  • Prune superseded idea notes (40 → 6)
  • Split inventory monolith, group `commands/`, honest file-size limits
  • Drop dead deps (jiti, tinyglobby) + clean stale dist

Stack order

  1. ghost/01-surface-spec
  2. ghost/02-surface-model
  3. ghost/03-polish-cuts
  4. ghost/04-one-road
  5. ghost/05-node-graph
  6. ➡️ ghost/06-cleanup (this PR) — tip = `phase-8-unify-nodes`

Survey was pre-graph raw-signal capture with no live CLI command — its dispatch
in fingerprint-commands was all dead _-prefixed code, reachable only as a
vestigial .json lint kind. Deleted: ghost-core/survey/, the survey exports, the
dead survey-pattern dispatch (~300 lines in fingerprint-commands), the
.json/survey file-kind, an orphan ghost-core/fingerprint-package.ts, and 6
survey tests. Also clears ~150 'surface' false-positives (ui_surfaces color
vocab) ahead of the surface->node unification.
…alog

Discovery is now name + description, like tool selection. 'description' is a
first-class node field (the retrieval payload); 'gather' with no arg builds the
catalog from graph nodes (buildGraphMenu) — node id + description — plus any
spine-only tree positions. Node frontmatter is passthrough: free-form keys
(audience, stage) ride along untouched, gated on nothing.

Surface-as-a-content-concept dissolves: the composition-edge vocabulary
(composes/governed-by) is deleted (lateral composition is node 'relates'), the
surface menu builder is replaced by the node catalog, and surfaces.yml is
demoted to an optional terse spine file (id + parent + description) that folds
into the node id space. Skill (capture.md, SKILL.md) documents description as
the retrieval payload. All green: 113 tests, full check.
Delete the pre-graph standalone artifacts ghost.resources/v1 and
ghost.patterns/v1 (modules, file-kinds, lint fns, path fields, test) — never
part of the node/graph model. Prune dead constants (RESOURCES/PATTERNS/
FINGERPRINT_YML/FINGERPRINT/FINGERPRINTS_DIRNAME/SCOPE_SURVEYS/CHECKS_FILENAME),
all dead public re-exports. Scrub the skill bundle of facet-era residue: delete
voice.md + patterns.md, rewrite schema.md and recall.md to the node model, and
remove every 'facet' reference across the bundle.

Remaining schemas are exactly the graph model: node, check, surfaces,
fingerprint-package, advisory-review. The intent/inventory/composition
filename constants stay only for legacy-package detection -> migrate guidance.
All green: 109 tests, full check, install bundle 10 files.
Delete orphan scan/schema.ts (198-line survey-era color/palette zod schema, zero
importers) and scan/package-config.ts (normalizeReferenceInput, dead since
--reference was dropped). Remove dead exports: getCommandDiscoveryForCommand,
fingerprintPackageDisplayPath, and the LintOptions interface + its re-export —
none had any caller. Remaining 'dead-looking' exports (GHOST_*_SCHEMA identity
constants, getCommandDiscoveryMetadata, resolveGitRoot) are intentional public
API / reserved surface and stay. All green: 109 tests, full check.
Two eras of phase plans had accumulated. Delete the pre-graph surface-model
cutover family (coordinate-space, surface-schema, surface-binding,
contract-and-binding, ghost-layers, reset, implementation-plan, phase-{1..8}-plan,
phase-7b-*, polish-*, guided-migration) — superseded by the graph reset. Delete
the shipped graph-era execution plans (one-road, graph-implementation-plan,
phase-{1-node-schema..7-cross-package}) — the implementation is in code and git
history is the record. Delete parked-survey-module (survey was since deleted).

Keep the durable set: fingerprint-first-architecture (settled), context-graph
(the model), scenarios-worked (worked reference), contract-storage +
compare-drift-fleet-rethink (open/parked), ghost-ui. Rewrite the README arc to
match and fix the one broken cross-link.
… limits

Architecture hygiene pass:
- Split scan/inventory.ts (1082 lines, one giant function-bag) into a focused
  scan/inventory/ module: constants, paths, walk, manifests, hints, git, and an
  index.ts orchestrator. Each concern is now independently readable/testable;
  largest piece is 243 lines.
- Group the 8 root-level command + review-packet files under src/commands/, so
  the layering reads commands/ (CLI) -> scan/ (I/O) -> ghost-core/ (model).
  review-packet (domain-ish, the odd one out at root) now lives with its review
  command. Fixed skill-command's bundle-path URL for the new depth.
- Delete all three file-size EXCEPTIONS: two were stale lies (cli.ts granted 580
  for 161 actual; fingerprint-commands 1135 for 178) and inventory no longer
  needs one. Every file now passes the honest 500-line default.

All green: 109 tests, full check, zero file-size exceptions.
jiti (1.7MB) and tinyglobby were declared runtime deps but imported nowhere in
source — Ghost rolls its own tiny workspace-glob matcher. Removed both; runtime
deps are now cac + yaml + zod.

Also fix the build bug where 'tsc --build' incremental retained deleted modules
(relay, compare, context/, core/, old inventory) in dist/ because the build's
rm -rf cleared dist but not tsconfig.tsbuildinfo. Now clears both. The published
artifact drops from ~1.9MB/777 files to ~397KB/248 files (104KB packed).
Updated the release-tarball check's expected-deps list. All green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant