@r_masseater/vite-plus-adopt 0.20.4 → 0.21.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.
package/README.md CHANGED
@@ -123,7 +123,7 @@ The Renovate preset updates `version` of each GitHub key and of `dotnet`. A new
123
123
 
124
124
  ## GitHub Actions caches
125
125
 
126
- `vpa ci` puts the shared `setup` action of [typescript-template](https://github.com/masseater/typescript-template) into every job that runs `vp`, and removes what that action replaces: hand-written `actions/cache` steps for the pnpm store, the pnpm metadata, the vpa tools and msch, the `voidzero-dev/setup-vp` step and the `vp install --frozen-lockfile` step. Comments and formatting around the edited steps stay. It pins every template action and workflow to one commit, and calls `maintain-caches.yml` from `.github/workflows/cache.yml`, which saves the pnpm store on the default branch and deletes cache entries that it no longer needs. A local action in `.github/actions/` that wraps the shared one keeps its extra steps, and `vpa ci` forwards the inputs `cache`, `save` and `session-path` that it declares. Run it again after a new `vpa` version to move the pins. The library entry exports `findCiDrift(root)`, which lists the files `vpa ci` would change and the files whose template pins differ.
126
+ `vpa ci` puts the shared `setup` action of [typescript-template](https://github.com/masseater/typescript-template) into every job that runs `vp`, and removes what that action replaces: hand-written `actions/cache` steps for the pnpm store, the pnpm metadata, the vpa tools and msch, the `voidzero-dev/setup-vp` step and the `vp install --frozen-lockfile` step. Comments and formatting around the edited steps stay. It pins every template action and workflow to one commit, and calls `maintain-caches.yml` from `.github/workflows/cache.yml`, which saves the pnpm store on the default branch and deletes cache entries that it no longer needs. A local action in `.github/actions/` that wraps the shared one keeps its extra steps, and `vpa ci` forwards the inputs `cache`, `save` and `session-path` that it declares. In a repository that uses the shared `setup` action, it also writes `up-to-date.yml` and `update-branches.yml` as the template has them, with their triggers and jobs such as the hourly run and the `wake` job that start the merge queue, and keeps the `up-to-date` job that the repository owns. Renovate only moves the pinned commits, so without this the rest of those workflows stays at what the template had when they were copied. Run it again after a new `vpa` version to move the pins. The library entry exports `findCiDrift(root)`, which lists the files `vpa ci` would change, the queue workflows that differ from the template and the files whose template pins differ.
127
127
 
128
128
  ## Replacement for @arethetypeswrong/core
129
129
 
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as runVpa } from "./vpa-4qVd4VBP.mjs";
2
+ import { t as runVpa } from "./vpa-D9vx1zUp.mjs";
3
3
  import { Effect, Path, Stdio } from "effect";
4
4
  import { runMain } from "@r_masseater/node-main";
5
5
  // src/app/run-cli.ts
package/dist/index.d.mts CHANGED
@@ -88,7 +88,7 @@ export declare const runVpa: {
88
88
  /** @internal */
89
89
  interface CiDrift {
90
90
  readonly file: string;
91
- readonly reason: "setup" | "ref";
91
+ readonly reason: "setup" | "ref" | "workflow";
92
92
  }
93
93
  /** @internal */
94
94
  type Services = FileSystem.FileSystem | Path.Path;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { i as VpToolsError, n as findCiDrift, r as loadViteConfig, t as runVpa } from "./vpa-4qVd4VBP.mjs";
1
+ export { i as VpToolsError, n as findCiDrift, r as loadViteConfig, t as runVpa } from "./vpa-D9vx1zUp.mjs";
@@ -11,7 +11,7 @@ import { TextlintKernelDescriptor } from "@textlint/kernel";
11
11
  import { loadBuiltinPlugins } from "textlint/lib/src/loader/TextlintrcLoader.js";
12
12
  import { normalizeTextlintPresetSubRuleKey } from "@textlint/utils";
13
13
  import { format as format$1, makeDetector } from "@r_masseater/h56m";
14
- import { isMap, isPair, isScalar, isSeq, parse, parseDocument, visit } from "yaml";
14
+ import { isMap, isNode, isPair, isScalar, isSeq, parse, parseDocument, visit } from "yaml";
15
15
  import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
16
16
  import { minimatch } from "minimatch";
17
17
  import { Tar } from "effect/encoding";
@@ -389,10 +389,74 @@ const finish = (report) => {
389
389
  if (report.output === "") return Effect.void;
390
390
  return writeTo("stdout", `${report.output}\n`);
391
391
  };
392
+ // src/features/sync-ci/model/yaml-nodes.ts
393
+ const EMPTY = "";
394
+ const ByStartDescending = Order.mapInput(Order.flip(Number.Order), ({ start }) => start);
395
+ const NEWLINE$1 = "\n";
396
+ const FIRST$1 = 0;
397
+ const NEXT$1 = 1;
398
+ const RANGE_END = 2;
399
+ /** @internal */
400
+ const scalarText = (node) => pipe(Option.liftPredicate(node, isScalar), Option.map(({ value }) => value), Option.filter(Predicate.isString), Option.getOrElse(() => EMPTY));
401
+ /** @internal */
402
+ const fieldOf = (key) => (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => scalarText(map.get(key, true))), Option.getOrElse(() => EMPTY));
403
+ /** @internal */
404
+ const usesOf = fieldOf("uses");
405
+ /** @internal */
406
+ const lineStart = ({ source, offset }) => pipe(source, String$1.slice(FIRST$1, offset), String$1.lastIndexOf(NEWLINE$1), Option.map((index) => index + NEXT$1), Option.getOrElse(() => FIRST$1));
407
+ /** @internal */
408
+ const startOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMapNullishOr(({ range }) => range), Option.map(([start]) => start));
409
+ /** @internal */
410
+ const endOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMapNullishOr(({ range }) => range), Option.map((range) => range[RANGE_END]));
411
+ const insertAt = (text) => ({ start, end, text: insert }) => pipe(text, String$1.slice(FIRST$1, start)) + insert + pipe(text, String$1.slice(end));
412
+ /** @internal */
413
+ const applyEdits = ({ source, edits }) => pipe(Array.sort(edits, ByStartDescending), Array.match({
414
+ onEmpty: () => source,
415
+ onNonEmpty: ([edit, ...rest]) => applyEdits({
416
+ source: insertAt(source)(edit),
417
+ edits: rest
418
+ })
419
+ }));
420
+ /** @internal */
421
+ const itemsOf = (node) => pipe(Option.liftPredicate(node, isSeq), Option.map(({ items }) => items), Option.getOrElse(() => []));
422
+ // src/features/sync-ci/model/apply-template.ts
423
+ const LAST_NEWLINE = /\n?$/u;
424
+ const NEWLINE = "\n";
425
+ const rangeOf = (node) => pipe(Option.liftPredicate(node, isNode), Option.flatMapNullishOr(({ range }) => range));
426
+ const jobNamed = (source, name) => pipe(Option.liftPredicate(parseDocument(source).get("jobs", true), isMap), Option.flatMap(({ items }) => Array.findFirst(items, ({ key }) => scalarText(key) === name)));
427
+ const jobSpan = (source, name) => pipe(jobNamed(source, name), Option.flatMap(({ key, value }) => Option.all({
428
+ start: Option.map(rangeOf(key), ([offset]) => lineStart({
429
+ source,
430
+ offset
431
+ })),
432
+ end: Option.map(rangeOf(value), ([, end]) => end)
433
+ })));
434
+ const ownJobEdit = (template, existing) => (name) => pipe(Option.all({
435
+ into: jobSpan(template, name),
436
+ from: jobSpan(existing, name)
437
+ }), Option.map(({ into, from }) => ({
438
+ start: into.start,
439
+ end: into.end,
440
+ text: pipe(existing, String$1.slice(from.start, from.end), String$1.replace(LAST_NEWLINE, NEWLINE))
441
+ })));
442
+ const applied = (template, existing) => {
443
+ const edits = pipe(template.ownJobs, Array.map(ownJobEdit(template.source, existing)), Array.getSomes);
444
+ return applyEdits({
445
+ source: template.source,
446
+ edits
447
+ });
448
+ };
449
+ /** @internal */
450
+ const fromTemplate = ({ templates, name, source }) => pipe(templates, Array.findFirst((template) => template.name === name), Option.match({
451
+ onNone: () => source,
452
+ onSome: (template) => applied(template, source)
453
+ }));
392
454
  // src/features/sync-ci/model/template.ts
