@polderlabs/bizar 3.17.0 → 3.19.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.
@@ -1,15 +1,15 @@
1
1
  /**
2
- * bizar plan-templates.mjs
2
+ * bizar artifact-templates.mjs
3
3
  *
4
4
  * Built-in template library for the visual planner v2.
5
5
  *
6
6
  * Templates are stored in two places:
7
7
  * 1. JS-embedded defaults (so the CLI works without filesystem reads)
8
- * 2. templates/plan/library/*.mdx (so users can edit/add templates)
8
+ * 2. templates/artifact/library/*.mdx (so users can edit/add templates)
9
9
  *
10
10
  * At lookup time we prefer the on-disk .mdx file (if present) and fall
11
11
  * back to the embedded string. The "blank" template is special: it
12
- * delegates to the existing plan.mdx.template file via the CLI caller.
12
+ * delegates to the existing artifact.mdx.template file via the CLI caller.
13
13
  *
14
14
  * Exports:
15
15
  * - getTemplate(name) → { name, description, content } | null
@@ -27,12 +27,12 @@ import { fileURLToPath } from 'node:url';
27
27
 
28
28
  const __dirname = dirname(fileURLToPath(import.meta.url));
29
29
  const PROJECT_ROOT = resolve(__dirname, '..');
30
- const TEMPLATES_DIR = join(PROJECT_ROOT, 'templates', 'plan');
30
+ const TEMPLATES_DIR = join(PROJECT_ROOT, 'templates', 'artifact');
31
31
  const LIBRARY_DIR = join(TEMPLATES_DIR, 'library');
32
32
 
33
33
  // ─── Embedded defaults ──────────────────────────────────────────────────────
34
34
  //
35
- // These are kept in sync with templates/plan/library/*.mdx. If the
35
+ // These are kept in sync with templates/artifact/library/*.mdx. If the
36
36
  // library directory is missing a file, the embedded version is used.
37
37
  // To change a built-in template, edit BOTH (or just the .mdx file if
38
38
  // the file is present — the loader prefers files).
@@ -40,7 +40,7 @@ const LIBRARY_DIR = join(TEMPLATES_DIR, 'library');
40
40
  const BUILT_IN_TEMPLATES = {
41
41
  'blank': {
42
42
  description: 'Empty starter — the same template the v1 planner used',
43
- content: null, // signals: caller should use plan.mdx.template
43
+ content: null, // signals: caller should use artifact.mdx.template
44
44
  },
45
45
  'feature-design': {
46
46
  description: 'For designing a new feature (problem, goals, design, tradeoffs)',
@@ -49,7 +49,7 @@ const BUILT_IN_TEMPLATES = {
49
49
  **Status:** \`[STATUS:draft]\` · **Author:** {{author}} · **Created:** {{created}}
50
50
 
51
51
  > [!INFO]
52
- > This is a v2 plan with the **feature-design** template. It uses callouts
52
+ > This is a v2 artifact with the **feature-design** template. It uses callouts
53
53
  > (\`> [!INFO]\`, \`> [!WARNING]\`, etc.), status badges, and GFM task lists.
54
54
 
55
55
  ## Problem
@@ -64,7 +64,7 @@ _What problem are we solving? Why now? What happens if we don't?_
64
64
 
65
65
  ## Non-goals
66
66
 
67
- - This feature does NOT do X (deferred to a future plan)
67
+ - This feature does NOT do X (deferred to a future artifact)
68
68
  - This feature does NOT cover Y (out of scope for this iteration)
69
69
 
70
70
  ## Design
@@ -112,7 +112,7 @@ _Endpoints, request/response shapes, error handling._
112
112
  2. Question 2?
113
113
  3. Question 3?
114
114
 
115
- ## Test plan
115
+ ## Test artifact
116
116
 
117
117
  - [ ] Unit tests for the new module
118
118
  - [ ] Integration tests for the API surface
@@ -134,7 +134,7 @@ _Endpoints, request/response shapes, error handling._
134
134
  ## References
135
135
 
136
136
  - [Design doc](https://example.com/design)
137
- - [Related plan](#)
137
+ - [Related artifact](#)
138
138
  `,
139
139
  },
140
140
  'bug-investigation': {
@@ -202,14 +202,14 @@ _The underlying issue._
202
202
 
203
203
  _The proposed fix._
204
204
 
205
- ## Test plan
205
+ ## Test artifact
206
206
 
207
207
  - [ ] Test that the bug is fixed (regression test on the failing case)
208
208
  - [ ] Test that the fix doesn't break anything (existing tests still pass)
209
209
  - [ ] Add a regression test to the suite
210
210
  - [ ] Manual verification in staging
211
211
 
212
- ## Rollback plan
212
+ ## Rollback artifact
213
213
 
214
214
  _How do we revert if the fix makes things worse?_
215
215
 
@@ -347,7 +347,7 @@ function discoverCustomTemplates() {
347
347
  /**
348
348
  * Return the template record for a given name (case-insensitive).
349
349
  * For the "blank" template, content is null — the caller should use
350
- * plan.mdx.template as the source.
350
+ * artifact.mdx.template as the source.
351
351
  *
352
352
  * @param {string} name
353
353
  * @returns {{ name: string, description: string, content: string|null, source: 'built-in'|'library' } | null}
@@ -357,7 +357,7 @@ export function getTemplate(name) {
357
357
  const normalized = String(name).toLowerCase().trim();
358
358
  if (!BUILT_IN_TEMPLATES[normalized]) return null;
359
359
 
360
- // "blank" is special: caller should use the standard plan.mdx.template
360
+ // "blank" is special: caller should use the standard artifact.mdx.template
361
361
  if (normalized === 'blank') {
362
362
  return {
363
363
  name: 'blank',
@@ -418,7 +418,7 @@ export function printTemplates() {
418
418
  console.log(` ${t.name.padEnd(nameWidth)} ${t.description}${tag}`);
419
419
  }
420
420
  console.log();
421
- console.log(' Use: bizar plan new <slug> --template <name>');
421
+ console.log(' Use: bizar artifact new <slug> --template <name>');
422
422
  console.log(' Built-in: ' + Object.keys(BUILT_IN_TEMPLATES).join(', '));
423
423
  }
424
424
 
@@ -426,7 +426,7 @@ export function printTemplates() {
426
426
 
427
427
  /**
428
428
  * Substitute {{key}} placeholders in template content. Mirrors the
429
- * behavior of the existing plan.mjs replaceTemplate — kept here so
429
+ * behavior of the existing artifact.mjs replaceTemplate — kept here so
430
430
  * the templates module is self-contained.
431
431
  *
432
432
  * @param {string} content
@@ -456,10 +456,10 @@ export function buildVars({ slug, title }) {
456
456
  };
457
457
  }
458
458
 
459
- // ─── CLI helpers (for `plan template save/list/delete`) ──────────────────────
459
+ // ─── CLI helpers (for `artifact template save/list/delete`) ──────────────────────
460
460
  //
461
461
  // These are minimal — the spec for v2 calls for full user-saved templates
462
- // in ~/.config/bizar/plan-templates/. v2.0 ships a stub for
462
+ // in ~/.config/bizar/artifact-templates/. v2.0 ships a stub for
463
463
  // library-directory operations; the user-templates dir is deferred to
464
464
  // a follow-up.
465
465
 
@@ -467,16 +467,16 @@ const USER_TEMPLATES_DIR = join(
467
467
  process.env.HOME || process.env.USERPROFILE || '~',
468
468
  '.config',
469
469
  'bizar',
470
- 'plan-templates',
470
+ 'artifact-templates',
471
471
  );
472
472
 
473
473
  /**
474
- * Save the content of an existing plan as a library template.
475
- * If a name is given, the file is written to templates/plan/library/.
476
- * The plan is read from plans/<planSlug>/plan.mdx.
474
+ * Save the content of an existing artifact as a library template.
475
+ * If a name is given, the file is written to templates/artifact/library/.
476
+ * The artifact is read from artifacts/<planSlug>/artifact.mdx.
477
477
  *
478
478
  * @param {string} name template name (becomes the filename)
479
- * @param {string} planSlug source plan to read content from
479
+ * @param {string} planSlug source artifact to read content from
480
480
  * @returns {string} absolute path to the saved file
481
481
  */
482
482
  export function saveTemplate(name, planSlug) {
@@ -484,11 +484,11 @@ export function saveTemplate(name, planSlug) {
484
484
  throw new Error(`Invalid template name "${name}". Use lowercase letters, digits, and hyphens.`);
485
485
  }
486
486
  if (!planSlug || !/^[a-z0-9][a-z0-9-]{0,63}$/.test(planSlug)) {
487
- throw new Error(`Invalid plan slug "${planSlug}".`);
487
+ throw new Error(`Invalid artifact slug "${planSlug}".`);
488
488
  }
489
- const sourcePath = join(PROJECT_ROOT, 'plans', planSlug, 'plan.mdx');
489
+ const sourcePath = join(PROJECT_ROOT, 'artifacts', planSlug, 'artifact.mdx');
490
490
  if (!existsSync(sourcePath)) {
491
- throw new Error(`Plan "${planSlug}" not found at ${sourcePath}`);
491
+ throw new Error(`Artifact "${planSlug}" not found at ${sourcePath}`);
492
492
  }
493
493
  const content = readFileSync(sourcePath, 'utf-8');
494
494
  mkdirSync(LIBRARY_DIR, { recursive: true });