@axn-dev/cli 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/dist/commands/completion.d.ts +11 -0
  3. package/dist/commands/completion.d.ts.map +1 -0
  4. package/dist/commands/completion.js +68 -0
  5. package/dist/commands/completion.js.map +1 -0
  6. package/dist/commands/init.d.ts +11 -0
  7. package/dist/commands/init.d.ts.map +1 -0
  8. package/dist/commands/init.js +206 -0
  9. package/dist/commands/init.js.map +1 -0
  10. package/dist/commands/install.d.ts +12 -0
  11. package/dist/commands/install.d.ts.map +1 -0
  12. package/dist/commands/install.js +305 -0
  13. package/dist/commands/install.js.map +1 -0
  14. package/dist/commands/setup.d.ts +9 -0
  15. package/dist/commands/setup.d.ts.map +1 -0
  16. package/dist/commands/setup.js +230 -0
  17. package/dist/commands/setup.js.map +1 -0
  18. package/dist/commands/uninstall.d.ts +9 -0
  19. package/dist/commands/uninstall.d.ts.map +1 -0
  20. package/dist/commands/uninstall.js +204 -0
  21. package/dist/commands/uninstall.js.map +1 -0
  22. package/dist/completion.d.ts +14 -0
  23. package/dist/completion.d.ts.map +1 -0
  24. package/dist/completion.js +24 -0
  25. package/dist/completion.js.map +1 -0
  26. package/dist/completion.test.d.ts +2 -0
  27. package/dist/completion.test.d.ts.map +1 -0
  28. package/dist/completion.test.js +37 -0
  29. package/dist/completion.test.js.map +1 -0
  30. package/dist/index.d.ts +7 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +7 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/main.d.ts +3 -0
  35. package/dist/main.d.ts.map +1 -0
  36. package/dist/main.js +100 -0
  37. package/dist/main.js.map +1 -0
  38. package/dist/plugins.d.ts +10 -0
  39. package/dist/plugins.d.ts.map +1 -0
  40. package/dist/plugins.js +142 -0
  41. package/dist/plugins.js.map +1 -0
  42. package/dist/repo-scan.d.ts +17 -0
  43. package/dist/repo-scan.d.ts.map +1 -0
  44. package/dist/repo-scan.js +54 -0
  45. package/dist/repo-scan.js.map +1 -0
  46. package/dist/skill-sources.d.ts +20 -0
  47. package/dist/skill-sources.d.ts.map +1 -0
  48. package/dist/skill-sources.js +61 -0
  49. package/dist/skill-sources.js.map +1 -0
  50. package/package.json +44 -3
  51. package/skills/axn-dev-cli/SKILL.md +265 -0
  52. package/skills/axn-dev-setup/SKILL.md +168 -0
  53. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 astropiano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ import type { Command } from "@axn-dev/core";