393
455
  const TEMPLATE_REF = "9ecb0fb2417f850c05a91c5af4703b4f1380a028";
394
456
  const TEMPLATE = "masseater/typescript-template/.github";
395
- const SETUP_ACTION = `${TEMPLATE}/actions/setup`;
457
+ const templateAction = (name) => `${TEMPLATE}/actions/${name}`;
458
+ const SETUP_ACTION = templateAction("setup");
459
+ const VERIFY_ACTION = templateAction("verify");
396
460
  const MAINTAIN_WORKFLOW_FILE = "maintain-caches.yml";
397
461
  const MAINTAIN_WORKFLOW = `${TEMPLATE}/workflows/${MAINTAIN_WORKFLOW_FILE}`;
398
462
  const TEMPLATE_USE = new RegExp(String.raw`^${TEMPLATE}/(?:actions|workflows)/[^@]+@`, "u");
@@ -424,36 +488,6 @@ const CACHE_WORKFLOW_SOURCE = Array.join([
424
488
  const PINNED_USE = new RegExp(String.raw`(?<use>${TEMPLATE}/(?:actions|workflows)/[^@\s]+)@(?<ref>[0-9a-f]{40})`, "gu");
425
489
  const refsIn = (source) => pipe(source, String$1.matchAll(PINNED_USE), Array.fromIterable, Array.flatMap(({ groups }) => pipe(Option.fromNullishOr(groups), Option.flatMap(Record.get("ref")), Option.toArray)));
426
490
  const withoutRefs = (source) => pipe(source, String$1.replaceAll(PINNED_USE, "$<use>"));
427
- // src/features/sync-ci/model/yaml-nodes.ts
428
- const EMPTY = "";
429
- const ByStartDescending = Order.mapInput(Order.flip(Number.Order), ({ start }) => start);
430
- const NEWLINE = "\n";
431
- const FIRST$1 = 0;
432
- const NEXT$1 = 1;
433
- const RANGE_END = 2;
434
- /** @internal */
435
- const scalarText = (node) => pipe(Option.liftPredicate(node, isScalar), Option.map(({ value }) => value), Option.filter(Predicate.isString), Option.getOrElse(() => EMPTY));
436
- /** @internal */
437
- const fieldOf = (key) => (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => scalarText(map.get(key, true))), Option.getOrElse(() => EMPTY));
438
- /** @internal */
439
- const usesOf = fieldOf("uses");
440
- /** @internal */
441
- const lineStart = ({ source, offset }) => pipe(source, String$1.slice(FIRST$1, offset), String$1.lastIndexOf(NEWLINE), Option.map((index) => index + NEXT$1), Option.getOrElse(() => FIRST$1));
442
- /** @internal */
443
- const startOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMapNullishOr(({ range }) => range), Option.map(([start]) => start));
444
- /** @internal */
445
- const endOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMapNullishOr(({ range }) => range), Option.map((range) => range[RANGE_END]));
446
- const insertAt = (text) => ({ start, end, text: insert }) => pipe(text, String$1.slice(FIRST$1, start)) + insert + pipe(text, String$1.slice(end));
447
- /** @internal */
448
- const applyEdits = ({ source, edits }) => pipe(Array.sort(edits, ByStartDescending), Array.match({
449
- onEmpty: () => source,
450
- onNonEmpty: ([edit, ...rest]) => applyEdits({
451
- source: insertAt(source)(edit),
452
- edits: rest
453
- })
454
- }));
455
- /** @internal */
456
- const itemsOf = (node) => pipe(Option.liftPredicate(node, isSeq), Option.map(({ items }) => items), Option.getOrElse(() => []));
457
491
  // src/features/sync-ci/model/cache-workflow.ts
