@codyswann/lisa 4.60.12 → 4.62.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 (102) hide show
  1. package/README.md +13 -0
  2. package/dist/cli/pr-landing.d.ts +80 -0
  3. package/dist/cli/pr-landing.d.ts.map +1 -0
  4. package/dist/cli/pr-landing.js +224 -0
  5. package/dist/cli/pr-landing.js.map +1 -0
  6. package/dist/cli/starter-cmd.d.ts +1 -1
  7. package/dist/cli/starter-cmd.d.ts.map +1 -1
  8. package/dist/cli/starter-cmd.js +25 -3
  9. package/dist/cli/starter-cmd.js.map +1 -1
  10. package/dist/cli/starter-sync-command.d.ts +29 -0
  11. package/dist/cli/starter-sync-command.d.ts.map +1 -0
  12. package/dist/cli/starter-sync-command.js +130 -0
  13. package/dist/cli/starter-sync-command.js.map +1 -0
  14. package/dist/cli/starter-sync-content.d.ts +25 -0
  15. package/dist/cli/starter-sync-content.d.ts.map +1 -0
  16. package/dist/cli/starter-sync-content.js +106 -0
  17. package/dist/cli/starter-sync-content.js.map +1 -0
  18. package/dist/cli/starter-sync-source.d.ts +33 -0
  19. package/dist/cli/starter-sync-source.d.ts.map +1 -0
  20. package/dist/cli/starter-sync-source.js +154 -0
  21. package/dist/cli/starter-sync-source.js.map +1 -0
  22. package/dist/cli/starter-sync-write.d.ts +11 -0
  23. package/dist/cli/starter-sync-write.d.ts.map +1 -0
  24. package/dist/cli/starter-sync-write.js +126 -0
  25. package/dist/cli/starter-sync-write.js.map +1 -0
  26. package/dist/cli/starter-sync.d.ts +22 -0
  27. package/dist/cli/starter-sync.d.ts.map +1 -0
  28. package/dist/cli/starter-sync.js +219 -0
  29. package/dist/cli/starter-sync.js.map +1 -0
  30. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  31. package/dist/core/nightly-e2e-guard-behavior-certificate.js.map +1 -1
  32. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  33. package/dist/core/upstream-evidence-manifest.js +13 -1
  34. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  35. package/dist/health/template-inspection.d.ts +16 -1
  36. package/dist/health/template-inspection.d.ts.map +1 -1
  37. package/dist/health/template-inspection.js +1 -1
  38. package/dist/health/template-inspection.js.map +1 -1
  39. package/dist/strategies/copy-contents.d.ts +11 -0
  40. package/dist/strategies/copy-contents.d.ts.map +1 -1
  41. package/dist/strategies/copy-contents.js +21 -5
  42. package/dist/strategies/copy-contents.js.map +1 -1
  43. package/dist/utils/atomic-file-write.d.ts +1 -1
  44. package/dist/utils/atomic-file-write.d.ts.map +1 -1
  45. package/dist/utils/atomic-file-write.js.map +1 -1
  46. package/package.json +4 -4
  47. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  49. package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +32 -0
  50. package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +32 -0
  51. package/plugins/lisa-agy/plugin.json +1 -1
  52. package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +32 -0
  53. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  55. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  56. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +32 -0
  60. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +32 -0
  62. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  64. package/plugins/lisa-expo-agy/plugin.json +1 -1
  65. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  69. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  70. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  74. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  75. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  79. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  80. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  84. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  85. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  86. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  89. package/plugins/lisa-rails-agy/plugin.json +1 -1
  90. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  93. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  94. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  95. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  96. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  99. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  100. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  101. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  102. package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +32 -0
package/README.md CHANGED
@@ -248,6 +248,19 @@ even if the remote has advanced. The command does not write to the starter or
248
248
  publish project changes. If setup's overlay application fails, finish repairing
249
249
  that project before deliberately adopting its baseline.
250
250
 
251
+ Run `lisa starter sync --path .` after committing the starter configuration.
252
+ The default opens a PR from an isolated worktree and preserves pending edits in
253
+ the current checkout. `--base` selects the destination branch (default: the
254
+ current branch). The PR stays open; the calling agent can use the existing
255
+ `lisa-drive-pr-to-merge` workflow with `auto_merge=false` for review and checks.
256
+ Set `starter.sync.strategy` to `direct-when-clean` to commit locally instead;
257
+ this mode refuses tracked or untracked pending changes and does not push.
258
+ Both modes run without prompts and honor normal Git hooks. Supply `--work-item`
259
+ and `--co-author` when the project requires commit attribution. `--json` emits
260
+ the result on stdout, with Git and hook output on stderr. Failed operations keep
261
+ their worktree for inspection; retry creates a fresh isolated attempt or returns
262
+ an already-open sync PR. No command writes to the starter repository.
263
+
251
264
  For Codex, apply emits a repository marketplace containing only the base Lisa
