fix(link): install agent skills in the template directory, not the parent#64
Conversation
…rent When --template is passed, the old flow installed the skills (.claude, .codex, etc.) in the cwd *before* asking for the subdirectory name, so the skills landed one level up from the actual project. Now we prompt for the directory, create it, cd in, download the template, run npm install, and only then install the skills — so they sit alongside the template files where agents will actually find them. Version bump 0.1.46 → 0.1.47. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WalkthroughVersion bumped from 0.1.46 → 0.1.47 in package manifest. Reorganized control flow in the project link command so Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/projects/link.ts`:
- Around line 261-262: The code currently calls installSkills(json)
unconditionally even when template download failed; update the flow to only call
installSkills when the template actually downloaded (e.g., check the
templateDownloaded flag or have downloadTemplate()/downloadGitHubTemplate()
return a success boolean) so that installSkills is skipped if templateDownloaded
is false; adjust downloadTemplate/downloadGitHubTemplate to return success (or
rethrow errors) if needed and use that value to gate the call to
installSkills(json).
🪄 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: b442c319-2c60-44b8-b68f-bcb4180254c9
📒 Files selected for processing (2)
package.jsonsrc/commands/projects/link.ts
| // Install agent skills inside the project directory | ||
| await installSkills(json); |
There was a problem hiding this comment.
Gate skill installation on templateDownloaded.
If downloadTemplate() / downloadGitHubTemplate() fails, those helpers return normally, so this still installs .claude/, .codex/, etc. into a partial directory even though Line 245 says to proceed only when the template actually downloaded.
Suggested fix
- // Install agent skills inside the project directory
- await installSkills(json);
+ // Install agent skills only when the template actually downloaded
+ if (templateDownloaded) {
+ await installSkills(json);
+ }
await reportCliUsage('cli.link', true, 6, projectConfig);Based on learnings: downloadTemplate and downloadGitHubTemplate catch/log failures internally and return normally, so template-init failures do not reach the outer catch block.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Install agent skills inside the project directory | |
| await installSkills(json); | |
| // Install agent skills only when the template actually downloaded | |
| if (templateDownloaded) { | |
| await installSkills(json); | |
| } | |
| await reportCliUsage('cli.link', true, 6, projectConfig); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/commands/projects/link.ts` around lines 261 - 262, The code currently
calls installSkills(json) unconditionally even when template download failed;
update the flow to only call installSkills when the template actually downloaded
(e.g., check the templateDownloaded flag or have
downloadTemplate()/downloadGitHubTemplate() return a success boolean) so that
installSkills is skipped if templateDownloaded is false; adjust
downloadTemplate/downloadGitHubTemplate to return success (or rethrow errors) if
needed and use that value to gate the call to installSkills(json).
Nudges users toward the end-to-end flow (build + deploy) instead of leaving them on localhost after their first agent session. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/commands/projects/link.ts (1)
261-263:⚠️ Potential issue | 🟠 MajorSkip skill installation when the template download failed.
installSkills(json)on Line 262 still runs even whentemplateDownloadedis falsy, so a failed template init can still leave.claude/,.codex/, etc. in a partial directory. Guard the skill install behind the same check you already use fornpm install/ next steps.Suggested fix
// Install agent skills inside the project directory - await installSkills(json); + if (templateDownloaded) { + await installSkills(json); + } await reportCliUsage('cli.link', true, 6, projectConfig);Based on learnings:
downloadTemplateanddownloadGitHubTemplatecatch/log failures internally and return normally, so template-init failures do not reach the outer catch block.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/projects/link.ts` around lines 261 - 263, The call to installSkills(json) runs even when templateDownloaded is falsy, causing partial skill files to be installed after a failed template init; update the control flow so installSkills(json) is executed only when templateDownloaded is truthy (the same guard used for the npm install/next-steps block), i.e., wrap or move the installSkills(json) invocation behind the templateDownloaded check so it is skipped when downloadTemplate/downloadGitHubTemplate failed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/commands/projects/link.ts`:
- Around line 261-263: The call to installSkills(json) runs even when
templateDownloaded is falsy, causing partial skill files to be installed after a
failed template init; update the control flow so installSkills(json) is executed
only when templateDownloaded is truthy (the same guard used for the npm
install/next-steps block), i.e., wrap or move the installSkills(json) invocation
behind the templateDownloaded check so it is skipped when
downloadTemplate/downloadGitHubTemplate failed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c9da7447-e82a-44e5-bd8a-52f82297b914
📒 Files selected for processing (1)
src/commands/projects/link.ts
Summary
When running `insforge link --template `, the skill-install step (`.claude/`, `.codex/`, `.cursor/`, …) fired in the original cwd before the user was prompted for the subdirectory name. Result: the skills ended up one level above the project, where no agent would actually find them.
New flow for `--template`:
Non-template `link` is unchanged (skills still install in cwd), just refactored so both branches share the same ordering logic.
Version bump 0.1.46 → 0.1.47.
Test plan
🤖 Generated with Claude Code
Note
Fix agent skill installation to run in the template directory, not the parent
installSkillsandreportCliUsagecalls to run after template download and dependency installation in the template path, rather than unconditionally before template handling.installSkillsandreportCliUsagenow run before showing dashboard guidance.Macroscope summarized 55c1077.
Summary by CodeRabbit
Bug Fixes
Chores