458
492
  const INDENT$1 = " ";
459
493
  const CALL = "caches";
@@ -485,6 +519,30 @@ const addMaintainJob = ({ source, jobs, telemetryNeeds }) => pipe(Option.liftPre
485
519
  })))]
486
520
  })
487
521
  }));
522
+ // src/features/sync-ci/model/drift.ts
523
+ const SINGLE_REF = 1;
524
+ /** @internal */
525
+ const refDrift = (sources) => {
526
+ const pinned = pipe(sources, Array.filter(({ source }) => !Array.isReadonlyArrayEmpty(refsIn(source))));
527
+ if (new Set(pipe(pinned, Array.flatMap(({ source }) => refsIn(source)))).size <= SINGLE_REF) return [];
528
+ return pipe(pinned, Array.map(({ file }) => ({
529
+ file,
530
+ reason: "ref"
531
+ })));
532
+ };
533
+ /** @internal */
534
+ const changeDrift = (changes) => pipe(changes, Array.flatMap(({ file, previous, setup, source }) => pipe([{
535
+ reason: "setup",
536
+ before: previous,
537
+ after: setup
538
+ }, {
539
+ reason: "workflow",
540
+ before: setup,
541
+ after: source
542
+ }], Array.filter(({ before, after }) => withoutRefs(before) !== withoutRefs(after)), Array.map(({ reason }) => ({
543
+ file,
544
+ reason
545
+ })))));
488
546
  // src/features/sync-ci/model/rewrite-steps.ts
