Skip to content

Commit 25cac80

Browse files
halindromeclaude
andcommitted
fix(install): address QA round 1 findings
- cbm_cmd_install: guard steps 5-12 (Codex, Gemini, Zed, OpenCode, Antigravity, Aider, KiloCode, PATH) with !has_project so --project installs only touch the project's .claude/ tree, not global agent dirs - cbm_cmd_update: add --project [path] flag parsing; when set, also reinstall skills in {project_path}/.claude/skills so project-local skills stay current after a binary update Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent d209ccb commit 25cac80

1 file changed

Lines changed: 46 additions & 7 deletions

File tree

‎src/cli/cli.c‎

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,12 @@ int cbm_cmd_install(int argc, char **argv) {
21262126
printf(" hooks: PreToolUse (Grep|Glob reminder)\n");
21272127
}
21282128

2129+
/* Steps 5-12: Global agent installs — skipped when --project is used
2130+
* because those tools use their own global config directories, not the
2131+
* project-local .claude/ tree. */
2132+
const char *shell_rc = "";
2133+
if (!has_project) {
2134+
21292135
/* Step 5: Install Codex CLI */
21302136
if (agents.codex) {
21312137
printf("Codex CLI:\n");
@@ -2255,18 +2261,23 @@ int cbm_cmd_install(int argc, char **argv) {
22552261
/* Step 12: Ensure PATH */
22562262
char bin_dir[1024];
22572263
snprintf(bin_dir, sizeof(bin_dir), "%s/.local/bin", home);
2258-
const char *rc = cbm_detect_shell_rc(home);
2259-
if (rc[0]) {
2260-
int path_rc = cbm_ensure_path(bin_dir, rc, dry_run);
2264+
shell_rc = cbm_detect_shell_rc(home);
2265+
if (shell_rc[0]) {
2266+
int path_rc = cbm_ensure_path(bin_dir, shell_rc, dry_run);
22612267
if (path_rc == 0) {
2262-
printf("\nAdded %s to PATH in %s\n", bin_dir, rc);
2268+
printf("\nAdded %s to PATH in %s\n", bin_dir, shell_rc);
22632269
} else if (path_rc == 1) {
22642270
printf("\nPATH already includes %s\n", bin_dir);
22652271
}
22662272
}
22672273

2268-
printf("\nInstall complete. Restart your shell or run:\n");
2269-
printf(" source %s\n", rc);
2274+
} /* end if (!has_project) */
2275+
2276+
printf("\nInstall complete.");
2277+
if (!has_project && shell_rc[0]) {
2278+
printf(" Restart your shell or run:\n source %s", shell_rc);
2279+
}
2280+
printf("\n");
22702281
if (dry_run) {
22712282
printf("\n(dry-run — no files were modified)\n");
22722283
}
@@ -2503,6 +2514,25 @@ int cbm_cmd_uninstall(int argc, char **argv) {
25032514
int cbm_cmd_update(int argc, char **argv) {
25042515
parse_auto_answer(argc, argv);
25052516

2517+
bool has_project = false;
2518+
char project_path[1024];
2519+
project_path[0] = '\0';
2520+
2521+
for (int i = 0; i < argc; i++) {
2522+
if (strcmp(argv[i], "--project") == 0) {
2523+
has_project = true;
2524+
if (i + 1 < argc && argv[i + 1][0] != '-') {
2525+
snprintf(project_path, sizeof(project_path), "%s", argv[i + 1]);
2526+
i++;
2527+
} else {
2528+
if (!getcwd(project_path, sizeof(project_path))) {
2529+
fprintf(stderr, "error: getcwd failed\n");
2530+
return 1;
2531+
}
2532+
}
2533+
}
2534+
}
2535+
25062536
const char *home = getenv("HOME");
25072537
if (!home) {
25082538
fprintf(stderr, "error: HOME not set\n");
@@ -2673,7 +2703,16 @@ int cbm_cmd_update(int argc, char **argv) {
26732703
char skills_dir[1024];
26742704
snprintf(skills_dir, sizeof(skills_dir), "%s/skills", claude_dir_upd);
26752705
int skill_count = cbm_install_skills(skills_dir, true, false);
2676-
printf("Updated %d skill(s).\n", skill_count);
2706+
printf("Updated %d global skill(s).\n", skill_count);
2707+
2708+
/* Also update project-local skills if --project was specified. */
2709+
if (has_project) {
2710+
char proj_skills_dir[1024];
2711+
snprintf(proj_skills_dir, sizeof(proj_skills_dir), "%s/.claude/skills", project_path);
2712+
int proj_skill_count = cbm_install_skills(proj_skills_dir, true, false);
2713+
printf("Updated %d project skill(s) in %s/.claude/skills.\n", proj_skill_count,
2714+
project_path);
2715+
}
26772716

26782717
/* Step 7: Verify new version */
26792718
printf("\nUpdate complete. Verifying:\n");

0 commit comments

Comments
 (0)