@artis-lab/cli 0.5.0 → 0.6.0

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.
package/README.md CHANGED
@@ -56,6 +56,29 @@ artis reply annotation-123 --comment "Fixed in revision 2."
56
56
 
57
57
  Run `artis help` for the full command and flag reference.
58
58
 
59
+ ## Install the agent skill
60
+
61
+ `artis install-skill` writes the bundled agent skill (`artis/SKILL.md`) into
62
+ your AI agent harness's skills directory, teaching it the publish → feedback →
63
+ revise loop without reading the docs:
64
+
65
+ ```bash
66
+ artis install-skill --list # harnesses, detection, install paths
67
+ artis install-skill --yes # every detected harness
68
+ artis install-skill --harness claude-code --force # one harness, overwrite existing
69
+ artis install-skill --dir .claude/skills # any custom skills directory
70
+ ```
71
+
72
+ Supported harnesses: Claude Code (`~/.claude/skills`), Cursor
73
+ (`~/.cursor/skills`), Codex (`~/.agents/skills`), OpenClaw
74
+ (`~/.openclaw/skills`), Pi (`~/.pi/agent/skills`), and Hermes
75
+ (`~/.hermes/skills`; honors `HERMES_HOME`, falling back to
76
+ `%LOCALAPPDATA%\hermes` on Windows). Detection is heuristic — a config
77
+ directory or a command on PATH — and `--harness` installs into undetected
78
+ harnesses too. An existing install is left untouched unless `--force` is
79
+ passed, so local edits to the skill survive upgrades. `--json` prints
80
+ machine-readable results.
81
+
59
82
  ## Development
60
83
 
61
84
  This package lives in the Artis monorepo. Build it with `nx build cli`; the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artis-lab/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Agent-first CLI for publishing, reviewing, and revising self-contained HTML artifacts on an Artis server.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/lib/args.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare function parseFlagValue(args: string[], name: string): string | undefined;
2
2
  export declare function hasFlag(args: string[], name: string): boolean;
