@phnx-labs/artifacts-cli 0.3.8 → 0.4.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/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - **Auto-publish is opt-in at the render funnel — no double links, no per-save
6
+ URLs.** `artifacts render`/`_pdf` publish the rendered artifact to a durable
7
+ private managed URL (with a terminal QR) by default; `--no-publish` /
8
+ `ARTIFACTS_NO_PUBLISH=1` skips it. But publishing now requires an explicit
9
+ `publish: true` at the `compileArtifact` boundary, so callers that only compile
10
+ no longer silently mint a managed link: the `artifacts share` command (which
11
+ does its own upload) no longer creates a second unwanted URL, and the `--open`
12
+ watch loop no longer mints a new permanent URL on every file save. Source:
13
+ `src/lib/render.ts` (`publishArtifact` opt-in), `src/cli.ts` (`serveArtifact`
14
+ never publishes on re-render), `src/lib/share.ts`.
15
+ - **Honest project provenance, and slugs derived from the title.** `artifacts
16
+ new` no longer fabricates `project` from the directory it happens to run in:
17
+ detection fills it only when cwd is genuinely inside the project's own
18
+ checkout — exactly one `~/.agents/projects/` entry claiming it (the canonical
19
+ yaml `name` matches Linear, and inside the `muqsitnawaz/agents` monorepo the
20
+ `defaultPath` subdirectory disambiguates: `agents/rush/cli` → `rush-cli`; a
21
+ tie stays empty) — or the git remote's repository name. Otherwise it stays
22
+ empty, so a scaffold written in the durable artifact home
23
+ (`~/.agents/artifacts/<date>/<slug>/`) no longer claims `project: .agents`.
24
+ An empty project warns in `artifacts check`; the new `--project <name>` flag
25
+ pins it explicitly, and declared frontmatter still always wins. A directory
26
+ basename is never used as a fallback. On `artifacts share`, the URL slug now
27
+ defaults to the artifact's title (re-sharing the same title updates the same
28
+ URL) instead of a cwd-derived project prefix plus random hex; `--slug`
29
+ remains as an override. Source: `src/lib/templates.ts`, `src/commands/new.ts`,
30
+ `src/lib/share.ts`.
31
+
32
+ ## 0.3.9 — 2026-08-25
33
+
34
+ - **Reader review is a round trip (PHNX-3247).** Selecting artifact text now
35
+ copies it and opens a `Copied · Highlight · Note` toolbar; highlights are
36
+ explicit, and clicking one opens its quote, autosaved note, Copy, and Remove
37
+ actions. Notes use `artifacts.notes.v1` in `<basename>.notes.json`, readable or
38
+ importable with `artifacts notes`. `render --open` serves only on 127.0.0.1,
39
+ watches the Markdown, accepts note updates, and offers an `Updated · Reload`
40
+ chip when a new render is ready; `--no-serve` preserves file:// opening.
41
+
5
42
  ## 0.3.8 — 2026-08-25
6
43
 
7
44
  - **Plan quality gate no longer disabled by kind/surface self-declaration (PHNX-2778).**
package/README.md CHANGED
@@ -27,7 +27,7 @@ Write the Markdown, run one command:
27
27
  ```bash
28
28
  artifacts new plan --out plan.md # scaffold; provenance auto-fills
29
29
  $EDITOR plan.md # kind + title; plans also need surface
30
- artifacts render plan.md --open # writes plan.html next to the source, opens it
30
+ artifacts render plan.md --open # writes, serves on 127.0.0.1, watches, opens
31
31
  artifacts share plan.md # publish a shareable link
32
32
  ```
33
33
 
@@ -38,7 +38,7 @@ artifacts new design # project-wide branding (DESIGN.md)
38
38
  artifacts check plan.md # validate without rendering
39
39
  ```
40
40
 
41
- Provenance (project, repository, branch, harness, agent, human, host, session, date) fills automatically from the current Git checkout and agent environment at render time; any value you declare in frontmatter wins. Additional frontmatter carries into the artifact header:
41
+ Provenance (project, repository, branch, harness, agent, human, host, session, date) fills automatically from the current Git checkout and agent environment at render time; any value you declare in frontmatter wins. `project` is never invented: it auto-fills only when the checkout identifies a real project (a `~/.agents/projects/` entry, or the git remote's repository name), and stays empty — with a warning from `artifacts check` — when the file lives somewhere that says nothing about what it is about, like the durable artifact home. Additional frontmatter carries into the artifact header:
42
42
 
43
43
  ```yaml
44
44
  project: agents-cli
@@ -75,15 +75,16 @@ offline brand mark; other hosts try a remote favicon and drop it if load fails.
75
75
 
76
76
  ## Commands
77
77
 
78
- Five commands. Everything else is a flag on one of them.
78
+ Six commands. Everything else is a flag on one of them.
79
79
 
80
80
  | Command | Purpose |
81
81
  | --- | --- |
