Skip to content

fix: honor GHOST_PACKAGE_DIR in drift, ack, history, and review-command paths#187

Merged
chailandau merged 1 commit into
mainfrom
chai/ghost-package-dir-everywhere
Jun 25, 2026
Merged

fix: honor GHOST_PACKAGE_DIR in drift, ack, history, and review-command paths#187
chailandau merged 1 commit into
mainfrom
chai/ghost-package-dir-everywhere

Conversation

@chailandau

@chailandau chailandau commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Why

Ghost supports relocating the fingerprint package via GHOST_PACKAGE_DIR (documented in SKILL.md for host wrappers and nested packages). But several commands still hardcoded the literal .ghost, so they ignored the configured directory. A repo whose package lives at, say, .agents/ghost/ works for init/scan/lint/verify/check/review, but silently breaks for drift, ack, diverge, compare --temporal, and the emit review-command footer.

This makes GHOST_PACKAGE_DIR resolution consistent across all local-package paths.

What

Replace hardcoded local-package .ghost literals with resolveGhostDirDefault() (which honors GHOST_PACKAGE_DIR and falls back to .ghost):

  • evolution-commands.tsloadLocalFingerprint() resolves the configured dir (fixes ack / diverge).
  • drift-command.ts — local source fallback and the legacy fingerprint.md fallback resolve the configured dir.
  • core/evolution/history.tsappendHistory / readHistory write and read history.jsonl under the configured dir (fixes compare --temporal).
  • context/package-review-command.ts — the emit footer's display fallback uses the configured dir.

Intentionally left as .ghost:

  • The FINGERPRINT_PACKAGE_DIR constants — that is the upstream default resolveGhostDirDefault() returns when unset.
  • node_modules/<pkg>/.ghost lookups — published npm packages ship their fingerprint at .ghost; a consumer's GHOST_PACKAGE_DIR does not apply to dependencies.

Tests

  • New test/evolution/history-package-dir.test.ts: history writes to .ghost by default and to .agents/ghost when GHOST_PACKAGE_DIR is set (and not to .ghost).
  • Full suite green: 411 tests passed.
  • pnpm check green (biome, typecheck, file-size, docs, bundle, CLI manifest).
  • Manual: GHOST_PACKAGE_DIR=.agents/ghost ghost init then ghost ack resolves the package from .agents/ghost (previously failed looking in .ghost); plain ghost init still defaults to .ghost.

Generated with Goose

…nd paths

Several local-fingerprint lookups hardcoded ".ghost" instead of the
configured package directory, so relocating the package via
GHOST_PACKAGE_DIR broke drift, ack, diverge, compare --temporal history,
and the review-command emit footer. Resolve those through
resolveGhostDirDefault() while keeping the .ghost default and leaving
published node_modules/<pkg>/.ghost paths unchanged.

Co-authored-by: Goose <opensource@block.xyz>
Ai-assisted: true
@chailandau chailandau marked this pull request as ready for review June 25, 2026 15:50
@chailandau chailandau requested a review from nahiyankhan as a code owner June 25, 2026 15:50
@chailandau chailandau merged commit f2c8207 into main Jun 25, 2026
5 checks passed
@chailandau chailandau deleted the chai/ghost-package-dir-everywhere branch June 25, 2026 16:11
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.

2 participants