@p11-core/cli 0.0.10 → 0.0.12

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/dist/index.js CHANGED
@@ -3466,8 +3466,11 @@ var require_commander = __commonJS({
3466
3466
  });
3467
3467
 
3468
3468
  // src/index.ts
3469
+ import { randomUUID } from "crypto";
3469
3470
  import { realpathSync } from "fs";
3470
3471
  import { chmod, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from "fs/promises";
3472
+ import http from "http";
3473
+ import https from "https";
3471
3474
  import { createRequire } from "module";
3472
3475
  import { homedir, tmpdir } from "os";
3473
3476
  import path from "path";
@@ -3503,11 +3506,16 @@ var nodeRequire = createRequire(import.meta.url);
3503
3506
  var packageJson = nodeRequire("../package.json");
3504
3507
  var builtDefaultApiUrl = "https://p11.rarexlabs.com";
3505
3508
  var defaultApiUrl = process.env.P11_API_URL || builtDefaultApiUrl;
3509
+ var builtPostHogKey = "phc_CftZMyBB3bMZQRj3CmJovHB3kvzwJmQhXSwUBgzUTUi6";
3510
+ var builtPostHogHost = "https://us.i.posthog.com";
3511
+ var builtAppEnv = "production";
3506
3512
  var generate = nodeRequire("@babel/generator").default;
3507
3513
  var traverse = nodeRequire("@babel/traverse").default;
3508
3514
  var updateCheckIntervalMs = 30 * 60 * 1e3;
3509
3515
  var updateCheckTimeoutMs = 800;
3516
+ var telemetryTimeoutMs = 300;
3510
3517
  var P11_HISTORY_FILE = "history.json";
3518
+ var P11_TELEMETRY_FILE = "telemetry.json";
3511
3519
  var P11_HISTORY_DIR_MODE = 448;
3512
3520
  var P11_HISTORY_FILE_MODE = 384;
3513
3521
  var P11_HISTORY_LOCK_STALE_MS = 3e4;
@@ -3659,37 +3667,79 @@ Examples:
3659
3667
 
3660
3668
  Environment:
3661
3669
  P11_API_URL Defaults to ${builtDefaultApiUrl}
3662
- P11_BUILD_DIR Directory for temporary share build files. Defaults to the OS temp directory.`
3670
+ P11_BUILD_DIR Directory for temporary share build files. Defaults to the OS temp directory.
3671
+ P11_TELEMETRY_DISABLED=1 disables anonymous usage analytics.`
3663
3672
  );
3664
3673
  const shareCommand = program2.command("share").description("Share a review link for a page.").argument("[page.tsx]").option("--json", "Print the API response as JSON.").option("--edit-url [url]", "Share a new version using an edit URL or edit id.").option("--api-url [url]", "Override the p11 API URL.").option("--build-dir [dir]", "Directory for temporary build files.").action(async (input, options2) => {
3665
- await publish(input, normalizePublishOptions(options2));
3674
+ await runCliAction(
3675
+ "share",
3676
+ {
3677
+ has_input: Boolean(input),
3678
+ json: Boolean(options2.json),
3679
+ edit_url: typeof options2.editUrl === "string",
3680
+ api_url_override: typeof options2.apiUrl === "string",
3681
+ build_dir_override: typeof options2.buildDir === "string"
3682
+ },
3683
+ () => publish(input, normalizePublishOptions(options2))
3684
+ );
3666
3685
  });
3667
3686
  allowLegacyParserBehavior(shareCommand);
3668
3687
  const commentsCommand = program2.command("comments").description("Fetch exported comments for a read/edit URL or id.").argument("[readUrl|editUrl|readId|editId]").option("--json", "Print comments as JSON.").option("--output [file]", "Write comments JSON to a file.").option("--version [n]", "Fetch comments for a specific page version.").option("--api-url [url]", "Override the p11 API URL.").action(async (target, options2) => {
3669
- await comments(target, normalizeCommentsOptions(options2));
3688
+ await runCliAction(
3689
+ "comments",
3690
+ {
3691
+ has_target: Boolean(target),
3692
+ json: Boolean(options2.json),
3693
+ output: typeof options2.output === "string",
3694
+ version: typeof options2.version === "string",
3695
+ api_url_override: typeof options2.apiUrl === "string"
3696
+ },
3697
+ () => comments(target, normalizeCommentsOptions(options2))
3698
+ );
3670
3699
  });
3671
3700
  allowLegacyParserBehavior(commentsCommand);
3672
3701
  const deleteCommand = program2.command("delete").description("Delete a document and all of its versions and comments.").argument("[editUrl|editId]").option("--json", "Print the API response as JSON.").option("--api-url [url]", "Override the p11 API URL.").action(async (target, options2) => {
3673
- await deleteDocument(target, normalizeDeleteOptions(options2));
3702
+ await runCliAction(
3703
+ "delete",
3704
+ {
3705
+ has_target: Boolean(target),
3706
+ json: Boolean(options2.json),
3707
+ api_url_override: typeof options2.apiUrl === "string"
3708
+ },
3709
+ () => deleteDocument(target, normalizeDeleteOptions(options2))
3710
+ );
3674
3711
  });
3675
3712
  allowLegacyParserBehavior(deleteCommand);
3676
3713
  program2.command("version").description("Print the p11 CLI version.").action(async () => {
3677
- await warnBeforeAction({ force: true });
3678
- console.log(packageJson.version);
3714
+ await runCliAction("version", {}, async () => {
3715
+ await warnBeforeAction({ force: true });
3716
+ console.log(packageJson.version);
3717
+ });
3679
3718
  });
3680
3719
  program2.command("history").description("List saved read/edit links.").option("--json", "Print saved history as JSON.").action(async (options2) => {
3681
- await history(normalizeHistoryOptions(options2));
3720
+ await runCliAction("history", { json: Boolean(options2.json) }, () => history(normalizeHistoryOptions(options2)));
3682
3721
  });
3683
3722
  const docsCommand = program2.command("docs").description("Print p11 authoring docs.").argument("[topic]", "Docs topic: components or sharing.").action(async (topic) => {
3684
- await docs(topic);
3723
+ await runCliAction("docs", { has_topic: Boolean(topic), known_topic: isKnownDocsTopic(topic) }, () => docs(topic));
3685
3724
  });
3686
3725
  allowLegacyParserBehavior(docsCommand);
3687
3726
  const exampleCommand = program2.command("example").description("Print or write a p11 example document.").argument("[name]", "Example name: minimal or all.").option("--output [file]", "Write the example to a file.").action(async (name, options2) => {
3688
- await example(name, normalizeExampleOptions(options2));
3727
+ await runCliAction(
3728
+ "example",
3729
+ {
3730
+ has_example: Boolean(name),
3731
+ known_example: isKnownExampleName(name),
3732
+ output: typeof options2.output === "string"
3733
+ },
3734
+ () => example(name, normalizeExampleOptions(options2))
3735
+ );
3689
3736
  });
3690
3737
  allowLegacyParserBehavior(exampleCommand);
3691
3738
  return program2;
3692
3739
  }
3740
+ var __testing = {
3741
+ captureCliTelemetry: captureCliTelemetryNow
3742
+ };
3693
3743
  function isKnownTopLevelCommand(program2, command) {
3694
3744
  return command === "--help" || command === "-h" || isVersionFlag(command) || command === "help" || program2.commands.some((subcommand) => subcommand.name() === command);
3695
3745
  }
