@p11-core/cli 0.0.3 → 0.0.5

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
@@ -3519,7 +3519,7 @@ var cliPackageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)),
3519
3519
  var docsTopics = /* @__PURE__ */ new Map([
3520
3520
  ["index", "docs/index.md"],
3521
3521
  ["components", "docs/components.md"],
3522
- ["publishing", "docs/publishing.md"]
3522
+ ["sharing", "docs/sharing.md"]
3523
3523
  ]);
3524
3524
  var exampleFiles = /* @__PURE__ */ new Map([["all-components", "examples/all-components.tsx"]]);
3525
3525
  var allowedDocumentComponents = /* @__PURE__ */ new Set([
@@ -3630,7 +3630,7 @@ async function main() {
3630
3630
  }
3631
3631
  function createCliProgram() {
3632
3632
  const program2 = new Command();
3633
- program2.name("p11").description("Publish and inspect p11 document pages.");
3633
+ program2.name("p11").description("Share and inspect p11 document pages.");
3634
3634
  program2.addHelpText(
3635
3635
  "after",
3636
3636
  `
@@ -3638,20 +3638,20 @@ function createCliProgram() {
3638
3638
  Environment:
3639
3639
  P11_API_URL Defaults to ${builtDefaultApiUrl}`
3640
3640
  );
3641
- const publishCommand = program2.command("publish").description("Publish a page module.").argument("[page.tsx]").option("--json", "Print the API response as JSON.").option("--edit-url [url]", "Update an existing page using an edit URL or edit id.").option("--api-url [url]", "Override the p11 API URL.").action(async (input, options) => {
3641
+ 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.").action(async (input, options) => {
3642
3642
  await warnIfUpdateAvailable();
3643
3643
  await publish(input, normalizePublishOptions(options));
3644
3644
  });
3645
- allowLegacyParserBehavior(publishCommand);
3645
+ allowLegacyParserBehavior(shareCommand);
3646
3646
  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, options) => {
3647
3647
  await warnIfUpdateAvailable();
3648
3648
  await comments(target, normalizeCommentsOptions(options));
3649
3649
  });
3650
3650
  allowLegacyParserBehavior(commentsCommand);
3651
- program2.command("history").description("List saved publish read/edit URLs.").option("--json", "Print saved history as JSON.").action(async (options) => {
3651
+ program2.command("history").description("List saved read/edit links.").option("--json", "Print saved history as JSON.").action(async (options) => {
3652
3652
  await history(normalizeHistoryOptions(options));
3653
3653
  });
3654
- const docsCommand = program2.command("docs").description("Print p11 authoring docs.").argument("[topic]", "Docs topic: components or publishing.").action(async (topic) => {
3654
+ const docsCommand = program2.command("docs").description("Print p11 authoring docs.").argument("[topic]", "Docs topic: components or sharing.").action(async (topic) => {
3655
3655
  await docs(topic);
3656
3656
  });
3657
3657
  allowLegacyParserBehavior(docsCommand);
@@ -3697,15 +3697,15 @@ function optionString(value, missingValueMessage) {
3697
3697
  return typeof value === "string" ? value : void 0;
3698
3698
  }
3699
3699
  async function publish(input, options) {
3700
- if (!input) throw new Error("Usage: p11 publish <page.tsx> [--json] [--edit-url URL]");
3700
+ if (!input) throw new Error("Usage: p11 share <page.tsx> [--json] [--edit-url URL]");
3701
3701
  const resolvedInput = path.resolve(input);
3702
3702
  const inputStat = await stat(resolvedInput).catch(() => null);
3703
3703
  if (!inputStat) throw new Error(`Path does not exist: ${input}`);
3704
3704
  if (!inputStat.isFile()) {
3705
- throw new Error("Input must be a .tsx, .jsx, .ts, or .js page module.");
3705
+ throw new Error("Input must be a .tsx, .jsx, .ts, or .js page file.");
3706
3706
  }
3707
3707
  if (!/\.[cm]?[tj]sx?$/.test(resolvedInput)) {
3708
- throw new Error("File input must be a .tsx, .jsx, .ts, or .js page module.");
3708
+ throw new Error("File input must be a .tsx, .jsx, .ts, or .js page file.");
3709
3709
  }
3710
3710
  const cleanupDir = await mkdtemp(path.join(process.cwd(), ".p11-build-"));
3711
3711
  const distDir = path.join(cleanupDir, "dist");
@@ -3728,14 +3728,14 @@ async function publish(input, options) {
3728
3728
  });
3729
3729
  const text = await response.text();
3730
3730
  if (!response.ok) {
3731
- throw new Error(`Publish failed (${response.status}): ${responseErrorMessage(text)}`);
3731
+ throw new Error(`Share failed (${response.status}): ${responseErrorMessage(text)}`);
3732
3732
  }
3733
3733
  const data = JSON.parse(text);
3734
3734
  await appendPublishHistory(data, {
3735
3735
  apiUrl,
3736
3736
  source: resolvedInput
3737
3737
  }).catch((error) => {
3738
- console.error(`Warning: published, but could not save history: ${errorMessage(error)}`);
3738
+ console.error(`Warning: shared, but could not save history: ${errorMessage(error)}`);
3739
3739
  });
3740
3740
  if (options.json) {
3741
3741
  console.log(JSON.stringify(data, null, 2));
@@ -3765,7 +3765,7 @@ async function docs(topic) {
3765
3765
  const normalizedTopic = topic ?? "index";
3766
3766
  const relativePath = docsTopics.get(normalizedTopic);
3767
3767
  if (!relativePath) {
3768
- throw new Error(`Unknown docs topic: ${normalizedTopic}. Available topics: components, publishing`);
3768
+ throw new Error(`Unknown docs topic: ${normalizedTopic}. Available topics: components, sharing`);
3769
3769
  }
3770
3770
  process.stdout.write(await readCliAsset(relativePath));
3771
3771
  }
@@ -3903,7 +3903,7 @@ async function removeStaleHistoryLock(lockDir) {
3903
3903
  }
3904
3904
  function printHistory(entries, limit) {
3905
3905
  if (entries.length === 0) {
3906
- console.log(`No history yet. Publish a document to create ${historyFilePath()}.`);
3906
+ console.log(`No history yet. Share a document to create ${historyFilePath()}.`);
3907
3907
  return;
3908
3908
  }
3909
3909
  const displayEntries = entries.slice(-limit).reverse();
@@ -4026,6 +4026,8 @@ async function buildPageModule(inputFile, outDir) {
4026
4026
  const pagePath = path.join(tempDir, "Page.tsx");
4027
4027
  const componentEntry = nodeRequire.resolve("@p11-core/components");
4028
4028
  const componentStyles = nodeRequire.resolve("@p11-core/components/styles.css");
4029
+ const textAnnotatorEntry = nodeRequire.resolve("@recogito/text-annotator");
4030
+ const textAnnotatorStyles = nodeRequire.resolve("@recogito/text-annotator/text-annotator.css");
4029
4031
  const pageSource = await readFile(inputFile, "utf8");
4030
4032
  const pageAst = parsePageSource(pageSource);
4031
4033
  validatePageAst(pageAst, inputFile);
@@ -4079,6 +4081,8 @@ async function buildPageModule(inputFile, outDir) {
4079
4081
  alias: {
4080
4082
  "@p11-core/components/styles.css": componentStyles,
4081
4083
  "@p11-core/components": componentEntry,
4084
+ "@recogito/text-annotator/text-annotator.css": textAnnotatorStyles,
4085
+ "@recogito/text-annotator": textAnnotatorEntry,
4082
4086
  "react/jsx-runtime": nodeRequire.resolve("react/jsx-runtime"),
4083
4087
  "react/jsx-dev-runtime": nodeRequire.resolve("react/jsx-dev-runtime"),
4084
4088
  "react-dom/client": nodeRequire.resolve("react-dom/client"),
@@ -1,6 +1,6 @@
1
1
  # p11 Components
2
2
 
3
- p11 documents are React modules that export a default component and import document-safe components from `@p11-core/components`.
3
+ p11 documents are React files that export a default component and import document-safe components from `@p11-core/components`.
4
4
 
5
5
  ## Minimal Document
6
6
 
@@ -76,7 +76,7 @@ Supported languages include TypeScript, JavaScript, Python, Rust, HTML/XML, CSS,
76
76
 
77
77
  ## Validation
78
78
 
79
- `p11 publish` validates the document before build and upload.
79
+ `p11 share` validates the document before build and upload.
80
80
 
81
81
  Do not import or render app/control components such as:
82
82
 
package/docs/index.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # p11 CLI Docs
2
2
 
3
- p11 publishes reviewable, public-but-unlisted document pages from React document modules.
3
+ p11 shares reviewable, public-but-unlisted document pages from React files.
4
4
 
5
5
  ## Common Commands
6
6
 
7
7
  ```bash
8
- p11 publish <page.tsx>
9
- p11 publish <page.tsx> --edit-url <editUrl>
8
+ p11 share <page.tsx>
9
+ p11 share <page.tsx> --edit-url <editUrl>
10
10
  p11 history
11
11
  p11 comments <readUrl|editUrl|readId|editId>
12
12
  ```
@@ -17,7 +17,7 @@ Add `--json` when scripting or when exact structured fields are needed.
17
17
 
18
18
  ```bash
19
19
  p11 docs components
20
- p11 docs publishing
20
+ p11 docs sharing
21
21
  ```
22
22
 
23
23
  ## Examples
@@ -28,4 +28,4 @@ p11 example all-components
28
28
  p11 example all-components --output ./all-components.tsx
29
29
  ```
30
30
 
31
- Use `p11 publish --help`, `p11 comments --help`, and `p11 history --help` for command-specific flags.
31
+ Use `p11 share --help`, `p11 comments --help`, and `p11 history --help` for command-specific flags.
@@ -1,18 +1,18 @@
1
- # p11 Publishing
1
+ # p11 Sharing
2
2
 
3
- Publish a document module:
3
+ Share a review link for a document:
4
4
 
5
5
  ```bash
6
- p11 publish ./page.tsx
6
+ p11 share ./page.tsx
7
7
  ```
8
8
 
9
- Update an existing document with an edit URL or edit id:
9
+ Share a new version with an edit URL or edit id:
10
10
 
11
11
  ```bash
12
- p11 publish ./page.tsx --edit-url <editUrl>
12
+ p11 share ./page.tsx --edit-url <editUrl>
13
13
  ```
14
14
 
15
- Fetch recent local publish history:
15
+ Fetch recent local share history:
16
16
 
17
17
  ```bash
18
18
  p11 history
@@ -46,7 +46,7 @@ export default function All() {
46
46
  <Quote>
47
47
  The page is intentionally broad: authors can use it to inspect
48
48
  screen layout, print pagination, source-line anchors, tables,
49
- figures, and syntax highlighting in one published document.
49
+ figures, and syntax highlighting in one shared document.
50
50
  </Quote>
51
51
  </Section>
52
52
 
@@ -76,7 +76,7 @@ export default function All() {
76
76
  Unordered lists work for parallel facts and short capabilities.
77
77
  </Text>
78
78
  <List>
79
- <ListItem>Publish static React-authored documents.</ListItem>
79
+ <ListItem>Share static React-authored documents.</ListItem>
80
80
  <ListItem>Allow anonymous comments on text selections.</ListItem>
81
81
  <ListItem>
82
82
  Export comments with source file and line anchors.
@@ -84,8 +84,8 @@ export default function All() {
84
84
  </List>
85
85
  <Text>Ordered lists work for procedural steps.</Text>
86
86
  <List ordered>
87
- <ListItem>Author a document module.</ListItem>
88
- <ListItem>Publish it with the CLI.</ListItem>
87
+ <ListItem>Author a document file.</ListItem>
88
+ <ListItem>Share it with the CLI.</ListItem>
89
89
  <ListItem>
90
90
  Review the screen view and browser print output.
91
91
  </ListItem>
@@ -166,12 +166,12 @@ export default function All() {
166
166
  <Heading>6. TypeScript</Heading>
167
167
  <CodeBlock language="typescript">
168
168
  {code`
169
- type PublishOptions = {
169
+ type ShareOptions = {
170
170
  input: string;
171
171
  comments?: boolean;
172
172
  };
173
173
 
174
- export async function publish(options: PublishOptions) {
174
+ export async function share(options: ShareOptions) {
175
175
  const response = await fetch("/api/pages", {
176
176
  method: "POST",
177
177
  body: JSON.stringify(options)
@@ -307,7 +307,7 @@ export default function All() {
307
307
  <Heading>14. Bash</Heading>
308
308
  <CodeBlock language="bash">
309
309
  {code`
310
- p11 publish ./all-components.tsx
310
+ p11 share ./all-components.tsx
311
311
  p11 comments <readUrl> --version 1
312
312
  `}
313
313
  </CodeBlock>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@p11-core/cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "bin": {