@artis-lab/cli 0.6.0 → 0.8.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 +1 -1
- package/package.json +1 -1
- package/src/lib/cli.d.ts +7 -1
- package/src/lib/cli.js +55 -5
- package/src/lib/revision-bases.d.ts +10 -0
- package/src/lib/revision-bases.js +75 -0
- package/src/lib/skill-install.d.ts +7 -5
- package/src/lib/skill-install.js +49 -36
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."
|
package/package.json
CHANGED
package/src/lib/cli.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { installSkillFromCli } from './skill-install.js';
|
|
|
2
2
|
import { artisCliVersion } from './version.js';
|
|
3
3
|
export { artisCliVersion };
|
|
4
4
|
export { installSkillFromCli };
|
|
5
|
-
export declare const commands: readonly ["annotate", "annotation", "artifact", "help", "install-skill", "login", "publish", "reply", "revise", "share", "version", "whoami"];
|
|
5
|
+
export declare const commands: readonly ["annotate", "annotation", "artifact", "guidelines", "help", "install-skill", "login", "publish", "reply", "revise", "share", "version", "whoami"];
|
|
6
6
|
export type ArtisCommand = (typeof commands)[number];
|
|
7
7
|
/**
|
|
8
8
|
* Mirrors the sdk's `ArtifactVisibility`, deliberately re-declared instead of
|
|
@@ -23,6 +23,12 @@ export interface PublishedArtifactResult {
|
|
|
23
23
|
url: string;
|
|
24
24
|
visibility: CliArtifactVisibility;
|
|
25
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>;
|
|
26
32
|
/**
|
|
27
33
|
* Validate a login `verificationUrl` returned by the configured host before it
|
|
28
34
|
* crosses a local process/shell boundary (Windows `cmd /c start`). A malicious
|
package/src/lib/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ 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 { getRememberedBase, rememberBase } from './revision-bases.js';
|
|
16
17
|
import { installSkillFromCli } from './skill-install.js';
|
|
17
18
|
import { artisCliVersion } from './version.js';
|
|
18
19
|
import { collectFlagValues, hasFlag, parseFlagValue } from './args.js';
|
|
@@ -22,6 +23,7 @@ export const commands = [
|
|
|
22
23
|
'annotate',
|
|
23
24
|
'annotation',
|
|
24
25
|
'artifact',
|
|
26
|
+
'guidelines',
|
|
25
27
|
'help',
|
|
26
28
|
'install-skill',
|
|
27
29
|
'login',
|
|
@@ -81,6 +83,7 @@ const valueFlags = new Set([
|
|
|
81
83
|
'--revision',
|
|
82
84
|
'--role',
|
|
83
85
|
'--status',
|
|
86
|
+
'--base',
|
|
84
87
|
'--summary',
|
|
85
88
|
'--text-end',
|
|
86
89
|
'--text-start',
|
|
@@ -235,6 +238,24 @@ function resolveOptionalTarget(args) {
|
|
|
235
238
|
return { apiKey, apiKeySource, baseUrl };
|
|
236
239
|
});
|
|
237
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Print the server's agent guidelines: the section index by default, or one
|
|
243
|
+
* section (`authoring`, `revising`, …, or `all`). Same content as MCP
|
|
244
|
+
* `get_authoring_guidelines`; served as `/skills.md?section=`.
|
|
245
|
+
*/
|
|
246
|
+
export function guidelinesFromCli(args) {
|
|
247
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
248
|
+
const [section] = getPositionals(args);
|
|
249
|
+
const config = yield readCliConfig();
|
|
250
|
+
const baseUrl = resolveBaseUrl(args, config);
|
|
251
|
+
const response = yield fetch(`${baseUrl}/skills.md?section=${encodeURIComponent(section !== null && section !== void 0 ? section : 'index')}`);
|
|
252
|
+
const text = yield response.text();
|
|
253
|
+
if (!response.ok) {
|
|
254
|
+
throw new Error(text.trim() || `Guidelines request failed with ${response.status}.`);
|
|
255
|
+
}
|
|
256
|
+
process.stdout.write(text.endsWith('\n') ? text : `${text}\n`);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
238
259
|
function parsePublishOptions(args) {
|
|
239
260
|
return __awaiter(this, void 0, void 0, function* () {
|
|
240
261
|
var _a, _b, _c, _d;
|
|
@@ -268,7 +289,11 @@ function apiFetch(credentials_1, path_1) {
|
|
|
268
289
|
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) }));
|
|
269
290
|
const payload = yield readJsonResponse(response);
|
|
270
291
|
if (!response.ok) {
|
|
271
|
-
|
|
292
|
+
const message = (_a = payload === null || payload === void 0 ? void 0 : payload.error) !== null && _a !== void 0 ? _a : `Request failed with ${response.status}.`;
|
|
293
|
+
// A revise conflict is only recoverable with the current revision id.
|
|
294
|
+
throw new Error((payload === null || payload === void 0 ? void 0 : payload.currentRevisionId)
|
|
295
|
+
? `${message} Current revision: ${payload.currentRevisionId}.`
|
|
296
|
+
: message);
|
|
272
297
|
}
|
|
273
298
|
return payload;
|
|
274
299
|
});
|
|
@@ -368,13 +393,14 @@ Usage:
|
|
|
368
393
|
artis --version
|
|
369
394
|
artis login [--host <url>]
|
|
370
395
|
artis whoami [--host <url>]
|
|
396
|
+
artis guidelines [section] [--host <url>]
|
|
371
397
|
artis install-skill [--harness <id>]... [--yes] [--dir <path>] [--force] [--list] [--json]
|
|
372
398
|
artis publish artifact.html [options]
|
|
373
399
|
artis artifact get <artifact-id-or-slug> [--json]
|
|
374
400
|
artis artifact html <artifact-id-or-slug> [--output <path>] [--revision <revision-id>] [--json]
|
|
375
401
|
artis artifact feedback <artifact-id-or-slug> [--json] [--revision <revision-id>]
|
|
376
402
|
artis share <artifact-id-or-slug> [--email <email> --role <viewer|commenter>] [--remove]
|
|
377
|
-
artis revise <artifact-id-or-slug> artifact.html --summary <text> [--resolve <annotation-id>]
|
|
403
|
+
artis revise <artifact-id-or-slug> artifact.html --summary <text> [--base <revision-id>] [--resolve <annotation-id>]
|
|
378
404
|
artis annotate <artifact-id-or-slug> --comment <text> [anchor options]
|
|
379
405
|
artis reply <annotation-id> --comment <text>
|
|
380
406
|
artis annotation edit <annotation-id> [--comment <text>] [--title <text>] [--requested-change <text>]
|
|
@@ -388,7 +414,8 @@ Options:
|
|
|
388
414
|
--visibility <value> public, unlisted, or private. Defaults to unlisted.
|
|
389
415
|
--kind <value> Artifact kind. Defaults to custom-html.
|
|
390
416
|
--author <name> Artifact author/agent name. Defaults to Artis CLI.
|
|
391
|
-
--summary <text> Revision summary.
|
|
417
|
+
--summary <text> Revision summary. Write one change per line; they render as a list.
|
|
418
|
+
--base <revision-id> Revision the file was edited from. Defaults to the revision this machine last published, read (artifact html), or revised. Refuses the revise if someone revised since.
|
|
392
419
|
--resolve <annotation-id> Mark an annotation resolved when revising. Repeatable.
|
|
393
420
|
--comment <text> Annotation or reply comment text (annotate, reply).
|
|
394
421
|
--requested-change <text> Structured change request for the artifact author (annotate).
|
|
@@ -425,8 +452,9 @@ Examples (--host is optional; without it commands target https://artis.xiispace.
|
|
|
425
452
|
artis reply annotation-123 --host https://artis.example.com --comment "Addressed in the latest revision"
|
|
426
453
|
artis annotation edit annotation-123 --host https://artis.example.com --comment "Corrected: the latency spike is on checkout, not search"
|
|
427
454
|
artis annotation retract annotation-123 --host https://artis.example.com
|
|
455
|
+
artis guidelines authoring
|
|
428
456
|
artis install-skill --yes
|
|
429
|
-
artis revise artifact-slug report.html --host https://artis.example.com --summary "Addressed open feedback" --resolve annotation-123`;
|
|
457
|
+
artis revise artifact-slug report.html --host https://artis.example.com --summary "Addressed open feedback" --base revision-abc --resolve annotation-123`;
|
|
430
458
|
}
|
|
431
459
|
// Annotated rather than inferred: the returned `visibility` flows through the
|
|
432
460
|
// sdk's `CreateArtifactInput`, so declaration emit would otherwise print an
|
|
@@ -453,6 +481,7 @@ export function publishArtifactFromCli(args) {
|
|
|
453
481
|
if (!(result === null || result === void 0 ? void 0 : result.result)) {
|
|
454
482
|
throw new Error('Publish response did not include artifact details.');
|
|
455
483
|
}
|
|
484
|
+
yield rememberBase(options.baseUrl, [result.result.artifactId, result.result.slug], result.result.revisionId);
|
|
456
485
|
return {
|
|
457
486
|
artifactId: result.result.artifactId,
|
|
458
487
|
revisionId: result.result.revisionId,
|
|
@@ -564,6 +593,11 @@ export function getArtifactHtmlFromCli(args) {
|
|
|
564
593
|
? `?revisionId=${encodeURIComponent(revisionId)}`
|
|
565
594
|
: '';
|
|
566
595
|
const result = yield apiFetchOptional(target, `/api/artifacts/${encodeURIComponent(artifactId)}/html${query}`);
|
|
596
|
+
// Whatever was read is what an edit of it builds on: `revise` sends it as
|
|
597
|
+
// the base, so a revision landing in between is refused, not overwritten.
|
|
598
|
+
if (result === null || result === void 0 ? void 0 : result.revisionId) {
|
|
599
|
+
yield rememberBase(target.baseUrl, [artifactId, result.artifactId], result.revisionId);
|
|
600
|
+
}
|
|
567
601
|
if (hasFlag(args, '--json')) {
|
|
568
602
|
console.log(JSON.stringify(result, null, 2));
|
|
569
603
|
return;
|
|
@@ -661,7 +695,7 @@ export function reviseArtifactFromCli(args) {
|
|
|
661
695
|
const [artifactId, filePath] = getPositionals(args);
|
|
662
696
|
const summary = parseFlagValue(args, '--summary');
|
|
663
697
|
if (!artifactId || !filePath) {
|
|
664
|
-
throw new Error('Usage: artis revise <artifact-id-or-slug> artifact.html --summary <text>');
|
|
698
|
+
throw new Error('Usage: artis revise <artifact-id-or-slug> artifact.html --summary <text> [--base <revision-id>]');
|
|
665
699
|
}
|
|
666
700
|
if (!summary) {
|
|
667
701
|
throw new Error('Missing --summary for revision.');
|
|
@@ -671,16 +705,22 @@ export function reviseArtifactFromCli(args) {
|
|
|
671
705
|
if (!html.toLowerCase().includes('<html')) {
|
|
672
706
|
throw new Error('Revision file must be self-contained HTML including <html>.');
|
|
673
707
|
}
|
|
708
|
+
const explicitBase = parseFlagValue(args, '--base');
|
|
709
|
+
const baseRevisionId = explicitBase !== null && explicitBase !== void 0 ? explicitBase : (yield getRememberedBase(credentials.baseUrl, artifactId));
|
|
674
710
|
const result = yield apiFetch(credentials, `/api/artifacts/${encodeURIComponent(artifactId)}/revisions`, {
|
|
675
711
|
method: 'POST',
|
|
676
712
|
body: JSON.stringify({
|
|
677
713
|
authorName: (_a = parseFlagValue(args, '--author')) !== null && _a !== void 0 ? _a : 'Artis CLI',
|
|
678
714
|
html,
|
|
715
|
+
baseRevisionId,
|
|
679
716
|
resolvedAnnotationIds: collectFlagValues(args, '--resolve'),
|
|
680
717
|
source: 'cli',
|
|
681
718
|
summary,
|
|
682
719
|
}),
|
|
683
720
|
});
|
|
721
|
+
if (result === null || result === void 0 ? void 0 : result.revision) {
|
|
722
|
+
yield rememberBase(credentials.baseUrl, [artifactId], result.revision.id, baseRevisionId);
|
|
723
|
+
}
|
|
684
724
|
if (hasFlag(args, '--json')) {
|
|
685
725
|
console.log(JSON.stringify(result, null, 2));
|
|
686
726
|
return;
|
|
@@ -690,6 +730,12 @@ export function reviseArtifactFromCli(args) {
|
|
|
690
730
|
}
|
|
691
731
|
console.log(`Revision ${result.revision.id}`);
|
|
692
732
|
console.log(`Version ${result.revision.version}`);
|
|
733
|
+
if (baseRevisionId && !explicitBase) {
|
|
734
|
+
console.log(`Base ${baseRevisionId} (remembered from this machine)`);
|
|
735
|
+
}
|
|
736
|
+
else if (!baseRevisionId) {
|
|
737
|
+
console.log('No base revision: pass --base, or read the artifact with publish or artifact html first, so a concurrent revision is refused instead of overwritten.');
|
|
738
|
+
}
|
|
693
739
|
});
|
|
694
740
|
}
|
|
695
741
|
export function createAnnotationFromCli(args) {
|
|
@@ -807,6 +853,10 @@ export function runArtisCli() {
|
|
|
807
853
|
yield whoamiFromCli(rest);
|
|
808
854
|
return;
|
|
809
855
|
}
|
|
856
|
+
if (command === 'guidelines') {
|
|
857
|
+
yield guidelinesFromCli(rest);
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
810
860
|
if (command === 'publish') {
|
|
811
861
|
const published = yield publishArtifactFromCli(rest);
|
|
812
862
|
if (hasFlag(rest, '--json')) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function getRevisionBasesPath(): string;
|
|
2
|
+
export declare function getRememberedBase(host: string, artifactIdOrSlug: string): Promise<string | undefined>;
|
|
3
|
+
/**
|
|
4
|
+
* Remember `revisionId` as the base for every name in `artifactKeys`. When
|
|
5
|
+
* `supersedes` is given (a revise built on that revision), entries for this
|
|
6
|
+
* host still pointing at it move forward too — the artifact may have been
|
|
7
|
+
* pulled by id and revised by slug. Best-effort: bookkeeping must never fail
|
|
8
|
+
* the command that produced it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function rememberBase(host: string, artifactKeys: Array<string | undefined>, revisionId: string, supersedes?: string): Promise<void>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { getConfigPath, normalizeHost } from './config.js';
|
|
5
|
+
/** Oldest entries are dropped past this, so the file cannot grow unbounded. */
|
|
6
|
+
const MAX_ENTRIES = 500;
|
|
7
|
+
export function getRevisionBasesPath() {
|
|
8
|
+
return join(dirname(getConfigPath()), 'revision-bases.json');
|
|
9
|
+
}
|
|
10
|
+
/** Keyed by host + the id or slug, since either can name an artifact. */
|
|
11
|
+
function entryKey(host, artifactIdOrSlug) {
|
|
12
|
+
return `${normalizeHost(host)} ${artifactIdOrSlug}`;
|
|
13
|
+
}
|
|
14
|
+
function readBases() {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a;
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(yield readFile(getRevisionBasesPath(), 'utf8'));
|
|
19
|
+
return { bases: (_a = parsed.bases) !== null && _a !== void 0 ? _a : {} };
|
|
20
|
+
}
|
|
21
|
+
catch (_b) {
|
|
22
|
+
return { bases: {} };
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function writeBases(file) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const entries = Object.entries(file.bases)
|
|
29
|
+
.sort(([, a], [, b]) => b.recordedAt.localeCompare(a.recordedAt))
|
|
30
|
+
.slice(0, MAX_ENTRIES);
|
|
31
|
+
const path = getRevisionBasesPath();
|
|
32
|
+
yield mkdir(dirname(path), { mode: 0o700, recursive: true });
|
|
33
|
+
yield writeFile(path, `${JSON.stringify({ bases: Object.fromEntries(entries) }, null, 2)}\n`, { mode: 0o600 });
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function getRememberedBase(host, artifactIdOrSlug) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
var _a;
|
|
39
|
+
const file = yield readBases();
|
|
40
|
+
return (_a = file.bases[entryKey(host, artifactIdOrSlug)]) === null || _a === void 0 ? void 0 : _a.revisionId;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Remember `revisionId` as the base for every name in `artifactKeys`. When
|
|
45
|
+
* `supersedes` is given (a revise built on that revision), entries for this
|
|
46
|
+
* host still pointing at it move forward too — the artifact may have been
|
|
47
|
+
* pulled by id and revised by slug. Best-effort: bookkeeping must never fail
|
|
48
|
+
* the command that produced it.
|
|
49
|
+
*/
|
|
50
|
+
export function rememberBase(host, artifactKeys, revisionId, supersedes) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
try {
|
|
53
|
+
const file = yield readBases();
|
|
54
|
+
const recordedAt = new Date().toISOString();
|
|
55
|
+
const hostPrefix = `${normalizeHost(host)} `;
|
|
56
|
+
if (supersedes) {
|
|
57
|
+
for (const [key, entry] of Object.entries(file.bases)) {
|
|
58
|
+
if (key.startsWith(hostPrefix) && entry.revisionId === supersedes) {
|
|
59
|
+
file.bases[key] = { revisionId, recordedAt };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const artifactKey of artifactKeys) {
|
|
64
|
+
if (artifactKey) {
|
|
65
|
+
file.bases[entryKey(host, artifactKey)] = { revisionId, recordedAt };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
yield writeBases(file);
|
|
69
|
+
}
|
|
70
|
+
catch (_a) {
|
|
71
|
+
// Without a remembered base, revise still works; the agent passes --base.
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=revision-bases.js.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The agent skill installed by `artis install-skill
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* `
|
|
2
|
+
* The agent skill installed by `artis install-skill`. Deliberately a router:
|
|
3
|
+
* it decides when to use Artis and which workflow applies, and defers every
|
|
4
|
+
* authoring rule and command detail to `artis guidelines`, which reads the
|
|
5
|
+
* server's current guidelines (`packages/sdk/src/lib/guidelines.ts`). An
|
|
6
|
+
* installed skill is never updated in place, so anything that changes over
|
|
7
|
+
* time belongs in the guidelines, not here.
|
|
6
8
|
*/
|
|
7
|
-
export declare const ARTIS_SKILL_MD = "---\nname: artis\ndescription: >-\n
|
|
9
|
+
export declare const ARTIS_SKILL_MD = "---\nname: artis\ndescription: >-\n Use for any Artis task: whenever the user mentions Artis, shares an Artis\n artifact link, or asks about an Artis artifact's feedback, annotations,\n revisions, or sharing; and to publish a deliverable that is better as an\n interactive page humans open in a browser (report, dashboard, timeline,\n postmortem, plan, prototype, review) than as a markdown dump.\n---\n\n# Artis\n\nArtis hosts self-contained HTML artifacts at stable URLs for a publish \u2192 review \u2192 revise loop. Use the `artis` CLI for every Artis action. If Artis MCP tools are already available in this session, you may use them instead; they share the same server and guidelines.\n\n## First rule: read the guidelines before authoring\n\nBefore writing, publishing, or revising an artifact in a session, run:\n\n artis guidelines # index of sections\n artis guidelines authoring # what a good artifact looks like\n artis guidelines revising # before any revise\n\nTreat that output as the source of truth for authoring rules and command syntax; it is served by the Artis server and stays current, while this file does not. `artis guidelines cli` and `artis help` give the full command reference.\n\n## Workflows\n\n### Someone shares an Artis link or names an artifact\n\nDo not curl or web-fetch the page: it is an app shell, and private artifacts are served only through signed URLs. Use the CLI with the id or slug from the link (`/artifacts/<slug>`):\n\n1. `artis artifact get <id-or-slug>` for metadata and revisions; `artis artifact feedback <id-or-slug>` for open review threads.\n2. `artis artifact html <id-or-slug> --output <file>` when you need the source.\n3. Do what was asked, then report the result or URL.\n\n### New deliverable\n\n1. Read `artis guidelines authoring` if you have not in this session.\n2. Write one self-contained HTML file and save it locally.\n3. `artis publish <file>` \u2014 `unlisted` unless the user asks for public or private.\n4. Return the printed URL with a one-line summary.\n\n### Revising an existing artifact\n\nRevise it; never publish a second artifact for the same work.\n\n1. Read `artis guidelines revising` if you have not in this session.\n2. `artis artifact feedback <id-or-slug>` for the open annotations and their ids.\n3. If the current source is not on disk, `artis artifact html <id-or-slug> --output <file>`.\n4. Edit the file, then `artis revise <id-or-slug> <file> --summary \"...\" --resolve <annotation-id>` (one change per summary line). The CLI sends the revision it last saw as the base; a conflict means someone revised since \u2014 pull the current source, reapply your changes, and revise again.\n\n## When not to publish\n\nDo not publish to Artis if the user asks for Markdown, plain text, a PDF, an answer in chat, or another destination. You may still use the CLI to read an Artis artifact they mention.\n\n## Setup and auth\n\n npm install -g @artis-lab/cli\n artis login --host <url> # browser approval; stores an API key\n artis whoami\n\nNever ask the user for a password. Hosts default to https://artis.xiispace.eu.org; pass `--host` or set `ARTIS_URL` for a self-hosted server. If a command reports missing or invalid credentials, run `artis login` and retry once; if login cannot complete here, say so and ask the user to authenticate. On any other failure, show the HTTP status and error once; do not retry blindly.\n";
|
|
8
10
|
export interface SkillHarnessDefinition {
|
|
9
11
|
/** Canonical id accepted by `--harness` and printed by `--list`. */
|
|
10
12
|
id: string;
|
package/src/lib/skill-install.js
CHANGED
|
@@ -7,61 +7,74 @@ import { collectFlagValues, hasFlag, parseFlagValue } from './args.js';
|
|
|
7
7
|
/** Directory the skill installs under, inside each harness's skills dir. */
|
|
8
8
|
const SKILL_DIR_NAME = 'artis';
|
|
9
9
|
/**
|
|
10
|
-
* The agent skill installed by `artis install-skill
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `
|
|
10
|
+
* The agent skill installed by `artis install-skill`. Deliberately a router:
|
|
11
|
+
* it decides when to use Artis and which workflow applies, and defers every
|
|
12
|
+
* authoring rule and command detail to `artis guidelines`, which reads the
|
|
13
|
+
* server's current guidelines (`packages/sdk/src/lib/guidelines.ts`). An
|
|
14
|
+
* installed skill is never updated in place, so anything that changes over
|
|
15
|
+
* time belongs in the guidelines, not here.
|
|
14
16
|
*/
|
|
15
17
|
export const ARTIS_SKILL_MD = `---
|
|
16
18
|
name: artis
|
|
17
19
|
description: >-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
Use for any Artis task: whenever the user mentions Artis, shares an Artis
|
|
21
|
+
artifact link, or asks about an Artis artifact's feedback, annotations,
|
|
22
|
+
revisions, or sharing; and to publish a deliverable that is better as an
|
|
23
|
+
interactive page humans open in a browser (report, dashboard, timeline,
|
|
24
|
+
postmortem, plan, prototype, review) than as a markdown dump.
|
|
22
25
|
---
|
|
23
26
|
|
|
24
27
|
# Artis
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
Artis hosts self-contained HTML artifacts at stable URLs for a publish → review → revise loop. Use the \`artis\` CLI for every Artis action. If Artis MCP tools are already available in this session, you may use them instead; they share the same server and guidelines.
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
## First rule: read the guidelines before authoring
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
Before writing, publishing, or revising an artifact in a session, run:
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
artis
|
|
34
|
-
artis
|
|
35
|
+
artis guidelines # index of sections
|
|
36
|
+
artis guidelines authoring # what a good artifact looks like
|
|
37
|
+
artis guidelines revising # before any revise
|
|
38
|
+
|
|
39
|
+
Treat that output as the source of truth for authoring rules and command syntax; it is served by the Artis server and stays current, while this file does not. \`artis guidelines cli\` and \`artis help\` give the full command reference.
|
|
40
|
+
|
|
41
|
+
## Workflows
|
|
42
|
+
|
|
43
|
+
### Someone shares an Artis link or names an artifact
|
|
44
|
+
|
|
45
|
+
Do not curl or web-fetch the page: it is an app shell, and private artifacts are served only through signed URLs. Use the CLI with the id or slug from the link (\`/artifacts/<slug>\`):
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
1. \`artis artifact get <id-or-slug>\` for metadata and revisions; \`artis artifact feedback <id-or-slug>\` for open review threads.
|
|
48
|
+
2. \`artis artifact html <id-or-slug> --output <file>\` when you need the source.
|
|
49
|
+
3. Do what was asked, then report the result or URL.
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
### New deliverable
|
|
39
52
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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]
|
|
53
|
+
1. Read \`artis guidelines authoring\` if you have not in this session.
|
|
54
|
+
2. Write one self-contained HTML file and save it locally.
|
|
55
|
+
3. \`artis publish <file>\` — \`unlisted\` unless the user asks for public or private.
|
|
56
|
+
4. Return the printed URL with a one-line summary.
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
### Revising an existing artifact
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
Revise it; never publish a second artifact for the same work.
|
|
54
61
|
|
|
55
|
-
1.
|
|
56
|
-
2.
|
|
57
|
-
3.
|
|
62
|
+
1. Read \`artis guidelines revising\` if you have not in this session.
|
|
63
|
+
2. \`artis artifact feedback <id-or-slug>\` for the open annotations and their ids.
|
|
64
|
+
3. If the current source is not on disk, \`artis artifact html <id-or-slug> --output <file>\`.
|
|
65
|
+
4. Edit the file, then \`artis revise <id-or-slug> <file> --summary "..." --resolve <annotation-id>\` (one change per summary line). The CLI sends the revision it last saw as the base; a conflict means someone revised since — pull the current source, reapply your changes, and revise again.
|
|
58
66
|
|
|
59
|
-
##
|
|
67
|
+
## When not to publish
|
|
68
|
+
|
|
69
|
+
Do not publish to Artis if the user asks for Markdown, plain text, a PDF, an answer in chat, or another destination. You may still use the CLI to read an Artis artifact they mention.
|
|
70
|
+
|
|
71
|
+
## Setup and auth
|
|
72
|
+
|
|
73
|
+
npm install -g @artis-lab/cli
|
|
74
|
+
artis login --host <url> # browser approval; stores an API key
|
|
75
|
+
artis whoami
|
|
60
76
|
|
|
61
|
-
|
|
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.
|
|
77
|
+
Never ask the user for a password. Hosts default to https://artis.xiispace.eu.org; pass \`--host\` or set \`ARTIS_URL\` for a self-hosted server. If a command reports missing or invalid credentials, run \`artis login\` and retry once; if login cannot complete here, say so and ask the user to authenticate. On any other failure, show the HTTP status and error once; do not retry blindly.
|
|
65
78
|
`;
|
|
66
79
|
/** Hermes keeps its config under $HERMES_HOME when set, otherwise
|
|
67
80
|
* `%LOCALAPPDATA%\hermes` on Windows and `~/.hermes` elsewhere — mirroring
|