Skip to content

Create lib/gsd-adapter.cjs with path resolution and tool invocation #138

@snipcodeit

Description

@snipcodeit

Context

Phase 34 — GSD Adapter. Currently, every command file that needs gsd-tools invokes it by hardcoding node ~/.claude/get-shit-done/bin/gsd-tools.cjs inline. commands/run.md alone has ~21 such invocations and commands/issue.md has 3. lib/gsd.cjs (73 lines) provides getGsdToolsPath and invokeGsdTool but is not used by commands — commands bypass it entirely. A centralized adapter eliminates scattered path assumptions and provides a single migration point for future gsd-tools API changes.

What Already Exists

  • lib/gsd.cjs (73 lines) — exports: getGsdToolsPath (resolves ~/.claude/get-shit-done/bin/gsd-tools.cjs via os.homedir()), invokeGsdTool (wraps execSync, returns parsed JSON or raw string). This module will be absorbed by gsd-adapter.cjs.
  • commands/run.md (1282 lines) — ~21 hardcoded node ~/.claude/get-shit-done/bin/gsd-tools.cjs invocations for: current-timestamp, init, verify plan-structure, verify-summary, verify artifacts, verify key-links, commit, resolve-model, init new-milestone, roadmap analyze, scaffold phase-dir, init plan-phase, init execute-phase
  • commands/issue.md (469 lines) — 3 hardcoded invocations: history-digest (line 113), current-timestamp (line 274), generate-slug (line 388)
  • commands/assign.md, commands/link.md — each have 1-2 hardcoded invocations
  • lib/index.cjs (18 lines) — barrel export for all lib modules; gsd-adapter.cjs should be added here

Description

Create lib/gsd-adapter.cjs — the centralized GSD integration layer. Phase 1: absorb lib/gsd.cjs. Phase 2: migrate utility function calls (timestamp, slug, model resolution) to adapter.

Technical Approach

  • Absorb lib/gsd.cjs: move getGsdToolsPath and invokeGsdTool into gsd-adapter.cjs; keep lib/gsd.cjs as a re-export shim for backward compat
  • Add typed wrappers for the most-used tool calls: getTimestamp(), generateSlug(title), resolveModel(type), historyDigest(), roadmapAnalyze()
  • Commands call the adapter functions rather than shelling out directly
  • Add to lib/index.cjs exports
  • Phase 3-4 (route selection, state reading) are in Migrate route selection and state reading to gsd-adapter.cjs #139

Done When

  • lib/gsd-adapter.cjs exists with: getGsdToolsPath, invokeGsdTool (absorbed from gsd.cjs), getTimestamp(), generateSlug(title), resolveModel(agentType), historyDigest(), roadmapAnalyze()
  • lib/gsd.cjs re-exports from gsd-adapter.cjs so existing callers aren't broken
  • lib/index.cjs exports gsd-adapter.cjs
  • commands/run.md timestamp and resolve-model calls updated to use adapter pattern
  • node -e "require('./lib/gsd-adapter.cjs').getGsdToolsPath()" returns the path without error

GSD Route

Quick task or GSD Phase 34 plan.

Phase Context

Phase 34 of 36 — GSD Adapter. Runs independently (no dep on 32/33). Issues: #138 (this), #139 (blocked on #138).

Depends on

Nothing — first issue of Phase 34.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions