@addorimprove/prompt 0.1.2 → 0.2.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.
Files changed (2) hide show
  1. package/dist/prompt.js +7 -6
  2. package/package.json +1 -1
package/dist/prompt.js CHANGED
@@ -456,14 +456,14 @@ ${doc.latest?.content ?? "(no versions)"}`);
456
456
  process.exitCode = 1;
457
457
  return;
458
458
  }
459
- const format = flagStr(args.flags, "format") ?? "mdx";
459
+ const format = flagStr(args.flags, "format");
460
460
  const content = await readContent(args.flags, `# ${name}
461
461
  `);
462
462
  if (!flags(args, "yes") && !flags(args, "y") && !await confirm(`Create document "${name}"?`)) {
463
463
  console.log("Aborted.");
464
464
  return;
465
465
  }
466
- const r = await client.createDoc({ name, content, format });
466
+ const r = await client.createDoc({ name, content, ...format ? { format } : {} });
467
467
  return out(json, r, `Created #${r.id} (${r.label}).`);
468
468
  }
469
469
  case "iterate": {
@@ -486,13 +486,13 @@ ${doc.latest?.content ?? "(no versions)"}`);
486
486
  process.exitCode = 1;
487
487
  return;
488
488
  }
489
- const format = flagStr(args.flags, "format") ?? "mdx";
489
+ const format = flagStr(args.flags, "format");
490
490
  const content = await readContent(args.flags, "");
491
491
  if (!flags(args, "yes") && !flags(args, "y") && !await confirm(`Add iterate version off ${parent} on #${id}?`)) {
492
492
  console.log("Aborted.");
493
493
  return;
494
494
  }
495
- const r = await client.addVersion(id, { intent: "iterate", parentLabel: parent, content, format });
495
+ const r = await client.addVersion(id, { intent: "iterate", parentLabel: parent, content, ...format ? { format } : {} });
496
496
  return out(json, r, `Added ${r.label}.`);
497
497
  }
498
498
  case "branch": {
@@ -506,13 +506,13 @@ ${doc.latest?.content ?? "(no versions)"}`);
506
506
  process.exitCode = 1;
507
507
  return;
508
508
  }
509
- const format = flagStr(args.flags, "format") ?? "mdx";
509
+ const format = flagStr(args.flags, "format");
510
510
  const content = await readContent(args.flags, "");
511
511
  if (!flags(args, "yes") && !flags(args, "y") && !await confirm(`Branch off ${parent} on #${id}?`)) {
512
512
  console.log("Aborted.");
513
513
  return;
514
514
  }
515
- const r = await client.addVersion(id, { intent: "branch", parentLabel: parent, content, format });
515
+ const r = await client.addVersion(id, { intent: "branch", parentLabel: parent, content, ...format ? { format } : {} });
516
516
  return out(json, r, `Branched → ${r.label}.`);
517
517
  }
518
518
  case "help":
@@ -538,6 +538,7 @@ Usage: prompt <command> [args] [flags] (or: npx @addorimprove/prompt <command>
538
538
  new --name <n> [-f file] [--format mdx|html] Create a document
539
539
  iterate <id> [--parent label] [-f file] Add a version on the same line
540
540
  branch <id> <parentLabel> [-f file] Fork a new line from a version
541
+ (omit --format to auto-detect mdx/html from content)
541
542
 
542
543
  Global flags: --base-url <url>, --json, -y/--yes
543
544
  Env: MD_PROMPT_API_KEY, MD_PROMPT_BASE_URL (shared with the 'prompt' skill)`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addorimprove/prompt",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "bin": { "prompt": "dist/prompt.js" },
6
6
  "files": ["dist"],