252
265
  plugin plus detected stacks and explicitly configured features. When Codex has
253
266
  those plugins installed, enabled, and trusted, it loads their native skills,
@@ -0,0 +1,80 @@
1
+ import { type CaptureCommand } from "./starter-provenance.js";
2
+ /** Git writes stream their normal hooks; metadata reads remain bounded. */
3
+ export interface LandingCommands {
4
+ readonly capture: CaptureCommand;
5
+ readonly run: (command: string, args: readonly string[], cwd: string) => Promise<void>;
6
+ }
7
+ /** Snapshot of the branch and every tracked/untracked pending change. */
8
+ export interface LandingSnapshot {
9
+ readonly root: string;
10
+ readonly head: string;
11
+ readonly branch: string;
12
+ readonly status: string;
13
+ }
14
+ /** A new, isolated branch owned by the landing operation. */
15
+ export interface PullRequestLanding {
16
+ readonly project: string;
17
+ readonly worktree: string;
18
+ readonly directory: string;
19
+ readonly head: string;
20
+ readonly branch: string;
21
+ readonly base: string;
22
+ readonly repo: string;
23
+ }
24
+ /** Optional attribution supplied by the caller, never fabricated by the tool. */
25
+ export interface LandingAttribution {
26
+ readonly workItem?: string;
27
+ readonly coAuthor?: string;
28
+ }
29
+ /**
30
+ * Execute normal Git hooks without a shell or an interactive prompt.
31
+ * @param command - Executable name.
32
+ * @param args - Separate command arguments.
33
+ * @param cwd - Owning worktree.
34
+ * @returns Completion after normal hooks finish.
35
+ */
36
+ export declare const runLandingCommand: LandingCommands["run"];
37
+ export declare const LANDING_COMMANDS: LandingCommands;
38
+ /**
39
+ * Inspect the exact repository root; a parent repository is not a substitute.
40
+ * @param project - Exact project root.
41
+ * @param commands - Git metadata reader.
42
+ * @returns Branch and working tree snapshot.
43
+ */
44
+ export declare function inspectLanding(project: string, commands?: LandingCommands): Promise<LandingSnapshot>;
45
+ /**
46
+ * Prepare the existing PR driver's isolated change-set worktree.
47
+ * @param snapshot - Original checkout snapshot.
48
+ * @param base - Destination branch.
49
+ * @param commands - Git and GitHub operations.
50
+ * @returns Existing PR or new isolated worktree.
51
+ */
52
+ export declare function preparePullRequest(snapshot: LandingSnapshot, base?: string, commands?: LandingCommands): Promise<PullRequestLanding | {
53
+ readonly url: string;
54
+ }>;
55
+ /**
56
+ * Remove only a clean worktree that this operation created; never force it.
57
+ * @param landing - Worktree owned by this operation.
58
+ * @param commands - Git operations.
59
+ */
60
+ export declare function releasePullRequestWorktree(landing: PullRequestLanding, commands?: LandingCommands): Promise<void>;
61
+ /**
62
+ * Commit only the declared change set after checking for unrelated changes.
63
+ * @param before - Snapshot before applying changes.
64
+ * @param paths - Files belonging to this change set.
65
+ * @param title - Commit subject.
66
+ * @param attribution - Caller supplied tracker and author.
67
+ * @param commands - Git operations.
68
+ * @returns Commit identifier, or undefined when already current.
69
+ */
70
+ export declare function commitLanding(before: LandingSnapshot, paths: readonly string[], title: string, attribution?: LandingAttribution, commands?: LandingCommands): Promise<string | undefined>;
71
+ /**
72
+ * Publish through the existing driver's mechanical path; never arm auto-merge.
73
+ * @param landing - Clean change set worktree.
74
+ * @param title - Pull request title.
75
+ * @param body - Reviewable change description.
76
+ * @param commands - Git and GitHub operations.
77
+ * @returns Created pull request URL.
78
+ */
79
+ export declare function publishPullRequest(landing: PullRequestLanding, title: string, body: string, commands?: LandingCommands): Promise<string>;
80
+ //# sourceMappingURL=pr-landing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-landing.d.ts","sourceRoot":"","sources":["../../src/cli/pr-landing.ts"],"names":[],"mappings":"AASA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9E,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,KACR,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,6DAA6D;AAC7D,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AC1B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAwD7B;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,QAAQ,kBAAmB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA+BjB"}
@@ -0,0 +1,224 @@
1
+ /** Shared mechanical landing for lisa-drive-pr-to-merge and its CLI callers. */
2
+ import { existsSync, statSync } from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
+ import { spawn } from "node:child_process";
5
+ import { createHash, randomUUID } from "node:crypto";
6
+ import { mkdtemp, realpath, rmdir, writeFile } from "node:fs/promises";
7
+ import { tmpdir } from "node:os";
8
+ import path from "node:path";
9
+ import { env as processEnvironment } from "node:process";
10
+ import { captureCommand } from "./starter-provenance.js";
11
+ /**
12
+ * Execute normal Git hooks without a shell or an interactive prompt.
13
+ * @param command - Executable name.
14
+ * @param args - Separate command arguments.
15
+ * @param cwd - Owning worktree.
16
+ * @returns Completion after normal hooks finish.
17
+ */
18
+ export const runLandingCommand = async (command, args, cwd) => await new Promise((resolve, reject) => {
19
+ const child = spawn(command, [...args], {
20
+ cwd,
21
+ stdio: ["ignore", 2, 2],
22
+ env: {
23
+ ...processEnvironment,
24
+ GIT_TERMINAL_PROMPT: "0",
25
+ GH_PROMPT_DISABLED: "1",
26
+ GIT_EDITOR: "true",
27
+ },
28
+ timeout: 30 * 60 * 1000,
29
+ });
30
+ child.once("error", reject);
31
+ child.once("close", (code, signal) => {
32
+ if (code === 0)
33
+ resolve();
34
+ else
35
+ reject(new Error(`${command} failed (${signal ?? code}); its output is above.`));
36
+ });
37
+ });
38
+ export const LANDING_COMMANDS = {
39
+ capture: captureCommand,
40
+ run: runLandingCommand,
41
+ };
42
+ /**
43
+ * Inspect the exact repository root; a parent repository is not a substitute.
44
+ * @param project - Exact project root.
45
+ * @param commands - Git metadata reader.
46
+ * @returns Branch and working tree snapshot.
47
+ */
48
+ export async function inspectLanding(project, commands = LANDING_COMMANDS) {
49
+ const root = await realpath(project);
50
+ const git = (args) => commands.capture("git", args, { cwd: root });
51
+ if ((await realpath(await git(["rev-parse", "--show-toplevel"]))) !== root)
52
+ throw new Error("Run starter sync at the repository root.");
53
+ const branch = await git(["branch", "--show-current"]);
54
+ if (!branch)
55
+ throw new Error("Starter sync needs a checked-out branch.");
56
+ return {
57
+ root,
58
+ branch,
59
+ head: await git(["rev-parse", "HEAD"]),
60
+ status: await git(["status", "--porcelain=v1", "--untracked-files=all"]),
61
+ };
62
+ }
63
+ /**
64
+ * Prepare the existing PR driver's isolated change-set worktree.
65
+ * @param snapshot - Original checkout snapshot.
66
+ * @param base - Destination branch.
67
+ * @param commands - Git and GitHub operations.
68
+ * @returns Existing PR or new isolated worktree.
69
+ */
70
+ export async function preparePullRequest(snapshot, base = snapshot.branch, commands = LANDING_COMMANDS) {
71
+ await commands.capture("git", ["check-ref-format", "--branch", base], {
72
+ cwd: snapshot.root,
73
+ });
74
+ const repo = await commands.capture("gh", ["repo", "view", "--json", "nameWithOwner", "--jq", ".nameWithOwner"], { cwd: snapshot.root });
75
+ const key = createHash("sha256")
76
+ .update(`${base}\n${snapshot.head}`)
77
+ .digest("hex")
78
+ .slice(0, 12);
79
+ const prefix = `chore/starter-sync-${key}-`;
80
+ const branch = `${prefix}${randomUUID().slice(0, 8)}`;
81
+ const existing = JSON.parse(await commands.capture("gh", [
82
+ "pr",
83
+ "list",
84
+ "--repo",
85
+ repo,
86
+ "--base",
87
+ base,
88
+ "--state",
89
+ "open",
90
+ "--json",
91
+ "url,headRefName",
92
+ "--limit",
93
+ "1000",
94
+ ], { cwd: snapshot.root }));
95
+ if (!Array.isArray(existing) || existing.length >= 1000)
96
+ throw new Error("Could not read existing starter pull requests.");
97
+ const match = existing.find(entry => typeof entry?.headRefName === "string" &&
98
+ entry.headRefName.startsWith(prefix));
99
+ if (match) {
100
+ if (typeof match.url !== "string")
101
+ throw new Error("Invalid PR URL.");
102
+ return { url: match.url };
103
+ }
104
+ const directory = await mkdtemp(path.join(tmpdir(), "lisa-starter-sync-"));
105
+ const worktree = path.join(directory, "worktree");
106
+ try {
107
+ await commands.run("git", ["worktree", "add", "--no-track", "-b", branch, worktree, snapshot.head], snapshot.root);
108
+ await bootstrapLanding(worktree, commands);
109
+ }
110
+ catch (error) {
111
+ throw new Error(`Could not prepare starter sync; inspect existing branch ${branch}. Temporary directory: ${directory}`, { cause: error });
112
+ }
113
+ return {
114
+ project: snapshot.root,
115
+ worktree,
116
+ directory,
117
+ head: snapshot.head,
118
+ branch,
119
+ base,
120
+ repo,
121
+ };
122
+ }
123
+ /**
124
+ * Remove only a clean worktree that this operation created; never force it.
125
+ * @param landing - Worktree owned by this operation.
126
+ * @param commands - Git operations.
127
+ */
128
+ export async function releasePullRequestWorktree(landing, commands = LANDING_COMMANDS) {
129
+ const head = await commands.capture("git", ["rev-parse", "HEAD"], {
130
+ cwd: landing.worktree,
131
+ });
132
+ await commands.run("git", ["worktree", "remove", landing.worktree], landing.project);
133
+ await rmdir(landing.directory);
134
+ if (head === landing.head)
135
+ await commands.run("git", ["branch", "-d", landing.branch], landing.project);
136
+ }
137
+ /**
138
+ * Commit only the declared change set after checking for unrelated changes.
139
+ * @param before - Snapshot before applying changes.
140
+ * @param paths - Files belonging to this change set.
141
+ * @param title - Commit subject.
142
+ * @param attribution - Caller supplied tracker and author.
143
+ * @param commands - Git operations.
144
+ * @returns Commit identifier, or undefined when already current.
145
+ */
146
+ export async function commitLanding(before, paths, title, attribution = {}, commands = LANDING_COMMANDS) {
147
+ const after = await inspectLanding(before.root, commands);
148
+ if (after.head !== before.head || after.branch !== before.branch)
149
+ throw new Error("The branch changed during starter sync; changes remain uncommitted.");
150
+ const staged = await commands.capture("git", ["diff", "--cached", "--name-only", "-z"], { cwd: before.root });
151
+ if (staged)
152
+ throw new Error("The index changed during starter sync; changes remain uncommitted.");
153
+ const changed = await commands.capture("git", [
154
+ "ls-files",
155
+ "--modified",
156
+ "--deleted",
157
+ "--others",
158
+ "--exclude-standard",
159
+ "-z",
160
+ ], { cwd: before.root });
161
+ if (changed
162
+ .split("\0")
163
+ .filter(Boolean)
164
+ .some(name => !paths.includes(name)))
165
+ throw new Error("Unrelated changes appeared during starter sync; nothing was committed.");
166
+ if (!after.status)
167
+ return undefined;
168
+ const trailers = [
169
+ attribution.workItem && `Work-Item: ${attribution.workItem}`,
170
+ attribution.coAuthor && `Co-authored-by: ${attribution.coAuthor}`,
171
+ ].filter(Boolean);
172
+ if ([attribution.workItem, attribution.coAuthor].some(value => value !== undefined && /[\r\n]/.test(value)))
173
+ throw new Error("Commit attribution must contain single-line values.");
174
+ await commands.run("git", ["add", "--", ...paths], before.root);
175
+ await commands.run("git", ["commit", "-m", [title, ...trailers].join("\n\n")], before.root);
176
+ return await commands.capture("git", ["rev-parse", "HEAD"], {
177
+ cwd: before.root,
178
+ });
179
+ }
180
+ /**
181
+ * Publish through the existing driver's mechanical path; never arm auto-merge.
182
+ * @param landing - Clean change set worktree.
183
+ * @param title - Pull request title.
184
+ * @param body - Reviewable change description.
185
+ * @param commands - Git and GitHub operations.
186
+ * @returns Created pull request URL.
187
+ */
188
+ export async function publishPullRequest(landing, title, body, commands = LANDING_COMMANDS) {
189
+ const current = await inspectLanding(landing.worktree, commands);
190
+ if (current.branch !== landing.branch || current.status)
191
+ throw new Error(`Starter landing is no longer clean on ${landing.branch}; inspect ${landing.worktree}.`);
192
+ await commands.run("git", ["push", "origin", `HEAD:refs/heads/${landing.branch}`], landing.worktree);
193
+ const bodyFile = path.join(landing.directory, "pull-request.md");
194
+ await writeFile(bodyFile, body, { flag: "wx", mode: 0o600 });
195
+ return await commands.capture("gh", [
196
+ "pr",
197
+ "create",
198
+ "--repo",
199
+ landing.repo,
200
+ "--head",
201
+ landing.branch,
202
+ "--base",
203
+ landing.base,
204
+ "--title",
205
+ title,
206
+ "--body-file",
207
+ bodyFile,
208
+ ], { cwd: landing.worktree });
209
+ }
210
+ /**
211
+ * Reuse the native worktree bootstrap before requiring commit hooks to run.
212
+ * @param worktree - Newly created worktree.
213
+ * @param commands - Normal subprocess runner.
214
+ */
215
+ async function bootstrapLanding(worktree, commands) {
216
+ if (existsSync(path.join(worktree, "package.json"))) {
217
+ const installer = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../plugins/lisa/hooks/install-pkgs.sh");
218
+ await commands.run("bash", [installer], worktree);
219
+ if (!existsSync(path.join(worktree, "node_modules")) ||
220
+ !statSync(path.join(worktree, "node_modules")).isDirectory())
221
+ throw new Error("Worktree dependency bootstrap did not produce node_modules.");
222
+ }
223
+ }
224
+ //# sourceMappingURL=pr-landing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-landing.js","sourceRoot":"","sources":["../../src/cli/pr-landing.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,IAAI,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,cAAc,EAAuB,MAAM,yBAAyB,CAAC;AAqC9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA2B,KAAK,EAC5D,OAAO,EACP,IAAI,EACJ,GAAG,EACH,EAAE,CACF,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC1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AAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7D,OAAO,MAAM,QAAQ,CAAC,OAAO,CAC3B,IAAI,EACJ;QACE,IAAI;QACJ,QAAQ;QACR,QAAQ;QACR,OAAO,CAAC,IAAI;QACZ,QAAQ;QACR,OAAO,CAAC,MAAM;QACd,QAAQ;QACR,OAAO,CAAC,IAAI;QACZ,SAAS;QACT,KAAK;QACL,aAAa;QACb,QAAQ;KACT,EACD,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,CAC1B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,gBAAgB,CAC7B,QAAgB,EAChB,QAAyB;IAEzB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACpD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAC5B,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAC5C,0CAA0C,CAC3C,CAAC;QACF,MAAM,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;QAClD,IACE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;YAChD,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,WAAW,EAAE;YAE5D,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -13,7 +13,7 @@ export interface StarterAdoptOptions {
13
13
  */
