feat: v5.2.3 — zero-friction install + automatic worktree support#24
feat: v5.2.3 — zero-friction install + automatic worktree support#24emredursun merged 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates Devran AI Kit to version 5.2.3, introducing automatic git worktree support via .worktreeinclude generation and a post-checkout hook. It also transitions IDE bridge files to be local-only, removing them from git tracking and cleaning up legacy .gitignore patterns. Review feedback recommends improving the robustness of the directory copying logic in the git hook to prevent potential nesting and suggests dynamically generating the list of bridge directories from existing constants to ensure consistency.
lib/worktree.js
Outdated
| ' # Copy .agent/ from main worktree (preserves customizations)', | ||
| ' # Uses -RP: no symlink dereferencing (security), recursive copy', | ||
| ' if [ -n "$COMMON_DIR" ] && [ -d "$MAIN_ROOT/.agent" ]; then', | ||
| ' cp -RP "$MAIN_ROOT/.agent" .agent/ 2>/dev/null || true', |
There was a problem hiding this comment.
The cp -RP command might behave unexpectedly if the .agent/ directory already exists in the destination (e.g., if it was partially created or exists due to a previous failed run). In some cp implementations, this could result in a nested .agent/.agent/ directory. It is safer to ensure the directory exists and then copy the contents using the /. source pattern, consistent with how bridge directories are handled below.
| ' cp -RP "$MAIN_ROOT/.agent" .agent/ 2>/dev/null || true', | |
| ' mkdir -p .agent 2>/dev/null', | |
| ' cp -RP "$MAIN_ROOT/.agent/." .agent/ 2>/dev/null || true', |
lib/worktree.js
Outdated
| ' cp -RP "$MAIN_ROOT/.agent" .agent/ 2>/dev/null || true', | ||
| ' fi', | ||
| ' # Copy bridge directories from main worktree (skip non-existent)', | ||
| ' for dir in .claude/commands .cursor/commands .opencode/commands .windsurf/workflows .github/prompts; do', |
There was a problem hiding this comment.
The list of bridge directories is hardcoded here, which creates a maintenance burden and risk of drift if IDE_BRIDGE_DIRS in lib/constants.js is updated. It's better to generate this list dynamically from the IDE_BRIDGE_DIRS constant.
| ' for dir in .claude/commands .cursor/commands .opencode/commands .windsurf/workflows .github/prompts; do', | |
| ' for dir in ' + Object.values(IDE_BRIDGE_DIRS).map(d => d.replace(/\/$/, '')).join(' ') + '; do', |
🔧 ✅ PR Fix CompleteFindings addressed: 2 (0 human · 2 bot) Fix Summary
DiffsFix #1 — lib/worktree.js:141 (@gemini-code-assist: "cp -RP might nest .agent/.agent/") - ' cp -RP "$MAIN_ROOT/.agent" .agent/ 2>/dev/null || true',
+ ' mkdir -p .agent 2>/dev/null',
+ ' cp -RP "$MAIN_ROOT/.agent/." .agent/ 2>/dev/null || true',Fix #2 — lib/worktree.js:144 (@gemini-code-assist: "hardcoded bridge dirs — drift risk") - ' for dir in .claude/commands .cursor/commands .opencode/commands .windsurf/workflows .github/prompts; do',
+ ' for dir in ' + Object.values(IDE_BRIDGE_DIRS).map(d => d.replace(/\/$/, '')).join(' ') + '; do',Verification
Next: Ready for merge. Bots re-analyze automatically on push. |
…eckout hook Three-layer worktree support ensures Kit workflows work seamlessly in git worktrees without manual re-initialization: 1. .worktreeinclude — Claude Code native mechanism copies gitignored files 2. post-checkout hook — copies .agent/ and bridge dirs from main worktree 3. --skip-worktree flag — opt-out for users who don't need worktree support New lib/worktree.js module with generateWorktreeInclude() and installPostCheckoutHook(). Hook uses cp -RP for symlink safety and provenance markers for idempotent operation.
- Bump version to 5.2.3 across package.json, manifest, CheatSheet, help.md - Update README: version badge, test count (1000), What's New, CLI flags - Update docs/architecture.md diagram header to v5.2.3 - Update docs/cli-reference.md with --skip-worktree flag - Update docs/ide-support.md with comprehensive worktree documentation - Update CHANGELOG with v5.2.2 and v5.2.3 entries
1. Prevent nested .agent/.agent/ — use mkdir -p + cp -RP with /. source pattern, consistent with bridge directory copy below. 2. Generate bridge dir list dynamically from IDE_BRIDGE_DIRS constant instead of hardcoding — eliminates drift risk. Addresses gemini-code-assist[bot]'s findings at lib/worktree.js:141,144
053fa3b to
17eab99
Compare
Summary
.claude/commands/git tracking — bridge files are now local-only. AddscleanupLegacyClaudeTracking()migration for existing installs. Users no longer see confusing local changes afterkit init..worktreeinclude+post-checkouthook. Kit workflows work seamlessly in git worktrees without manual re-initialization.Key Changes
lib/worktree.jsmodule withgenerateWorktreeInclude()andinstallPostCheckoutHook()IDE_BRIDGE_DIRSconstant inlib/constants.jsfor shared bridge directory mapping--skip-worktreeCLI flag for opt-outcp -RPfor symlink safety, provenance markers for idempotent operationTest plan
npx vitest run)npx @devran-ai/kit initin fresh project — no unexpected local changesgit worktree add— verify .agent/ and bridge dirs auto-copied--skip-worktreeflag skips worktree setup