============================================================================ install — install into a code agent (from store, GitHub, or local directory) ============================================================================
(kind entities.Kind)
| 1342 | // ============================================================================ |
| 1343 | |
| 1344 | func entityInstallCommand(kind entities.Kind) *cobra.Command { |
| 1345 | var ( |
| 1346 | app string |
| 1347 | all bool |
| 1348 | force bool |
| 1349 | fromLocal bool |
| 1350 | fromGH bool |
| 1351 | ) |
| 1352 | cmd := &cobra.Command{ |
| 1353 | Use: "install [NAME | OWNER/REPO | PATH]", |
| 1354 | Short: "Install " + string(kind) + "(s) into a code agent", |
| 1355 | Long: "Install " + string(kind) + `(s) into a target code agent. |
| 1356 | |
| 1357 | Three install modes: |
| 1358 | |
| 1359 | 1. From local store (default): |
| 1360 | Install an item previously fetched via 'update'. |
| 1361 | cam ` + string(kind) + ` install my-skill --app claude |
| 1362 | |
| 1363 | 2. From a GitHub repository (--from-github): |
| 1364 | Download and install directly from a GitHub repo. |
| 1365 | cam ` + string(kind) + ` install owner/repo --from-github |
| 1366 | |
| 1367 | 3. From a local directory (--from-local): |
| 1368 | Discover and install items from a local directory. |
| 1369 | cam ` + string(kind) + ` install ./my-skills --from-local |
| 1370 | |
| 1371 | When --app is omitted in an interactive terminal, you will be prompted |
| 1372 | to select a target agent. |
| 1373 | |
| 1374 | Supported agents: ` + strings.Join(entities.SupportedApps(kind), ", ") + `. |
| 1375 | |
| 1376 | Use --all to install every discovered item. |
| 1377 | Use --force to overwrite existing installations.`, |
| 1378 | Example: " # Install from local store\n" + |
| 1379 | " cam " + string(kind) + " install my-skill --app claude\n" + |
| 1380 | " cam " + string(kind) + " install --all --app claude\n\n" + |
| 1381 | " # Install from GitHub repository\n" + |
| 1382 | " cam " + string(kind) + " install anthropics/skills --from-github\n\n" + |
| 1383 | " # Install from local directory (prompts for target agent)\n" + |
| 1384 | " cam " + string(kind) + " install ./my-skills-dir --from-local\n" + |
| 1385 | " cam " + string(kind) + " install ~/repos/skills my-skill --from-local\n" + |
| 1386 | " cam " + string(kind) + " install ~/repos/skills --from-local --all", |
| 1387 | Args: cobra.MaximumNArgs(2), |
| 1388 | RunE: func(cmd *cobra.Command, args []string) error { |
| 1389 | out := cmd.OutOrStdout() |
| 1390 | |
| 1391 | if fromLocal && fromGH { |
| 1392 | return fmt.Errorf("--from-local and --from-github cannot be used together") |
| 1393 | } |
| 1394 | |
| 1395 | // resolveApps returns the target agent(s). When --app is given, |
| 1396 | // returns that single app. Otherwise prompts interactively |
| 1397 | // with multi-select so the user can install to several agents. |
| 1398 | resolveApps := func() ([]string, error) { |
| 1399 | if app != "" { |
| 1400 | return []string{app}, nil |
| 1401 | } |
no test coverage detected