Skip to content

refactor: modularize install.js into per-runtime modules#941

Open
amanape wants to merge 30 commits intogsd-build:mainfrom
amanape:refactor/install-modularization
Open

refactor: modularize install.js into per-runtime modules#941
amanape wants to merge 30 commits intogsd-build:mainfrom
amanape:refactor/install-modularization

Conversation

@amanape
Copy link
Contributor

@amanape amanape commented Mar 4, 2026

What

Breaks bin/install.js (2464 lines) into focused, per-runtime modules under bin/lib/core.js, codex.js, opencode.js, gemini.js, claude.js — reducing install.js to a thin orchestrator.

Why

The monolithic installer handles 4 runtimes (Claude Code, OpenCode, Gemini, Codex) with distinct conversion, config, and install/uninstall logic all in one file. This makes it hard to test, maintain, and extend. The refactor enables per-module testing and clearer ownership of runtime-specific logic.

Changes

  • Phase 1 — Test baseline: Added converter, shared utility, and install flow tests (1680+ test lines); added Stryker mutation testing config (69.51% kill rate)
  • Phase 2 — Module extraction: Extracted bin/lib/core.js (shared utilities/constants), bin/lib/codex.js, bin/lib/opencode.js, bin/lib/gemini.js, bin/lib/claude.js; migrated test imports from GSD_TEST_MODE to per-module imports
  • Phase 3 — Verification: Confirmed 705 tests pass, 28.07% install coverage maintained, backward compat preserved
  • Phase 4 — Cleanup: Removed 13 dead imports from install.js, realigned Stryker mutate targets to new modules

Testing

  • Tested on macOS
  • Tested on Windows
  • Tested on Linux

Checklist

  • Follows GSD style (no enterprise patterns, no filler)
  • Updates CHANGELOG.md for user-facing changes
  • No unnecessary dependencies added (Stryker is devDependency only)
  • Works on Windows (backslash paths tested)

Breaking Changes

None — all changes are internal. Existing CLI interface, flags, prompts, and output are unchanged. tests/codex-config.test.cjs backward compatibility preserved.

amanape added 30 commits March 4, 2026 15:19
…kCommand, readSettings, writeSettings, processAttribution, parseJsonc, extractFrontmatterAndBody, cleanupOrphanedHooks, fileHash, generateManifest)
…tructuring, inline-require in GSD_TEST_MODE block
@amanape amanape marked this pull request as ready for review March 4, 2026 17:13
@amanape amanape requested a review from glittercowboy as a code owner March 4, 2026 17:13
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