14
14
  export declare function runStarterAdopt(repo: string, options?: StarterAdoptOptions, capture?: CaptureCommand): Promise<void>;
15
15
  /**
16
- * Register the starter adoption command without changing default apply routing.
16
+ * Register the starter adoption and sync commands without changing default apply routing.
17
17
  * @param program - Commander root.
18
18
  * @param run - Adoption handler.
19
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"starter-cmd.d.ts","sourceRoot":"","sources":["../../src/cli/starter-cmd.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAEjC,sEAAsE;AACtE,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,mBAAwB,EACjC,OAAO,GAAE,cAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,GAAG,GAAE,OAAO,eAAiC,GAC5C,IAAI,CAeN"}
1
+ {"version":3,"file":"starter-cmd.d.ts","sourceRoot":"","sources":["../../src/cli/starter-cmd.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAEjC,sEAAsE;AACtE,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,mBAAwB,EACjC,OAAO,GAAE,cAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,GAAG,GAAE,OAAO,eAAiC,GAC5C,IAAI,CA2CN"}
@@ -1,5 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { readProjectConfig } from "../core/project-config.js";
3
+ import { runStarterSync, } from "./starter-sync-command.js";
3
4
  import { captureCommand, readGitHubStarter, recordStarterProvenance, validateStarterRepo, } from "./starter-provenance.js";
4
5
  /**
5
6
  * Adopt a starter without resetting a baseline that is already tracked.
@@ -20,14 +21,15 @@ export async function runStarterAdopt(repo, options = {}, capture = captureComma
20
21
  console.log(`Adopted ${repo} at ${template.lastSync.sha}. This records a baseline for future changes; existing project files were not synchronized.`);
21
22
  }
22
23
  /**
23
- * Register the starter adoption command without changing default apply routing.
24
+ * Register the starter adoption and sync commands without changing default apply routing.
24
25
  * @param program - Commander root.
25
26
  * @param run - Adoption handler.
26
27
  */