82
- | `artifacts new <plan\|report\|visual\|worksheet\|design> [--out file] [--blank] [--stdout]` | Scaffolds an artifact and pre-fills detectable provenance. When the target lands under a committed `.agents/artifacts/` tree it pre-fills anonymized provenance instead (`human: author`, `host: fleet-worker`, no session id) — that directory is published. `--blank` leaves every field empty; `--stdout` prints the skeleton without writing; `design` writes a starter `DESIGN.md`; `worksheet` generates a `worksheet_id`. |
82
+ | `artifacts new <plan\|report\|visual\|worksheet\|design> [--out file] [--project name] [--blank] [--stdout]` | Scaffolds an artifact and pre-fills detectable provenance. When the target lands under a committed `.agents/artifacts/` tree it pre-fills anonymized provenance instead (`human: author`, `host: fleet-worker`, no session id) — that directory is published. `project` is detected only when cwd is genuinely inside the project's own checkout (a known `~/.agents/projects/` entry or the git remote's repo name); inside the durable artifact home (`~/.agents/artifacts/`) detection stays empty rather than inventing a name — pass `--project` or fill the frontmatter, and `artifacts check` warns until you do. `--blank` leaves every field empty (an explicit `--project` still pins the project); `--stdout` prints the skeleton without writing; `design` writes a starter `DESIGN.md`; `worksheet` generates a `worksheet_id`. |
83
83
  | `artifacts check file.md` | Validates frontmatter metadata, required sections, asset paths, and embedded HTML/SVG safety. |
84
- | `artifacts render file.md [--out file] [--open]` | Renders Markdown to self-contained HTML next to the source. `--open` shows it in your default browser. Embeds the Markdown source for recovery. |
84
+ | `artifacts render file.md [--out file] [--open] [--no-serve] [--no-publish]` | Renders Markdown to self-contained HTML next to the source, then auto-publishes it to a durable **private** managed URL and prints the URL plus a terminal QR (`--no-publish` / `ARTIFACTS_NO_PUBLISH=1` keeps it local; the `--open` watch loop re-renders on save but never re-publishes). `--open` serves on 127.0.0.1, watches the Markdown, and shows it in your browser; `--no-serve` keeps file:// behavior. Embeds the Markdown source for recovery. |
85
85
  | `artifacts answers <ws.md> [--from file.json] [--json] [--pending]` | Reads or merges a `worksheet`'s answers. No flag prints a filled/pending table; `--json` emits `id → {label, value, state}`; `--pending` filters to pending fields or worksheets; `--from` merges an exported answers file back into the `.md` (id-matched, dirty-only, atomic). A directory scans for worksheets and lists per-file pending counts. |
86
- | `artifacts share file.md` | Renders Markdown when needed and publishes through the configured R2/Worker endpoint. |
86
+ | `artifacts notes <file.md\|file.html> [--from sidecar.json] [--json]` | Reads the adjacent `<basename>.notes.json` review sidecar as a table or JSON, or imports an `artifacts.notes.v1` sidecar. |
87
+ | `artifacts share file.md [--slug slug]` | Renders Markdown when needed and publishes through the configured R2/Worker endpoint. The URL slug is derived from the artifact title (filename for title-less files); `--slug` overrides it. Re-sharing the same title updates the same URL. |
87
88
 
88
89
  ### Internal commands
89
90
 
@@ -219,7 +220,7 @@ Four reader affordances are generated from the artifact itself. An agent writes
219
220
 
220
221
  **Read count.** Each artifact keeps a per-browser read count in `localStorage`, shown in the document header (`first read`, then `2 reads`). It is scoped to the artifact's own URL and title, so two artifacts published under the same title do not share a counter. Nothing is sent anywhere.
221
222
 
222
- **Highlights.** Select text in the artifact body to save a highlight in this browser. Highlights survive reloads and reopening the page; click any highlighted text to remove that selection. They use the same URL-and-title artifact identity as the read count, stay on the reader's device, and need no server or account.
223
+ **Reader review.** Selecting text always copies it and opens **Copied · Highlight · Note** without clearing the browser selection. **Highlight** explicitly saves the range. **Note** saves it and opens a textarea; clicking an existing highlight opens the same quote/note popover with Copy and Remove. Local state uses the artifact's URL-and-title identity. With `render --open`, notes also autosave after roughly 600 ms to `<basename>.notes.json` beside the Markdown, while Markdown rewrites surface an **Updated · Reload** chip. Static/shared pages never post feedback off-box.
223
224
 
224
225
  Themes already follow the reader's system preference and switch live when the OS theme changes, unless the reader picks one explicitly with the in-page toggle.
225
226
 
package/dist/cli.d.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  #!/usr/bin/env node
2
+ import { type PublishOptions } from './lib/render.js';
2
3
  export declare function openPath(path: string, deps?: {
3
4
  tryAgents?: (p: string) => boolean;
4
5
  osOpen?: (p: string) => void;
5
6
  /** Override the probe timeout so a test can assert the fallback quickly. */
6
7
  timeoutMs?: number;
7
8
  }): void;
9
+ export declare function serveArtifact(source: string, out: string, options?: PublishOptions): Promise<{
10
+ url: string;
11
+ close: () => Promise<void>;
12
+ }>;
package/dist/cli.js CHANGED
@@ -1,17 +1,22 @@
1
1
  #!/usr/bin/env node
2
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { mkdirSync, readFileSync, watch, writeFileSync } from 'node:fs';
3
3
  import { fileURLToPath } from 'node:url';
4
- import { dirname, join, resolve } from 'node:path';
4
+ import { basename, dirname, join, resolve } from 'node:path';
5
5
  import { spawn, spawnSync } from 'node:child_process';
6
+ import { createHash } from 'node:crypto';
7
+ import { createServer } from 'node:http';
6
8
  import { Command, Option } from 'commander';
