@artis-lab/cli 0.5.0 → 0.7.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 +24 -1
- package/package.json +1 -1
- package/src/lib/args.d.ts +1 -0
- package/src/lib/args.js +8 -0
- package/src/lib/cli.d.ts +9 -1
- package/src/lib/cli.js +54 -14
- package/src/lib/skill-install.d.ts +48 -0
- package/src/lib/skill-install.js +312 -0
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ Defaults:
|
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
artis artifact feedback artifact-slug
|
|
51
|
-
artis revise artifact-slug revised.html --summary "Addressed review feedback"
|
|
51
|
+
artis revise artifact-slug revised.html --summary "Addressed review feedback" --base <revision-id>
|
|
52
52
|
artis share artifact-slug --email reviewer@example.com --role commenter
|
|
53
53
|
artis annotate artifact-slug --comment "Tighten this heading" --quote "Checkout latency"
|
|
54
54
|
artis reply annotation-123 --comment "Fixed in revision 2."
|
|
@@ -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
package/src/lib/args.d.ts
CHANGED
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
|
|
4
|
+
export { installSkillFromCli };
|
|
5
|
+
export declare const commands: readonly ["annotate", "annotation", "artifact", "guidelines", "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
|
|
@@ -21,6 +23,12 @@ export interface PublishedArtifactResult {
|
|
|
21
23
|
url: string;
|
|
22
24
|
visibility: CliArtifactVisibility;
|
|
23
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Print the server's agent guidelines: the section index by default, or one
|
|
28
|
+
* section (`authoring`, `revising`, …, or `all`). Same content as MCP
|
|
29
|
+
* `get_authoring_guidelines`; served as `/skills.md?section=`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function guidelinesFromCli(args: string[]): Promise<void>;
|
|
24
32
|
/**
|
|
25
33
|
* Validate a login `verificationUrl` returned by the configured host before it
|
|
26
34
|
* crosses a local process/shell boundary (Windows `cmd /c start`). A malicious
|
package/src/lib/cli.js
CHANGED
|
@@ -13,14 +13,18 @@ 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',
|
|
25
|
+
'guidelines',
|
|
23
26
|
'help',
|
|
27
|
+
'install-skill',
|
|
24
28
|
'login',
|
|
25
29
|
'publish',
|
|
26
30
|
'reply',
|
|
@@ -62,7 +66,9 @@ const valueFlags = new Set([
|
|
|
62
66
|
'--comment',
|
|
63
67
|
'--css',
|
|
64
68
|
'--description',
|
|
69
|
+
'--dir',
|
|
65
70
|
'--email',
|
|
71
|
+
'--harness',
|
|
66
72
|
'--host',
|
|
67
73
|
'--kind',
|
|
68
74
|
'--output',
|
|
@@ -76,6 +82,7 @@ const valueFlags = new Set([
|
|
|
76
82
|
'--revision',
|
|
77
83
|
'--role',
|
|
78
84
|
'--status',
|
|
85
|
+
'--base',
|
|
79
86
|
'--summary',
|
|
80
87
|
'--text-end',
|
|
81
88
|
'--text-start',
|
|
@@ -83,14 +90,6 @@ const valueFlags = new Set([
|
|
|
83
90
|
'--url',
|
|
84
91
|
'--visibility',
|
|
85
92
|
]);
|
|
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
93
|
function getPositionals(args) {
|
|
95
94
|
const positionals = [];
|
|
96
95
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -238,6 +237,24 @@ function resolveOptionalTarget(args) {
|
|
|
238
237
|
return { apiKey, apiKeySource, baseUrl };
|
|
239
238
|
});
|
|
240
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Print the server's agent guidelines: the section index by default, or one
|
|
242
|
+
* section (`authoring`, `revising`, …, or `all`). Same content as MCP
|
|
243
|
+
* `get_authoring_guidelines`; served as `/skills.md?section=`.
|
|
244
|
+
*/
|
|
245
|
+
export function guidelinesFromCli(args) {
|
|
246
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
247
|
+
const [section] = getPositionals(args);
|
|
248
|
+
const config = yield readCliConfig();
|
|
249
|
+
const baseUrl = resolveBaseUrl(args, config);
|
|
250
|
+
const response = yield fetch(`${baseUrl}/skills.md?section=${encodeURIComponent(section !== null && section !== void 0 ? section : 'index')}`);
|
|
251
|
+
const text = yield response.text();
|
|
252
|
+
if (!response.ok) {
|
|
253
|
+
throw new Error(text.trim() || `Guidelines request failed with ${response.status}.`);
|
|
254
|
+
}
|
|
255
|
+
process.stdout.write(text.endsWith('\n') ? text : `${text}\n`);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
241
258
|
function parsePublishOptions(args) {
|
|
242
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
243
260
|
var _a, _b, _c, _d;
|
|
@@ -271,7 +288,11 @@ function apiFetch(credentials_1, path_1) {
|
|
|
271
288
|
const response = yield fetch(`${credentials.baseUrl}${path}`, Object.assign(Object.assign({}, init), { headers: Object.assign({ authorization: `Bearer ${credentials.apiKey}`, 'content-type': 'application/json' }, init.headers) }));
|
|
272
289
|
const payload = yield readJsonResponse(response);
|
|
273
290
|
if (!response.ok) {
|
|
274
|
-
|
|
291
|
+
const message = (_a = payload === null || payload === void 0 ? void 0 : payload.error) !== null && _a !== void 0 ? _a : `Request failed with ${response.status}.`;
|
|
292
|
+
// A revise conflict is only recoverable with the current revision id.
|
|
293
|
+
throw new Error((payload === null || payload === void 0 ? void 0 : payload.currentRevisionId)
|
|
294
|
+
? `${message} Current revision: ${payload.currentRevisionId}.`
|
|
295
|
+
: message);
|
|
275
296
|
}
|
|
276
297
|
return payload;
|
|
277
298
|
});
|
|
@@ -371,12 +392,14 @@ Usage:
|
|
|
371
392
|
artis --version
|
|
372
393
|
artis login [--host <url>]
|
|
373
394
|
artis whoami [--host <url>]
|
|
395
|
+
artis guidelines [section] [--host <url>]
|
|
396
|
+
artis install-skill [--harness <id>]... [--yes] [--dir <path>] [--force] [--list] [--json]
|
|
374
397
|
artis publish artifact.html [options]
|
|
375
398
|
artis artifact get <artifact-id-or-slug> [--json]
|
|
376
399
|
artis artifact html <artifact-id-or-slug> [--output <path>] [--revision <revision-id>] [--json]
|
|
377
400
|
artis artifact feedback <artifact-id-or-slug> [--json] [--revision <revision-id>]
|
|
378
401
|
artis share <artifact-id-or-slug> [--email <email> --role <viewer|commenter>] [--remove]
|
|
379
|
-
artis revise <artifact-id-or-slug> artifact.html --summary <text> [--resolve <annotation-id>]
|
|
402
|
+
artis revise <artifact-id-or-slug> artifact.html --summary <text> [--base <revision-id>] [--resolve <annotation-id>]
|
|
380
403
|
artis annotate <artifact-id-or-slug> --comment <text> [anchor options]
|
|
381
404
|
artis reply <annotation-id> --comment <text>
|
|
382
405
|
artis annotation edit <annotation-id> [--comment <text>] [--title <text>] [--requested-change <text>]
|
|
@@ -390,7 +413,8 @@ Options:
|
|
|
390
413
|
--visibility <value> public, unlisted, or private. Defaults to unlisted.
|
|
391
414
|
--kind <value> Artifact kind. Defaults to custom-html.
|
|
392
415
|
--author <name> Artifact author/agent name. Defaults to Artis CLI.
|
|
393
|
-
--summary <text> Revision summary.
|
|
416
|
+
--summary <text> Revision summary. Write one change per line; they render as a list.
|
|
417
|
+
--base <revision-id> Revision the file was edited from (printed by publish and artifact html). Refuses the revise if someone revised since.
|
|
394
418
|
--resolve <annotation-id> Mark an annotation resolved when revising. Repeatable.
|
|
395
419
|
--comment <text> Annotation or reply comment text (annotate, reply).
|
|
396
420
|
--requested-change <text> Structured change request for the artifact author (annotate).
|
|
@@ -408,6 +432,11 @@ Options:
|
|
|
408
432
|
--email <email> Email address for artis share.
|
|
409
433
|
--role <role> Share role: viewer or commenter. Defaults to viewer.
|
|
410
434
|
--remove Remove the email from an artifact share list.
|
|
435
|
+
--harness <id> Agent harness to install the artis skill into (install-skill). Repeatable: claude-code, cursor, codex, openclaw, pi, hermes.
|
|
436
|
+
--yes Install the skill into every detected harness (install-skill).
|
|
437
|
+
--dir <path> Install the skill into a custom skills directory (install-skill).
|
|
438
|
+
--force Overwrite an already-installed skill (install-skill).
|
|
439
|
+
--list List harnesses, detection, and install paths (install-skill).
|
|
411
440
|
--json Print machine-readable JSON for supported commands.
|
|
412
441
|
|
|
413
442
|
Examples (--host is optional; without it commands target https://artis.xiispace.eu.org):
|
|
@@ -422,7 +451,9 @@ Examples (--host is optional; without it commands target https://artis.xiispace.
|
|
|
422
451
|
artis reply annotation-123 --host https://artis.example.com --comment "Addressed in the latest revision"
|
|
423
452
|
artis annotation edit annotation-123 --host https://artis.example.com --comment "Corrected: the latency spike is on checkout, not search"
|
|
424
453
|
artis annotation retract annotation-123 --host https://artis.example.com
|
|
425
|
-
artis
|
|
454
|
+
artis guidelines authoring
|
|
455
|
+
artis install-skill --yes
|
|
456
|
+
artis revise artifact-slug report.html --host https://artis.example.com --summary "Addressed open feedback" --base revision-abc --resolve annotation-123`;
|
|
426
457
|
}
|
|
427
458
|
// Annotated rather than inferred: the returned `visibility` flows through the
|
|
428
459
|
// sdk's `CreateArtifactInput`, so declaration emit would otherwise print an
|
|
@@ -657,7 +688,7 @@ export function reviseArtifactFromCli(args) {
|
|
|
657
688
|
const [artifactId, filePath] = getPositionals(args);
|
|
658
689
|
const summary = parseFlagValue(args, '--summary');
|
|
659
690
|
if (!artifactId || !filePath) {
|
|
660
|
-
throw new Error('Usage: artis revise <artifact-id-or-slug> artifact.html --summary <text>');
|
|
691
|
+
throw new Error('Usage: artis revise <artifact-id-or-slug> artifact.html --summary <text> [--base <revision-id>]');
|
|
661
692
|
}
|
|
662
693
|
if (!summary) {
|
|
663
694
|
throw new Error('Missing --summary for revision.');
|
|
@@ -672,6 +703,7 @@ export function reviseArtifactFromCli(args) {
|
|
|
672
703
|
body: JSON.stringify({
|
|
673
704
|
authorName: (_a = parseFlagValue(args, '--author')) !== null && _a !== void 0 ? _a : 'Artis CLI',
|
|
674
705
|
html,
|
|
706
|
+
baseRevisionId: parseFlagValue(args, '--base'),
|
|
675
707
|
resolvedAnnotationIds: collectFlagValues(args, '--resolve'),
|
|
676
708
|
source: 'cli',
|
|
677
709
|
summary,
|
|
@@ -791,6 +823,10 @@ export function runArtisCli() {
|
|
|
791
823
|
console.log(getCliHelp());
|
|
792
824
|
return;
|
|
793
825
|
}
|
|
826
|
+
if (command === 'install-skill') {
|
|
827
|
+
yield installSkillFromCli(rest);
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
794
830
|
if (command === 'login') {
|
|
795
831
|
yield loginFromCli(rest);
|
|
796
832
|
return;
|
|
@@ -799,6 +835,10 @@ export function runArtisCli() {
|
|
|
799
835
|
yield whoamiFromCli(rest);
|
|
800
836
|
return;
|
|
801
837
|
}
|
|
838
|
+
if (command === 'guidelines') {
|
|
839
|
+
yield guidelinesFromCli(rest);
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
802
842
|
if (command === 'publish') {
|
|
803
843
|
const published = yield publishArtifactFromCli(rest);
|
|
804
844
|
if (hasFlag(rest, '--json')) {
|
|
@@ -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 \"...\" --base <revision-id> [--resolve <annotation-id>]...\n artis guidelines [section]\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 `--base <revision-id>` (the revision you edited, printed by `publish` and `artifact html`) and `--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`. A conflict means someone revised since: pull the current revision, reapply your changes, and retry with its id. Write the `--summary` one change per line.\n4. For authoring rules beyond this file, run `artis guidelines` (index) and `artis guidelines <section>`.\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,312 @@
|
|
|
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 "..." --base <revision-id> [--resolve <annotation-id>]...
|
|
45
|
+
artis guidelines [section]
|
|
46
|
+
artis annotate <id-or-slug> --comment "..." [--quote "..."] [--requested-change "..."] [--status open|needs-revision|resolved]
|
|
47
|
+
artis reply <annotation-id> --comment "..."
|
|
48
|
+
artis annotation edit <annotation-id> [--comment "..."] [--title "..."] [--requested-change "..."]
|
|
49
|
+
artis annotation retract <annotation-id>
|
|
50
|
+
artis share <id-or-slug> --email a@b.com --role viewer|commenter [--remove]
|
|
51
|
+
|
|
52
|
+
Run \`artis help\` for the full flag reference.
|
|
53
|
+
|
|
54
|
+
## Workflow
|
|
55
|
+
|
|
56
|
+
1. Publish with the default \`unlisted\` visibility unless the user asks for public or private. Return the artifact URL and a short summary.
|
|
57
|
+
2. Gather feedback with \`artis artifact feedback <id>\`; the printed prompt lists open annotations with their ids.
|
|
58
|
+
3. Revise with a complete replacement document, passing \`--base <revision-id>\` (the revision you edited, printed by \`publish\` and \`artifact html\`) and \`--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\`. A conflict means someone revised since: pull the current revision, reapply your changes, and retry with its id. Write the \`--summary\` one change per line.
|
|
59
|
+
4. For authoring rules beyond this file, run \`artis guidelines\` (index) and \`artis guidelines <section>\`.
|
|
60
|
+
|
|
61
|
+
## Authoring rules
|
|
62
|
+
|
|
63
|
+
- Self-contained HTML with inline CSS and small scripts; avoid external dependencies unless asked.
|
|
64
|
+
- Prefer visual structure (cards, timelines, diagrams) over long prose; semantic, responsive markup.
|
|
65
|
+
- Theme via \`prefers-color-scheme\`; interactive artifacts should offer copy/export so users can paste changes back to you.
|
|
66
|
+
- On failure, show the HTTP status and response body once; do not retry blindly.
|
|
67
|
+
`;
|
|
68
|
+
/** Hermes keeps its config under $HERMES_HOME when set, otherwise
|
|
69
|
+
* `%LOCALAPPDATA%\hermes` on Windows and `~/.hermes` elsewhere — mirroring
|
|
70
|
+
* NousResearch/hermes-agent's `get_hermes_home()`. */
|
|
71
|
+
function hermesHomeDir(home) {
|
|
72
|
+
var _a;
|
|
73
|
+
const fromEnv = process.env['HERMES_HOME'];
|
|
74
|
+
// An empty value means "unset", matching the CLI's host/env convention.
|
|
75
|
+
if (fromEnv) {
|
|
76
|
+
return fromEnv;
|
|
77
|
+
}
|
|
78
|
+
if (process.platform === 'win32') {
|
|
79
|
+
return join((_a = process.env['LOCALAPPDATA']) !== null && _a !== void 0 ? _a : join(home, 'AppData', 'Local'), 'hermes');
|
|
80
|
+
}
|
|
81
|
+
return join(home, '.hermes');
|
|
82
|
+
}
|
|
83
|
+
const skillHarnesses = [
|
|
84
|
+
{
|
|
85
|
+
id: 'claude-code',
|
|
86
|
+
label: 'Claude Code',
|
|
87
|
+
aliases: ['claude', 'cc'],
|
|
88
|
+
markerDirs: (home) => [join(home, '.claude')],
|
|
89
|
+
commands: ['claude'],
|
|
90
|
+
skillsDir: (home) => join(home, '.claude', 'skills'),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'cursor',
|
|
94
|
+
label: 'Cursor',
|
|
95
|
+
aliases: [],
|
|
96
|
+
markerDirs: (home) => [join(home, '.cursor')],
|
|
97
|
+
commands: ['cursor'],
|
|
98
|
+
skillsDir: (home) => join(home, '.cursor', 'skills'),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'codex',
|
|
102
|
+
label: 'Codex',
|
|
103
|
+
aliases: [],
|
|
104
|
+
markerDirs: (home) => [join(home, '.codex'), join(home, '.agents')],
|
|
105
|
+
commands: ['codex'],
|
|
106
|
+
skillsDir: (home) => join(home, '.agents', 'skills'),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'openclaw',
|
|
110
|
+
label: 'OpenClaw',
|
|
111
|
+
aliases: ['opencode'],
|
|
112
|
+
markerDirs: (home) => [join(home, '.openclaw')],
|
|
113
|
+
commands: ['openclaw'],
|
|
114
|
+
skillsDir: (home) => join(home, '.openclaw', 'skills'),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'pi',
|
|
118
|
+
label: 'Pi Agent',
|
|
119
|
+
aliases: [],
|
|
120
|
+
markerDirs: (home) => [join(home, '.pi', 'agent'), join(home, '.pi')],
|
|
121
|
+
commands: ['pi'],
|
|
122
|
+
skillsDir: (home) => join(home, '.pi', 'agent', 'skills'),
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 'hermes',
|
|
126
|
+
label: 'Hermes',
|
|
127
|
+
aliases: [],
|
|
128
|
+
markerDirs: (home) => [hermesHomeDir(home)],
|
|
129
|
+
commands: ['hermes'],
|
|
130
|
+
skillsDir: (home) => join(hermesHomeDir(home), 'skills'),
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
export function skillPathFor(harness, home) {
|
|
134
|
+
return join(harness.skillsDir(home), SKILL_DIR_NAME, 'SKILL.md');
|
|
135
|
+
}
|
|
136
|
+
/** Resolve `--harness` values (ids or aliases) to harness definitions,
|
|
137
|
+
* deduplicated in registry order. Unknown values list the valid ids. */
|
|
138
|
+
export function parseHarnessIds(values) {
|
|
139
|
+
const resolved = [];
|
|
140
|
+
for (const value of values) {
|
|
141
|
+
const harness = skillHarnesses.find((candidate) => candidate.id === value || candidate.aliases.includes(value));
|
|
142
|
+
if (!harness) {
|
|
143
|
+
throw new Error(`Invalid harness "${value}". Expected one of: ${skillHarnesses
|
|
144
|
+
.map((candidate) => candidate.id)
|
|
145
|
+
.join(', ')}.`);
|
|
146
|
+
}
|
|
147
|
+
if (!resolved.includes(harness)) {
|
|
148
|
+
resolved.push(harness);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return resolved.sort((a, b) => skillHarnesses.indexOf(a) - skillHarnesses.indexOf(b));
|
|
152
|
+
}
|
|
153
|
+
/** Executable names come only from the static registry above, never from user
|
|
154
|
+
* input, so building the shell command by interpolation is safe by
|
|
155
|
+
* construction. */
|
|
156
|
+
function commandExists(name) {
|
|
157
|
+
const result = process.platform === 'win32'
|
|
158
|
+
? spawnSync('where', [name], { stdio: 'ignore' })
|
|
159
|
+
: spawnSync('sh', ['-c', `command -v ${name}`], { stdio: 'ignore' });
|
|
160
|
+
return result.status === 0;
|
|
161
|
+
}
|
|
162
|
+
function pathExists(path, kind) {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
try {
|
|
165
|
+
const stats = yield stat(path);
|
|
166
|
+
return kind === 'file' ? stats.isFile() : stats.isDirectory();
|
|
167
|
+
}
|
|
168
|
+
catch (_a) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
export function getSkillHarnessReports(home) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
const reports = [];
|
|
176
|
+
for (const harness of skillHarnesses) {
|
|
177
|
+
let detected = false;
|
|
178
|
+
for (const markerDir of harness.markerDirs(home)) {
|
|
179
|
+
if (yield pathExists(markerDir, 'directory')) {
|
|
180
|
+
detected = true;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (!detected) {
|
|
185
|
+
detected = harness.commands.some(commandExists);
|
|
186
|
+
}
|
|
187
|
+
const skillsDir = harness.skillsDir(home);
|
|
188
|
+
const skillPath = join(skillsDir, SKILL_DIR_NAME, 'SKILL.md');
|
|
189
|
+
reports.push({
|
|
190
|
+
id: harness.id,
|
|
191
|
+
label: harness.label,
|
|
192
|
+
skillsDir,
|
|
193
|
+
skillPath,
|
|
194
|
+
detected,
|
|
195
|
+
installed: yield pathExists(skillPath, 'file'),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return reports;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function installSkillFile(skillPath, force) {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
const existed = yield pathExists(skillPath, 'file');
|
|
204
|
+
// An existing install is left untouched unless --force is passed, so a
|
|
205
|
+
// locally customized skill survives upgrades.
|
|
206
|
+
if (existed && !force) {
|
|
207
|
+
return 'skipped';
|
|
208
|
+
}
|
|
209
|
+
yield mkdir(dirname(skillPath), { recursive: true });
|
|
210
|
+
yield writeFile(skillPath, ARTIS_SKILL_MD, 'utf8');
|
|
211
|
+
return existed ? 'updated' : 'installed';
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function printHarnessTable(reports) {
|
|
215
|
+
const idWidth = Math.max(...reports.map((report) => report.id.length));
|
|
216
|
+
const labelWidth = Math.max(...reports.map((report) => report.label.length));
|
|
217
|
+
console.log('Agent harnesses and their artis skill install paths:');
|
|
218
|
+
for (const report of reports) {
|
|
219
|
+
const detected = report.detected ? 'detected' : '—';
|
|
220
|
+
const installed = report.installed ? 'installed' : '—';
|
|
221
|
+
console.log(` ${report.id.padEnd(idWidth)} ${report.label.padEnd(labelWidth)} ${detected.padEnd(9)} ${installed.padEnd(9)} ${report.skillPath}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
export function installSkillFromCli(args_1) {
|
|
225
|
+
return __awaiter(this, arguments, void 0, function* (args, options = {}) {
|
|
226
|
+
var _a;
|
|
227
|
+
const home = (_a = options.home) !== null && _a !== void 0 ? _a : homedir();
|
|
228
|
+
const json = hasFlag(args, '--json');
|
|
229
|
+
const force = hasFlag(args, '--force');
|
|
230
|
+
if (hasFlag(args, '--list')) {
|
|
231
|
+
const reports = yield getSkillHarnessReports(home);
|
|
232
|
+
if (json) {
|
|
233
|
+
console.log(JSON.stringify({ harnesses: reports }, null, 2));
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
printHarnessTable(reports);
|
|
237
|
+
}
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const harnessValues = collectFlagValues(args, '--harness');
|
|
241
|
+
const dir = parseFlagValue(args, '--dir');
|
|
242
|
+
const yes = hasFlag(args, '--yes');
|
|
243
|
+
if (dir && (harnessValues.length > 0 || yes)) {
|
|
244
|
+
throw new Error('Pass either --dir or --harness/--yes, not both.');
|
|
245
|
+
}
|
|
246
|
+
const targets = [];
|
|
247
|
+
if (dir) {
|
|
248
|
+
targets.push({
|
|
249
|
+
target: dir,
|
|
250
|
+
skillPath: join(dir, SKILL_DIR_NAME, 'SKILL.md'),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
else if (harnessValues.length > 0) {
|
|
254
|
+
// Explicit --harness skips detection: installing into a harness this
|
|
255
|
+
// machine cannot detect is a valid, deliberate choice.
|
|
256
|
+
for (const harness of parseHarnessIds(harnessValues)) {
|
|
257
|
+
targets.push({
|
|
258
|
+
target: harness.id,
|
|
259
|
+
skillPath: skillPathFor(harness, home),
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else if (yes) {
|
|
264
|
+
const detected = (yield getSkillHarnessReports(home)).filter((report) => report.detected);
|
|
265
|
+
if (detected.length === 0) {
|
|
266
|
+
throw new Error('No agent harnesses detected. Run "artis install-skill --list" to inspect paths, or pass --harness <id> or --dir <path>.');
|
|
267
|
+
}
|
|
268
|
+
for (const report of detected) {
|
|
269
|
+
targets.push({ target: report.id, skillPath: report.skillPath });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
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.');
|
|
274
|
+
}
|
|
275
|
+
const results = [];
|
|
276
|
+
const errors = [];
|
|
277
|
+
for (const target of targets) {
|
|
278
|
+
try {
|
|
279
|
+
const status = yield installSkillFile(target.skillPath, force);
|
|
280
|
+
results.push({ target: target.target, status, path: target.skillPath });
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
errors.push({
|
|
284
|
+
target: target.target,
|
|
285
|
+
error: error instanceof Error ? error.message : String(error),
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (json) {
|
|
290
|
+
console.log(JSON.stringify({ results, errors }, null, 2));
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
for (const result of results) {
|
|
294
|
+
if (result.status === 'skipped') {
|
|
295
|
+
console.log(`Skipped ${result.target} (already installed; use --force to overwrite): ${result.path}`);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
console.log(`${result.status === 'updated' ? 'Updated' : 'Installed'} artis skill for ${result.target}: ${result.path}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// Per-target failures do not abort the remaining installs, but the command
|
|
303
|
+
// still exits non-zero once everything has been attempted and reported.
|
|
304
|
+
if (errors.length > 0) {
|
|
305
|
+
for (const failure of errors) {
|
|
306
|
+
console.error(`install-skill failed for ${failure.target}: ${failure.error}`);
|
|
307
|
+
}
|
|
308
|
+
throw new Error(`install-skill completed with errors (${errors.map((failure) => failure.target).join(', ')}).`);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=skill-install.js.map
|