489
547
  const CACHE_USE = /^actions\/cache(?:\/(?:restore|save))?@/u;
490
548
  const SETUP_VP_USE = "voidzero-dev/setup-vp@";
@@ -504,8 +562,8 @@ const runOf = fieldOf("run");
504
562
  const pathOf = (step) => pipe(Option.liftPredicate(step, isMap), Option.map((map) => scalarText(map.getIn(["with", "path"], true))), Option.getOrElse(() => ""));
505
563
  const isManaged = (step) => pipe(usesOf(step), String$1.startsWith(SETUP_VP_USE)) || CACHE_USE.test(usesOf(step)) && MANAGED_PATH.test(pathOf(step)) || MANAGED_RUN.test(runOf(step));
506
564
  const localAction = (step) => pipe(LOCAL_USE.exec(usesOf(step)), Option.fromNullishOr, Option.flatMapNullishOr(({ groups }) => groups), Option.flatMap(Record.get("name")));
507
- const isSetup = (localSetups) => (step) => pipe(usesOf(step), String$1.startsWith(`masseater/typescript-template/.github/actions/setup@`)) || pipe(localAction(step), Option.exists((name) => localSetups.has(name)));
508
- const runsVp = (step) => pipe(usesOf(step), String$1.startsWith(`masseater/typescript-template/.github/actions/verify@`)) || VP_COMMAND.test(runOf(step));
565
+ const isSetup = (localSetups) => (step) => pipe(usesOf(step), String$1.startsWith(`${SETUP_ACTION}@`)) || pipe(localAction(step), Option.exists((name) => localSetups.has(name)));
566
+ const runsVp = (step) => pipe(usesOf(step), String$1.startsWith(`${VERIFY_ACTION}@`)) || VP_COMMAND.test(runOf(step));
509
567
  const forwardedLines = (inputs, pad) => pipe(FORWARDED_INPUTS, Array.filter((name) => pipe(inputs, Array.contains(name))), Array.map((name) => `${pad}${INDENT}${name}: \${{ inputs.${name} }}`), Array.match({
510
568
  onEmpty: () => [],
511
569
  onNonEmpty: (lines) => [`${pad}with:`, ...lines]
@@ -610,13 +668,106 @@ const rewriteDocument = ({ source, localSetups }) => {
610
668
  jobs: pipe(tableAt(result, ["jobs"]), Array.filter(([, job]) => !reportsTelemetry(job)), Array.map(([name]) => name))
611
669
  };
612
670
  };
671
+ // src/features/sync-ci/model/template-workflows.ts
672
+ const IF_PULL_REQUEST = "github.event_name == 'pull_request'";
673
+ const UP_TO_DATE_SOURCE = Array.join([
674
+ "name: up-to-date",
675
+ "",
676
+ "on:",
677
+ " pull_request:",
678
+ " types: [opened, synchronize, reopened, ready_for_review, edited]",
679
+ " workflow_dispatch:",
680
+ "",
681
+ "permissions: {}",
682
+ "",
683
+ "env:",
684
+ ` TAKUMI_GUARD_TOKEN: \${{ secrets.TAKUMI_GUARD_TOKEN }}`,
685
+ "",
686
+ "jobs:",
687
+ " up-to-date:",
688
+ " runs-on: ubuntu-latest",
689
+ " permissions:",
690
+ " contents: read",
691
+ " steps:",
692
+ ` - if: ${IF_PULL_REQUEST}`,
693
+ " uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1",
694
+ " with:",
695
+ " persist-credentials: false",
696
+ ` - if: ${IF_PULL_REQUEST}`,
697
+ ` uses: ${pinned(SETUP_ACTION)}`,
698
+ ` - if: ${IF_PULL_REQUEST}`,
699
+ " env:",
700
+ ` TITLE: \${{ github.event.pull_request.title }}`,
701
+ ` NUMBER: \${{ github.event.pull_request.number }}`,
702
+ " run: vp exec msch --message \"$TITLE (#$NUMBER)\"",
703
+ "",
704
+ " wake:",
705
+ " needs: [up-to-date]",
706
+ ` if: always() && ${IF_PULL_REQUEST}`,
707
+ " runs-on: ubuntu-latest",
708
+ " permissions:",
709
+ " actions: write",
710
+ " steps:",
711
+ " - env:",
712
+ ` GH_TOKEN: \${{ github.token }}`,
713
+ ` DEFAULT_BRANCH: \${{ github.event.repository.default_branch }}`,
714
+ " run: gh workflow run update-branches.yml --repo \"$GITHUB_REPOSITORY\" --ref \"$DEFAULT_BRANCH\"",
715
+ ""
716
+ ], "\n");
717
+ const UPDATE_BRANCHES_SOURCE = Array.join([
718
+ "name: update-branches",
719
+ "",
720
+ "on:",
721
+ " push:",
722
+ " branches: [main]",
723
+ " schedule:",
724
+ " - cron: \"17 * * * *\"",
725
+ " workflow_dispatch:",
726
+ "",
727
+ "permissions: {}",
728
+ "",
729
+ "concurrency:",
730
+ ` group: \${{ github.workflow }}`,
731
+ " cancel-in-progress: false",
732
+ "",
733
+ "jobs:",
734
+ " update:",
735
+ " runs-on: ubuntu-latest",
736
+ " permissions:",
737
+ " contents: read",
738
+ " id-token: write",
739
+ " steps:",
740
+ ` - uses: ${pinned(templateAction("update-branches"))}`,
741
+ "",
742
+ " ci-telemetry:",
743
+ " needs: [update]",
744
+ " if: always()",
745
+ " runs-on: ubuntu-latest",
746
+ " permissions:",
747
+ " actions: read",
748
+ " contents: read",
749
+ " steps:",
750
+ ` - uses: ${pinned(templateAction("ci-telemetry"))}`,
751
+ " with:",
752
+ ` github-token: \${{ github.token }}`,
753
+ ""
754
+ ], "\n");
755
+ /** @internal */
756
+ const TEMPLATE_WORKFLOWS = [{
757
+ name: "up-to-date.yml",
758
+ source: UP_TO_DATE_SOURCE,
759
+ ownJobs: ["up-to-date"]
760
+ }, {
761
+ name: "update-branches.yml",
762
+ source: UPDATE_BRANCHES_SOURCE,
763
+ ownJobs: []
764
+ }];
613
765
  // src/features/sync-ci/model/sync-ci.ts
614
766
  const WORKFLOWS = ".github/workflows";
615
767
  const ACTIONS = ".github/actions";
616
768
  const YAML_FILE = /\.ya?ml$/u;
617
769
  const ACTION_FILES = ["action.yml", "action.yaml"];
618
770
  const SEQUENTIAL = { concurrency: 1 };
619
- const SINGLE_REF = 1;
620
771
  const entriesOf = (directory) => FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readDirectory(directory)), Effect.map((entries) => Array.sort(entries, String$1.Order)), Effect.orElseSucceed(() => []));
