@theholocron/cli 3.29.10 → 3.29.12

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/cli.mjs CHANGED
@@ -2712,13 +2712,22 @@ var test_default$1 = "name: Test\n\non: # yamllint disable-line rule:truthy\n p
2712
2712
  var typecheck_default$1 = "name: Typecheck\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\nconcurrency:\n group: typecheck-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n\njobs:\n typecheck:\n name: Typecheck\n uses: theholocron/.github/.github/workflows/typecheck.yml@main\n secrets: inherit\n";
2713
2713
  //#endregion
2714
2714
  //#region src/commands/setup-workflows.ts
2715
- /** Header prepended when holocron setup writes a generated file to a repo. */
2716
- function workflowHeader(source = "packages/cli/src/commands/setup-workflows.ts") {
2715
+ /**
2716
+ * Header prepended to every auto-generated workflow thin caller.
2717
+ *
2718
+ * Used by both `holocron setup` (initial creation) and `holocron sync-github`
2719
+ * (subsequent updates) so the header is always identical regardless of which
2720
+ * command last wrote the file.
2721
+ *
2722
+ * @param source - path within theholocron/holocron that owns the template
2723
+ * @param forPrimary - true only when writing to theholocron/.github itself
2724
+ */
2725
+ function workflowHeader(source = "packages/cli/src/commands/setup-workflows.ts", forPrimary = false) {
2717
2726
  return [
2718
- `# AUTO-GENERATED — do not edit directly.`,
2727
+ forPrimary ? `# AUTO-GENERATED — do not edit in theholocron/.github directly.` : `# AUTO-GENERATED — do not edit directly.`,
2719
2728
  `# Source: theholocron/holocron · ${source}`,
2720
- `# Tool: holocron setup`,
2721
- `# Changes: run \`holocron setup\` to regenerate.`,
2729
+ `# Tool: holocron sync-github`,
2730
+ `# Changes: edit source in theholocron/holocron and push to alpha or main.`,
2722
2731
  ``
2723
2732
  ].join("\n");
2724
2733
  }
@@ -4422,7 +4431,7 @@ function parseWorkflowsFromTs(source) {
4422
4431
  }
4423
4432
  const withStr = objContent.slice(withOpen, k);
4424
4433
  try {
4425
- const jsonSafe = withStr.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)\s*:/g, "$1\"$2\":");
4434
+ const jsonSafe = withStr.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)\s*:/g, "$1\"$2\":").replace(/,(\s*[}\]])/g, "$1");
4426
4435
  withObj = JSON.parse(jsonSafe);
4427
4436
  } catch {}
4428
4437
  }
@@ -4457,15 +4466,6 @@ function reusableHeader(source) {
4457
4466
  ``
4458
4467
  ].join("\n");
4459
4468
  }
4460
- function thinCallerHeader(forPrimary = false) {
4461
- return [
4462
- forPrimary ? `# AUTO-GENERATED — do not edit in theholocron/.github directly.` : `# AUTO-GENERATED — do not edit directly.`,
4463
- `# Source: theholocron/holocron · packages/cli/src/commands/setup-workflows.ts`,
4464
- `# Tool: holocron sync-github`,
4465
- `# Changes: edit source in theholocron/holocron and push to alpha or main.`,
4466
- ``
4467
- ].join("\n");
4468
- }
4469
4469
  function buildBatch(repo, allowedWorkflows, withOverrides) {
4470
4470
  const files = [];
4471
4471
  const isPrimaryGithubRepo = repo === DEFAULT_REPO;
@@ -4481,7 +4481,7 @@ function buildBatch(repo, allowedWorkflows, withOverrides) {
4481
4481
  for (const [name, content] of Object.entries(WORKFLOW_TEMPLATES)) {
4482
4482
  files.push({
4483
4483
  path: `workflow-templates/${name}.yml`,
4484
- content: thinCallerHeader(true) + content
4484
+ content: workflowHeader(void 0, true) + content
4485
4485
  });
4486
4486
  const props = WORKFLOW_TEMPLATE_PROPERTIES[name];
4487
4487
  if (props) files.push({
@@ -4496,7 +4496,7 @@ function buildBatch(repo, allowedWorkflows, withOverrides) {
4496
4496
  if (!content) continue;
4497
4497
  files.push({
4498
4498
  path: `.github/workflows/${name}.yml`,
4499
- content: thinCallerHeader() + content
4499
+ content: workflowHeader() + content
4500
4500
  });
4501
4501
  }
4502
4502
  return files;