7
9
  import chalk from 'chalk';
10
+ import QRCode from 'qrcode';
8
11
  import { addNewCommand } from './commands/new.js';
9
12
  import { exportPdf, parsePdfLayout } from './lib/pdf.js';
10
- import { compileArtifact, decompileHtml } from './lib/render.js';
13
+ import { compileArtifact, decompileHtml, publishArtifact } from './lib/render.js';
11
14
  import { estimateArtifactTokens } from './lib/tokens.js';
12
15
  import { validateMarkdown } from './lib/validate.js';
13
16
  import { shareAnalytics, shareDelete, shareJoin, sharePublish, shareSetup, shareStatus } from './commands/share.js';
14
17
  import { answersCommand } from './commands/answers.js';
18
+ import { notesCommand } from './commands/notes.js';
19
+ import { notesSidecarPath, parseNotesExport } from './lib/notes.js';
15
20
  const { version } = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '../package.json'), 'utf-8'));
16
21
  const program = new Command();
17
22
  function printDiagnostics(diagnostics) {
@@ -21,6 +26,19 @@ function printDiagnostics(diagnostics) {
21
26
  console.error(`${label}${where} ${diagnostic.message}`);
22
27
  }
23
28
  }
29
+ async function printArtifactResult(result, outPath) {
30
+ if (!result.shareUrl) {
31
+ console.log(`${chalk.bold('wrote')} ${outPath}`);
32
+ return;
33
+ }
34
+ console.log(chalk.green(result.shareUrl));
35
+ const qr = await QRCode.toString(result.shareUrl, {
36
+ type: 'terminal',
37
+ small: true,
38
+ errorCorrectionLevel: 'L',
39
+ });
40
+ console.log(qr.trimEnd());
41
+ }
24
42
  function defaultOutFor(input, ext) {
25
43
  // Markdown sources render next to the source; HTML inputs keep the .artifacts
26
44
  // default so normalization never clobbers the input file.
@@ -80,6 +98,67 @@ export function openPath(path, deps = {}) {
80
98
  const child = spawn(cmd, args, { detached: true, stdio: 'ignore' });
81
99
  child.unref();
82
100
  }
101
+ export async function serveArtifact(source, out, options = {}) {
102
+ const sourcePath = resolve(source);
103
+ const outPath = resolve(out);
104
+ const pagePath = '/' + encodeURIComponent(basename(outPath));
105
+ let rendering = false;
106
+ const rerender = async () => {
107
+ if (rendering)
108
+ return;
109
+ rendering = true;
110
+ try {
111
+ // The one-shot publish (if any) already happened in the render/_pdf action
112
+ // before serveArtifact was called. Watch-loop re-renders on every file save
113
+ // MUST NOT publish — otherwise each keystroke-save mints a new permanent URL.
114
+ const result = await compileArtifact(sourcePath, outPath, { ...options, publish: false });
115
+ printDiagnostics(result.diagnostics);
116
+ }
117
+ finally {
118
+ rendering = false;
119
+ }
120
+ };
121
+ const server = createServer((request, response) => {
122
+ if (request.method === 'POST' && request.url === '/notes') {
123
+ let raw = '';
124
+ request.setEncoding('utf8');
125
+ request.on('data', (chunk) => { raw += chunk; if (raw.length > 1_000_000)
126
+ request.destroy(); });
127
+ request.on('end', () => {
128
+ try {
129
+ const notes = parseNotesExport(raw);
130
+ writeFileSync(notesSidecarPath(sourcePath), JSON.stringify(notes, null, 2) + '\n');
131
+ response.writeHead(204).end();
132
+ }
133
+ catch (error) {
134
+ response.writeHead(400, { 'content-type': 'text/plain; charset=utf-8' }).end(error instanceof Error ? error.message : String(error));
135
+ }
136
+ });
137
+ return;
138
+ }
139
+ if (request.method !== 'GET' || (request.url !== '/' && request.url?.split('?')[0] !== pagePath)) {
140
+ response.writeHead(404).end('not found');
141
+ return;
142
+ }
143
+ const html = readFileSync(outPath, 'utf8');
144
+ const contentHash = createHash('sha256').update(html).digest('hex').slice(0, 16);
145
+ const stamped = html.replace('</head>', `<meta name="artifacts-content-hash" content="${contentHash}">\n</head>`);
146
+ response.writeHead(200, { 'content-type': 'text/html; charset=utf-8', 'cache-control': 'no-store' }).end(stamped);
147
+ });
148
+ await new Promise((ready, reject) => {
149
+ server.once('error', reject);
150
+ server.listen(0, '127.0.0.1', ready);
151
+ });
152
+ const watcher = watch(sourcePath, { persistent: true }, () => { void rerender(); });
153
+ const address = server.address();
154
+ if (!address || typeof address === 'string')
155
+ throw new Error('Could not determine loopback server port.');
156
+ const url = `http://127.0.0.1:${address.port}${pagePath}`;
157
+ return { url, close: async () => {
158
+ watcher.close();
159
+ await new Promise((done, reject) => server.close((error) => error ? reject(error) : done()));
160
+ } };
161
+ }
83
162
  program
84
163
  .name('artifacts')
85
164
  .description('Render Markdown artifacts into polished HTML and shareable static links.')
@@ -88,12 +167,18 @@ program
88
167
  Happy path:
89
168
  1. artifacts new plan --out <file>.md # kind + title; plans also need surface;
90
169
  # provenance auto-fills
91
- 2. artifacts render <file>.md --open # writes <file>.html next to the source
92
- 3. artifacts share <file>.md --expire 30d
170
+ 2. artifacts render <file>.md --open # prints a private managed URL + QR
93
171
 
94
172
  Run artifacts <command> --help for details.
95
173
  `);
96
174
  addNewCommand(program);
175
+ program
176
+ .command('notes')
177
+ .description('Read artifact review notes or import an artifacts.notes.v1 sidecar.')
178
+ .argument('<file.md|file.html>')
179
+ .option('--from <sidecar.json>', 'import notes into the sidecar next to the artifact')
180
+ .option('--json', 'emit machine-readable JSON')
181
+ .action(notesCommand);
97
182
  program
98
183
  .command('answers')
99
184
  .description('Read worksheet answers or merge an artifacts.answers.v1 export into Markdown.')
@@ -136,10 +221,12 @@ program
136
221
  });
137
222
  program
138
223
  .command('render')
139
- .description('Render Markdown to HTML next to the source, or normalize existing HTML.')
224
+ .description('Render Markdown to HTML and publish a private managed URL.')
140
225
  .argument('<file.md|file.html>')
141
226
  .option('--out <file>', 'output file')
142
227
  .option('--open', 'open the rendered HTML in your default browser')
228
+ .option('--no-serve', 'open the rendered file:// URL without watching or notes sync')
229
+ .option('--no-publish', 'keep the rendered artifact local instead of publishing it')
143
230
  // Deprecated in 0.3.0, removed in 0.4.0. A deployed ExitPlanMode hook copy may
144
231
  // still print `artifacts render <file> --format html`, and Commander errors on
145
232
  // unknown options — so these exist to hand a lagging caller a migration
@@ -173,16 +260,23 @@ Notes:
173
260
  console.error(`${chalk.yellow('warning')} --format is deprecated and ignored; render is HTML-only. It is removed in 0.4.0.`);
174
261
  }
175
262
  const out = opts.out || defaultOutFor(file, '.html');
176
- const result = await compileArtifact(file, out);
263
+ const result = await compileArtifact(file, out, { publish: opts.publish });
177
264
  printDiagnostics(result.diagnostics);
178
265
  if (result.diagnostics.some((diagnostic) => diagnostic.level === 'error')) {
179
266
  process.exitCode = 1;
180
267
  return;
181
268
  }
182
- console.log(`${chalk.bold('wrote')} ${out}`);
269
+ await printArtifactResult(result, out);
183
270
  if (opts.open) {
184
- openPath(resolve(out));
185
- console.log(`${chalk.bold('opened')} ${out}`);
271
+ if (opts.serve === false || !/\.md$/i.test(file)) {
272
+ openPath(resolve(out));
273
+ console.log(chalk.bold('opened locally'));
274
+ }
275
+ else {
276
+ const served = await serveArtifact(file, out, { publish: opts.publish });
277
+ openPath(served.url);
278
+ console.log(chalk.bold('served locally'));
279
+ }
186
280
  }
187
281
  });
188
282
  program
@@ -204,10 +298,11 @@ program
204
298
  .argument('<file.md|file.html>')
205
299
  .requiredOption('--out <file>', 'output PDF file')
206
300
  .option('--layout <layout>', 'PDF layout: document or poster', parsePdfLayout, 'document')
301
+ .option('--no-publish', 'keep the rendered artifact local instead of publishing it')
207
302
  .action(async (file, opts) => {
208
303
  const outHtml = /\.md$/i.test(file) ? defaultOutFor(file, '.html') : file;
209
304
  if (/\.md$/i.test(file)) {
210
- const result = await compileArtifact(file, outHtml);
305
+ const result = await compileArtifact(file, outHtml, { publish: false });
211
306
  printDiagnostics(result.diagnostics);
212
307
  if (result.diagnostics.some((diagnostic) => diagnostic.level === 'error')) {
213
308
  process.exitCode = 1;
@@ -215,12 +310,14 @@ program
215
310
  }
216
311
  }
217
312
  await exportPdf(outHtml, opts.out, { layout: opts.layout });
218
- console.log(`${chalk.bold('wrote')} ${opts.out}`);
313
+ const published = await publishArtifact(opts.out, { publish: opts.publish });
314
+ printDiagnostics(published.diagnostics);
315
+ await printArtifactResult(published, opts.out);
219
316
  });
220
317
  const share = program.command('share').description('Publish static artifacts with the R2/Worker share model.');
221
318
  share
222
319
  .argument('[file]', 'file to publish')
223
- .option('--slug <slug>', 'URL slug')
320
+ .option('--slug <slug>', 'URL slug override (default: derived from the artifact title)')
224
321
  .option('--expire <spec>', 'expiry such as 30d, 12h, or 2026-08-01')
225
322
  .option('--github-user <user>', 'URL namespace')
226
323
  .option('--json', 'emit JSON')
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAkB,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,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 -4,6 +4,7 @@ export type NewOptions = {
4
4
  blank?: boolean;
5
5
  force?: boolean;
6
6
  stdout?: boolean;
7
+ project?: string;
7
8
  };
8
9
  export declare function runNewCommand(kind: string, opts: NewOptions): void;
9
10
  export declare function addNewCommand(program: Command): void;
@@ -41,10 +41,17 @@ export function runNewCommand(kind, opts) {
41
41
  // path: once the value is in the source, it is committed, and the anonymizing
42
42
  // fallback in validateMarkdown cannot help because explicit frontmatter wins
43
43
  // by design.
44
- const context = isPublishedArtifactPath(resolve(out))
44
+ const detected = isPublishedArtifactPath(resolve(out))
45
45
  ? anonymizedArtifactContext()
46
46
  : detectArtifactContext();
47
- const content = opts.blank ? templateFor(artifactKind) : templateFor(artifactKind, context);
47
+ // An explicit --project is the author stating what the artifact is about; it
48
+ // always wins over detection. Once artifacts live in the durable home
49
+ // (~/.agents/artifacts/) instead of the repo they describe, detection comes
50
+ // back empty and this flag is how the real project gets named.
51
+ const context = opts.blank ? {} : detected;
52
+ if (opts.project?.trim())
53
+ context.project = opts.project.trim();
54
+ const content = templateFor(artifactKind, context);
48
55
  if (opts.stdout) {
49
56
  process.stdout.write(content);
50
57
  return;
@@ -57,12 +64,14 @@ export function addNewCommand(program) {
57
64
  .description('Scaffold a Markdown artifact: plan, report, visual, worksheet, or design.')
58
65
  .argument('<kind>', 'plan, report, visual, worksheet, or design')
59
66
  .option('--out <file>', 'output file')
67
+ .option('--project <name>', 'project the artifact is about (default: detected from the git checkout)')
60
68
  .option('--blank', 'write an unfilled template instead of a context-filled artifact')
61
69
  .option('--stdout', 'print the artifact to stdout without writing a file')
62
70
  .option('--force', 'overwrite the default output file if it already exists')
63
71
  .addHelpText('after', `
64
72
  Examples:
65
73
  $ artifacts new plan --out plan.md # provenance filled from git and the agent env
74
+ $ artifacts new plan --project rush-app # name the project when cwd is not its checkout
66
75
  $ artifacts new plan --blank # plan.template.md, every field left empty
67
76
  $ artifacts new plan --blank --stdout # print the required section skeleton
68
77
  $ artifacts new design # DESIGN.md, project-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OAAO,EAAE;;;;;;;CAOzB,CAAC;SACG,MAAM,CAAC,aAAa,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface NotesOptions {
2
+ from?: string;
3
+ json?: boolean;
4
+ }
5
+ export declare function notesCommand(target: string, options: NotesOptions): void;
@@ -0,0 +1,28 @@
1
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { NOTES_SCHEMA, notesSidecarPath, parseNotesExport } from '../lib/notes.js';
4
+ function preview(value) {
5
+ const oneLine = value.replace(/\s+/g, ' ').trim();
6
+ return oneLine.length > 54 ? `${oneLine.slice(0, 51)}...` : oneLine;
7
+ }
8
+ export function notesCommand(target, options) {
9
+ const sidecar = notesSidecarPath(target);
10
+ if (options.from) {
11
+ const imported = parseNotesExport(readFileSync(resolve(options.from), 'utf8'));
12
+ writeFileSync(sidecar, JSON.stringify(imported, null, 2) + '\n');
13
+ console.log(`imported ${imported.notes.length} notes · wrote ${sidecar}`);
14
+ return;
15
+ }
16
+ const exported = existsSync(sidecar)
17
+ ? parseNotesExport(readFileSync(sidecar, 'utf8'))
18
+ : { schema: NOTES_SCHEMA, notes: [] };
19
+ if (options.json) {
20
+ console.log(JSON.stringify(exported, null, 2));
21
+ return;
22
+ }
23
+ console.log('id\tsection\tquote\tnote\tcreated_at');
24
+ for (const note of exported.notes) {
25
+ console.log(`${note.id}\t${note.section}\t${preview(note.quote)}\t${preview(note.note) || '—'}\t${note.created_at}`);
26
+ }
27
+ }
28
+ //# sourceMappingURL=notes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notes.js","sourceRoot":"","sources":["../../src/commands/notes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAg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AsC,CAAC,CAAC;IACpD,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAuB,EAAE,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvH,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- export declare const HIGHLIGHTS_SCRIPT = "<script>\n(() => {\n const root = document.querySelector('.artifact-body');\n if (!root) return;\n\n const storageKey = 'artifacts-highlights:' + location.origin + location.pathname + ':' + (document.title || '');\n const selector = 'h2,h3,p,li,blockquote,pre,figcaption,td,th,dd';\n const hash = (value) => {\n let result = 2166136261;\n for (let index = 0; index < value.length; index += 1) {\n result ^= value.charCodeAt(index);\n result = Math.imul(result, 16777619);\n }\n return (result >>> 0).toString(36);\n };\n const anchors = [...root.querySelectorAll(selector)].filter((element) => !element.parentElement.closest(selector));\n const bases = [];\n let section = 'document';\n for (const anchor of anchors) {\n if ((anchor.tagName === 'H2' || anchor.tagName === 'H3') && anchor.id) section = anchor.id;\n const text = (anchor.textContent || '').replace(/\\s+/g, ' ').trim();\n const base = anchor.id ? 'id:' + anchor.id : section + ':' + anchor.tagName.toLowerCase() + ':' + hash(text);\n bases.push(base);\n }\n const totals = new Map();\n for (const base of bases) totals.set(base, (totals.get(base) || 0) + 1);\n const occurrences = new Map();\n for (let index = 0; index < anchors.length; index += 1) {\n const anchor = anchors[index];\n const base = bases[index];\n const occurrence = (occurrences.get(base) || 0) + 1;\n occurrences.set(base, occurrence);\n anchor.dataset.readerAnchor = base.startsWith('id:') ? base : base + ':count:' + totals.get(base) + ':occurrence:' + occurrence;\n }\n const byId = new Map(anchors.map((anchor) => [anchor.dataset.readerAnchor, anchor]));\n\n const read = () => {\n try {\n const value = JSON.parse(localStorage.getItem(storageKey) || '[]');\n return Array.isArray(value) ? value.filter((item) => item && item.id && item.start && item.end) : [];\n } catch { return []; }\n };\n let highlights = read();\n const write = () => { try { localStorage.setItem(storageKey, JSON.stringify(highlights)); } catch {} };\n const textLength = (anchor) => (anchor.textContent || '').length;\n const offsetAt = (anchor, node, offset) => {\n const range = document.createRange();\n range.selectNodeContents(anchor);\n try { range.setEnd(node, offset); } catch { return null; }\n return range.toString().length;\n };\n const wrap = (anchor, start, end, id) => {\n if (end <= start) return;\n const nodes = [];\n const walker = document.createTreeWalker(anchor, NodeFilter.SHOW_TEXT);\n let cursor = 0;\n let node = walker.nextNode();\n while (node) {\n const nodeStart = cursor;\n const nodeEnd = cursor + node.data.length;\n if (nodeEnd > start && nodeStart < end) nodes.push([node, Math.max(0, start - nodeStart), Math.min(node.data.length, end - nodeStart)]);\n cursor = nodeEnd;\n node = walker.nextNode();\n }\n for (let index = nodes.length - 1; index >= 0; index -= 1) {\n const [textNode, from, to] = nodes[index];\n if (to <= from) continue;\n const range = document.createRange();\n range.setStart(textNode, from);\n range.setEnd(textNode, to);\n const mark = document.createElement('mark');\n mark.className = 'reader-highlight';\n mark.dataset.highlightId = id;\n mark.title = 'Click to remove highlight';\n range.surroundContents(mark);\n }\n };\n const clearMarks = () => {\n for (const mark of root.querySelectorAll('mark[data-highlight-id]')) mark.replaceWith(...mark.childNodes);\n for (const anchor of anchors) anchor.normalize();\n };\n const render = () => {\n clearMarks();\n for (const highlight of highlights) {\n const first = byId.get(highlight.start.anchor);\n const last = byId.get(highlight.end.anchor);\n const firstIndex = anchors.indexOf(first);\n const lastIndex = anchors.indexOf(last);\n if (!first || !last || firstIndex < 0 || lastIndex < firstIndex) continue;\n for (let index = firstIndex; index <= lastIndex; index += 1) {\n const anchor = anchors[index];\n wrap(anchor, index === firstIndex ? highlight.start.offset : 0, index === lastIndex ? highlight.end.offset : textLength(anchor), highlight.id);\n }\n }\n };\n\n root.addEventListener('mouseup', () => {\n const selection = getSelection();\n if (!selection || selection.isCollapsed || !selection.rangeCount) return;\n const range = selection.getRangeAt(0);\n const startAnchor = range.startContainer.parentElement?.closest('[data-reader-anchor]');\n const endAnchor = range.endContainer.parentElement?.closest('[data-reader-anchor]');\n if (!startAnchor || !endAnchor || !root.contains(startAnchor) || !root.contains(endAnchor)) return;\n const startOffset = offsetAt(startAnchor, range.startContainer, range.startOffset);\n const endOffset = offsetAt(endAnchor, range.endContainer, range.endOffset);\n if (startOffset === null || endOffset === null) return;\n const startIndex = anchors.indexOf(startAnchor);\n const endIndex = anchors.indexOf(endAnchor);\n if (startIndex > endIndex || (startIndex === endIndex && startOffset >= endOffset)) return;\n const candidate = { start: { anchor: startAnchor.dataset.readerAnchor, offset: startOffset }, end: { anchor: endAnchor.dataset.readerAnchor, offset: endOffset } };\n if (highlights.some((item) => item.start.anchor === candidate.start.anchor && item.start.offset === candidate.start.offset && item.end.anchor === candidate.end.anchor && item.end.offset === candidate.end.offset)) return;\n highlights.push({ id: Date.now().toString(36) + Math.random().toString(36).slice(2), ...candidate });\n write();\n selection.removeAllRanges();\n render();\n });\n root.addEventListener('click', (event) => {\n const mark = event.target.closest('mark[data-highlight-id]');\n if (!mark || !root.contains(mark)) return;\n event.preventDefault();\n event.stopPropagation();\n highlights = highlights.filter((item) => item.id !== mark.dataset.highlightId);\n write();\n render();\n });\n render();\n})();\n</script>";
1
+ export declare const HIGHLIGHTS_SCRIPT = "<script>\n(() => {\n const root = document.querySelector('.artifact-body');\n if (!root) return;\n\n const storageKey = 'artifacts-highlights:' + location.origin + location.pathname + ':' + (document.title || '');\n const selector = 'h2,h3,p,li,blockquote,pre,figcaption,td,th,dd';\n const hash = (value) => {\n let result = 2166136261;\n for (let index = 0; index < value.length; index += 1) { result ^= value.charCodeAt(index); result = Math.imul(result, 16777619); }\n return (result >>> 0).toString(36);\n };\n const anchors = [...root.querySelectorAll(selector)].filter((element) => !element.parentElement.closest(selector));\n const bases = [];\n let section = 'document';\n for (const anchor of anchors) {\n if ((anchor.tagName === 'H2' || anchor.tagName === 'H3') && anchor.id) section = anchor.id;\n anchor.dataset.readerSection = section;\n const text = (anchor.textContent || '').replace(/\\s+/g, ' ').trim();\n bases.push(anchor.id ? 'id:' + anchor.id : section + ':' + anchor.tagName.toLowerCase() + ':' + hash(text));\n }\n const totals = new Map();\n for (const base of bases) totals.set(base, (totals.get(base) || 0) + 1);\n const occurrences = new Map();\n for (let index = 0; index < anchors.length; index += 1) {\n const anchor = anchors[index];\n const base = bases[index];\n const occurrence = (occurrences.get(base) || 0) + 1;\n occurrences.set(base, occurrence);\n anchor.dataset.readerAnchor = base.startsWith('id:') ? base : base + ':count:' + totals.get(base) + ':occurrence:' + occurrence;\n }\n const byId = new Map(anchors.map((anchor) => [anchor.dataset.readerAnchor, anchor]));\n\n const read = () => {\n try {\n const value = JSON.parse(localStorage.getItem(storageKey) || '[]');\n return Array.isArray(value) ? value.filter((item) => item && item.id && item.start && item.end).map((item) => ({\n quote: '', note: '', section: 'document', created_at: new Date().toISOString(), ...item,\n })) : [];\n } catch { return []; }\n };\n let highlights = read();\n let postTimer;\n const post = () => {\n if (location.protocol !== 'http:' || !['127.0.0.1', 'localhost', '::1'].includes(location.hostname)) return;\n fetch('/notes', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ schema: 'artifacts.notes.v1', notes: highlights }) }).catch(() => {});\n };\n const write = () => {\n try { localStorage.setItem(storageKey, JSON.stringify(highlights)); } catch {}\n clearTimeout(postTimer); postTimer = setTimeout(post, 600);\n };\n const textLength = (anchor) => (anchor.textContent || '').length;\n const offsetAt = (anchor, node, offset) => {\n const range = document.createRange(); range.selectNodeContents(anchor);\n try { range.setEnd(node, offset); } catch { return null; }\n return range.toString().length;\n };\n const wrap = (anchor, start, end, id) => {\n if (end <= start) return;\n const nodes = []; const walker = document.createTreeWalker(anchor, NodeFilter.SHOW_TEXT); let cursor = 0; let node = walker.nextNode();\n while (node) {\n const nodeStart = cursor; const nodeEnd = cursor + node.data.length;\n if (nodeEnd > start && nodeStart < end) nodes.push([node, Math.max(0, start - nodeStart), Math.min(node.data.length, end - nodeStart)]);\n cursor = nodeEnd; node = walker.nextNode();\n }\n for (let index = nodes.length - 1; index >= 0; index -= 1) {\n const [textNode, from, to] = nodes[index]; if (to <= from) continue;\n const range = document.createRange(); range.setStart(textNode, from); range.setEnd(textNode, to);\n const mark = document.createElement('mark'); mark.className = 'reader-highlight'; mark.dataset.highlightId = id; mark.title = 'Open note';\n range.surroundContents(mark);\n }\n };\n const clearMarks = () => {\n for (const mark of root.querySelectorAll('mark[data-highlight-id]')) mark.replaceWith(...mark.childNodes);\n for (const anchor of anchors) anchor.normalize();\n };\n const render = () => {\n clearMarks();\n for (const highlight of highlights) {\n const first = byId.get(highlight.start.anchor); const last = byId.get(highlight.end.anchor);\n const firstIndex = anchors.indexOf(first); const lastIndex = anchors.indexOf(last);\n if (!first || !last || firstIndex < 0 || lastIndex < firstIndex) continue;\n for (let index = firstIndex; index <= lastIndex; index += 1) wrap(anchors[index], index === firstIndex ? highlight.start.offset : 0, index === lastIndex ? highlight.end.offset : textLength(anchors[index]), highlight.id);\n }\n };\n\n const style = document.createElement('style');\n style.textContent = '.reader-toolbar,.reader-popover{position:fixed;z-index:40;display:flex;align-items:center;gap:6px;padding:7px;border:1px solid var(--line,#ccc);border-radius:10px;background:var(--surface,#fff);color:var(--text,#111);box-shadow:0 10px 35px rgba(0,0,0,.18);font:500 12px/1.2 var(--font-mono,monospace)}.reader-toolbar[hidden],.reader-popover[hidden]{display:none}.reader-toolbar-status{padding:0 6px;color:var(--muted,#666)}.reader-toolbar button,.reader-popover button{border:1px solid var(--line,#ccc);border-radius:999px;background:var(--surface-alt,#f5f5f5);color:inherit;padding:6px 9px;font:inherit;cursor:pointer}.reader-popover{width:min(360px,calc(100vw - 24px));align-items:stretch;flex-direction:column;padding:12px}.reader-popover-quote{margin:0;color:var(--muted,#666);font-style:italic;line-height:1.45}.reader-popover textarea{width:100%;min-height:84px;resize:vertical;border:1px solid var(--line,#ccc);border-radius:7px;padding:8px;background:var(--bg,#fff);color:inherit;font:13px/1.4 var(--font-body,sans-serif)}.reader-popover-actions{display:flex;gap:6px}.reader-remove{margin-left:auto;color:var(--danger,#b91c1c)!important}';\n document.head.append(style);\n const toolbar = document.createElement('div'); toolbar.className = 'reader-toolbar'; toolbar.hidden = true;\n toolbar.innerHTML = '<span class=\"reader-toolbar-status\">Copied</span><span aria-hidden=\"true\">\u00B7</span><button type=\"button\" data-reader-action=\"highlight\">Highlight</button><span aria-hidden=\"true\">\u00B7</span><button type=\"button\" data-reader-action=\"note\">Note</button>';\n document.body.append(toolbar);\n const popover = document.createElement('div'); popover.className = 'reader-popover'; popover.hidden = true;\n popover.innerHTML = '<p class=\"reader-popover-quote\"></p><textarea aria-label=\"Note\" placeholder=\"Attach a note\u2026\"></textarea><div class=\"reader-popover-actions\"><button type=\"button\" data-reader-action=\"copy\">Copy</button><button type=\"button\" class=\"reader-remove\" data-reader-action=\"remove\">Remove</button></div>';\n document.body.append(popover);\n let pending = null; let activeId = null; let noteTimer;\n const place = (element, rect) => { element.style.left = Math.max(8, Math.min(innerWidth - element.offsetWidth - 8, rect.left)) + 'px'; element.style.top = Math.max(8, rect.bottom + 8) + 'px'; };\n const openNote = (item, rect) => {\n activeId = item.id; toolbar.hidden = true; popover.hidden = false;\n popover.querySelector('.reader-popover-quote').textContent = '\u201C' + item.quote + '\u201D'; popover.querySelector('textarea').value = item.note || '';\n place(popover, rect);\n };\n const persistPending = (open) => {\n if (!pending) return;\n const duplicate = highlights.find((item) => item.start.anchor === pending.start.anchor && item.start.offset === pending.start.offset && item.end.anchor === pending.end.anchor && item.end.offset === pending.end.offset);\n const item = duplicate || { id: Date.now().toString(36) + Math.random().toString(36).slice(2), ...pending, created_at: new Date().toISOString() };\n if (!duplicate) highlights.push(item);\n write(); toolbar.hidden = true; render();\n if (open) openNote(item, pending.rect);\n };\n\n root.addEventListener('mouseup', () => {\n const selection = getSelection(); if (!selection || selection.isCollapsed || !selection.rangeCount) return;\n const range = selection.getRangeAt(0); const startAnchor = range.startContainer.parentElement?.closest('[data-reader-anchor]'); const endAnchor = range.endContainer.parentElement?.closest('[data-reader-anchor]');\n if (!startAnchor || !endAnchor || !root.contains(startAnchor) || !root.contains(endAnchor)) return;\n const startOffset = offsetAt(startAnchor, range.startContainer, range.startOffset); const endOffset = offsetAt(endAnchor, range.endContainer, range.endOffset);\n if (startOffset === null || endOffset === null) return;\n const startIndex = anchors.indexOf(startAnchor); const endIndex = anchors.indexOf(endAnchor);\n if (startIndex > endIndex || (startIndex === endIndex && startOffset >= endOffset)) return;\n const quote = selection.toString(); const rect = range.getBoundingClientRect();\n pending = { quote, note: '', section: startAnchor.dataset.readerSection || 'document', start: { anchor: startAnchor.dataset.readerAnchor, offset: startOffset }, end: { anchor: endAnchor.dataset.readerAnchor, offset: endOffset }, rect };\n navigator.clipboard?.writeText(quote).catch(() => {});\n popover.hidden = true; toolbar.hidden = false; requestAnimationFrame(() => place(toolbar, rect));\n });\n toolbar.addEventListener('mousedown', (event) => event.preventDefault());\n toolbar.addEventListener('click', (event) => {\n const action = event.target.closest('button')?.dataset.readerAction;\n if (action === 'highlight') persistPending(false);\n if (action === 'note') persistPending(true);\n });\n root.addEventListener('click', (event) => {\n const mark = event.target.closest('mark[data-highlight-id]'); if (!mark || !root.contains(mark)) return;\n event.preventDefault(); event.stopPropagation();\n const item = highlights.find((value) => value.id === mark.dataset.highlightId); if (item) openNote(item, mark.getBoundingClientRect());\n });\n popover.querySelector('textarea').addEventListener('input', (event) => {\n clearTimeout(noteTimer); noteTimer = setTimeout(() => {\n const item = highlights.find((value) => value.id === activeId); if (item) { item.note = event.target.value; write(); }\n }, 600);\n });\n popover.addEventListener('click', (event) => {\n const action = event.target.closest('button')?.dataset.readerAction; const item = highlights.find((value) => value.id === activeId); if (!item) return;\n if (action === 'copy') navigator.clipboard?.writeText(item.quote).catch(() => {});\n if (action === 'remove') { highlights = highlights.filter((value) => value.id !== activeId); write(); popover.hidden = true; render(); }\n });\n render();\n})();\n</script>";