@praxis-framework/seed 0.1.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 (42) hide show
  1. package/README.md +47 -0
  2. package/dist/catalog.d.ts +60 -0
  3. package/dist/catalog.d.ts.map +1 -0
  4. package/dist/catalog.js +239 -0
  5. package/dist/catalog.js.map +1 -0
  6. package/dist/index.d.ts +16 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +14 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/seed.d.ts +43 -0
  11. package/dist/seed.d.ts.map +1 -0
  12. package/dist/seed.js +508 -0
  13. package/dist/seed.js.map +1 -0
  14. package/dist/template.d.ts +16 -0
  15. package/dist/template.d.ts.map +1 -0
  16. package/dist/template.js +47 -0
  17. package/dist/template.js.map +1 -0
  18. package/dist/traits.d.ts +26 -0
  19. package/dist/traits.d.ts.map +1 -0
  20. package/dist/traits.js +43 -0
  21. package/dist/traits.js.map +1 -0
  22. package/dist/types.d.ts +288 -0
  23. package/dist/types.d.ts.map +1 -0
  24. package/dist/types.js +87 -0
  25. package/dist/types.js.map +1 -0
  26. package/package.json +55 -0
  27. package/template/.env.example +8 -0
  28. package/template/CLAUDE.md +151 -0
  29. package/template/_gitignore +20 -0
  30. package/template/docker-compose.yml +44 -0
  31. package/template/escalations/README.md +51 -0
  32. package/template/lib/.gitkeep +0 -0
  33. package/template/lib/autonomy.yaml +158 -0
  34. package/template/lib/output-schemas.yaml +88 -0
  35. package/template/lib/tools.yaml +70 -0
  36. package/template/memory/README.md +51 -0
  37. package/template/memory/accounts/.gitkeep +0 -0
  38. package/template/memory/notes/.gitkeep +0 -0
  39. package/template/memory/people/.gitkeep +0 -0
  40. package/template/persona.md +75 -0
  41. package/template/verbs/escalate.md +112 -0
  42. package/template/verbs/proposed/README.md +25 -0
