V0.1.3/m1/claude code refactor#3
Open
Vedansi18 wants to merge 3 commits into
Open
Conversation
Adds the new src/agents/ module: four adapter interfaces (HookAdapter, VSCodeExtensionAdapter, CLIWrapAdapter, BrowserExtensionAdapter), an in-process registry (registerAdapter, detectAll, getAdapter), and an empty index.ts placeholder for future adapter registrations. Unit tests in registry.test.ts cover the registry behaviour. Adds src/cli/commands/install.snapshot.test.ts plus its generated baseline snapshot. The snapshot captures current installAction output (settings.json bytes + stdout) with $HOME and platform-dependent strings normalised so the snapshot is portable across machines. This is the zero-diff safety net for M1 Branch 2 (claude-code refactor): that branch must keep this snapshot byte-identical. No existing source code is modified. Per dev plan §1.6 in reviewduel-submodule. Branch: v0.1.3/m1/foundation-scaffold Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Moves the six Claude Code hook helpers (getClaudeSettingsPath,
buildHookCommand, buildStopHookCommand, buildHookEntry, writeHookEntry,
removeHookEntry) from src/cli/commands/install.ts to
src/agents/adapters/claude-code.ts. Function bodies are byte-identical.
install.ts re-exports them so existing imports (and install.test.ts)
continue to work unchanged.
Adds claudeCodeAdapter (HookAdapter) that wraps the moved functions and
self-registers via src/agents/index.ts side-effect import.
installAction's Claude Code branch in the for-loop now delegates to the
adapter via getAdapter('claude-code').install(ctx).
Adds optional settingsPath override to InstallContext so callers can
decouple the target file path from ctx.home — preserves the pre-refactor
pattern where paths.claudeSettings was passed independently of homedir()
(used by install.test.ts to inject custom tmp paths without stubbing
HOME). Without this, tests would write hook entries to the real
~/.claude/settings.json instead of their tmp dir.
Adds src/agents/adapters/claude-code.test.ts (18 unit tests) covering
the moved helpers + adapter contract (detect, settingsPath, buildHooks,
install, uninstall) + the settingsPath override behaviour.
Zero-diff invariant preserved: install snapshot from M1 Branch 1 remains
byte-identical. All 177 relevant tests pass. typecheck clean.
Branch: v0.1.3/m1/claude-code-refactor (off v0.1.3/m1/foundation-scaffold,
which sits on upstream/user-experience-improvements-sub-7).
Per dev plan §3.0 in reviewduel-submodule.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The original install.ts comment was a single line: // Register the advisory pipeline hook (separate from MCP — different file) The previous M1/B2 commit (d93852e) expanded this into a four-line comment explaining the adapter delegation. Per team feedback, comments on existing pre-refactor code should be kept verbatim — the §1.5 strict zero-diff guarantee includes comments on existing code. No behavioural change. Tests + snapshot unchanged (177/177 pass, install snapshot remains byte-identical with M1 Branch 1's baseline). Branch: v0.1.3/m1/claude-code-refactor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Vedansi18
added a commit
to Vedansi18/nexpath
that referenced
this pull request
May 28, 2026
…dry-run Resolves dev plan §6 Q3 (VS Code extension marketplace ID): chose emptyops.nexpath-vscode over nexpath.coding-agent-hooks — org-scoped under the emptyops publisher namespace, lower collision risk on both marketplaces, durable across future browser / JetBrains / etc. Nexpath extensions that'll share the publisher. Changes: - package.json#publisher: nexpath -> emptyops - cursor.ts / windsurf.ts MARKETPLACE_ID + their tests - PUBLISH.md / CROSS-OS-VERIFY.md / SMOKE-TEST.md URLs - publish-extension.yml sanity-check URLs Snapshot invariant preserved: install.snapshot.test.ts.snap doesn't embed the marketplace ID (cursor/windsurf detect() returns false in tmpHome -> those adapters never run in the snapshot scenario). Drift hi0001234d#3 fix: pinned CI runners from floating *-latest labels to specific versions (ubuntu-22.04, windows-2022, macos-14) so the matrix is reproducible. macos-13 was already pinned. New PUBLISH.md section "Pre-merge CI dry-run" walks the engineer through triggering the workflow with publish=false to validate every platform's .vsix builds clean before opening the B6 PR. Verification: - Sub-package vitest: 224 / 224 across 18 files - Root vitest: 2119 passing + 18 pre-existing TtySelectFn - Root + sub-package tsc clean - Local vsce package --target linux-x64: clean 3.83 MB .vsix, zero warnings Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors Claude Code's install logic into a reusable
HookAdaptervia a new agent registry. Foundation for adding Cursor/Windsurf/Codex/etc. adapters in later milestoneswithout touching the existing pipeline (
nexpath auto,nexpath stop, classifier, decision-session, store).What changed
getClaudeSettingsPath,buildHookCommand,buildStopHookCommand,buildHookEntry,writeHookEntry,removeHookEntry) verbatimfrom
src/cli/commands/install.ts→src/agents/adapters/claude-code.ts. Function bodies are byte-identical;install.tsre-exports them for backward compatibility withinstall.test.tsand other importers.claudeCodeAdapter: HookAdapterthat wraps the moved functions and self-registers viasrc/agents/index.tsside-effect import.installAction's Claude Code branch in the for-loop to delegate togetAdapter('claude-code').install(ctx). The other 6 agent branches stay inline (per v1scope: only Claude Code is an adapter in M1).
settingsPath?: stringfield onInstallContextso callers (tests) can decouple the target file path fromhomedir()— preserves the pre-refactorpattern where
paths.claudeSettingswas passed independently.src/agents/adapters/claude-code.test.ts— 18 unit tests covering helpers + adapter contract +settingsPathoverride.