3
+ export declare function collectFlagValues(args: string[], name: string): string[];
package/src/lib/args.js CHANGED
@@ -8,4 +8,12 @@ export function parseFlagValue(args, name) {
8
8
  export function hasFlag(args, name) {
9
9
  return args.includes(name);
10
10
  }
11
+ export function collectFlagValues(args, name) {
12
+ return args.reduce((values, arg, index) => {
13
+ if (arg === name && args[index + 1]) {
14
+ values.push(args[index + 1]);
15
+ }
16
+ return values;
17
+ }, []);
18
+ }
11
19
  //# sourceMappingURL=args.js.map
package/src/lib/cli.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import { installSkillFromCli } from './skill-install.js';
1
2
  import { artisCliVersion } from './version.js';
2
3
  export { artisCliVersion };
3
- export declare const commands: readonly ["annotate", "annotation", "artifact", "help", "login", "publish", "reply", "revise", "share", "version", "whoami"];
4
+ export { installSkillFromCli };
5
+ export declare const commands: readonly ["annotate", "annotation", "artifact", "help", "install-skill", "login", "publish", "reply", "revise", "share", "version", "whoami"];
4
6
  export type ArtisCommand = (typeof commands)[number];
5
7
  /**
6
8
  * Mirrors the sdk's `ArtifactVisibility`, deliberately re-declared instead of
package/src/lib/cli.js CHANGED
@@ -13,14 +13,17 @@ function isRootAnnotation(annotation) {
13
13
  return annotation.motivation === 'commenting';
14
14
  }
15
15
  import { ARTIS_DEFAULT_HOST, findProfileForHost, getConfigPath, normalizeHost, readCliConfig, saveDefaultProfile, } from './config.js';
16
+ import { installSkillFromCli } from './skill-install.js';
16
17
  import { artisCliVersion } from './version.js';
17
- import { hasFlag, parseFlagValue } from './args.js';
18
+ import { collectFlagValues, hasFlag, parseFlagValue } from './args.js';
18
19
  export { artisCliVersion };
20
+ export { installSkillFromCli };
19
21
  export const commands = [
20
22
  'annotate',
21
23
  'annotation',
22
24
  'artifact',
23
25
  'help',
26
+ 'install-skill',
24
27
  'login',
25
28
  'publish',
26
29
  'reply',
@@ -62,7 +65,9 @@ const valueFlags = new Set([
62
65
  '--comment',
63
66
  '--css',
64
67
  '--description',
68
+ '--dir',
65
69
  '--email',
70
+ '--harness',
66
71
  '--host',
67
72
  '--kind',
68
73
  '--output',
@@ -83,14 +88,6 @@ const valueFlags = new Set([
83
88
  '--url',
84
89
  '--visibility',
85
90
  ]);
86
- function collectFlagValues(args, name) {
87
- return args.reduce((values, arg, index) => {
88
- if (arg === name && args[index + 1]) {
89
- values.push(args[index + 1]);
90
- }
91
- return values;
92
- }, []);
93
- }
94
91
  function getPositionals(args) {
95
92
  const positionals = [];
96
93
  for (let index = 0; index < args.length; index += 1) {
@@ -371,6 +368,7 @@ Usage:
371
368
  artis --version
372
369
  artis login [--host <url>]
373
370
  artis whoami [--host <url>]
371
+ artis install-skill [--harness <id>]... [--yes] [--dir <path>] [--force] [--list] [--json]
374
372
  artis publish artifact.html [options]
375
373
  artis artifact get <artifact-id-or-slug> [--json]
376
374
  artis artifact html <artifact-id-or-slug> [--output <path>] [--revision <revision-id>] [--json]
@@ -408,6 +406,11 @@ Options:
408
406
  --email <email> Email address for artis share.
409
407
  --role <role> Share role: viewer or commenter. Defaults to viewer.
410
408
  --remove Remove the email from an artifact share list.
409
+ --harness <id> Agent harness to install the artis skill into (install-skill). Repeatable: claude-code, cursor, codex, openclaw, pi, hermes.
410
+ --yes Install the skill into every detected harness (install-skill).
411
+ --dir <path> Install the skill into a custom skills directory (install-skill).
412
+ --force Overwrite an already-installed skill (install-skill).
413
+ --list List harnesses, detection, and install paths (install-skill).
411
414
  --json Print machine-readable JSON for supported commands.
412
415
 
413
416
  Examples (--host is optional; without it commands target https://artis.xiispace.eu.org):
@@ -422,6 +425,7 @@ Examples (--host is optional; without it commands target https://artis.xiispace.
422
425
  artis reply annotation-123 --host https://artis.example.com --comment "Addressed in the latest revision"
423
426
  artis annotation edit annotation-123 --host https://artis.example.com --comment "Corrected: the latency spike is on checkout, not search"
424
427
  artis annotation retract annotation-123 --host https://artis.example.com
428
+ artis install-skill --yes
425
429
  artis revise artifact-slug report.html --host https://artis.example.com --summary "Addressed open feedback" --resolve annotation-123`;
426
430
  }
427
431
  // Annotated rather than inferred: the returned `visibility` flows through the
@@ -791,6 +795,10 @@ export function runArtisCli() {
791
795
  console.log(getCliHelp());
792
796
  return;
793
797
  }
798
+ if (command === 'install-skill') {
799
+ yield installSkillFromCli(rest);
800
+ return;
801
+ }
794
802
  if (command === 'login') {
795
803
  yield loginFromCli(rest);
796
804
  return;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The agent skill installed by `artis install-skill`: a compact guide to the
3
+ * publish → review → revise loop using this CLI. Keep roughly in sync with
4
+ * `getCliHelp()` and the server-side agent guidance in
5
+ * `apps/app/src/worker/lib/skills.ts`.
6
+ */
7
+ export declare const ARTIS_SKILL_MD = "---\nname: artis\ndescription: >-\n Publish, review, and revise self-contained HTML artifacts on an Artis server\n with the artis CLI. Use when the deliverable should be an interactive page\n humans open in a browser (dashboards, timelines, prototypes, reports) rather\n than a markdown dump.\n---\n\n# Artis\n\nHost, share, and revise **self-contained HTML artifacts** at stable URLs.\n\n**Loop:** publish \u2192 get feedback \u2192 revise (optionally resolving annotations).\n\n## Setup\n\n npm install -g @artis-lab/cli\n artis login --host <url> # required before publishing\n artis whoami # verify credentials\n\n`artis login` opens a browser approval flow and stores the API key in `~/.artis/config.json`; never ask the user for a password. Hosts default to https://artis.xiispace.eu.org. Override with `--host`, `ARTIS_URL`, or a saved login \u2014 a self-hosted user never wants the default.\n\n## Commands\n\n artis publish artifact.html [--visibility unlisted|public|private] [--kind <kind>] [--title <t>] [--author <name>]\n artis artifact get <id-or-slug> [--json]\n artis artifact feedback <id-or-slug> [--json] [--revision <id>]\n artis artifact html <id-or-slug> [--output <path>] [--revision <id>]\n artis revise <id-or-slug> revised.html --summary \"...\" [--resolve <annotation-id>]...\n artis annotate <id-or-slug> --comment \"...\" [--quote \"...\"] [--requested-change \"...\"] [--status open|needs-revision|resolved]\n artis reply <annotation-id> --comment \"...\"\n artis annotation edit <annotation-id> [--comment \"...\"] [--title \"...\"] [--requested-change \"...\"]\n artis annotation retract <annotation-id>\n artis share <id-or-slug> --email a@b.com --role viewer|commenter [--remove]\n\nRun `artis help` for the full flag reference.\n\n## Workflow\n\n1. Publish with the default `unlisted` visibility unless the user asks for public or private. Return the artifact URL and a short summary.\n2. Gather feedback with `artis artifact feedback <id>`; the printed prompt lists open annotations with their ids.\n3. Revise with a complete replacement document, passing `--resolve <annotation-id>` for each addressed annotation. If the file is no longer on disk, pull the current source first: `artis artifact html <id> --output revised.html`, edit it, then `artis revise`.\n\n## Authoring rules\n\n- Self-contained HTML with inline CSS and small scripts; avoid external dependencies unless asked.\n- Prefer visual structure (cards, timelines, diagrams) over long prose; semantic, responsive markup.\n- Theme via `prefers-color-scheme`; interactive artifacts should offer copy/export so users can paste changes back to you.\n- On failure, show the HTTP status and response body once; do not retry blindly.\n";
8
+ export interface SkillHarnessDefinition {
9
+ /** Canonical id accepted by `--harness` and printed by `--list`. */
10
+ id: string;
11
+ label: string;
12
+ /** Extra `--harness` spellings resolved to this harness. */
13
+ aliases: readonly string[];
14
+ /** Directories whose existence implies the harness is in use, resolved
15
+ * against a home directory. */
16
+ markerDirs: (home: string) => string[];
17
+ /** Executable names whose presence on PATH implies the harness is in use. */
18
+ commands: readonly string[];
19
+ /** The harness's user-level skills directory, resolved against a home
20
+ * directory. */
21
+ skillsDir: (home: string) => string;
22
+ }
23
+ export declare function skillPathFor(harness: SkillHarnessDefinition, home: string): string;
24
+ /** Resolve `--harness` values (ids or aliases) to harness definitions,
25
+ * deduplicated in registry order. Unknown values list the valid ids. */
26
+ export declare function parseHarnessIds(values: string[]): SkillHarnessDefinition[];
27
+ export interface SkillHarnessReport {
28
+ id: string;
29
+ label: string;
30
+ skillsDir: string;
31
+ skillPath: string;
32
+ detected: boolean;
33
+ installed: boolean;
34
+ }
35
+ export declare function getSkillHarnessReports(home: string): Promise<SkillHarnessReport[]>;
36
+ export type SkillInstallStatus = 'installed' | 'updated' | 'skipped';
37
+ export interface SkillInstallResult {
38
+ /** Harness id, or the resolved skills directory for `--dir` installs. */
39
+ target: string;
40
+ status: SkillInstallStatus;
41
+ path: string;
42
+ }
43
+ export interface InstallSkillOptions {
44
+ /** Base directory for harness paths. Defaults to the real home directory;
45
+ * tests pass a temp dir to stay hermetic. */
46
+ home?: string;
47
+ }
48
+ export declare function installSkillFromCli(args: string[], options?: InstallSkillOptions): Promise<void>;
@@ -0,0 +1,310 @@
1
+ import { __awaiter } from "tslib";
2
+ import { spawnSync } from 'node:child_process';
3
+ import { mkdir, stat, writeFile } from 'node:fs/promises';
4
+ import { homedir } from 'node:os';
5
+ import { dirname, join } from 'node:path';
6
+ import { collectFlagValues, hasFlag, parseFlagValue } from './args.js';
7
+ /** Directory the skill installs under, inside each harness's skills dir. */
8
+ const SKILL_DIR_NAME = 'artis';
9
+ /**
10
+ * The agent skill installed by `artis install-skill`: a compact guide to the
11
+ * publish → review → revise loop using this CLI. Keep roughly in sync with
12
+ * `getCliHelp()` and the server-side agent guidance in
13
+ * `apps/app/src/worker/lib/skills.ts`.
14
+ */
15
+ export const ARTIS_SKILL_MD = `---
16
+ name: artis
17
+ description: >-
18
+ Publish, review, and revise self-contained HTML artifacts on an Artis server
19
+ with the artis CLI. Use when the deliverable should be an interactive page
20
+ humans open in a browser (dashboards, timelines, prototypes, reports) rather
21
+ than a markdown dump.
22
+ ---
23
+
24
+ # Artis
25
+
26
+ Host, share, and revise **self-contained HTML artifacts** at stable URLs.
27
+
28
+ **Loop:** publish → get feedback → revise (optionally resolving annotations).
29
+
30
+ ## Setup
31
+
32
+ npm install -g @artis-lab/cli
33
+ artis login --host <url> # required before publishing
34
+ artis whoami # verify credentials
35
+
36
+ \`artis login\` opens a browser approval flow and stores the API key in \`~/.artis/config.json\`; never ask the user for a password. Hosts default to https://artis.xiispace.eu.org. Override with \`--host\`, \`ARTIS_URL\`, or a saved login — a self-hosted user never wants the default.
37
+
38
+ ## Commands
39
+
40
+ artis publish artifact.html [--visibility unlisted|public|private] [--kind <kind>] [--title <t>] [--author <name>]
41
+ artis artifact get <id-or-slug> [--json]
42
+ artis artifact feedback <id-or-slug> [--json] [--revision <id>]
43
+ artis artifact html <id-or-slug> [--output <path>] [--revision <id>]
44
+ artis revise <id-or-slug> revised.html --summary "..." [--resolve <annotation-id>]...
45
+ artis annotate <id-or-slug> --comment "..." [--quote "..."] [--requested-change "..."] [--status open|needs-revision|resolved]
46
+ artis reply <annotation-id> --comment "..."
47
+ artis annotation edit <annotation-id> [--comment "..."] [--title "..."] [--requested-change "..."]
48
+ artis annotation retract <annotation-id>
49
+ artis share <id-or-slug> --email a@b.com --role viewer|commenter [--remove]
50
+
51
+ Run \`artis help\` for the full flag reference.
52
+
53
+ ## Workflow
54
+
55
+ 1. Publish with the default \`unlisted\` visibility unless the user asks for public or private. Return the artifact URL and a short summary.
56
+ 2. Gather feedback with \`artis artifact feedback <id>\`; the printed prompt lists open annotations with their ids.
57
+ 3. Revise with a complete replacement document, passing \`--resolve <annotation-id>\` for each addressed annotation. If the file is no longer on disk, pull the current source first: \`artis artifact html <id> --output revised.html\`, edit it, then \`artis revise\`.
58
+
59
+ ## Authoring rules
60
+
61
+ - Self-contained HTML with inline CSS and small scripts; avoid external dependencies unless asked.
62
+ - Prefer visual structure (cards, timelines, diagrams) over long prose; semantic, responsive markup.
63
+ - Theme via \`prefers-color-scheme\`; interactive artifacts should offer copy/export so users can paste changes back to you.
64
+ - On failure, show the HTTP status and response body once; do not retry blindly.
65
+ `;
66
+ /** Hermes keeps its config under $HERMES_HOME when set, otherwise
67
+ * `%LOCALAPPDATA%\hermes` on Windows and `~/.hermes` elsewhere — mirroring
68
+ * NousResearch/hermes-agent's `get_hermes_home()`. */
69
+ function hermesHomeDir(home) {
70
+ var _a;
71
+ const fromEnv = process.env['HERMES_HOME'];
72
+ // An empty value means "unset", matching the CLI's host/env convention.
73
+ if (fromEnv) {
74
+ return fromEnv;
75
+ }
76
+ if (process.platform === 'win32') {
77
+ return join((_a = process.env['LOCALAPPDATA']) !== null && _a !== void 0 ? _a : join(home, 'AppData', 'Local'), 'hermes');
78
+ }
79
+ return join(home, '.hermes');
80
+ }
81
+ const skillHarnesses = [
82
+ {
83
+ id: 'claude-code',
84
+ label: 'Claude Code',
85
+ aliases: ['claude', 'cc'],
86
+ markerDirs: (home) => [join(home, '.claude')],
87
+ commands: ['claude'],
88
+ skillsDir: (home) => join(home, '.claude', 'skills'),
89
+ },
90
+ {
91
+ id: 'cursor',
92
+ label: 'Cursor',
93
+ aliases: [],
94
+ markerDirs: (home) => [join(home, '.cursor')],
95
+ commands: ['cursor'],
96
+ skillsDir: (home) => join(home, '.cursor', 'skills'),
97
+ },
98
+ {
99
+ id: 'codex',
100
+ label: 'Codex',
101
+ aliases: [],
102
+ markerDirs: (home) => [join(home, '.codex'), join(home, '.agents')],
103
+ commands: ['codex'],
104
+ skillsDir: (home) => join(home, '.agents', 'skills'),
105
+ },
106
+ {
107
+ id: 'openclaw',
108
+ label: 'OpenClaw',
109
+ aliases: ['opencode'],
110
+ markerDirs: (home) => [join(home, '.openclaw')],
111
+ commands: ['openclaw'],
112
+ skillsDir: (home) => join(home, '.openclaw', 'skills'),
113
+ },
114
+ {
115
+ id: 'pi',
116
+ label: 'Pi Agent',
117
+ aliases: [],
118
+ markerDirs: (home) => [join(home, '.pi', 'agent'), join(home, '.pi')],
119
+ commands: ['pi'],
120
+ skillsDir: (home) => join(home, '.pi', 'agent', 'skills'),
121
+ },
122
+ {
123
+ id: 'hermes',
124
+ label: 'Hermes',
125
+ aliases: [],
126
+ markerDirs: (home) => [hermesHomeDir(home)],
127
+ commands: ['hermes'],
128
+ skillsDir: (home) => join(hermesHomeDir(home), 'skills'),
129
+ },
130
+ ];
131
+ export function skillPathFor(harness, home) {
132
+ return join(harness.skillsDir(home), SKILL_DIR_NAME, 'SKILL.md');
133
+ }
134
+ /** Resolve `--harness` values (ids or aliases) to harness definitions,
135
+ * deduplicated in registry order. Unknown values list the valid ids. */
136
+ export function parseHarnessIds(values) {
137
+ const resolved = [];
138
+ for (const value of values) {
139
+ const harness = skillHarnesses.find((candidate) => candidate.id === value || candidate.aliases.includes(value));
140
+ if (!harness) {
141
+ throw new Error(`Invalid harness "${value}". Expected one of: ${skillHarnesses
142
+ .map((candidate) => candidate.id)
143
+ .join(', ')}.`);
144
+ }
145
+ if (!resolved.includes(harness)) {
146
+ resolved.push(harness);
147
+ }
148
+ }
149
+ return resolved.sort((a, b) => skillHarnesses.indexOf(a) - skillHarnesses.indexOf(b));
150
+ }
151
+ /** Executable names come only from the static registry above, never from user
152
+ * input, so building the shell command by interpolation is safe by
153
+ * construction. */
154
+ function commandExists(name) {
155
+ const result = process.platform === 'win32'
156
+ ? spawnSync('where', [name], { stdio: 'ignore' })
157
+ : spawnSync('sh', ['-c', `command -v ${name}`], { stdio: 'ignore' });
158
+ return result.status === 0;
159
+ }
160
+ function pathExists(path, kind) {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ try {
163
+ const stats = yield stat(path);
164
+ return kind === 'file' ? stats.isFile() : stats.isDirectory();
165
+ }
166
+ catch (_a) {
167
+ return false;
168
+ }
169
+ });
170
+ }
171
+ export function getSkillHarnessReports(home) {
172
+ return __awaiter(this, void 0, void 0, function* () {
173
+ const reports = [];
174
+ for (const harness of skillHarnesses) {
175
+ let detected = false;
176
+ for (const markerDir of harness.markerDirs(home)) {
177
+ if (yield pathExists(markerDir, 'directory')) {
178
+ detected = true;
179
+ break;
180
+ }
181
+ }
182
+ if (!detected) {
183
+ detected = harness.commands.some(commandExists);
184
+ }
185
+ const skillsDir = harness.skillsDir(home);
186
+ const skillPath = join(skillsDir, SKILL_DIR_NAME, 'SKILL.md');
187
+ reports.push({
188
+ id: harness.id,
189
+ label: harness.label,
190
+ skillsDir,
191
+ skillPath,
192
+ detected,
193
+ installed: yield pathExists(skillPath, 'file'),
194
+ });
195
+ }
196
+ return reports;
197
+ });
198
+ }
199
+ function installSkillFile(skillPath, force) {
200
+ return __awaiter(this, void 0, void 0, function* () {
201
+ const existed = yield pathExists(skillPath, 'file');
202
+ // An existing install is left untouched unless --force is passed, so a
203
+ // locally customized skill survives upgrades.
204
+ if (existed && !force) {
205
+ return 'skipped';
206
+ }
207
+ yield mkdir(dirname(skillPath), { recursive: true });
208
+ yield writeFile(skillPath, ARTIS_SKILL_MD, 'utf8');
209
+ return existed ? 'updated' : 'installed';
210
+ });
211
+ }
212
+ function printHarnessTable(reports) {
213
+ const idWidth = Math.max(...reports.map((report) => report.id.length));
214
+ const labelWidth = Math.max(...reports.map((report) => report.label.length));
215
+ console.log('Agent harnesses and their artis skill install paths:');
216
+ for (const report of reports) {
217
+ const detected = report.detected ? 'detected' : '—';
218
+ const installed = report.installed ? 'installed' : '—';
219
+ console.log(` ${report.id.padEnd(idWidth)} ${report.label.padEnd(labelWidth)} ${detected.padEnd(9)} ${installed.padEnd(9)} ${report.skillPath}`);
220
+ }
221
+ }
222
+ export function installSkillFromCli(args_1) {
223
+ return __awaiter(this, arguments, void 0, function* (args, options = {}) {
224
+ var _a;
225
+ const home = (_a = options.home) !== null && _a !== void 0 ? _a : homedir();
226
+ const json = hasFlag(args, '--json');
227
+ const force = hasFlag(args, '--force');
228
+ if (hasFlag(args, '--list')) {
229
+ const reports = yield getSkillHarnessReports(home);
230
+ if (json) {
231
+ console.log(JSON.stringify({ harnesses: reports }, null, 2));
232
+ }
233
+ else {
234
+ printHarnessTable(reports);
235
+ }
236
+ return;
237
+ }
238
+ const harnessValues = collectFlagValues(args, '--harness');
239
+ const dir = parseFlagValue(args, '--dir');
240
+ const yes = hasFlag(args, '--yes');
241
+ if (dir && (harnessValues.length > 0 || yes)) {
242
+ throw new Error('Pass either --dir or --harness/--yes, not both.');
243
+ }
244
+ const targets = [];
245
+ if (dir) {
246
+ targets.push({
247
+ target: dir,
248
+ skillPath: join(dir, SKILL_DIR_NAME, 'SKILL.md'),
249
+ });
250
+ }
251
+ else if (harnessValues.length > 0) {
252
+ // Explicit --harness skips detection: installing into a harness this
253
+ // machine cannot detect is a valid, deliberate choice.
254
+ for (const harness of parseHarnessIds(harnessValues)) {
255
+ targets.push({
256
+ target: harness.id,
257
+ skillPath: skillPathFor(harness, home),
258
+ });
259
+ }
260
+ }
261
+ else if (yes) {
262
+ const detected = (yield getSkillHarnessReports(home)).filter((report) => report.detected);
263
+ if (detected.length === 0) {
264
+ throw new Error('No agent harnesses detected. Run "artis install-skill --list" to inspect paths, or pass --harness <id> or --dir <path>.');
265
+ }
266
+ for (const report of detected) {
267
+ targets.push({ target: report.id, skillPath: report.skillPath });
268
+ }
269
+ }
270
+ else {
271
+ throw new Error('No harness selected. Pass --harness <id> (repeatable), --yes for every detected harness, or --dir <path> for a custom skills directory. Run "artis install-skill --list" to inspect.');
272
+ }
273
+ const results = [];
274
+ const errors = [];
275
+ for (const target of targets) {
276
+ try {
277
+ const status = yield installSkillFile(target.skillPath, force);
278
+ results.push({ target: target.target, status, path: target.skillPath });
279
+ }
280
+ catch (error) {
281
+ errors.push({
282
+ target: target.target,
283
+ error: error instanceof Error ? error.message : String(error),
284
+ });
285
+ }
286
+ }
287
+ if (json) {
288
+ console.log(JSON.stringify({ results, errors }, null, 2));
289
+ }
290
+ else {
291
+ for (const result of results) {
292
+ if (result.status === 'skipped') {
293
+ console.log(`Skipped ${result.target} (already installed; use --force to overwrite): ${result.path}`);
294
+ }
295
+ else {
296
+ console.log(`${result.status === 'updated' ? 'Updated' : 'Installed'} artis skill for ${result.target}: ${result.path}`);
297
+ }
298
+ }
299
+ }
300
+ // Per-target failures do not abort the remaining installs, but the command
301
+ // still exits non-zero once everything has been attempted and reported.
302
+ if (errors.length > 0) {
303
+ for (const failure of errors) {
304
+ console.error(`install-skill failed for ${failure.target}: ${failure.error}`);
305
+ }
306
+ throw new Error(`install-skill completed with errors (${errors.map((failure) => failure.target).join(', ')}).`);
307
+ }
308
+ });
309
+ }
310
+ //# sourceMappingURL=skill-install.js.map