2
+ export declare const ZSH_SCRIPT: string;
3
+ export declare const BASH_SCRIPT: string;
4
+ export declare class CompletionCommand implements Command {
5
+ readonly name = "completion";
6
+ readonly description = "Print shell completion script (zsh|bash)";
7
+ complete(words: string[]): string[];
8
+ help(): string;
9
+ execute(args: string[]): Promise<void>;
10
+ }
11
+ //# sourceMappingURL=completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,eAAO,MAAM,UAAU,QASV,CAAC;AAEd,eAAO,MAAM,WAAW,QASX,CAAC;AAEd,qBAAa,iBAAkB,YAAW,OAAO;IAC/C,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,WAAW,8CAA8C;IAElE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAQnC,IAAI,IAAI,MAAM;IAmBR,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB7C"}
@@ -0,0 +1,68 @@
1
+ // Proper zsh #compdef script — intended to be placed in a fpath directory
2
+ // as _axn-dev so zsh autoloads it without any .zshrc modification.
3
+ export const ZSH_SCRIPT = `#compdef axn-dev
4
+
5
+ _axn_dev() {
6
+ local -a completions
7
+ completions=(\${(f)"$(axn-dev --complete \${words[@]} 2>/dev/null)"})
8
+ compadd -a completions
9
+ }
10
+
11
+ _axn_dev
12
+ `.trimStart();
13
+ export const BASH_SCRIPT = `# axn-dev bash completion
14
+ # Generated by: axn-dev completion bash
15
+
16
+ _axn_dev_complete() {
17
+ local IFS=$'\\n'
18
+ COMPREPLY=( $(axn-dev --complete "\${COMP_WORDS[@]}" 2>/dev/null) )
19
+ }
20
+
21
+ complete -F _axn_dev_complete axn-dev
22
+ `.trimStart();
23
+ export class CompletionCommand {
24
+ name = "completion";
25
+ description = "Print shell completion script (zsh|bash)";
26
+ complete(words) {
27
+ const cur = words[words.length - 1] ?? "";
28
+ if (words.length === 3) {
29
+ return ["zsh", "bash"].filter((s) => s.startsWith(cur) && s !== cur);
30
+ }
31
+ return [];
32
+ }
33
+ help() {
34
+ return `
35
+ Usage: axn-dev completion <shell>
36
+
37
+ Print a shell completion script to stdout.
38
+
39
+ Shells:
40
+ zsh #compdef script for fpath-based autoloading
41
+ bash complete-based script
42
+
43
+ Preferred setup (no .zshrc modification needed after first time):
44
+ axn-dev install --completion
45
+
46
+ Manual setup:
47
+ axn-dev completion zsh > ~/.zsh/completions/_axn-dev
48
+ axn-dev completion bash > ~/.bash_completion.d/axn-dev
49
+ `.trim();
50
+ }
51
+ async execute(args) {
52
+ const shell = args[0];
53
+ if (!shell || shell === "--help" || shell === "-h") {
54
+ console.log(this.help());
55
+ return;
56
+ }
57
+ if (shell === "zsh") {
58
+ process.stdout.write(ZSH_SCRIPT);
59
+ }
60
+ else if (shell === "bash") {
61
+ process.stdout.write(BASH_SCRIPT);
62
+ }
63
+ else {
64
+ throw new Error(`Unknown shell '${shell}'. Supported: zsh, bash`);
65
+ }
66
+ }
67
+ }
68
+ //# sourceMappingURL=completion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,mEAAmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;CASzB,CAAC,SAAS,EAAE,CAAC;AAEd,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;CAS1B,CAAC,SAAS,EAAE,CAAC;AAEd,MAAM,OAAO,iBAAiB;IACnB,IAAI,GAAG,YAAY,CAAC;IACpB,WAAW,GAAG,0CAA0C,CAAC;IAElE,QAAQ,CAAC,KAAe;QACtB,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI;QACF,OAAO;;;;;;;;;;;;;;;CAeV,CAAC,IAAI,EAAE,CAAC;IACP,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAc;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEtB,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACzB,OAAO;QACT,CAAC;QAED,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACnC,CAAC;aAAM,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,yBAAyB,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { Command } from "@axn-dev/core";
2
+ export declare class InitCommand implements Command {
3
+ readonly name = "init";
4
+ readonly description = "Initialize ~/.axn-dev/config.yaml with repo paths";
5
+ complete: (words: string[]) => string[];
6
+ help(): string;
7
+ execute(args: string[]): Promise<void>;
8
+ private generateYaml;
9
+ private findGitRoot;
10
+ }
11
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAoC7C,qBAAa,WAAY,YAAW,OAAO;IACzC,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,WAAW,uDAAuD;IAE3E,QAAQ,gCAEL;IAEH,IAAI,IAAI,MAAM;IAiBR,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwG5C,OAAO,CAAC,YAAY;IA6CpB,OAAO,CAAC,WAAW;CAQpB"}
@@ -0,0 +1,206 @@
1
+ import { flagCompleter } from "@axn-dev/core";
2
+ import { existsSync, mkdirSync, writeFileSync, readFileSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { join, resolve } from "node:path";
5
+ import { createInterface } from "node:readline";
6
+ import { scanWorkspaceTree } from "../repo-scan.js";
7
+ const CONFIG_DIR = ".axn-dev";
8
+ const CONFIG_FILE = "config.yaml";
9
+ function ask(question, defaultValue) {
10
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
11
+ const suffix = defaultValue ? ` [${defaultValue}]` : "";
12
+ return new Promise((resolve) => {
13
+ rl.question(`${question}${suffix}: `, (answer) => {
14
+ rl.close();
15
+ resolve(answer.trim() || defaultValue || "");
16
+ });
17
+ });
18
+ }
19
+ function askYN(question, defaultYes = true) {
20
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
21
+ const hint = defaultYes ? "[Y/n]" : "[y/N]";
22
+ return new Promise((resolve) => {
23
+ rl.question(`${question} ${hint}: `, (answer) => {
24
+ rl.close();
25
+ const a = answer.trim().toLowerCase();
26
+ if (!a)
27
+ resolve(defaultYes);
28
+ else
29
+ resolve(a === "y" || a === "yes");
30
+ });
31
+ });
32
+ }
33
+ export class InitCommand {
34
+ name = "init";
35
+ description = "Initialize ~/.axn-dev/config.yaml with repo paths";
36
+ complete = flagCompleter([
37
+ "--global", "--local", "--force", "-f", "--scan", "--help", "-h",
38
+ ]);
39
+ help() {
40
+ return `
41
+ Usage: axn-dev init [options]
42
+
43
+ Initialize the axn-dev configuration file.
44
+
45
+ Options:
46
+ --global Write to ~/.axn-dev/config.yaml (default)
47
+ --local Write to <git-root>/.axn-dev/config.yaml
48
+ --force Overwrite existing config without prompting
49
+ --scan <dir> Scan a directory tree for git checkouts to register:
50
+ *-integration dirs go to integration:, others to repos:
51
+
52
+ If run without options, interactively prompts for repo paths.
53
+ `.trim();
54
+ }
55
+ async execute(args) {
56
+ let scope = "global";
57
+ let force = false;
58
+ let scanDir = null;
59
+ for (let i = 0; i < args.length; i++) {
60
+ const a = args[i];
61
+ if (a === "--help" || a === "-h") {
62
+ console.log(this.help());
63
+ return;
64
+ }
65
+ if (a === "--global")
66
+ scope = "global";
67
+ else if (a === "--local")
68
+ scope = "local";
69
+ else if (a === "--force" || a === "-f")
70
+ force = true;
71
+ else if (a === "--scan" && args[i + 1]) {
72
+ scanDir = resolve(args[++i]);
73
+ }
74
+ }
75
+ // Determine target path
76
+ let configDir;
77
+ if (scope === "local") {
78
+ const gitRoot = this.findGitRoot(process.cwd());
79
+ if (!gitRoot) {
80
+ throw new Error("Not inside a git repository. Cannot write local config.");
81
+ }
82
+ configDir = join(gitRoot, CONFIG_DIR);
83
+ }
84
+ else {
85
+ configDir = join(homedir(), CONFIG_DIR);
86
+ }
87
+ const configPath = join(configDir, CONFIG_FILE);
88
+ // Check if already exists
89
+ if (existsSync(configPath) && !force) {
90
+ console.log(`Config already exists: ${configPath}`);
91
+ const existing = readFileSync(configPath, "utf-8");
92
+ console.log("\n--- Current config ---");
93
+ console.log(existing);
94
+ console.log("--- End ---\n");
95
+ const overwrite = await askYN("Overwrite?", false);
96
+ if (!overwrite) {
97
+ console.log("Aborted.");
98
+ return;
99
+ }
100
+ }
101
+ // Gather info
102
+ let integration = [];
103
+ const repos = {};
104
+ if (scanDir) {
105
+ console.log(`Scanning ${scanDir} for repos...`);
106
+ const scan = scanWorkspaceTree(scanDir);
107
+ integration = scan.integration;
108
+ Object.assign(repos, scan.repos);
109
+ }
110
+ else {
111
+ // Interactive mode
112
+ console.log("\naxn-dev init — Configure your development environment\n");
113
+ // Integration repos
114
+ console.log("Integration repos contain global scenarios (compose stacks).");
115
+ let addMore = true;
116
+ while (addMore) {
117
+ const path = await ask("Integration repo path (empty to skip)");
118
+ if (path) {
119
+ const resolved = resolve(path);
120
+ if (existsSync(resolved)) {
121
+ integration.push(resolved);
122
+ }
123
+ else {
124
+ console.log(` Path does not exist: ${resolved}`);
125
+ const addAnyway = await askYN(" Add anyway?", false);
126
+ if (addAnyway)
127
+ integration.push(resolved);
128
+ }
129
+ addMore = await askYN("Add another integration repo?", false);
130
+ }
131
+ else {
132
+ addMore = false;
133
+ }
134
+ }
135
+ // Individual repos
136
+ console.log("\nAdd repo checkout paths (these become env vars for docker-compose).");
137
+ console.log("Press Enter with empty path to finish.\n");
138
+ let addMoreRepos = await askYN("Add repos?", false);
139
+ while (addMoreRepos) {
140
+ const name = await ask(" Repo name");
141
+ if (!name)
142
+ break;
143
+ const path = await ask(` Path for ${name}`);
144
+ if (path)
145
+ repos[name] = resolve(path);
146
+ addMoreRepos = await askYN(" Add another?", false);
147
+ }
148
+ }
149
+ // Generate YAML
150
+ const yaml = this.generateYaml(integration, repos);
151
+ // Write
152
+ mkdirSync(configDir, { recursive: true });
153
+ writeFileSync(configPath, yaml, "utf-8");
154
+ console.log(`\nConfig written to: ${configPath}`);
155
+ console.log("\nYou can edit this file anytime. Run 'axn-dev list' to verify scenarios are found.");
156
+ }
157
+ generateYaml(integration, repos) {
158
+ const lines = [
159
+ "# axn-dev CLI configuration",
160
+ "",
161
+ ];
162
+ // Integration
163
+ lines.push("# Integration repos — searched in order for global scenarios");
164
+ if (integration.length > 0) {
165
+ lines.push("integration:");
166
+ for (const p of integration) {
167
+ lines.push(` - ${p}`);
168
+ }
169
+ }
170
+ else {
171
+ lines.push("# integration:");
172
+ lines.push("# - /path/to/my-integration-repo");
173
+ }
174
+ lines.push("");
175
+ // Repos
176
+ lines.push("# Repo checkout paths — injected as env vars for docker-compose");
177
+ lines.push("# Object form sets the env var name: my-repo: {path: /x, env: MYREPO}");
178
+ if (Object.keys(repos).length > 0) {
179
+ lines.push("repos:");
180
+ for (const [name, path] of Object.entries(repos)) {
181
+ lines.push(` ${name}: ${path}`);
182
+ }
183
+ }
184
+ else {
185
+ lines.push("# repos:");
186
+ lines.push("# my-repo: /path/to/my-repo");
187
+ lines.push("# other-repo: /path/to/other-repo");
188
+ }
189
+ lines.push("");
190
+ // Plugin-owned sections
191
+ lines.push("# Command plugins may declare their own top-level keys here");
192
+ lines.push("# (e.g. an infra plugin might use `infra: /path/to/infra-repo`).");
193
+ lines.push("");
194
+ return lines.join("\n");
195
+ }
196
+ findGitRoot(startDir) {
197
+ let dir = resolve(startDir);
198
+ while (dir !== "/") {
199
+ if (existsSync(join(dir, ".git")))
200
+ return dir;
201
+ dir = resolve(dir, "..");
202
+ }
203
+ return null;
204
+ }
205
+ }
206
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,UAAU,GAAG,UAAU,CAAC;AAC9B,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,SAAS,GAAG,CAAC,QAAgB,EAAE,YAAqB;IAClD,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,MAAM,MAAM,GAAG,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,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACrB,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjD,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACpD,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEf,wBAAwB;QACxB,KAAK,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;QAC1E,KAAK,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;QAC/E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAEO,WAAW,CAAC,QAAgB;QAClC,IAAI,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC;YACnB,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;gBAAE,OAAO,GAAG,CAAC;YAC9C,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import type { Command } from "@axn-dev/core";
2
+ export declare class InstallCommand implements Command {
3
+ readonly name = "install";
4
+ readonly description = "Install skills for AI agents, shell completion, or plugin packages";
5
+ complete(words: string[]): string[];
6
+ help(): string;
7
+ execute(args: string[]): Promise<void>;
8
+ private installCompletion;
9
+ private installZshCompletion;
10
+ private installBashCompletion;
11
+ }
12
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAkG7C,qBAAa,cAAe,YAAW,OAAO;IAC5C,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,WAAW,wEAAwE;IAE5F,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAmBnC,IAAI,IAAI,MAAM;IAyCR,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YA+G9B,iBAAiB;YAgBjB,oBAAoB;YAgCpB,qBAAqB;CAsBpC"}
@@ -0,0 +1,305 @@
1
+ import { existsSync, mkdirSync, cpSync, appendFileSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { homedir } from "node:os";
4
+ import { findSkill, listAllSkills } from "../skill-sources.js";
5
+ import { installPlugin } from "../plugins.js";
6
+ const AGENTS = [
7
+ {
8
+ name: "claude",
9
+ personalPath: join(homedir(), ".claude/skills"),
10
+ projectPath: ".claude/skills",
11
+ detect: () => existsSync(join(homedir(), ".claude")) || existsSync(".claude"),
12
+ },
13
+ {
14
+ name: "openclaw",
15
+ personalPath: join(homedir(), ".openclaw/skills"),
16
+ projectPath: ".openclaw/skills",
17
+ detect: () => existsSync(join(homedir(), ".openclaw")) || existsSync(".openclaw"),
18
+ },
19
+ {
20
+ name: "codex",
21
+ personalPath: join(homedir(), ".codex/skills"),
22
+ projectPath: ".codex/skills",
23
+ detect: () => existsSync(join(homedir(), ".codex")) || existsSync(".codex"),
24
+ },
25
+ {
26
+ name: "cursor",
27
+ personalPath: "", // Cursor only supports project-level
28
+ projectPath: ".cursor/skills",
29
+ detect: () => existsSync(".cursor"),
30
+ },
31
+ {
32
+ name: "devin",
33
+ personalPath: join(homedir(), ".config", "devin", "skills"),
34
+ projectPath: ".devin/skills",
35
+ detect: () => existsSync(join(homedir(), ".config", "devin")) ||
36
+ existsSync(join(homedir(), ".devin")) ||
37
+ existsSync(".devin") ||
38
+ existsSync(".agents"),
39
+ },
40
+ {
41
+ name: "vibe",
42
+ personalPath: join(homedir(), ".vibe/skills"),
43
+ projectPath: ".vibe/skills",
44
+ detect: () => existsSync(join(homedir(), ".vibe")) || existsSync(".vibe"),
45
+ },
46
+ ];
47
+ function findAvailableAgents() {
48
+ return AGENTS.filter((agent) => agent.detect?.() ?? true);
49
+ }
50
+ function getSkillSourcePath(skillName) {
51
+ return findSkill(skillName)?.dir ?? null;
52
+ }
53
+ function listSkillNames() {
54
+ return listAllSkills().map((s) => s.name);
55
+ }
56
+ function installToTarget(skillSource, skillName, targetBase, label) {
57
+ const skillTarget = join(targetBase, skillName);
58
+ console.log(`Installing to ${label}: ${skillTarget}`);
59
+ mkdirSync(skillTarget, { recursive: true });
60
+ cpSync(skillSource, skillTarget, { recursive: true });
61
+ console.log(` ✓ Installed`);
62
+ }
63
+ function installToAgent(agent, skillSource, skillName, projectLevel, repo) {
64
+ const basePath = repo
65
+ ? resolve(repo, agent.projectPath)
66
+ : projectLevel
67
+ ? agent.projectPath
68
+ : agent.personalPath;
69
+ if (!basePath) {
70
+ console.log(`Skipping ${agent.name}: ${projectLevel ? "project-level" : "personal"} installation not supported`);
71
+ return;
72
+ }
73
+ const label = repo ? `${agent.name} (repo)` : projectLevel ? `${agent.name} (project)` : `${agent.name} (personal)`;
74
+ installToTarget(skillSource, skillName, basePath, label);
75
+ }
76
+ function installToAgentsRepo(skillSource, skillName, repo) {
77
+ const skillTarget = resolve(repo, ".agents", skillName);
78
+ console.log(`Installing to repo .agents: ${skillTarget}`);
79
+ mkdirSync(skillTarget, { recursive: true });
80
+ cpSync(skillSource, skillTarget, { recursive: true });
81
+ console.log(` ✓ Installed`);
82
+ }
83
+ export class InstallCommand {
84
+ name = "install";
85
+ description = "Install skills for AI agents, shell completion, or plugin packages";
86
+ complete(words) {
87
+ const prev = words[words.length - 2] ?? "";
88
+ const cur = words[words.length - 1] ?? "";
89
+ if (prev === "--skill") {
90
+ return listSkillNames().filter((s) => s.startsWith(cur));
91
+ }
92
+ if (prev === "--agent") {
93
+ return AGENTS.map((a) => a.name).filter((n) => n.startsWith(cur));
94
+ }
95
+ if (prev === "--shell") {
96
+ return ["zsh", "bash"].filter((s) => s.startsWith(cur) && s !== cur);
97
+ }
98
+ if (prev === "--repo")
99
+ return [];
100
+ return [
101
+ "--skill", "--skills", "--plugin", "--completion", "--project", "--repo",
102
+ "--devin", "--vibe", "--agent", "--all-agents", "--shell", "--help", "-h",
103
+ ].filter((f) => f.startsWith(cur) && f !== cur);
104
+ }
105
+ help() {
106
+ return `
107
+ axn-dev install <target> [options]
108
+
109
+ Targets:
110
+ --skill <name> Install a specific skill by name
111
+ --skills Install all available skills
112
+ --plugin <spec> Install a plugin package into ~/.axn-dev/plugins
113
+ (npm spec: name, name@version, or local path)
114
+ --completion Install shell tab-completion into your shell profile
115
+
116
+ Options:
117
+ --project Install at project level (default: personal/global)
118
+ --repo <path> Install into a repo's .agents folder (standard agent skills)
119
+ --devin Use Devin-specific paths (.devin/skills in repo, ~/.config/devin/skills user-level)
120
+ --vibe Use Vibe-specific paths (.vibe/skills in repo, ~/.vibe/skills user-level)
121
+ --agent <name> Install only for specific agent (claude, openclaw, codex, cursor, devin, vibe)
122
+ --all-agents Install for all configured agents (default: detected agents)
123
+ -h, --help Show this help
124
+
125
+ Options (--completion):
126
+ --shell <zsh|bash> Shell to install for (auto-detected if omitted)
127
+
128
+ Examples:
129
+ axn-dev install --skill axn-dev-cli
130
+ axn-dev install --skills
131
+ axn-dev install --skills --project
132
+ axn-dev install --skills --agent claude
133
+ axn-dev install --skills --agent vibe
134
+ axn-dev install --skills --repo /path/to/repo # .agents
135
+ axn-dev install --skills --repo /path/to/repo --devin # .devin/skills
136
+ axn-dev install --skills --devin # ~/.config/devin/skills
137
+ axn-dev install --skills --vibe # ~/.vibe/skills
138
+ axn-dev install --completion
139
+ axn-dev install --completion --shell bash
140
+ axn-dev install --plugin @acme/axn-dev-foo
141
+ axn-dev install --plugin @acme/axn-dev-foo@1.2.0
142
+ axn-dev install --plugin ../my-plugin # local dir for development
143
+ `;
144
+ }
145
+ async execute(args) {
146
+ if (!args.length || args[0] === "--help" || args[0] === "-h") {
147
+ console.log(this.help());
148
+ return;
149
+ }
150
+ const pluginEquals = args.find((a) => a.startsWith("--plugin="));
151
+ const pluginIdx = args.indexOf("--plugin");
152
+ const pluginSpec = pluginEquals
153
+ ? pluginEquals.split("=")[1]
154
+ : pluginIdx >= 0 ? args[pluginIdx + 1] : undefined;
155
+ if (pluginIdx >= 0 || pluginEquals) {
156
+ if (!pluginSpec || pluginSpec.startsWith("-")) {
157
+ throw new Error("Missing plugin spec. Usage: axn-dev install --plugin <name[@version]|path>");
158
+ }
159
+ installPlugin(pluginSpec);
160
+ return;
161
+ }
162
+ if (args[0] === "--completion") {
163
+ const shellIdx = args.indexOf("--shell");
164
+ const shellFlag = shellIdx >= 0 ? args[shellIdx + 1] : null;
165
+ await this.installCompletion(shellFlag || null);
166
+ return;
167
+ }
168
+ const [target, ...rest] = args;
169
+ const projectLevel = rest.includes("--project");
170
+ const devinFlag = rest.includes("--devin");
171
+ const vibeFlag = rest.includes("--vibe");
172
+ const explicitAllAgents = rest.includes("--all-agents");
173
+ const agentEquals = rest.find((a) => a.startsWith("--agent="));
174
+ const agentIdx = rest.indexOf("--agent");
175
+ const specificAgent = agentEquals ? agentEquals.split("=")[1] : agentIdx >= 0 ? rest[agentIdx + 1] : undefined;
176
+ const repoEquals = rest.find((a) => a.startsWith("--repo="));
177
+ const repoIdx = rest.indexOf("--repo");
178
+ const repoArg = repoEquals ? repoEquals.split("=")[1] : repoIdx >= 0 ? rest[repoIdx + 1] : undefined;
179
+ const repo = repoArg ? resolve(repoArg) : undefined;
180
+ const useAgentsRepo = repo && !specificAgent && !devinFlag && !vibeFlag && !explicitAllAgents;
181
+ const allAgents = !specificAgent && !repo && !devinFlag && !vibeFlag && !explicitAllAgents;
182
+ let skillsToInstall;
183
+ if (target === "--skills") {
184
+ skillsToInstall = listSkillNames();
185
+ if (skillsToInstall.length === 0) {
186
+ throw new Error("No skills found. Run 'pnpm build' in the axn-dev-cli workspace, or reinstall the package.");
187
+ }
188
+ }
189
+ else if (target === "--skill" || target.startsWith("--skill=")) {
190
+ const skillName = target.startsWith("--skill=") ? target.split("=")[1] : rest[0];
191
+ if (!skillName) {
192
+ throw new Error("Missing skill name. Usage: axn-dev install --skill <name>");
193
+ }
194
+ skillsToInstall = [skillName];
195
+ }
196
+ else {
197
+ throw new Error(`Unknown target '${target}'. Run 'axn-dev install --help'.`);
198
+ }
199
+ const agents = specificAgent
200
+ ? AGENTS.filter((a) => a.name === specificAgent)
201
+ : devinFlag
202
+ ? AGENTS.filter((a) => a.name === "devin")
203
+ : vibeFlag
204
+ ? AGENTS.filter((a) => a.name === "vibe")
205
+ : allAgents
206
+ ? findAvailableAgents()
207
+ : AGENTS;
208
+ if (!useAgentsRepo && agents.length === 0) {
209
+ console.log("No agents detected. Use --agent <name> to force installation to a specific agent.");
210
+ return;
211
+ }
212
+ for (const skillName of skillsToInstall) {
213
+ const skillSource = getSkillSourcePath(skillName);
214
+ if (!skillSource) {
215
+ if (skillsToInstall.length === 1) {
216
+ throw new Error(`Skill source not found for '${skillName}'. Run 'pnpm build' in the axn-dev-cli workspace, or reinstall the linked package.`);
217
+ }
218
+ console.error(` ✗ Skipping '${skillName}': source not found.`);
219
+ continue;
220
+ }
221
+ console.log(`\nInstalling ${skillName} skill...\n`);
222
+ if (useAgentsRepo && repo) {
223
+ try {
224
+ installToAgentsRepo(skillSource, skillName, repo);
225
+ }
226
+ catch (err) {
227
+ console.error(` ✗ Failed to install to repo .agents: ${err instanceof Error ? err.message : err}`);
228
+ }
229
+ continue;
230
+ }
231
+ for (const agent of agents) {
232
+ try {
233
+ installToAgent(agent, skillSource, skillName, projectLevel, repo);
234
+ }
235
+ catch (err) {
236
+ console.error(` ✗ Failed to install to ${agent.name}: ${err instanceof Error ? err.message : err}`);
237
+ }
238
+ }
239
+ }
240
+ console.log("\nDone. Restart your AI agent to load the skill.");
241
+ }
242
+ async installCompletion(shell) {
243
+ const detectedShell = shell ?? process.env["SHELL"]?.split("/").pop() ?? "zsh";
244
+ const supported = ["zsh", "bash"];
245
+ if (!supported.includes(detectedShell)) {
246
+ throw new Error(`Shell '${detectedShell}' not supported. Use --shell zsh or --shell bash.`);
247
+ }
248
+ const { ZSH_SCRIPT, BASH_SCRIPT } = await import("./completion.js");
249
+ if (detectedShell === "zsh") {
250
+ await this.installZshCompletion(ZSH_SCRIPT);
251
+ }
252
+ else {
253
+ await this.installBashCompletion(BASH_SCRIPT);
254
+ }
255
+ }
256
+ async installZshCompletion(script) {
257
+ // Write _axn-dev into ~/.zsh/completions/ (standard fpath location)
258
+ const completionsDir = join(homedir(), ".zsh", "completions");
259
+ const completionFile = join(completionsDir, "_axn-dev");
260
+ mkdirSync(completionsDir, { recursive: true });
261
+ writeFileSync(completionFile, script, "utf-8");
262
+ console.log(`✅ Written: ${completionFile}`);
263
+ // Ensure fpath and compinit are in .zshrc (one-time, idempotent)
264
+ const zshrc = join(homedir(), ".zshrc");
265
+ const fpathLine = `fpath=(~/.zsh/completions $fpath)`;
266
+ const compInitLine = `autoload -Uz compinit && compinit`;
267
+ const existing = existsSync(zshrc) ? readFileSync(zshrc, "utf-8") : "";
268
+ const needsFpath = !existing.includes(".zsh/completions");
269
+ const needsCompinit = !existing.includes("compinit");
270
+ if (needsFpath || needsCompinit) {
271
+ const lines = ["\n# axn-dev shell completion"];
272
+ if (needsFpath)
273
+ lines.push(fpathLine);
274
+ if (needsCompinit)
275
+ lines.push(compInitLine);
276
+ appendFileSync(zshrc, lines.join("\n") + "\n");
277
+ console.log(`✅ Updated ~/.zshrc with fpath + compinit`);
278
+ }
279
+ else {
280
+ console.log(`✓ ~/.zshrc already has fpath + compinit`);
281
+ }
282
+ console.log(`\nRun to activate: autoload -Uz compinit && compinit`);
283
+ console.log(`Or restart your shell.`);
284
+ }
285
+ async installBashCompletion(script) {
286
+ const completionsDir = join(homedir(), ".bash_completion.d");
287
+ const completionFile = join(completionsDir, "axn-dev");
288
+ mkdirSync(completionsDir, { recursive: true });
289
+ writeFileSync(completionFile, script, "utf-8");
290
+ console.log(`✅ Written: ${completionFile}`);
291
+ // Ensure ~/.bash_completion.d is sourced from ~/.bashrc
292
+ const bashrc = join(homedir(), ".bashrc");
293
+ const sourceLine = `\n# axn-dev shell completion\nfor f in ~/.bash_completion.d/*; do source "$f"; done\n`;
294
+ const existing = existsSync(bashrc) ? readFileSync(bashrc, "utf-8") : "";
295
+ if (!existing.includes(".bash_completion.d")) {
296
+ appendFileSync(bashrc, sourceLine);
297
+ console.log(`✅ Updated ~/.bashrc to source ~/.bash_completion.d/`);
298
+ }
299
+ else {
300
+ console.log(`✓ ~/.bashrc already sources ~/.bash_completion.d/`);
301
+ }
302
+ console.log(`\nRun to activate: source ~/.bashrc`);
303
+ }
304
+ }
305
+ //# sourceMappingURL=install.js.map