fix(setup): correct agent install paths and rename cmd/deployhq -> cmd/dhq#8
Conversation
…d/dhq dhq setup was writing SKILL.md to paths none of the four agents auto-discover (~/.claude/SKILL.md, ~/.codex/SKILL.md, ~/.cursor/SKILL.md, ~/.windsurf/SKILL.md). Each agent now writes to its canonical location: - claude: ~/.claude/skills/deployhq/SKILL.md (user) or .claude/skills/deployhq/SKILL.md (project) - codex: ~/.codex/AGENTS.md (user) or ./AGENTS.md (project), via marker block - cursor: .cursor/rules/deployhq.mdc with Cursor .mdc frontmatter; user-level errors with hint - windsurf: ~/.codeium/windsurf/memories/global_rules.md (user, marker block) or .windsurf/rules/deployhq.md (project) Shared files (AGENTS.md, global_rules.md) use BEGIN dhq / END dhq markers so reinstall is idempotent and uninstall removes only our block. Also rename cmd/deployhq/ -> cmd/dhq/ so `go install .../cmd/dhq@latest` produces a binary named dhq (matching brew/scoop). Updates .goreleaser.yaml, README install instructions, and CLAUDE.md build command accordingly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR renames the CLI entrypoint from ./cmd/deployhq to ./cmd/dhq across build config and docs, and refactors internal/commands/setup.go into a scope-aware, per-agent installer with full-file and marked-block write strategies and atomic block helpers. ChangesCLI Entrypoint Rename
Setup Command Installer Refactoring
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/commands/setup.go`:
- Around line 115-147: The cobra command defined by variable cmd for the setup
subcommand currently lacks an Args validator and therefore silently accepts
unexpected positional arguments; update the cmd declaration to include Args:
cobra.NoArgs so the command immediately rejects any extra positional parameters
(e.g., when RunE is invoked for the cobra.Command created in
internal/commands/setup.go), ensuring unexpected inputs like "dhq setup foo"
return an error before mutating operations in RunE.
- Around line 280-306: The current upsertBlock (and similarly removeBlock)
rewrites shared files directly with os.WriteFile which can corrupt files on
failure; change these to use an atomic write: implement a helper
writeFileAtomic(path, data []byte, perm os.FileMode) that writes to a temp file
in the same directory, fsyncs the temp, then rename to the target, and replace
all os.WriteFile(...) calls in upsertBlock and removeBlock with
writeFileAtomic(...) so updates of files containing the blockBegin/blockEnd
markers are atomic and safe.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6bc0a3c3-b4ca-41c8-95bd-eb29549b57bb
📒 Files selected for processing (5)
.goreleaser.yamlCLAUDE.mdREADME.mdcmd/dhq/main.gointernal/commands/setup.go
Two follow-ups from CodeRabbit review on PR #8: 1. Add `Args: cobra.NoArgs` to setup subcommands so `dhq setup claude foo` errors instead of silently ignoring the stray argument. Mutating commands should fail fast on unexpected input. 2. Write shared files (AGENTS.md, ~/.codeium/.../global_rules.md) atomically via a temp file + rename. Previously a crash mid-write could lose user content outside the dhq-managed block. The new writeFileAtomic helper replaces direct os.WriteFile calls in upsertBlock / removeBlock. Dedicated files we own (Claude SKILL.md, Cursor .mdc, Windsurf project rule) still use os.WriteFile — they're recoverable by rerunning `dhq setup`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
dhq setup <agent>was writingSKILL.mdto paths none of the four agents auto-discover (~/.claude/SKILL.md,~/.codex/SKILL.md,~/.cursor/SKILL.md,~/.windsurf/SKILL.md). Verified against each vendor's official docs. Each agent now writes to its canonical location.cmd/deployhq/→cmd/dhq/sogo install github.com/deployhq/deployhq-cli/cmd/dhq@latestproduces adhqbinary, matching the Homebrew/Scoop install paths.Path changes
~/.claude/skills/deployhq/SKILL.md./.claude/skills/deployhq/SKILL.md~/.codex/AGENTS.md./AGENTS.md./.cursor/rules/deployhq.mdc~/.codeium/windsurf/memories/global_rules.md./.windsurf/rules/deployhq.mdShared files (
AGENTS.md,global_rules.md) use<!-- BEGIN dhq -->/<!-- END dhq -->markers so reinstall is idempotent and uninstall removes only our block, preserving any pre-existing user content.Cursor frontmatter (
.mdc) added so the rule is recognized:Test plan
go build ./cmd/dhq/producesdhqbinarydhq setup --helplists all four agentsdhq setup cursor(no--project) errors with"Cursor does not support user-level install; rerun with --project"dhq setup cursor --projectwrites.cursor/rules/deployhq.mdcwith Cursor frontmatterdhq setup codex --projectagainst an existingAGENTS.mdappends a marker block; running again updates in place (still 1 block); uninstall removes the block, original content intactdhq setup windsurf --projectwrites plain.windsurf/rules/deployhq.md(no markers — we own that file)dhq setup windsurf(user) wraps content in markers inside~/.codeium/windsurf/memories/global_rules.mddhq setup claude --projectwrites.claude/skills/deployhq/SKILL.mdwith Anthropic skill frontmattergo vet ./...andgolangci-lint run ./internal/commands/...clean🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Chores