@@ -3699,6 +3749,31 @@ function isVersionFlag(command) {
3699
3749
  function allowLegacyParserBehavior(command) {
3700
3750
  return command.allowUnknownOption().allowExcessArguments();
3701
3751
  }
3752
+ function isKnownDocsTopic(topic) {
3753
+ return docsTopics.has(topic ?? "index");
3754
+ }
3755
+ function isKnownExampleName(name) {
3756
+ return name === void 0 || exampleFiles.has(name);
3757
+ }
3758
+ async function runCliAction(command, properties, action) {
3759
+ const startedAt = Date.now();
3760
+ try {
3761
+ await action();
3762
+ captureCliTelemetry("p11_cli_command_succeeded", {
3763
+ command,
3764
+ duration_ms: Date.now() - startedAt,
3765
+ ...properties
3766
+ });
3767
+ } catch (error) {
3768
+ await captureCliTelemetryNow("p11_cli_command_failed", {
3769
+ command,
3770
+ duration_ms: Date.now() - startedAt,
3771
+ error_name: error instanceof Error ? error.name : "Error",
3772
+ ...properties
3773
+ });
3774
+ throw error;
3775
+ }
3776
+ }
3702
3777
  function normalizePublishOptions(options) {
3703
3778
  return {
3704
3779
  json: options.json,
@@ -4037,6 +4112,130 @@ function delay(ms) {
4037
4112
  function historyFilePath() {
4038
4113
  return path.join(homedir(), ".p11", P11_HISTORY_FILE);
4039
4114
  }
4115
+ function captureCliTelemetry(event, properties = {}) {
4116
+ scheduleTelemetry(() => captureCliTelemetryNow(event, properties, { keepAlive: false }));
4117
+ }
4118
+ async function captureCliTelemetryNow(event, properties = {}, options = {}) {
4119
+ const key = postHogKey();
4120
+ if (!key) return;
4121
+ try {
4122
+ const host = postHogHost();
4123
+ const { anonymousId, isNew } = await telemetryIdentity();
4124
+ const baseProperties = cliTelemetryBaseProperties();
4125
+ const events = [];
4126
+ if (isNew && event !== "p11_cli_activated") {
4127
+ events.push(sendPostHogEvent(host, key, "p11_cli_activated", anonymousId, baseProperties, options));
4128
+ }
4129
+ events.push(sendPostHogEvent(host, key, event, anonymousId, { ...baseProperties, ...properties }, options));
4130
+ await Promise.all(events);
4131
+ } catch {
4132
+ }
4133
+ }
4134
+ function scheduleTelemetry(task) {
4135
+ const run = () => {
4136
+ task().catch(() => {
4137
+ });
4138
+ };
4139
+ if (typeof setImmediate === "function") {
4140
+ setImmediate(run);
4141
+ return;
4142
+ }
4143
+ setTimeout(run, 0);
4144
+ }
4145
+ async function sendPostHogEvent(host, key, event, distinctId, properties, options = {}) {
4146
+ const payload = JSON.stringify({
4147
+ api_key: key,
4148
+ event,
4149
+ distinct_id: distinctId,
4150
+ properties: compactObject(properties)
4151
+ });
4152
+ const endpoint = new URL("/capture/", host);
4153
+ const client = endpoint.protocol === "http:" ? http : https;
4154
+ await new Promise((resolve, reject) => {
4155
+ const request = client.request(
4156
+ endpoint,
4157
+ {
4158
+ method: "POST",
4159
+ headers: {
4160
+ "content-type": "application/json",
4161
+ "content-length": Buffer.byteLength(payload)
4162
+ }
4163
+ },
4164
+ (response) => {
4165
+ response.resume();
4166
+ response.on("end", resolve);
4167
+ }
4168
+ );
4169
+ const timeout = setTimeout(() => {
4170
+ request.destroy(new Error("Telemetry request timed out."));
4171
+ }, telemetryTimeoutMs);
4172
+ if (options.keepAlive === false) timeout.unref?.();
4173
+ request.on("socket", (socket) => {
4174
+ if (options.keepAlive === false) socket.unref();
4175
+ });
4176
+ request.on("error", reject);
4177
+ request.on("close", () => clearTimeout(timeout));
4178
+ request.end(payload);
4179
+ });
4180
+ }
4181
+ function cliTelemetryBaseProperties() {
4182
+ return {
4183
+ product: "p11",
4184
+ surface: "cli",
4185
+ app_env: analyticsEnv(),
4186
+ cli_version: packageJson.version,
4187
+ node_version: process.versions.node,
4188
+ platform: process.platform,
4189
+ arch: process.arch
4190
+ };
4191
+ }
4192
+ function postHogKey() {
4193
+ if (isTruthyEnv(process.env.P11_TELEMETRY_DISABLED) || isTruthyEnv(process.env.DO_NOT_TRACK)) return "";
4194
+ return (process.env.P11_POSTHOG_KEY || builtPostHogKey || "").trim();
4195
+ }
4196
+ function postHogHost() {
4197
+ const rawHost = (process.env.P11_POSTHOG_HOST || builtPostHogHost || "https://us.i.posthog.com").trim();
4198
+ try {
4199
+ return new URL(rawHost.endsWith("/") ? rawHost : `${rawHost}/`);
4200
+ } catch {
4201
+ return new URL("https://us.i.posthog.com/");
4202
+ }
4203
+ }
4204
+ function isTruthyEnv(value) {
4205
+ return value === "1" || value === "true" || value === "yes";
4206
+ }
4207
+ function analyticsEnv() {
4208
+ return (process.env.APP_ENV || builtAppEnv || "production").trim() || "production";
4209
+ }
4210
+ async function telemetryIdentity() {
4211
+ const filePath = telemetryFilePath();
4212
+ const raw = await readFile(filePath, "utf8").catch(() => null);
4213
+ if (raw) {
4214
+ const parsed = JSON.parse(raw);
4215
+ if (typeof parsed.anonymousId === "string" && /^anon_[A-Za-z0-9-]{12,80}$/.test(parsed.anonymousId)) {
4216
+ return {
4217
+ anonymousId: parsed.anonymousId,
4218
+ isNew: false
4219
+ };
4220
+ }
4221
+ }
4222
+ const data = {
4223
+ anonymousId: `anon_${randomUUID()}`,
4224
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
4225
+ };
4226
+ const telemetryDir = path.dirname(filePath);
4227
+ await ensurePrivateHistoryDir(telemetryDir);
4228
+ await writeFile(filePath, `${JSON.stringify(data, null, 2)}
4229
+ `, { mode: P11_HISTORY_FILE_MODE });
4230
+ await chmod(filePath, P11_HISTORY_FILE_MODE);
4231
+ return {
4232
+ anonymousId: data.anonymousId,
4233
+ isNew: true
4234
+ };
4235
+ }
4236
+ function telemetryFilePath() {
4237
+ return path.join(homedir(), ".p11", P11_TELEMETRY_FILE);
4238
+ }
4040
4239
  function commentsExportJson(data) {
4041
4240
  return JSON.stringify(commentExportData(data), null, 2);
4042
4241
  }
@@ -4544,6 +4743,7 @@ function parseUrlVersion(value) {
4544
4743
  }
4545
4744
  }
4546
4745
  export {
4746
+ __testing,
4547
4747
  addSourceLineAttributes,
4548
4748
  appendPublishHistory,
4549
4749
  buildPageModule,
@@ -76,7 +76,7 @@ Supported languages include TypeScript, JavaScript, Python, Rust, HTML/XML, CSS,
76
76
 
77
77
  ## Validation
78
78
 
79
- `p11 share` validates the document before build and upload.
79
+ Before sharing, `p11 share` validates the document.
80
80
 
81
81
  Do not import or render app/control components such as:
82
82
 
package/docs/index.md CHANGED
@@ -14,7 +14,7 @@ p11 comments <readUrl|editUrl|readId|editId>
14
14
  p11 delete <editUrl|editId>
15
15
  ```
16
16
 
17
- Add `--json` when scripting or when exact structured fields are needed.
17
+ For `share`, `history`, `comments`, and `delete`, add `--json` when scripting or when exact structured fields are needed.
18
18
 
19
19
  ## Docs Topics
20
20
 
package/docs/sharing.md CHANGED
@@ -35,6 +35,6 @@ p11 delete <editUrl|editId>
35
35
  Add `--json` when scripting or when exact structured fields are needed.
36
36
 
37
37
  `P11_API_URL` overrides the default API URL. `--api-url <url>` can override it per command.
38
- Temporary share builds are created under the OS temp directory by default. Use `P11_BUILD_DIR` or `--build-dir <dir>` only when you need to inspect or redirect the transient build workspace.
38
+ Use `P11_BUILD_DIR` or `--build-dir <dir>` only when you need a custom working directory while sharing.
39
39
 
40
40
  Edit URLs are bearer credentials for updating or deleting a document. Keep them private.
@@ -26,7 +26,7 @@ import {
26
26
  } from "@p11-core/components";
27
27
 
28
28
  const figureSrc =
29
- "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 720 240'%3E%3Crect width='720' height='240' fill='%23f8fafc'/%3E%3Cpath d='M80 172h560' stroke='%23d4d4d8' stroke-width='2'/%3E%3Ccircle cx='160' cy='132' r='42' fill='%2318181b'/%3E%3Crect x='260' y='92' width='120' height='80' rx='8' fill='%2352525b'/%3E%3Cpath d='M460 172 540 72l80 100z' fill='%2371717a'/%3E%3Ctext x='80' y='52' font-family='Inter, Arial' font-size='28' font-weight='700' fill='%2318181b'%3Ep11 document figure%3C/text%3E%3C/svg%3E";
29
+ "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 720 240'%3E%3Crect width='720' height='240' fill='%23f8fafc'/%3E%3Cpath d='M80 172h560' stroke='%23d4d4d8' stroke-width='2'/%3E%3Ccircle cx='160' cy='132' r='42' fill='%2318181b'/%3E%3Crect x='260' y='92' width='120' height='80' rx='8' fill='%2352525b'/%3E%3Cpath d='M460 172 540 72l80 100z' fill='%2371717a'/%3E%3Ctext x='80' y='52' font-family='Inter, Arial' font-size='28' font-weight='700' fill='%2318181b'%3ESample document figure%3C/text%3E%3C/svg%3E";
30
30
 
31
31
  export default function All() {
32
32
  return (
@@ -35,26 +35,25 @@ export default function All() {
35
35
  <Section>
36
36
  <Heading level={1}>All Components Showcase</Heading>
37
37
  <Text>
38
- This example replaces the original decision brief with a compact
39
- tour of every document-safe component exported by{" "}
40
- <code>@p11-core/components</code>. It also includes safe inline markup
41
- such as <strong>strong text</strong>, <em>emphasis</em>,{" "}
38
+ This example is a compact tour of every available document
39
+ component. It also includes common inline markup such as{" "}
40
+ <strong>strong text</strong>, <em>emphasis</em>,{" "}
42
41
  <code>inline code</code>,{" "}
43
42
  <Strikethrough>obsolete wording</Strikethrough>, and a{" "}
44
- <a href="https://example.com">print-safe link</a>.
43
+ <a href="https://example.com">sample link</a>.
45
44
  </Text>
46
45
  <Quote>
47
- The page is intentionally broad: authors can use it to inspect
48
- screen layout, print pagination, source-line anchors, tables,
49
- figures, and syntax highlighting in one shared document.
46
+ The page is intentionally broad: authors can inspect text hierarchy,
47
+ lists, tables, figures, page breaks, and syntax highlighting in one
48
+ sample document.
50
49
  </Quote>
51
50
  </Section>
52
51
 
53
52
  <Section>
54
53
  <Heading>1. Text Hierarchy</Heading>
55
54
  <Text>
56
- The heading component supports levels one through six while keeping
57
- the document printable and commentable.
55
+ The heading component supports levels one through six for clear
56
+ document structure.
58
57
  </Text>
59
58
  <Heading level={2}>Level Two Heading</Heading>
60
59
  <Text>
@@ -73,21 +72,21 @@ export default function All() {
73
72
  <Section>
74
73
  <Heading>2. Lists</Heading>
75
74
  <Text>
76
- Unordered lists work for parallel facts and short capabilities.
75
+ Unordered lists work for parallel facts and concise observations.
77
76
  </Text>
78
77
  <List>
79
- <ListItem>Share static React-authored documents.</ListItem>
80
- <ListItem>Allow anonymous comments on text selections.</ListItem>
78
+ <ListItem>Summarize goals and outcomes.</ListItem>
79
+ <ListItem>Group related facts into scannable entries.</ListItem>
81
80
  <ListItem>
82
- Export comments with source file and line anchors.
81
+ Keep supporting details close to the relevant topic.
83
82
  </ListItem>
84
83
  </List>
85
84
  <Text>Ordered lists work for procedural steps.</Text>
86
85
  <List ordered>
87
- <ListItem>Author a document file.</ListItem>
88
- <ListItem>Share it with the CLI.</ListItem>
86
+ <ListItem>Draft the initial material.</ListItem>
87
+ <ListItem>Review the structure and supporting evidence.</ListItem>
89
88
  <ListItem>
90
- Review the screen view and browser print output.
89
+ Prepare the final version for its audience.
91
90
  </ListItem>
92
91
  </List>
93
92
  </Section>
@@ -102,12 +101,12 @@ export default function All() {
102
101
  <DefinitionList>
103
102
  <DefinitionTerm>Page</DefinitionTerm>
104
103
  <DefinitionDescription>
105
- A printable document surface with fixed letter-sized dimensions.
104
+ A bounded document surface used to organize related sections.
106
105
  </DefinitionDescription>
107
- <DefinitionTerm>Comment anchor</DefinitionTerm>
106
+ <DefinitionTerm>Margin note</DefinitionTerm>
108
107
  <DefinitionDescription>
109
- Source metadata attached to document text so reviewer feedback can
110
- point back to authored content.
108
+ A short observation that adds context without interrupting the
109
+ main flow.
111
110
  </DefinitionDescription>
112
111
  </DefinitionList>
113
112
  </Section>
@@ -118,27 +117,27 @@ export default function All() {
118
117
  <TableHeader>
119
118
  <TableRow>
120
119
  <TableHead>Component</TableHead>
121
- <TableHead>Rendered Tag</TableHead>
120
+ <TableHead>Example Use</TableHead>
122
121
  <TableHead>Purpose</TableHead>
123
122
  </TableRow>
124
123
  </TableHeader>
125
124
  <TableBody>
126
125
  <TableRow>
127
126
  <TableCell>TableHeader</TableCell>
128
- <TableCell>thead</TableCell>
127
+ <TableCell>Column labels</TableCell>
129
128
  <TableCell>
130
- Groups the header rows for print-safe tables.
129
+ Groups the header rows for structured data.
131
130
  </TableCell>
132
131
  </TableRow>
133
132
  <TableRow>
134
133
  <TableCell>TableBody</TableCell>
135
- <TableCell>tbody</TableCell>
134
+ <TableCell>Table content</TableCell>
136
135
  <TableCell>Groups the body rows and cells.</TableCell>
137
136
  </TableRow>
138
137
  <TableRow>
139
138
  <TableCell>TableHead and TableCell</TableCell>
140
- <TableCell>th and td</TableCell>
141
- <TableCell>Provide commentable table content.</TableCell>
139
+ <TableCell>Labels and values</TableCell>
140
+ <TableCell>Present comparable table content.</TableCell>
142
141
  </TableRow>
143
142
  </TableBody>
144
143
  </Table>
@@ -149,11 +148,11 @@ export default function All() {
149
148
  <Figure>
150
149
  <img
151
150
  src={figureSrc}
152
- alt="Abstract p11 document figure with simple geometric marks"
151
+ alt="Abstract sample document figure with simple geometric marks"
153
152
  />
154
153
  <Caption>
155
- Figure 1. Figure and Caption components keep visual evidence with
156
- its explanatory text.
154
+ Figure 1. Figure and Caption components keep visual material with
155
+ its explanation.
157
156
  </Caption>
158
157
  </Figure>
159
158
  </Section>
@@ -166,18 +165,18 @@ export default function All() {
166
165
  <Heading>6. TypeScript</Heading>
167
166
  <CodeBlock language="typescript">
168
167
  {code`
169
- type ShareOptions = {
170
- input: string;
171
- comments?: boolean;
168
+ type BriefOptions = {
169
+ title: string;
170
+ includeSummary?: boolean;
172
171
  };
173
172
 
174
- export async function share(options: ShareOptions) {
175
- const response = await fetch("/api/pages", {
173
+ export async function createBrief(options: BriefOptions) {
174
+ const response = await fetch("/api/briefs", {
176
175
  method: "POST",
177
176
  body: JSON.stringify(options)
178
177
  });
179
178
 
180
- return response.json() as Promise<{ docId: string; readUrl: string; editUrl: string; version: number }>;
179
+ return response.json() as Promise<{ id: string; title: string; updatedAt: string }>;
181
180
  }
182
181
  `}
183
182
  </CodeBlock>
@@ -187,11 +186,11 @@ export default function All() {
187
186
  <Heading>7. JavaScript</Heading>
188
187
  <CodeBlock language="javascript">
189
188
  {code`
190
- const pages = new Map();
189
+ const notes = new Map();
191
190
 
192
- export function rememberPage(page) {
193
- pages.set(page.id, {
194
- ...page,
191
+ export function rememberNote(note) {
192
+ notes.set(note.id, {
193
+ ...note,
195
194
  updatedAt: new Date().toISOString()
196
195
  });
197
196
  }
@@ -206,12 +205,12 @@ export default function All() {
206
205
  from dataclasses import dataclass
207
206
 
208
207
  @dataclass
209
- class Comment:
210
- author: str
211
- body: str
208
+ class Task:
209
+ owner: str
210
+ title: str
212
211
 
213
- def preview(comment: Comment) -> str:
214
- return f"{comment.author}: {comment.body[:48]}"
212
+ def preview(task: Task) -> str:
213
+ return f"{task.owner}: {task.title[:48]}"
215
214
  `}
216
215
  </CodeBlock>
217
216
  </Section>
@@ -221,13 +220,13 @@ export default function All() {
221
220
  <CodeBlock language="rust">
222
221
  {code`
223
222
  #[derive(Debug)]
224
- struct Page<'a> {
223
+ struct Milestone<'a> {
225
224
  id: &'a str,
226
- comments_enabled: bool,
225
+ complete: bool,
227
226
  }
228
227
 
229
- fn describe(page: &Page) -> String {
230
- format!("{} comments={}", page.id, page.comments_enabled)
228
+ fn describe(milestone: &Milestone) -> String {
229
+ format!("{} complete={}", milestone.id, milestone.complete)
231
230
  }
232
231
  `}
233
232
  </CodeBlock>
@@ -237,9 +236,9 @@ export default function All() {
237
236
  <Heading>10. HTML And XML</Heading>
238
237
  <CodeBlock language="html">
239
238
  {code`
240
- <article class="p11-page">
239
+ <article class="sample-page">
241
240
  <h1>All Components Showcase</h1>
242
- <p data-p11-block>Reviewers can comment on document text.</p>
241
+ <p>Each section demonstrates a different document pattern.</p>
243
242
  </article>
244
243
  `}
245
244
  </CodeBlock>
@@ -253,13 +252,13 @@ export default function All() {
253
252
  <Heading>11. CSS</Heading>
254
253
  <CodeBlock language="css">
255
254
  {code`
256
- .p11-page {
255
+ .sample-page {
257
256
  color: #27272a;
258
- font-family: var(--p11-font-body);
257
+ font-family: ui-serif, Georgia, serif;
259
258
  line-height: 1.62;
260
259
  }
261
260
 
262
- .p11-code-block code.hljs {
261
+ .sample-code-block code {
263
262
  background: transparent;
264
263
  }
265
264
  `}
@@ -271,9 +270,8 @@ export default function All() {
271
270
  <CodeBlock language="json">
272
271
  {code`
273
272
  {
274
- "docId": "all",
273
+ "title": "All Components Showcase",
275
274
  "version": 2,
276
- "comments": true,
277
275
  "languages": ["typescript", "javascript", "python", "rust", "html", "css", "json", "yaml", "bash"]
278
276
  }
279
277
  `}
@@ -285,10 +283,8 @@ export default function All() {
285
283
  <CodeBlock language="yaml">
286
284
  {code`
287
285
  document:
288
- id: all
286
+ title: All Components Showcase
289
287
  version: 2
290
- comments: true
291
- retentionDays: 7
292
288
  languages:
293
289
  - typescript
294
290
  - javascript
@@ -307,8 +303,8 @@ export default function All() {
307
303
  <Heading>14. Bash</Heading>
308
304
  <CodeBlock language="bash">
309
305
  {code`
310
- p11 share ./all.tsx
311
- p11 comments <readUrl> --version 1
306
+ mkdir -p notes
307
+ printf "Summary ready\n" > notes/summary.txt
312
308
  `}
313
309
  </CodeBlock>
314
310
  </Section>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@p11-core/cli",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "bin": {