621
772
  const readSource = (file, name) => FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readFileString(file)), Effect.map((source) => ({
622
773
  file,
@@ -666,17 +817,22 @@ const cacheWorkflow = ({ root, workflows, usesSetup }) => Effect.gen(function* p
666
817
  onNone: () => ({
667
818
  file: path.join(root, WORKFLOWS, CACHE_WORKFLOW),
668
819
  previous: "",
820
+ setup: CACHE_WORKFLOW_SOURCE,
669
821
  source: CACHE_WORKFLOW_SOURCE
670
822
  }),
671
- onSome: ({ file, rewritten, source }) => ({
672
- file,
673
- previous: source,
674
- source: addMaintainJob({
823
+ onSome: ({ file, rewritten, source }) => {
824
+ const maintained = addMaintainJob({
675
825
  source: rewritten.source,
676
826
  jobs: rewritten.jobs,
677
827
  telemetryNeeds: rewritten.telemetryNeeds
678
- })
679
- })
828
+ });
829
+ return {
830
+ file,
831
+ previous: source,
832
+ setup: maintained,
833
+ source: maintained
834
+ };
835
+ }
680
836
  }))];
681
837
  });
682
838
  const write = (root, { file, source }) => Effect.gen(function* writeChanged() {
@@ -694,10 +850,7 @@ const isTemplate = (root) => Effect.gen(function* findMaintainWorkflow() {
694
850
  const path = yield* Path.Path;
695
851
  return yield* fs.exists(path.join(root, WORKFLOWS, MAINTAIN_WORKFLOW_FILE)).pipe(Effect.orElseSucceed(() => false));
696
852
  });
697
- const planned = (root) => Effect.gen(function* plan() {
698
- if (yield* isTemplate(root)) return OWN_CI;
699
- const workflows = yield* workflowSources(root);
700
- const actions = yield* actionSources(root);
853
+ const planRewrites = (root, workflows, actions) => Effect.gen(function* planChanges() {
701
854
  const localSetups = settle(actions, /* @__PURE__ */ new Set());
702
855
  const rewrittenWorkflows = rewriteAll(workflows, localSetups);
703
856
  const rewrittenActions = rewriteAll(actions, localSetups);
@@ -707,29 +860,29 @@ const planned = (root) => Effect.gen(function* plan() {
707
860
  workflows: rewrittenWorkflows,
708
861
  usesSetup
709
862
  });
863
+ const templates = pipe(TEMPLATE_WORKFLOWS, Array.filter(() => usesSetup));
710
864
  return {
711
- changes: pipe([...rewrittenActions, ...rewrittenWorkflows], Array.filter(({ rewritten, source }) => rewritten.source !== source), Array.map(({ file, rewritten, source }) => ({
865
+ changes: pipe([...rewrittenActions, ...rewrittenWorkflows], Array.map(({ file, name, rewritten, source }) => ({
712
866
  file,
713
867
  previous: source,
714
- source: rewritten.source
715
- })), Array.filter(({ file }) => !pipe(created, Array.some((change) => change.file === file))), Array.appendAll(created)),
868
+ setup: rewritten.source,
869
+ source: fromTemplate({
870
+ templates,
871
+ name,
872
+ source: rewritten.source
873
+ })
874
+ })), Array.filter(({ previous, source }) => previous !== source), Array.filter(({ file }) => !pipe(created, Array.some((change) => change.file === file))), Array.appendAll(created)),
716
875
  sources: [...actions, ...workflows]
717
876
  };
718
877
  });
719
- const refDrift = (sources) => {
720
- const pinned = pipe(sources, Array.filter(({ source }) => !Array.isReadonlyArrayEmpty(refsIn(source))));
721
- if (new Set(pipe(pinned, Array.flatMap(({ source }) => refsIn(source)))).size <= SINGLE_REF) return [];
722
- return pipe(pinned, Array.map(({ file }) => ({
723
- file,
724
- reason: "ref"
725
- })));
726
- };
727
- const setupDrift = (changes) => pipe(changes, Array.filter(({ previous, source }) => withoutRefs(previous) !== withoutRefs(source)), Array.map(({ file }) => ({
728
- file,
729
- reason: "setup"
730
- })));
878
+ const planned = (root) => Effect.gen(function* plan() {
879
+ if (yield* isTemplate(root)) return OWN_CI;
880
+ const workflows = yield* workflowSources(root);
881
+ const actions = yield* actionSources(root);
882
+ return yield* planRewrites(root, workflows, actions);
883
+ });
731
884
  /** @internal */
732
- const findCiDrift = (root) => planned(root).pipe(Effect.map(({ changes, sources }) => [...setupDrift(changes), ...refDrift(sources)]));
885
+ const findCiDrift = (root) => planned(root).pipe(Effect.map(({ changes, sources }) => [...changeDrift(changes), ...refDrift(sources)]));
733
886
  /** @internal */
734
887
  const syncCi = (root) => planned(root).pipe(Effect.flatMap(({ changes }) => Effect.forEach(changes, (change) => write(root, change), {
735
888
  ...SEQUENTIAL,
@@ -1722,4 +1875,4 @@ const runVpa = Function.dual(2, (root, args) => pipe(args, Array.match({
1722
1875
  })));
1723
1876
  export { VpToolsError as i, findCiDrift as n, loadViteConfig as r, runVpa as t };
1724
1877
 
1725
- //# sourceMappingURL=vpa-4qVd4VBP.mjs.map
1878
+ //# sourceMappingURL=vpa-D9vx1zUp.mjs.map