Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@insforge/cli",

"version": "0.1.46",
"version": "0.1.47",
"description": "InsForge CLI - Command line tool for InsForge platform",
"type": "module",
"bin": {
Expand Down
41 changes: 23 additions & 18 deletions src/commands/projects/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,6 @@ export function registerProjectLinkCommand(program: Command): void {
outputSuccess(`Linked to project "${project.name}" (${project.appkey}.${project.region})`);
}

// Install agent skills
await installSkills(json);
await reportCliUsage('cli.link', true, 6, projectConfig);

// Report agent-connected event (best-effort)
try {
await reportAgentConnected({ project_id: project.id }, apiUrl);
Expand Down Expand Up @@ -262,6 +258,10 @@ export function registerProjectLinkCommand(program: Command): void {
}
}

// Install agent skills inside the project directory
await installSkills(json);
Comment on lines +261 to +262
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
// 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).

await reportCliUsage('cli.link', true, 6, projectConfig);

if (!json) {
const dashboardUrl = `${getFrontendUrl()}/dashboard/project/${project.id}`;
clack.log.step(`Dashboard: ${dashboardUrl}`);
Expand All @@ -273,20 +273,25 @@ export function registerProjectLinkCommand(program: Command): void {
clack.log.warn('Template download failed. You can retry or set up manually.');
}
}
} else if (!json) {
// No template — show dashboard link and suggest prompts
const dashboardUrl = `${getFrontendUrl()}/dashboard/project/${project.id}`;
clack.log.step(`Dashboard: ${dashboardUrl}`);

const prompts = [
'Build a todo app with Google OAuth sign-in',
'Build an Instagram clone where users can upload photos, like, and comment',
'Build an AI chatbot with conversation history',
];
clack.note(
`Open your coding agent (Claude Code, Codex, Cursor, etc.) and try:\n\n${prompts.map((p) => `• "${p}"`).join('\n')}`,
'Start building',
);
} else {
// No template — install agent skills in the current directory
await installSkills(json);
await reportCliUsage('cli.link', true, 6, projectConfig);

if (!json) {
const dashboardUrl = `${getFrontendUrl()}/dashboard/project/${project.id}`;
clack.log.step(`Dashboard: ${dashboardUrl}`);

const prompts = [
'Build a todo app with Google OAuth sign-in',
'Build an Instagram clone where users can upload photos, like, and comment',
'Build an AI chatbot with conversation history and deploy it to a live URL',
];
clack.note(
`Open your coding agent (Claude Code, Codex, Cursor, etc.) and try:\n\n${prompts.map((p) => `• "${p}"`).join('\n')}`,
'Start building',
);
}
}
} catch (err) {
await reportCliUsage('cli.link', false);
Expand Down
Loading