27
28
  export function addStarterCommand(program, run = runStarterAdopt) {
28
- program
29
+ const starter = program
29
30
  .command("starter")
30
- .description("Manage the project's starter origins")
31
+ .description("Manage the project's starter origins");
32
+ starter
31
33
  .command("adopt")
32
34
  .description("Record a starter baseline for an existing project")
33
35
  .argument("<repo>", "Starter as owner/repository")
@@ -36,5 +38,25 @@ export function addStarterCommand(program, run = runStarterAdopt) {
36
38
  .action(async (repo, options) => {
37
39
  await run(repo, options);
38
40
  });
41
+ starter
42
+ .command("sync")
43
+ .description("Open a starter update PR, or commit with direct-when-clean")
44
+ .option("--path <path>", "Existing project root")
45
+ .option("--base <branch>", "PR base (default: current branch)")
46
+ .option("--work-item <ref>", "Existing tracker item for commit and PR linkage")
47
+ .option("--co-author <identity>", "Actual agent co-author, when applicable")
48
+ .option("--json", "Print the landing result as JSON")
49
+ .action(async (options) => {
50
+ const result = await runStarterSync(options);
51
+ if (result.worktree)
52
+ console.error(`PR created; inspect retained worktree: ${result.worktree}`);
53
+ console.log(options.json
54
+ ? JSON.stringify(result)
55
+ : result.url
56
+ ? `Starter update PR: ${result.url}`
57
+ : result.commit
58
+ ? `Committed starter updates: ${result.commit}`
59
+ : "Starter is already current.");
60
+ });
39
61
  }
40
62
  //# sourceMappingURL=starter-c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,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,QAAQ;YACjB,OAAO,CAAC,KAAK,CACX,0CAA0C,MAAM,CAAC,QAAQ,EAAE,CAC5D,CAAC;QACJ,OAAO,CAAC,GAAG,CACT,OAAO,CAAC,IAAI;YACV,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;YACxB,CAAC,CAAC,MAAM,CAAC,GAAG;gBACV,CAAC,CAAC,sBAAsB,MAAM,CAAC,GAAG,EAAE;gBACpC,CAAC,CAAC,MAAM,CAAC,MAAM;oBACb,CAAC,CAAC,8BAA8B,MAAM,CAAC,MAAM,EAAE;oBAC/C,CAAC,CAAC,6BAA6B,CACtC,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { syncStarterTemplates, type StarterSyncResult } from "./starter-sync.js";
2
+ import { type LandingCommands } from "./pr-landing.js";
3
+ /** Headless CLI inputs and optional commit attribution. */
4
+ export interface StarterSyncCommandOptions {
5
+ readonly path?: string;
6
+ readonly base?: string;
7
+ readonly workItem?: string;
8
+ readonly coAuthor?: string;
9
+ }
10
+ /** Shared landing operations and the existing sync engine. */
11
+ export interface StarterLandingDependencies extends LandingCommands {
12
+ readonly sync: typeof syncStarterTemplates;
13
+ }
14
+ /** Observable landing outcome for terminal and automation callers. */
15
+ export interface StarterLandingResult {
16
+ readonly state: "current" | "committed" | "pull-request";
17
+ readonly results: readonly StarterSyncResult[];
18
+ readonly commit?: string;
19
+ readonly url?: string;
20
+ readonly worktree?: string;
21
+ }
22
+ /**
23
+ * Sync in an isolated PR worktree by default, or commit on an explicitly clean tree.
24
+ * @param options - Project path and landing options.
25
+ * @param dependencies - Injectable engine and Git operations.
26
+ * @returns Observable landing outcome.
27
+ */
28
+ export declare function runStarterSync(options?: StarterSyncCommandOptions, dependencies?: Partial<StarterLandingDependencies>): Promise<StarterLandingResult>;
29
+ //# sourceMappingURL=starter-sync-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starter-sync-command.d.ts","sourceRoot":"","sources":["../../src/cli/starter-sync-command.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,oBAAoB,EACpB,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAOL,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AAEzB,2DAA2D;AAC3D,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,8DAA8D;AAC9D,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,QAAQ,CAAC,IAAI,EAAE,OAAO,oBAAoB,CAAC;CAC5C;AAED,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC;IACzD,QAAQ,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAMD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,GAAE,yBAA8B,EACvC,YAAY,GAAE,OAAO,CAAC,0BAA0B,CAAM,GACrD,OAAO,CAAC,oBAAoB,CAAC,CAsC/B"}
@@ -0,0 +1,130 @@
1
+ import path from "node:path";
2
+ import { isDeepStrictEqual } from "node:util";
3
+ import { fileURLToPath } from "node:url";
4
+ import { unlink } from "node:fs/promises";
5
+ import { readProjectConfig, validateProjectConfig, } from "../core/project-config.js";
6
+ import { syncStarterTemplates, } from "./starter-sync.js";
7
+ import { commitLanding, inspectLanding, LANDING_COMMANDS, preparePullRequest, publishPullRequest, releasePullRequestWorktree, } from "./pr-landing.js";
8
+ const PULL_REQUEST = "pull-request";
9
+ const TITLE = "chore: sync starter updates";
10
+ const CONFIG = ".lisa.config.json";
11
+ /**
12
+ * Sync in an isolated PR worktree by default, or commit on an explicitly clean tree.
13
+ * @param options - Project path and landing options.
14
+ * @param dependencies - Injectable engine and Git operations.
15
+ * @returns Observable landing outcome.
16
+ */
17
+ export async function runStarterSync(options = {}, dependencies = {}) {
18
+ const deps = {
19
+ ...LANDING_COMMANDS,
20
+ sync: syncStarterTemplates,
21
+ ...dependencies,
22
+ };
23
+ const before = await inspectLanding(path.resolve(options.path ?? "."), deps);
24
+ const config = await readProjectConfig(before.root);
25
+ if (!config.starter?.templates?.length)
26
+ throw new Error("No starter is tracked. Adopt the project's starter before syncing.");
27
+ if (config.starter.sync?.strategy === "direct-when-clean") {
28
+ return await landDirect(before, options, deps);
29
+ }
30
+ const committed = validateProjectConfig(JSON.parse(await deps.capture("git", ["show", `${before.head}:${CONFIG}`], {
31
+ cwd: before.root,
32
+ })), CONFIG);
33
+ if (!isDeepStrictEqual(config.starter, committed.starter))
34
+ throw new Error("Commit the starter configuration before opening a sync PR; the isolated worktree uses committed settings.");
35
+ const landing = await preparePullRequest(before, options.base, deps);
36
+ if (!("worktree" in landing))
37
+ return { state: PULL_REQUEST, url: landing.url, results: [] };
38
+ try {
39
+ return await landStarterPullRequest(landing, options, deps);
40
+ }
41
+ catch (error) {
42
+ throw new Error(`${error instanceof Error ? error.message : String(error)}\nStarter changes retained at ${landing.worktree}.`, { cause: error });
43
+ }
44
+ }
45
+ /**
46
+ * Refuse publication on partial failure; retain the engine's retryable files.
47
+ * @param projectRoot - Destination worktree.
48
+ * @param deps - Sync engine dependency.
49
+ * @returns Successful per-template results.
50
+ */
51
+ async function applyStarter(projectRoot, deps) {
52
+ const lisaRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
53
+ const results = await deps.sync({ projectRoot, lisaRoot });
54
+ const failures = results.filter(result => result.state === "failed");
55
+ if (failures.length)
56
+ throw new Error(failures
57
+ .map(result => `${result.repo}: ${result.error ?? "sync failed"}`)
58
+ .join("\n"));
59
+ return results;
60
+ }
61
+ /**
62
+ * The engine reports its owned file changes; provenance is the only extra file.
63
+ * @param results - Successful engine results.
64
+ * @returns Exact paths eligible for staging.
65
+ */
66
+ function changedPaths(results) {
67
+ return [...new Set([CONFIG, ...results.flatMap(result => result.changed)])];
68
+ }
69
+ /**
70
+ * Hand the engine's changes to the same landing functions used by the PR driver.
71
+ * @param landing - Isolated destination worktree.
72
+ * @param options - Caller attribution.
73
+ * @param deps - Shared operations.
74
+ * @returns Published PR or current outcome.
75
+ */
76
+ async function landStarterPullRequest(landing, options, deps) {
77
+ const before = await inspectLanding(landing.worktree, deps);
78
+ if (before.status)
79
+ throw new Error("The new worktree contains changes from its checkout hook; inspect them before syncing.");
80
+ const results = await applyStarter(landing.worktree, deps);
81
+ const commit = await commitLanding(before, changedPaths(results), TITLE, options, deps);
82
+ if (!commit) {
83
+ await releasePullRequestWorktree(landing, deps);
84
+ return { state: "current", results };
85
+ }
86
+ const body = [
87
+ "Starter changes applied using Lisa's existing ownership rules. Review this pull request before merging.",
88
+ options.workItem
89
+ ? `Refs ${options.workItem}\nWork-Item: ${options.workItem}`
90
+ : "",
91
+ ...results.map(result => `- ${result.repo}: ${result.state}; ${result.changed.length} file(s) changed.`),
92
+ "Next: run the existing lisa-drive-pr-to-merge workflow with auto_merge=false to handle review and checks. This command does not enable auto-merge.",
93
+ ]
94
+ .filter(Boolean)
95
+ .join("\n\n");
96
+ const url = await publishPullRequest(landing, TITLE, body, deps);
97
+ try {
98
+ await unlink(path.join(landing.directory, "pull-request.md"));
99
+ await releasePullRequestWorktree(landing, deps);
100
+ }
101
+ catch {
102
+ return {
103
+ state: PULL_REQUEST,
104
+ results,
105
+ commit,
106
+ url,
107
+ worktree: landing.worktree,
108
+ };
109
+ }
110
+ return { state: PULL_REQUEST, results, commit, url };
111
+ }
112
+ /**
113
+ * Apply and commit only after the current checkout passes the clean-tree check.
114
+ * @param before - Original checkout snapshot.
115
+ * @param options - Commit attribution.
116
+ * @param deps - Shared operations.
117
+ * @returns Direct commit or current outcome.
118
+ */
119
+ async function landDirect(before, options, deps) {
120
+ if (before.status)
121
+ throw new Error("Starter sync refused: this working tree has uncommitted changes.");
122
+ const results = await applyStarter(before.root, deps);
123
+ const commit = await commitLanding(before, changedPaths(results), TITLE, options, deps);
124
+ return {
125
+ state: commit ? "committed" : "current",
126
+ results,
127
+ ...(commit ? { commit } : {}),
128
+ };
129
+ }
130
+ //# sourceMappingURL=starter-sync-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starter-sync-command.js","sourceRoot":"","sources":["../../src/cli/starter-sync-command.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,oBAAoB,GAErB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,0BAA0B,GAI3B,MAAM,iBAAiB,CAAC;AAwBzB,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,KAAK,GAAG,6BAA6B,CAAC;AAC5C,MAAM,MAAM,GAAG,mBAAmB,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,UAAqC,EAAE,EACvC,eAAoD,EAAE;IAEtD,MAAM,IAAI,GAAG;QACX,GAAG,gBAA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;QAC9D,MAAM,0BAA0B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,KAAK,EAAE,YAAY;YACnB,OAAO;YACP,MAAM;YACN,GAAG;YACH,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,UAAU,CACvB,MAAuB,EACvB,OAAkC,EAClC,IAAgC;IAEhC,IAAI,MAAM,CAAC,MAAM;QACf,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAC;IACJ,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,MAAM,aAAa,CAChC,MAAM,EACN,YAAY,CAAC,OAAO,CAAC,EACrB,KAAK,EACL,OAAO,EACP,IAAI,CACL,CAAC;IACF,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;QACvC,OAAO;QACP,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { TemplateCandidate } from "../health/template-inspection.js";
2
+ import type { StarterChange } from "./starter-sync-source.js";
3
+ /**
4
+ * Resolve canonical markers; markerless copy-contents uses whole-file ownership.
5
+ * @param candidates - Applicable copy-contents template sources.
6
+ * @returns Distinct governed opening markers.
7
+ */
8
+ export declare function starterBlockMarkers(candidates: readonly TemplateCandidate[]): Promise<readonly string[]>;
9
+ /**
10
+ * Apply only the blocks governed by the existing canonical template sources.
11
+ * @param change - Exact before/after starter file.
12
+ * @param current - Existing consumer bytes.
13
+ * @param markers - Canonical opening markers for this path.
14
+ * @returns Updated bytes, preserving all consumer content outside those blocks.
15
+ */
16
+ export declare function mergeStarterBlocks(change: StarterChange, current: Buffer | undefined, markers: readonly string[]): Promise<Buffer>;
17
+ /**
18
+ * Reuse Lisa's JSON strategies for paths governed by JSON merge semantics.
19
+ * @param change - Pinned starter JSON file.
20
+ * @param current - Existing consumer bytes.
21
+ * @param candidates - Applicable JSON strategies in canonical order.
22
+ * @returns Merged bytes; source removal preserves the consumer's JSON document.
23
+ */
24
+ export declare function mergeStarterJson(change: StarterChange, current: Buffer | undefined, candidates: readonly TemplateCandidate[]): Buffer | undefined;
25
+ //# sourceMappingURL=starter-sync-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starter-sync-content.d.ts","sourceRoot":"","sources":["../../src/cli/starter-sync-content.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAQ1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAyD9D;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,SAAS,iBAAiB,EAAE,GACvC,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAW5B;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,OAAO,CAAC,MAAM,CAAC,CAejB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,UAAU,EAAE,SAAS,iBAAiB,EAAE,GACvC,MAAM,GAAG,SAAS,CAiBpB"}