Skip to content

refactor: centralize per-tool path conventions into constants modules - #1856

Merged
dyoshikawa merged 4 commits into
dyoshikawa:mainfrom
saitota:functional-high-1
Jun 15, 2026
Merged

refactor: centralize per-tool path conventions into constants modules#1856
dyoshikawa merged 4 commits into
dyoshikawa:mainfrom
saitota:functional-high-1

Conversation

@saitota

@saitota saitota commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Background

Each external tool's configuration conventions — directory names, file names, scope-specific paths — were independently hardcoded as string literals across up to 9 feature files per tool ({tool}-rule.ts, {tool}-command.ts, {tool}-skill.ts, {tool}-mcp.ts, etc.). There was no programmatic connection between these scattered literals; they were implicit duplicates of the same knowledge.

This created a concrete maintenance burden: when a tool renames its config directory (e.g. the Gemini CLI → Antigravity migration that produced antigravity-rule.ts / antigravity-cli-rule.ts / antigravity-ide-rule.ts and legacy aliases), up to 9 files required changes with no compile-time safety net. A missed file produces a silent mismatch in generated output — no type error, no test failure.

Changes

  • Add src/constants/{tool}-paths.ts for every supported tool (27 new files), each exporting the tool's directory names, file names, and scope-specific paths as named constants.
  • Update all src/features/**/{tool}-*.ts files to import path constants from the corresponding module instead of repeating string literals.

No runtime behavior changes. Path values are identical — this is a pure refactor.

Why this structure

The feature-first directory layout (src/features/rules/, src/features/commands/, …) is preserved. Only the volatile knowledge — where a tool stores its files — is extracted to a single authoritative location per tool. A tool path change now requires editing one file; all dependents get a compile-time error if they break.

Test plan

  • pnpm build — clean
  • pnpm typecheck — clean
  • pnpm test — 6301/6302 pass (1 pre-existing failure in warp-permissions.test.ts unrelated to this change)
  • pnpm oxlint — clean
  • pnpm fmt — applied

saitota added 3 commits June 13, 2026 09:17
各ツール(cursor, roo, kiro, kilo, geminicli, codexcli, agentsmd,
augmentcode, cline, copilot, devin, factorydroid, junie, opencode, pi,
amp, warp, goose, deepagents, rovodev, zed, takt, qwencode, antigravity,
antigravity-cli, antigravity-ide, replit)について
src/constants/{tool}-paths.ts を新規作成し、ディレクトリ名・ファイル名の
文字列リテラルを一元管理する。

feature ファイル群(rules, commands, skills, mcp, subagents, ignore,
permissions, hooks)はすべてこれらの constants からインポートするよう更新。
これによりツール固有パスの変更が単一ファイルの修正で完結するようになり、
コンパイル時に依存箇所が漏れなく検出される。
oxfmt format pass on changed files; remove dead code left by the
constants migration (unused DEFAULT_TAKT_SUBAGENT_DIR,
DEFAULT_TAKT_COMMAND_DIR, WARP_MEMORIES_DIR_PATH import, and two
ANTIGRAVITY_* imports).
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Unfortunately, this PR has 1326 added lines, which exceeds the limit of 1000 lines for external contributors.

Please split your changes into smaller PRs. See CONTRIBUTING.md for details.

@dyoshikawa
dyoshikawa merged commit 4b91558 into dyoshikawa:main Jun 15, 2026
5 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner

@saitota Thank you!

rudironsoni pushed a commit to rudironsoni/rulesync that referenced this pull request Jun 18, 2026
Follow-ups from PR dyoshikawa#1856.

- Dedupe the Antigravity CLI permissions constants. `antigravity-paths.ts` is now
  the single source of truth for `ANTIGRAVITY_CLI_PERMISSIONS_SUBDIR` /
  `_DIR_PATH` / `_FILE_NAME`; `antigravity-cli-paths.ts` re-exports them (the
  subdir under the `ANTIGRAVITY_CLI_GLOBAL_SUBDIR` name its skill consumer uses)
  instead of redefining identical literals.
- Remove genuinely dead exported path constants that no consumer imports (verified
  with knip + grep): the unused `ANTIGRAVITY_*_PATH` / `ANTIGRAVITY_RULE_FILE_*` /
  `ANTIGRAVITY_COMMANDS_DIR_PATH` family, the dead `antigravity-ide` config/skills/
  mcp/hooks constants, and the unused `*_RULES_DIR_PATH` / `*_STEERING_DIR_PATH` /
  `*_MEMORIES_DIR_PATH` / `*_INSTRUCTIONS_DIR_PATH` constants left over from the
  centralization (cursor, kilo, roo, augmentcode, kiro, copilot, etc.).
- Drop `export` from constants used only as internal building blocks
  (`WINDSURF_SUBDIR`, `PI_AGENT_DIR`, `TAKT_FACETS_DIR_PATH`) so they stay private
  rather than appearing as unused public exports.
- Add `src/constants/paths.test.ts` pinning key centralized constants to their
  expected path strings, including that the deduped Antigravity CLI constants
  resolve identically through both modules.

Closes dyoshikawa#1864
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