package/dist/seed.js ADDED
@@ -0,0 +1,508 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { simpleGit } from 'simple-git';
4
+ import { buildSeededCatalog, renderToolsYaml } from './catalog.js';
5
+ import { resolveTemplatePath } from './template.js';
6
+ import { findTrait } from './traits.js';
7
+ import { SeedError, SeedInputSchema, } from './types.js';
8
+ const TEMPLATE_FILES = [
9
+ { source: 'CLAUDE.md', target: 'CLAUDE.md' },
10
+ { source: 'persona.md', target: 'persona.md' },
11
+ { source: 'verbs/escalate.md', target: 'verbs/escalate.md' },
12
+ { source: 'verbs/proposed/README.md', target: 'verbs/proposed/README.md' },
13
+ { source: 'memory/README.md', target: 'memory/README.md' },
14
+ { source: 'escalations/README.md', target: 'escalations/README.md' },
15
+ { source: 'lib/autonomy.yaml', target: 'lib/autonomy.yaml' },
16
+ { source: 'lib/output-schemas.yaml', target: 'lib/output-schemas.yaml' },
17
+ { source: '.gitignore', target: '.gitignore' },
18
+ { source: 'docker-compose.yml', target: 'docker-compose.yml' },
19
+ { source: '.env.example', target: '.env.example' },
20
+ ];
21
+ /**
22
+ * Files copied byte-for-byte without {ROLE_NAME} substitution or section
23
+ * injection. `lib/autonomy.yaml` is operator-edited post-seed so we leave
24
+ * its placeholders alone. `lib/output-schemas.yaml` is framework-shipped
25
+ * reference material — the operator should read it, not the substitutor.
26
+ * `docker-compose.yml` and `.env.example` are operator-edited runtime
27
+ * scaffolding — no `{ROLE_NAME}` references, copied as-is.
28
+ */
29
+ const VERBATIM_TARGETS = new Set([
30
+ 'lib/autonomy.yaml',
31
+ 'lib/output-schemas.yaml',
32
+ 'docker-compose.yml',
33
+ '.env.example',
34
+ ]);
35
+ /** Directories to ensure exist in the seeded role, even if empty. */
36
+ const SEED_DIRS = [
37
+ 'verbs',
38
+ 'verbs/proposed',
39
+ 'lib',
40
+ 'memory',
41
+ 'memory/people',
42
+ 'memory/accounts',
43
+ 'memory/notes',
44
+ 'escalations',
45
+ 'output',
46
+ 'output/document',
47
+ 'output/draft',
48
+ 'output/record',
49
+ 'output/plan',
50
+ 'output/reference',
51
+ ];
52
+ /**
53
+ * Empty leaf directories that get a `.gitkeep` so the role's git history
54
+ * preserves the layout.
55
+ */
56
+ const GITKEEP_LEAVES = [
57
+ 'verbs/proposed',
58
+ 'lib',
59
+ 'memory/people',
60
+ 'memory/accounts',
61
+ 'memory/notes',
62
+ 'escalations',
63
+ 'output/document',
64
+ 'output/draft',
65
+ 'output/record',
66
+ 'output/plan',
67
+ 'output/reference',
68
+ ];
69
+ /**
70
+ * Seed a praxis role from the framework template into `targetPath`.
71
+ *
72
+ * The seed owns one repo concern: if `targetPath` isn't already a git
73
+ * repository, it runs `git init --initial-branch=main` before writing
74
+ * any files. Existing repos are left alone (no branch rename, no
75
+ * re-init). Beyond that, the seed performs only file IO — no commits,
76
+ * no environment side-effects beyond writing into the target. Callers
77
+ * (dashboard, CLI) layer their own commit / approval / cleanup behaviour
78
+ * around the result.
79
+ */
80
+ export async function seedRole(rawInput, targetPath, options = {}) {
81
+ const inputResult = SeedInputSchema.safeParse(rawInput);
82
+ if (!inputResult.success) {
83
+ const issues = inputResult.error.issues
84
+ .map((i) => `${i.path.join('.') || '<root>'}: ${i.message}`)
85
+ .join('; ');
86
+ throw new SeedError(`Invalid seed input: ${issues}`, 'INVALID_INPUT');
87
+ }
88
+ const input = inputResult.data;
89
+ const absTarget = path.resolve(targetPath);
90
+ const templateRoot = resolveTemplatePath(options.templatePath);
91
+ const overwrite = options.overwrite ?? false;
92
+ const dryRun = options.dryRun ?? false;
93
+ // Compute the full set of files we'd write, both template-derived and
94
+ // generated (verbs, .gitkeep). We need this list up-front to enforce the
95
+ // "all-or-nothing" guarantee — we check every target against existing
96
+ // files before touching disk, so a conflict aborts cleanly without
97
+ // partial writes.
98
+ const plan = await planSeed(input, templateRoot);
99
+ if (!dryRun && !overwrite) {
100
+ const conflicts = [];
101
+ for (const rel of plan.allTargets) {
102
+ const dst = path.join(absTarget, rel);
103
+ if (await pathExists(dst))
104
+ conflicts.push(rel);
105
+ }
106
+ if (conflicts.length > 0) {
107
+ throw new SeedError(`Target ${absTarget} already contains files that would be overwritten: ${conflicts
108
+ .slice(0, 5)
109
+ .join(', ')}${conflicts.length > 5 ? `, +${conflicts.length - 5} more` : ''}. Pass { overwrite: true } to force.`, 'TARGET_CONFLICT');
110
+ }
111
+ }
112
+ // Build the filtered tools catalog up-front so a malformed template fails
113
+ // fast, before we touch the target directory.
114
+ const seededCatalog = await buildSeededCatalog(templateRoot, input.tools);
115
+ if (dryRun) {
116
+ return {
117
+ targetPath: absTarget,
118
+ filesWritten: plan.allTargets.slice(),
119
+ filesSkipped: [],
120
+ };
121
+ }
122
+ const filesWritten = [];
123
+ const filesSkipped = [];
124
+ // Auto-initialise the target as a git repo if it isn't one already. The
125
+ // seed's contract is "take a dir (empty or otherwise), produce a populated,
126
+ // version-controlled role" — callers don't need to pre-run `git init`. If
127
+ // the operator already ran it (perhaps with their own branch preferences),
128
+ // we no-op and preserve their setup. The target dir must exist; we don't
129
+ // mkdir it (that's the caller's job — auto-creating a parent of the wrong
130
+ // path would be worse than failing here).
131
+ await ensureGitRepo(absTarget);
132
+ // Materialise directories first.
133
+ for (const dir of SEED_DIRS) {
134
+ await fs.mkdir(path.join(absTarget, dir), { recursive: true });
135
+ }
136
+ // Template files.
137
+ for (const pair of TEMPLATE_FILES) {
138
+ const src = await resolveTemplateFile(templateRoot, pair.source);
139
+ let body;
140
+ try {
141
+ body = await fs.readFile(src, 'utf-8');
142
+ }
143
+ catch (e) {
144
+ const cause = e instanceof Error ? e.message : String(e);
145
+ throw new SeedError(`Failed to read template ${pair.source}: ${cause}`, 'TEMPLATE_MISSING');
146
+ }
147
+ if (!VERBATIM_TARGETS.has(pair.target)) {
148
+ body = body.replace(/\{ROLE_NAME\}/g, input.role_definition.role_name);
149
+ if (pair.target === 'CLAUDE.md') {
150
+ body = injectClaudeDescription(body, input.role_definition.one_sentence_purpose);
151
+ body = injectVerbsTable(body, input.initial_verbs);
152
+ }
153
+ if (pair.target === 'persona.md') {
154
+ body = injectPersona(body, input);
155
+ }
156
+ }
157
+ const dst = path.join(absTarget, pair.target);
158
+ await fs.mkdir(path.dirname(dst), { recursive: true });
159
+ try {
160
+ await fs.writeFile(dst, body, 'utf-8');
161
+ }
162
+ catch (e) {
163
+ const cause = e instanceof Error ? e.message : String(e);
164
+ throw new SeedError(`Failed to write ${pair.target}: ${cause}`, 'WRITE_FAILED');
165
+ }
166
+ filesWritten.push(pair.target);
167
+ }
168
+ // Generated tools.yaml — built-ins plus operator-selected optional tools.
169
+ {
170
+ const target = 'lib/tools.yaml';
171
+ const dst = path.join(absTarget, target);
172
+ const body = renderToolsYaml(seededCatalog);
173
+ try {
174
+ await fs.writeFile(dst, body, 'utf-8');
175
+ }
176
+ catch (e) {
177
+ const cause = e instanceof Error ? e.message : String(e);
178
+ throw new SeedError(`Failed to write ${target}: ${cause}`, 'WRITE_FAILED');
179
+ }
180
+ filesWritten.push(target);
181
+ }
182
+ // Stub verbs.
183
+ for (const verb of input.initial_verbs) {
184
+ const target = path.join('verbs', `${verb.slug}.md`);
185
+ const dst = path.join(absTarget, target);
186
+ if (!overwrite && (await pathExists(dst))) {
187
+ filesSkipped.push(target);
188
+ continue;
189
+ }
190
+ const body = renderVerbStub(input, verb);
191
+ try {
192
+ await fs.writeFile(dst, body, 'utf-8');
193
+ }
194
+ catch (e) {
195
+ const cause = e instanceof Error ? e.message : String(e);
196
+ throw new SeedError(`Failed to write ${target}: ${cause}`, 'WRITE_FAILED');
197
+ }
198
+ filesWritten.push(target);
199
+ }
200
+ // .gitkeep on empty leaves.
201
+ for (const leaf of GITKEEP_LEAVES) {
202
+ const dirPath = path.join(absTarget, leaf);
203
+ const entries = await fs.readdir(dirPath);
204
+ if (entries.length === 0) {
205
+ const keep = path.join(leaf, '.gitkeep');
206
+ await fs.writeFile(path.join(absTarget, keep), '', 'utf-8');
207
+ filesWritten.push(keep);
208
+ }
209
+ }
210
+ return {
211
+ targetPath: absTarget,
212
+ filesWritten,
213
+ filesSkipped,
214
+ };
215
+ }
216
+ /**
217
+ * Compute the file list the seeder would produce. Used both to detect
218
+ * conflicts up-front and to drive dry-run output.
219
+ */
220
+ async function planSeed(input, templateRoot) {
221
+ // Verify template directory exists before anything else — fail loudly.
222
+ if (!(await pathExists(templateRoot))) {
223
+ throw new SeedError(`Template directory missing: ${templateRoot}`, 'TEMPLATE_MISSING');
224
+ }
225
+ const targets = [];
226
+ for (const pair of TEMPLATE_FILES) {
227
+ targets.push(pair.target);
228
+ }
229
+ // Generated lib/tools.yaml — written every seed (subset of the framework
230
+ // catalog), so include it in conflict detection.
231
+ targets.push('lib/tools.yaml');
232
+ for (const verb of input.initial_verbs) {
233
+ targets.push(path.join('verbs', `${verb.slug}.md`));
234
+ }
235
+ // .gitkeep entries depend on whether the dir is empty after writes, but
236
+ // for the planning step we conservatively include them. Worst case the
237
+ // conflict check flags a nonexistent file (it doesn't — pathExists only
238
+ // returns true if the file is there). Including them here means an
239
+ // overwrite of an existing role with leftover .gitkeeps doesn't surprise
240
+ // the operator.
241
+ for (const leaf of GITKEEP_LEAVES) {
242
+ targets.push(path.join(leaf, '.gitkeep'));
243
+ }
244
+ return { allTargets: targets };
245
+ }
246
+ /**
247
+ * Replace the CLAUDE.md placeholder one-liner with the operator's role
248
+ * description.
249
+ */
250
+ export function injectClaudeDescription(body, description) {
251
+ return body.replace(/\{One-line first-person description[^}]*\}/, description);
252
+ }
253
+ /**
254
+ * Replace the verbs-table placeholder row in CLAUDE.md with one row per
255
+ * operator-supplied verb. The framework template ships the table with
256
+ * `Persona` and `Escalate` rows already in place plus a single
257
+ * `_(add your role's verbs here)_` placeholder row; this function deletes
258
+ * the placeholder and appends one row per captured verb in the order they
259
+ * were captured.
260
+ *
261
+ * Columns: `Verb` (slug, prettified bold) / `File` (path to the stub) /
262
+ * `Input Stage` (always `<unset>` — the wizard does not capture this yet) /
263
+ * `Output Stage` (first description bullet, or `<unset>` when the operator
264
+ * left description empty).
265
+ *
266
+ * If the placeholder row is absent (e.g. the template has been customised),
267
+ * the body is returned unchanged — losing the operator's verbs from the
268
+ * manual is bad, but mangling a customised manual is worse.
269
+ */
270
+ export function injectVerbsTable(body, verbs) {
271
+ const placeholder = "| _(add your role's verbs here)_ | | | |";
272
+ if (!body.includes(placeholder))
273
+ return body;
274
+ if (verbs.length === 0) {
275
+ // Nothing captured — drop the placeholder line so the table reads cleanly.
276
+ return body.replace(`${placeholder}\n`, '').replace(placeholder, '');
277
+ }
278
+ const rows = verbs.map((verb) => {
279
+ const name = prettify(verb.slug);
280
+ const file = `verbs/${verb.slug}.md`;
281
+ const summary = verb.description.length > 0 && verb.description[0] ? verb.description[0] : '<unset>';
282
+ return `| **${name}** | \`${file}\` | <unset> | ${summary} |`;
283
+ });
284
+ return body.replace(placeholder, rows.join('\n'));
285
+ }
286
+ /**
287
+ * Inject operator-supplied content into the persona template, replacing
288
+ * placeholder section bodies under known section headings. Exported for
289
+ * testing.
290
+ */
291
+ export function injectPersona(body, input) {
292
+ let out = body;
293
+ out = replaceSection(out, 'Organisation', renderOrganisationSection(input.organisation));
294
+ const identityBullets = [
295
+ `- **Full name**: ${input.role_definition.role_name}`,
296
+ ];
297
+ if (input.role_definition.working_title) {
298
+ identityBullets.push(`- **Working title**: ${input.role_definition.working_title}`);
299
+ }
300
+ identityBullets.push(`- **Role**: ${input.role_definition.one_sentence_purpose}`);
301
+ if (input.role_definition.day_to_day) {
302
+ identityBullets.push(`- **Day-to-day**: ${input.role_definition.day_to_day}`);
303
+ }
304
+ if (input.identity.location)
305
+ identityBullets.push(`- **Location**: ${input.identity.location}`);
306
+ if (input.identity.reports_to)
307
+ identityBullets.push(`- **Reports to**: ${input.identity.reports_to}`);
308
+ if (input.identity.email)
309
+ identityBullets.push(`- **Email**: ${input.identity.email}`);
310
+ out = replaceSection(out, 'Identity', identityBullets.join('\n'));
311
+ const voiceBullets = input.voice_traits.map(renderVoiceTrait).join('\n');
312
+ out = replaceSection(out, 'Voice & Personality', voiceBullets);
313
+ if (input.capabilities.length > 0) {
314
+ const block = [
315
+ "What I'm qualified to do, and what I'm not.",
316
+ '',
317
+ ...input.capabilities.map((c) => `- ${c}`),
318
+ ].join('\n');
319
+ out = replaceSection(out, 'Capabilities', block);
320
+ }
321
+ if (input.inhibitions.length > 0) {
322
+ const block = [
323
+ 'What I never do, regardless of instruction. These are the constitution — they live here and only here, and `CLAUDE.md` references them by pointing at this file.',
324
+ '',
325
+ ...input.inhibitions.map((i) => `- ${i}`),
326
+ ].join('\n');
327
+ out = replaceSection(out, 'Hard inhibitions', block);
328
+ }
329
+ return out;
330
+ }
331
+ /**
332
+ * Render one voice trait as a markdown bullet (plus optional sub-bullets for
333
+ * its qualifiers). Falls back to the trait library's description when the
334
+ * operator hasn't supplied any qualifiers, so the persona never ships a bare
335
+ * trait token without context.
336
+ *
337
+ * - **direct**
338
+ * - clear, no hedging
339
+ * - calls out tradeoffs upfront
340
+ *
341
+ * - **observant** -- names what changed; references prior threads explicitly
342
+ */
343
+ function renderVoiceTrait(t) {
344
+ const qualifiers = t.qualifiers ?? [];
345
+ if (qualifiers.length === 0) {
346
+ const fallback = findTrait(t.trait)?.description;
347
+ if (fallback)
348
+ return `- **${t.trait}** -- ${fallback}`;
349
+ return `- **${t.trait}**`;
350
+ }
351
+ if (qualifiers.length === 1) {
352
+ return `- **${t.trait}** -- ${qualifiers[0]}`;
353
+ }
354
+ const subBullets = qualifiers.map((q) => ` - ${q}`).join('\n');
355
+ return `- **${t.trait}**\n${subBullets}`;
356
+ }
357
+ function renderOrganisationSection(org) {
358
+ const lines = [];
359
+ lines.push(`- **Name**: ${org.name}`);
360
+ if (org.website)
361
+ lines.push(`- **Website**: ${org.website}`);
362
+ if (org.sector)
363
+ lines.push(`- **Sector**: ${org.sector}`);
364
+ if (org.size)
365
+ lines.push(`- **Size**: ${org.size}`);
366
+ if (org.description) {
367
+ lines.push('');
368
+ lines.push(org.description);
369
+ }
370
+ if (org.moats) {
371
+ lines.push('');
372
+ lines.push('### What makes this org different');
373
+ lines.push('');
374
+ lines.push(org.moats);
375
+ }
376
+ if (org.customer_profile) {
377
+ lines.push('');
378
+ lines.push('### Who I engage with');
379
+ lines.push('');
380
+ lines.push(org.customer_profile);
381
+ }
382
+ return lines.join('\n');
383
+ }
384
+ function replaceSection(text, heading, replacement) {
385
+ const escaped = heading.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
386
+ const re = new RegExp(`(## ${escaped}\\s*\\n)([\\s\\S]*?)(?=\\n## |$)`);
387
+ if (!re.test(text))
388
+ return text;
389
+ return text.replace(re, `$1${replacement}\n`);
390
+ }
391
+ function renderVerbStub(input, verb) {
392
+ const description = verb.description ?? [];
393
+ const heading = `# ${prettify(verb.slug)}`;
394
+ const lead = `You are ${input.role_definition.role_name}.`;
395
+ // Body section — either the operator-authored bullets, or a TODO marker
396
+ // when the wizard didn't capture any.
397
+ const body = description.length > 0
398
+ ? description.map((line) => `- ${line}`).join('\n')
399
+ : '<!-- TODO: describe what this verb does. -->';
400
+ return `---
401
+ verb: <unset>
402
+ when_to_run: <unset>
403
+ inputs: []
404
+ outputs: []
405
+ ---
406
+
407
+ ${heading}
408
+
409
+ ${lead}
410
+
411
+ **Read \`persona.md\` first.**
412
+
413
+ ## What this verb does
414
+
415
+ ${body}
416
+
417
+ ## When to run
418
+
419
+ <describe the trigger — operator invocation, end-of-run, scheduled, etc.>
420
+
421
+ ## How you run it
422
+
423
+ 1. <step one>
424
+ 2. <step two>
425
+ 3. <step three>
426
+
427
+ ## Hard rules
428
+
429
+ - NEVER edit existing verbs on your own initiative — file an \`improvement\` escalation instead.
430
+
431
+ ## Reporting
432
+
433
+ At the end of every run, before signing off, two things:
434
+
435
+ 1. **The work product** — what I did, what I produced, anything blocking. The shape depends on this verb's purpose.
436
+ 2. **The reflection beat** — pause and check:
437
+ - Did anything shift my picture of a person, account, or my own voice? → write to \`memory/\`
438
+ - Did I hit friction worth surfacing? → file an \`improvement\` escalation
439
+ - Did I see a recurring pattern that deserves its own playbook? → draft a \`proposed_skill\`
440
+ - Am I stuck on something my operator needs to weigh in on? → file a \`help\` escalation
441
+
442
+ If nothing surprised me, the beat is still a beat — I just sign off cleanly. The pause is non-negotiable; the writing follows what I find.
443
+ `;
444
+ }
445
+ function prettify(slug) {
446
+ return slug
447
+ .split('-')
448
+ .map((p) => (p.length > 0 ? (p[0]?.toUpperCase() ?? '') + p.slice(1) : p))
449
+ .join(' ');
450
+ }
451
+ /**
452
+ * Ensure `absTarget` is a git repository. If `checkIsRepo()` reports false
453
+ * (no `.git` discovered), run `git init --initial-branch=main`. If the dir
454
+ * is already a repo, do nothing — we preserve the operator's choice of
455
+ * default branch and any other prior config.
456
+ *
457
+ * Failures here are rare (missing git binary, disk permissions) and surface
458
+ * as `SeedError` with `WRITE_FAILED` so the caller's existing error handling
459
+ * keeps working. The dir must exist before this runs — if it doesn't,
460
+ * `simple-git`'s base-dir check throws an unambiguous error we re-raise.
461
+ */
462
+ async function ensureGitRepo(absTarget) {
463
+ if (!(await pathExists(absTarget))) {
464
+ throw new SeedError(`Target directory does not exist: ${absTarget}. Create it before seeding.`, 'WRITE_FAILED');
465
+ }
466
+ const git = simpleGit(absTarget);
467
+ try {
468
+ if (await git.checkIsRepo())
469
+ return;
470
+ await git.init({ '--initial-branch': 'main' });
471
+ }
472
+ catch (e) {
473
+ const cause = e instanceof Error ? e.message : String(e);
474
+ throw new SeedError(`Failed to initialise git repository at ${absTarget}: ${cause}`, 'WRITE_FAILED');
475
+ }
476
+ }
477
+ async function pathExists(p) {
478
+ try {
479
+ await fs.access(p);
480
+ return true;
481
+ }
482
+ catch {
483
+ return false;
484
+ }
485
+ }
486
+ /**
487
+ * Resolve a template file path inside `templateRoot`, falling back to an
488
+ * underscored alias for entries whose dotted form npm strips at pack time.
489
+ * Today only `.gitignore` needs this — npm always excludes top-level and
490
+ * nested `.gitignore` files from the published tarball, so the seed's build
491
+ * script renames `.gitignore` → `_gitignore` in the published copy. In the
492
+ * dev monorepo the dotted file exists alongside the original template and
493
+ * wins the lookup; in published mode only the underscored form ships.
494
+ */
495
+ async function resolveTemplateFile(templateRoot, source) {
496
+ const direct = path.join(templateRoot, source);
497
+ if (await pathExists(direct))
498
+ return direct;
499
+ const base = path.basename(source);
500
+ if (base.startsWith('.')) {
501
+ const alias = path.join(path.dirname(source), `_${base.slice(1)}`);
502
+ const aliasPath = path.join(templateRoot, alias);
503
+ if (await pathExists(aliasPath))
504
+ return aliasPath;
505
+ }
506
+ return direct;
507
+ }
508
+ //# sourceMappingURL=seed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed.js","sourceRoot":"","sources":["../src/seed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,SAAS,EACT,eAAe,GAOhB,MAAM,YAAY,CAAC;AAepB,MAAM,cAAc,GAAmB;IACrC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE;IAC5C,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE;IAC9C,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE;IAC5D,EAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,EAAE,0BAA0B,EAAE;IAC1E,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAC1D,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,uBAAuB,EAAE;IACpE,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE;IAC5D,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,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AC,YAAY,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,MAAM,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;IACpD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Resolve the framework `template/` directory.
3
+ *
4
+ * Resolution order:
5
+ * 1. Explicit override (`override` arg).
6
+ * 2. `<package-root>/template/` — for when a published build bundles the
7
+ * template alongside the compiled JS (out of scope for the v0 monorepo
8
+ * layout, but supported so we don't paint ourselves into a corner).
9
+ * 3. Walk up from the package directory looking for a `template/` sibling.
10
+ * Handles the monorepo-dev case: `packages/seed/dist/` → `packages/seed/`
11
+ * → `packages//` → repo-root, where `template/` lives.
12
+ *
13
+ * Throws `SeedError('TEMPLATE_MISSING')` if nothing matches.
14
+ */
15
+ export declare function resolveTemplatePath(override?: string): string;
16
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CA+B7D"}
@@ -0,0 +1,47 @@
1
+ import { existsSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { SeedError } from './types.js';
5
+ /**
6
+ * Resolve the framework `template/` directory.
7
+ *
8
+ * Resolution order:
9
+ * 1. Explicit override (`override` arg).
10
+ * 2. `<package-root>/template/` — for when a published build bundles the
11
+ * template alongside the compiled JS (out of scope for the v0 monorepo
12
+ * layout, but supported so we don't paint ourselves into a corner).
13
+ * 3. Walk up from the package directory looking for a `template/` sibling.
14
+ * Handles the monorepo-dev case: `packages/seed/dist/` → `packages/seed/`
15
+ * → `packages//` → repo-root, where `template/` lives.
16
+ *
17
+ * Throws `SeedError('TEMPLATE_MISSING')` if nothing matches.
18
+ */
19
+ export function resolveTemplatePath(override) {
20
+ if (override !== undefined) {
21
+ if (!existsSync(override)) {
22
+ throw new SeedError(`Template override path does not exist: ${override}`, 'TEMPLATE_MISSING');
23
+ }
24
+ return path.resolve(override);
25
+ }
26
+ // src/template.ts (dev) → src/ → packages/seed/
27
+ // dist/template.js (build) → dist/ → packages/seed/
28
+ const here = fileURLToPath(new URL('.', import.meta.url));
29
+ const packageRoot = path.resolve(here, '..');
30
+ const bundled = path.join(packageRoot, 'template');
31
+ if (existsSync(bundled))
32
+ return bundled;
33
+ // Walk up from packageRoot looking for `template/`.
34
+ let cursor = packageRoot;
35
+ // 6 levels is plenty — we're typically 2 levels deep in the monorepo.
36
+ for (let i = 0; i < 6; i += 1) {
37
+ const candidate = path.join(cursor, 'template');
38
+ if (existsSync(candidate))
39
+ return candidate;
40
+ const parent = path.dirname(cursor);
41
+ if (parent === cursor)
42
+ break;
43
+ cursor = parent;
44
+ }
45
+ throw new SeedError('Could not locate a praxis template/ directory. Pass `templatePath` in SeedOptions to override.', 'TEMPLATE_MISSING');
46
+ }
47
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAiB;IACnD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,SAAS,CAAC,0CAA0C,QAAQ,EAAE,EAAE,kBAAkB,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,gDAAgD;IAChD,oDAAoD;IACpD,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE7C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACnD,IAAI,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAExC,oDAAoD;IACpD,IAAI,MAAM,GAAG,WAAW,CAAC;IACzB,sEAAsE;IACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAChD,IAAI,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,MAAM,KAAK,MAAM;YAAE,MAAM;QAC7B,MAAM,GAAG,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,SAAS,CACjB,gGAAgG,EAChG,kBAAkB,CACnB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Curated trait library for the voice & personality flow. Each entry pairs a
3
+ * canonical lowercase token (the value stored on disk and selected by the
4
+ * operator) with a one-line description used as the default rendering when
5
+ * the operator hasn't supplied any qualifiers.
6
+ *
7
+ * This list lives in `@praxis-framework/seed` because two callers need it:
8
+ * - the CLI's voice flow shows it to the operator as a multi-select cloud,
9
+ * - the seeder injects descriptions into `persona.md` when a trait
10
+ * has no qualifiers attached.
11
+ *
12
+ * v1 keeps the library inline. A planned follow-up moves the authored copy
13
+ * to `template/lib/traits.yaml` (mirroring `tools.yaml`) so operators can
14
+ * extend it; the consumers will then load it through a catalog reader rather
15
+ * than importing this constant.
16
+ */
17
+ export interface TraitEntry {
18
+ /** Short canonical token, lowercase. Stored on disk. */
19
+ name: string;
20
+ /** One-line description shown alongside the trait when picking. */
21
+ description: string;
22
+ }
23
+ export declare const TRAIT_LIBRARY: readonly TraitEntry[];
24
+ /** Look up a trait by its canonical name. Returns `undefined` for unknowns. */
25
+ export declare function findTrait(name: string): TraitEntry | undefined;
26
+ //# sourceMappingURL=traits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traits.d.ts","sourceRoot":"","sources":["../src/traits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,UAAU;IACzB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAqB9C,CAAC;AAEF,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE9D"}