@webmaster-droid/cli 0.4.1 → 0.4.2

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/index.js +56 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -330,6 +330,7 @@ function findAttribute(node, name) {
330
330
  }
331
331
  return null;
332
332
  }
333
+ var SEEDABLE_ROOT_PREFIXES = ["pages.", "layout.", "seo.", "themeTokens."];
333
334
  var EDITABLE_COMPONENT_PATHS = {
334
335
  EditableText: [{ pathProp: "path", fallbackProp: "fallback" }],
335
336
  EditableRichText: [{ pathProp: "path", fallbackProp: "fallback" }],
@@ -343,7 +344,24 @@ var EDITABLE_COMPONENT_PATHS = {
343
344
  ]
344
345
  };
345
346
  function isSeedableEditablePath(pathValue) {
346
- return pathValue.startsWith("pages.") || pathValue.startsWith("layout.") || pathValue.startsWith("seo.") || pathValue.startsWith("themeTokens.");
347
+ return SEEDABLE_ROOT_PREFIXES.some((prefix) => pathValue.startsWith(prefix));
348
+ }
349
+ function formatSourceLocation(file, line) {
350
+ return line ? `${file}:${line}` : file;
351
+ }
352
+ function printSkipDetails(heading, entries) {
353
+ if (entries.length === 0) {
354
+ return;
355
+ }
356
+ console.log(heading);
357
+ const MAX_PREVIEW = 25;
358
+ const shown = entries.slice(0, MAX_PREVIEW);
359
+ for (const entry of shown) {
360
+ console.log(` - ${entry}`);
361
+ }
362
+ if (entries.length > shown.length) {
363
+ console.log(` - ... ${entries.length - shown.length} more`);
364
+ }
347
365
  }
348
366
  program.name("webmaster-droid").description("Webmaster Droid CLI").version(CLI_VERSION);
349
367
  program.command("init").description("Initialize webmaster-droid environment template in current project").option("--backend <backend>", "backend (supabase|aws)", "supabase").option("--out <dir>", "output dir", ".").action(async (opts) => {
@@ -384,6 +402,8 @@ program.command("init").description("Initialize webmaster-droid environment temp
384
402
  "MODEL_OPENAI_ENABLED=true",
385
403
  "MODEL_GEMINI_ENABLED=true",
386
404
  "DEFAULT_MODEL_ID=openai:gpt-5.2",
405
+ "OPENAI_API_KEY=",
406
+ "GOOGLE_GENERATIVE_AI_API_KEY=",
387
407
  "",
388
408
  "# AWS (optional backend)",
389
409
  "CMS_S3_BUCKET=",
@@ -488,6 +508,7 @@ program.command("seed").description("Generate CMS seed document from Editable co
488
508
  dynamicPaths.push({
489
509
  file: relFile,
490
510
  line: pathAttr?.loc?.start.line,
511
+ component: componentName,
491
512
  prop: spec.pathProp
492
513
  });
493
514
  continue;
@@ -500,6 +521,8 @@ program.command("seed").description("Generate CMS seed document from Editable co
500
521
  invalidPaths.push({
501
522
  file: relFile,
502
523
  line: pathAttr?.loc?.start.line,
524
+ component: componentName,
525
+ prop: spec.pathProp,
503
526
  path: normalizedPath
504
527
  });
505
528
  continue;
@@ -559,7 +582,19 @@ program.command("seed").description("Generate CMS seed document from Editable co
559
582
  preservedPaths,
560
583
  dynamicPathSkips: dynamicPaths.length,
561
584
  invalidPathSkips: invalidPaths.length,
562
- writeFailures
585
+ writeFailures,
586
+ allowedRootPrefixes: [...SEEDABLE_ROOT_PREFIXES],
587
+ dynamicPathDetails: dynamicPaths.map((entry) => ({
588
+ ...entry,
589
+ location: formatSourceLocation(entry.file, entry.line),
590
+ reason: "Path prop uses a dynamic expression and cannot be seeded automatically. Convert to concrete indexed paths."
591
+ })),
592
+ invalidPathDetails: invalidPaths.map((entry) => ({
593
+ ...entry,
594
+ location: formatSourceLocation(entry.file, entry.line),
595
+ reason: `Path root is outside supported prefixes (${SEEDABLE_ROOT_PREFIXES.join(", ")}).`
596
+ })),
597
+ manualMigrationRequired: dynamicPaths.length > 0 || invalidPaths.length > 0
563
598
  };
564
599
  if (opts.json) {
565
600
  emitCliEnvelope({
@@ -580,12 +615,29 @@ program.command("seed").description("Generate CMS seed document from Editable co
580
615
  );
581
616
  if (dynamicPaths.length > 0) {
582
617
  console.log(
583
- `Skipped ${dynamicPaths.length} dynamic path expression(s). Convert them manually or use concrete index paths.`
618
+ `Skipped ${dynamicPaths.length} dynamic path expression(s). Manual migration required before first edit.`
619
+ );
620
+ printSkipDetails(
621
+ "Dynamic path locations:",
622
+ dynamicPaths.map(
623
+ (entry) => `${formatSourceLocation(entry.file, entry.line)} <${entry.component} ${entry.prop}=...>`
624
+ )
584
625
  );
585
626
  }
586
627
  if (invalidPaths.length > 0) {
587
628
  console.log(
588
- `Skipped ${invalidPaths.length} non-editable path(s) outside pages/layout/seo/themeTokens.`
629
+ `Skipped ${invalidPaths.length} non-editable path(s) outside allowed roots (${SEEDABLE_ROOT_PREFIXES.join(", ")}).`
630
+ );
631
+ printSkipDetails(
632
+ "Invalid root path locations:",
633
+ invalidPaths.map(
634
+ (entry) => `${formatSourceLocation(entry.file, entry.line)} <${entry.component} ${entry.prop}="${entry.path}">`
635
+ )
636
+ );
637
+ }
638
+ if (dynamicPaths.length > 0 || invalidPaths.length > 0) {
639
+ console.log(
640
+ "Seed report includes all skipped entries. Resolve these paths manually, then rerun `webmaster-droid seed`."
589
641
  );
590
642
  }
591
643
  if (writeFailures > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmaster-droid/cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "webmaster-droid": "dist/index.js"