@nestledjs/upgrades 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.
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_CHANNEL = exports.TERMINAL_OUTCOMES = void 0;
4
+ exports.readSiteConfig = readSiteConfig;
5
+ exports.nestledDir = nestledDir;
6
+ exports.logPathFor = logPathFor;
7
+ exports.readUpgradeLog = readUpgradeLog;
8
+ exports.writeUpgradeLog = writeUpgradeLog;
9
+ exports.readTemplateStamp = readTemplateStamp;
10
+ exports.initBaseline = initBaseline;
11
+ exports.advanceBaseline = advanceBaseline;
12
+ const node_fs_1 = require("node:fs");
13
+ const node_path_1 = require("node:path");
14
+ const yaml_1 = require("yaml");
15
+ /** Outcomes that mean a note should not be offered again. */
16
+ exports.TERMINAL_OUTCOMES = new Set([
17
+ 'applied',
18
+ 'superseded',
19
+ 'not-applicable',
20
+ ]);
21
+ exports.DEFAULT_CHANNEL = 'stable';
22
+ function readSiteConfig(projectDir) {
23
+ var _a;
24
+ const file = (0, node_path_1.join)(nestledDir(projectDir), 'config.yaml');
25
+ if (!(0, node_fs_1.existsSync)(file))
26
+ return {};
27
+ return (_a = (0, yaml_1.parse)((0, node_fs_1.readFileSync)(file, 'utf8'))) !== null && _a !== void 0 ? _a : {};
28
+ }
29
+ function nestledDir(projectDir) {
30
+ return (0, node_path_1.join)(projectDir, '.nestled');
31
+ }
32
+ function logPathFor(projectDir) {
33
+ return (0, node_path_1.join)(nestledDir(projectDir), 'upgrade-log.yaml');
34
+ }
35
+ function readUpgradeLog(projectDir) {
36
+ var _a, _b, _c;
37
+ const file = logPathFor(projectDir);
38
+ if (!(0, node_fs_1.existsSync)(file)) {
39
+ return { template: {}, upgrades: {} };
40
+ }
41
+ const raw = (_a = (0, yaml_1.parse)((0, node_fs_1.readFileSync)(file, 'utf8'))) !== null && _a !== void 0 ? _a : {};
42
+ return {
43
+ template: (_b = raw.template) !== null && _b !== void 0 ? _b : {},
44
+ upgrades: (_c = raw.upgrades) !== null && _c !== void 0 ? _c : {},
45
+ };
46
+ }
47
+ function writeUpgradeLog(projectDir, log) {
48
+ const file = logPathFor(projectDir);
49
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(file), { recursive: true });
50
+ (0, node_fs_1.writeFileSync)(file, (0, yaml_1.stringify)(log), 'utf8');
51
+ }
52
+ /**
53
+ * Read the version stamp that travelled with the clone. Tolerates a couple of
54
+ * filename spellings so producers aren't locked into one. Returns null if the
55
+ * clone predates the stamp (legacy adoption — caller must supply a baseline).
56
+ */
57
+ function readTemplateStamp(projectDir) {
58
+ const candidates = [
59
+ (0, node_path_1.join)(nestledDir(projectDir), 'template-version'),
60
+ (0, node_path_1.join)(nestledDir(projectDir), 'template-version.yaml'),
61
+ (0, node_path_1.join)(nestledDir(projectDir), 'template-version.json'),
62
+ ];
63
+ for (const file of candidates) {
64
+ if (!(0, node_fs_1.existsSync)(file))
65
+ continue;
66
+ const raw = (0, yaml_1.parse)((0, node_fs_1.readFileSync)(file, 'utf8'));
67
+ if (raw && typeof raw.release === 'string') {
68
+ return { release: raw.release, commit: raw.commit, repo: raw.repo };
69
+ }
70
+ }
71
+ return null;
72
+ }
73
+ /**
74
+ * Establish (or re-affirm) the baseline for a clone. Precedence for the
75
+ * baseline release: explicit `--at` > existing log > committed template stamp.
76
+ * Idempotent: re-running never lowers an existing baseline or loses history.
77
+ */
78
+ function initBaseline(projectDir, options = {}) {
79
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
80
+ const log = readUpgradeLog(projectDir);
81
+ const stamp = readTemplateStamp(projectDir);
82
+ const baselineRelease = (_b = (_a = options.at) !== null && _a !== void 0 ? _a : log.template.baselineRelease) !== null && _b !== void 0 ? _b : stamp === null || stamp === void 0 ? void 0 : stamp.release;
83
+ if (!baselineRelease) {
84
+ throw new Error('Cannot determine a baseline. Pass --at <release>, or add a committed ' +
85
+ '.nestled/template-version to the template so clones carry their origin.');
86
+ }
87
+ const config = readSiteConfig(projectDir);
88
+ log.template = Object.assign(Object.assign({}, log.template), { repo: (_d = (_c = options.repo) !== null && _c !== void 0 ? _c : log.template.repo) !== null && _d !== void 0 ? _d : stamp === null || stamp === void 0 ? void 0 : stamp.repo, channel: (_f = (_e = options.channel) !== null && _e !== void 0 ? _e : log.template.channel) !== null && _f !== void 0 ? _f : exports.DEFAULT_CHANNEL, baselineRelease, remote: (_k = (_h = (_g = options.remote) !== null && _g !== void 0 ? _g : log.template.remote) !== null && _h !== void 0 ? _h : (_j = config.template) === null || _j === void 0 ? void 0 : _j.remote) !== null && _k !== void 0 ? _k : stamp === null || stamp === void 0 ? void 0 : stamp.remote, ref: (_p = (_m = (_l = options.ref) !== null && _l !== void 0 ? _l : log.template.ref) !== null && _m !== void 0 ? _m : (_o = config.template) === null || _o === void 0 ? void 0 : _o.ref) !== null && _p !== void 0 ? _p : stamp === null || stamp === void 0 ? void 0 : stamp.ref, originCommit: (_r = (_q = log.template.originCommit) !== null && _q !== void 0 ? _q : options.commit) !== null && _r !== void 0 ? _r : stamp === null || stamp === void 0 ? void 0 : stamp.commit, lastReviewedCommit: (_t = (_s = log.template.lastReviewedCommit) !== null && _s !== void 0 ? _s : options.commit) !== null && _t !== void 0 ? _t : stamp === null || stamp === void 0 ? void 0 : stamp.commit });
89
+ writeUpgradeLog(projectDir, log);
90
+ return log;
91
+ }
92
+ /**
93
+ * Advance the baseline as far as the manifest allows: walk releases in order
94
+ * above the current baseline and move the baseline forward across each release
95
+ * whose every note has reached a terminal outcome in the log, stopping at the
96
+ * first release that still has unfinished work. Also carries `lastReviewedCommit`
97
+ * forward to the release's template commit. Mutates and returns `log`.
98
+ */
99
+ function advanceBaseline(log, releasesAscending) {
100
+ var _a;
101
+ const applied = (_a = log.upgrades) !== null && _a !== void 0 ? _a : {};
102
+ for (const release of releasesAscending) {
103
+ const allTerminal = release.noteIds.every((id) => {
104
+ const status = applied[id];
105
+ return status != null && exports.TERMINAL_OUTCOMES.has(status);
106
+ });
107
+ if (!allTerminal)
108
+ break;
109
+ log.template.baselineRelease = release.id;
110
+ if (release.templateCommit)
111
+ log.template.lastReviewedCommit = release.templateCommit;
112
+ }
113
+ return log;
114
+ }
115
+ //# sourceMappingURL=baseline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../../../upgrades/src/lib/baseline.ts"],"names":[],"mappings":";;;AAuEA,wCAIC;AAED,gCAEC;AAED,gCAEC;AAED,wCAUC;AAED,0CAIC;AAOD,8CAcC;AAmBD,oCA6BC;AASD,0CAeC;AAlMD,qCAA6E;AAC7E,yCAA0C;AAC1C,+BAAwC;AAgBxC,6DAA6D;AAChD,QAAA,iBAAiB,GAAyB,IAAI,GAAG,CAAU;IACtE,SAAS;IACT,YAAY;IACZ,gBAAgB;CACjB,CAAC,CAAC;AAqBU,QAAA,eAAe,GAAG,QAAQ,CAAC;AA2BxC,SAAgB,cAAc,CAAC,UAAkB;;IAC/C,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,UAAU,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,CAAC;IACzD,IAAI,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,OAAO,MAAC,IAAA,YAAK,EAAC,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAgB,mCAAI,EAAE,CAAC;AACjE,CAAC;AAED,SAAgB,UAAU,CAAC,UAAkB;IAC3C,OAAO,IAAA,gBAAI,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AACtC,CAAC;AAED,SAAgB,UAAU,CAAC,UAAkB;IAC3C,OAAO,IAAA,gBAAI,EAAC,UAAU,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAC1D,CAAC;AAED,SAAgB,cAAc,CAAC,UAAkB;;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kB,GAAG,OAAO,CAAC,cAAc,CAAC;IACvF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function run(argv: string[]): number;
package/src/lib/cli.js ADDED
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = run;
4
+ const pending_1 = require("./pending");
5
+ const baseline_1 = require("./baseline");
6
+ const feed_1 = require("./feed");
7
+ const apply_1 = require("./apply");
8
+ function parseArgs(argv) {
9
+ const [command = 'help', ...rest] = argv;
10
+ const flags = {};
11
+ for (let i = 0; i < rest.length; i++) {
12
+ const token = rest[i];
13
+ if (!token.startsWith('--'))
14
+ continue;
15
+ const key = token.slice(2);
16
+ const next = rest[i + 1];
17
+ if (next != null && !next.startsWith('--')) {
18
+ flags[key] = next;
19
+ i++;
20
+ }
21
+ else {
22
+ flags[key] = true;
23
+ }
24
+ }
25
+ return { command, flags };
26
+ }
27
+ function str(flags, key) {
28
+ return typeof flags[key] === 'string' ? flags[key] : undefined;
29
+ }
30
+ function projectDirFrom(flags) {
31
+ var _a;
32
+ return (_a = str(flags, 'project')) !== null && _a !== void 0 ? _a : process.cwd();
33
+ }
34
+ function feedOptions(flags) {
35
+ return {
36
+ manifestFile: str(flags, 'manifest'),
37
+ remote: str(flags, 'remote'),
38
+ ref: str(flags, 'ref'),
39
+ };
40
+ }
41
+ function printPending(pending) {
42
+ var _a, _b;
43
+ if (pending.notes.length === 0) {
44
+ console.log(`Up to date on channel "${pending.channel}" (baseline ${(_a = pending.baseline) !== null && _a !== void 0 ? _a : 'unset'}` +
45
+ `${pending.ceiling ? `, channel at ${pending.ceiling}` : ''}).`);
46
+ return;
47
+ }
48
+ console.log(`${pending.notes.length} pending note(s) on channel "${pending.channel}" ` +
49
+ `(baseline ${(_b = pending.baseline) !== null && _b !== void 0 ? _b : 'unset'} → ${pending.ceiling}):\n`);
50
+ for (const release of pending.releases) {
51
+ const notes = pending.notes.filter((n) => n.releaseId === release.id);
52
+ if (notes.length === 0)
53
+ continue;
54
+ console.log(` ${release.id}${release.title ? ` — ${release.title}` : ''}`);
55
+ for (const note of notes) {
56
+ const flag = note.status ? ` [${note.status}]` : '';
57
+ console.log(` • ${note.id} (${note.delivery})${flag} — ${note.title}`);
58
+ }
59
+ }
60
+ }
61
+ function cmdInit(flags) {
62
+ var _a;
63
+ const projectDir = projectDirFrom(flags);
64
+ const log = (0, baseline_1.initBaseline)(projectDir, {
65
+ at: str(flags, 'at'),
66
+ channel: str(flags, 'channel'),
67
+ repo: str(flags, 'repo'),
68
+ remote: str(flags, 'remote'),
69
+ ref: str(flags, 'ref'),
70
+ });
71
+ console.log(`Initialised baseline: channel "${log.template.channel}", ` +
72
+ `baseline release ${log.template.baselineRelease}` +
73
+ `${log.template.remote ? `, feed ${log.template.remote}@${(_a = log.template.ref) !== null && _a !== void 0 ? _a : 'develop'}` : ''}.`);
74
+ if (!(0, baseline_1.readTemplateStamp)(projectDir) && !flags.at) {
75
+ console.log('Note: no .nestled/template-version stamp found; baseline was taken from ' +
76
+ 'existing state. For a legacy clone, pass --at <release> to be explicit.');
77
+ }
78
+ return 0;
79
+ }
80
+ function cmdCheck(flags) {
81
+ const projectDir = projectDirFrom(flags);
82
+ const log = (0, baseline_1.readUpgradeLog)(projectDir);
83
+ const feed = (0, feed_1.resolveFeed)(projectDir, log, feedOptions(flags));
84
+ printPending((0, pending_1.computePending)(feed.manifest, log));
85
+ return 0;
86
+ }
87
+ function cmdStatus(flags) {
88
+ var _a, _b, _c, _d, _e;
89
+ const projectDir = projectDirFrom(flags);
90
+ const log = (0, baseline_1.readUpgradeLog)(projectDir);
91
+ console.log(`channel: ${(_a = log.template.channel) !== null && _a !== void 0 ? _a : baseline_1.DEFAULT_CHANNEL} (default applied if unset)`);
92
+ console.log(`baseline: ${(_b = log.template.baselineRelease) !== null && _b !== void 0 ? _b : '(unset — run `nestled-update init`)'}`);
93
+ console.log(`feed: ${log.template.remote ? `${log.template.remote}@${(_c = log.template.ref) !== null && _c !== void 0 ? _c : 'develop'}` : '(unset)'}`);
94
+ console.log(`origin: ${(_d = log.template.originCommit) !== null && _d !== void 0 ? _d : '(unknown)'}`);
95
+ const outcomes = Object.entries((_e = log.upgrades) !== null && _e !== void 0 ? _e : {});
96
+ console.log(`applied history: ${outcomes.length} recorded`);
97
+ for (const [id, outcome] of outcomes) {
98
+ console.log(` ${id}: ${outcome}`);
99
+ }
100
+ return 0;
101
+ }
102
+ function reportApply(result) {
103
+ var _a, _b, _c, _d, _e, _f, _g, _h;
104
+ switch (result.status) {
105
+ case 'up-to-date':
106
+ console.log(`Up to date on channel "${result.channel}" (baseline ${(_a = result.baselineRelease) !== null && _a !== void 0 ? _a : 'unset'}).`);
107
+ return 0;
108
+ case 'applied':
109
+ console.log(`Applied ${result.applied.length} note(s) on branch ${result.branch}:`);
110
+ for (const note of result.applied) {
111
+ const via = note.via3way ? ' (3-way)' : note.alreadyApplied ? ' (already present)' : '';
112
+ console.log(` • ${note.id} — ${note.title}${via}`);
113
+ }
114
+ console.log(`Baseline advanced to ${(_b = result.baselineRelease) !== null && _b !== void 0 ? _b : 'unset'}.`);
115
+ if (((_c = result.pr) === null || _c === void 0 ? void 0 : _c.status) === 'created')
116
+ console.log(`PR: ${result.pr.url}`);
117
+ if (((_d = result.pr) === null || _d === void 0 ? void 0 : _d.status) === 'blocked')
118
+ console.log(`PR not created: ${result.pr.reason}`);
119
+ return 0;
120
+ case 'blocked':
121
+ console.error(`Blocked at ${(_e = result.blocked) === null || _e === void 0 ? void 0 : _e.id}: ${(_f = result.blocked) === null || _f === void 0 ? void 0 : _f.reason}`);
122
+ if ((_g = result.blocked) === null || _g === void 0 ? void 0 : _g.output)
123
+ console.error(result.blocked.output);
124
+ console.error('Nothing was applied; the branch was rolled back. Adapt the note by intent, then re-run.');
125
+ return 1;
126
+ case 'verification-failed':
127
+ console.error(`Verification failed: ${(_h = result.blocked) === null || _h === void 0 ? void 0 : _h.reason}`);
128
+ console.error('Applied changes were rolled back so the tree stays clean. Fix and re-run.');
129
+ return 1;
130
+ default:
131
+ return 1;
132
+ }
133
+ }
134
+ function cmdApply(flags) {
135
+ const projectDir = projectDirFrom(flags);
136
+ const verify = str(flags, 'verify');
137
+ const result = (0, apply_1.applyRun)(projectDir, Object.assign(Object.assign({}, feedOptions(flags)), { allowDirty: flags['allow-dirty'] === true, autoPR: flags.pr === true ? true : undefined, verification: verify != null ? verify.split(',').map((s) => s.trim()).filter(Boolean) : undefined, defaultBranch: str(flags, 'base') }));
138
+ return reportApply(result);
139
+ }
140
+ const HELP = `nestled-update — apply Nestled template upgrades to this project
141
+
142
+ Usage: nestled-update <command> [options]
143
+
144
+ Commands:
145
+ init Establish the baseline for this clone (from .nestled/template-version or --at)
146
+ check Show pending upgrades for this project's channel (no changes)
147
+ status Show current channel, baseline, feed, and applied history
148
+ apply Apply pending upgrades on a branch (all-or-nothing, verified, rollback on failure)
149
+ help Show this help
150
+
151
+ Options:
152
+ --project <dir> Target project directory (default: cwd)
153
+ --manifest <path> Read the feed from a local manifest file (dev/testing/offline)
154
+ --remote <url> Template git URL for the feed (init records it; overrides the log)
155
+ --ref <branch> Feed branch on the template (default: develop)
156
+ --channel <name> Channel to follow: stable | canary (init only; default: stable)
157
+ --at <release> Explicit baseline release id (init only)
158
+ --repo <name> Template repo name to record (init only)
159
+ --verify <cmds> Comma-separated verification commands (apply; else inferred)
160
+ --pr Push the branch and open a PR after a successful apply
161
+ --base <branch> Base branch for the PR (default: develop)
162
+ --allow-dirty Allow apply when the working tree has uncommitted changes
163
+ `;
164
+ function run(argv) {
165
+ const { command, flags } = parseArgs(argv);
166
+ try {
167
+ switch (command) {
168
+ case 'init':
169
+ return cmdInit(flags);
170
+ case 'check':
171
+ return cmdCheck(flags);
172
+ case 'status':
173
+ return cmdStatus(flags);
174
+ case 'apply':
175
+ return cmdApply(flags);
176
+ case 'help':
177
+ case '--help':
178
+ case '-h':
179
+ console.log(HELP);
180
+ return 0;
181
+ default:
182
+ console.error(`Unknown command: ${command}\n`);
183
+ console.log(HELP);
184
+ return 1;
185
+ }
186
+ }
187
+ catch (error) {
188
+ console.error(`Error: ${error.message}`);
189
+ return 1;
190
+ }
191
+ }
192
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../upgrades/src/lib/cli.ts"],"names":[],"mappings":";;AAyLA,kBA0BC;AAnND,uCAA0D;AAC1D,yCAKoB;AACpB,iCAAqC;AACrC,mCAAmD;AAOnD,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACzC,MAAM,KAAK,GAAqC,EAAE,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,SAAS;QACtC,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;YAClB,CAAC,EAAE,CAAC;QACN,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,GAAG,CAAC,KAA0B,EAAE,GAAW;IAClD,OAAO,OAAO,KAAK,CAAC,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C;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Manifest } from './manifest';
2
+ import { UpgradeLog } from './baseline';
3
+ /** Where the feed lives inside the template repo. */
4
+ export declare const FEED_DIR = ".nestled-upgrades";
5
+ export declare const MANIFEST_PATH = ".nestled-upgrades/manifest.yaml";
6
+ export declare const UPSTREAM_REMOTE = "nestled-upstream";
7
+ /**
8
+ * A resolved feed: the parsed manifest plus a way to read a patch file the
9
+ * notes reference. `readPatch` takes the note's `patch` value (a path relative
10
+ * to the feed dir, or a full repo path) and returns the diff text.
11
+ */
12
+ export interface ResolvedFeed {
13
+ manifest: Manifest;
14
+ source: string;
15
+ readPatch(patchRef: string): string | null;
16
+ }
17
+ export interface ResolveFeedOptions {
18
+ /** Local manifest file (dev/testing/offline); bypasses git fetch. */
19
+ manifestFile?: string;
20
+ /** Override the template git URL (else taken from the log). */
21
+ remote?: string;
22
+ /** Override the feed ref (else taken from the log, default `develop`). */
23
+ ref?: string;
24
+ }
25
+ export declare function resolveFeed(projectDir: string, log: UpgradeLog, options?: ResolveFeedOptions): ResolvedFeed;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UPSTREAM_REMOTE = exports.MANIFEST_PATH = exports.FEED_DIR = void 0;
4
+ exports.resolveFeed = resolveFeed;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const manifest_1 = require("./manifest");
8
+ const git_1 = require("./git");
9
+ /** Where the feed lives inside the template repo. */
10
+ exports.FEED_DIR = '.nestled-upgrades';
11
+ exports.MANIFEST_PATH = `${exports.FEED_DIR}/manifest.yaml`;
12
+ exports.UPSTREAM_REMOTE = 'nestled-upstream';
13
+ function normalizePatchRef(patchRef) {
14
+ if (patchRef.startsWith(`${exports.FEED_DIR}/`))
15
+ return patchRef;
16
+ return `${exports.FEED_DIR}/${patchRef.replace(/^\.?\/*/, '')}`;
17
+ }
18
+ /**
19
+ * Resolve the feed from a local manifest file: patches are read from
20
+ * `<manifest dir>/patches/...` (or a path relative to the manifest's dir).
21
+ */
22
+ function resolveLocalFeed(manifestFile) {
23
+ const manifest = (0, manifest_1.loadManifestFromFile)(manifestFile);
24
+ const baseDir = (0, node_path_1.dirname)(manifestFile);
25
+ return {
26
+ manifest,
27
+ source: manifestFile,
28
+ readPatch(patchRef) {
29
+ const rel = patchRef.startsWith(`${exports.FEED_DIR}/`)
30
+ ? patchRef.slice(exports.FEED_DIR.length + 1)
31
+ : patchRef.replace(/^\.?\/*/, '');
32
+ const candidate = (0, node_path_1.isAbsolute)(patchRef) ? patchRef : (0, node_path_1.join)(baseDir, rel);
33
+ return (0, node_fs_1.existsSync)(candidate) ? (0, node_fs_1.readFileSync)(candidate, 'utf8') : null;
34
+ },
35
+ };
36
+ }
37
+ /**
38
+ * Resolve the feed from the template git repo: ensure the upstream remote,
39
+ * fetch the feed ref, then read the manifest and patches via `git show` at that
40
+ * ref — no working checkout of the template needed.
41
+ */
42
+ function resolveGitFeed(projectDir, remote, ref) {
43
+ (0, git_1.ensureRemote)(projectDir, exports.UPSTREAM_REMOTE, remote);
44
+ const fetched = (0, git_1.fetchRef)(projectDir, exports.UPSTREAM_REMOTE, ref, { filterBlobless: true });
45
+ if (fetched.status !== 0) {
46
+ throw new Error(`Failed to fetch feed ref "${ref}" from ${remote}: ${fetched.stderr || fetched.stdout}`);
47
+ }
48
+ const rev = `${exports.UPSTREAM_REMOTE}/${ref}`;
49
+ const manifestText = (0, git_1.showFile)(projectDir, rev, exports.MANIFEST_PATH);
50
+ if (manifestText == null) {
51
+ throw new Error(`No ${exports.MANIFEST_PATH} found at ${rev}. Has a release been published to this channel yet?`);
52
+ }
53
+ const manifest = (0, manifest_1.parseManifest)(manifestText);
54
+ return {
55
+ manifest,
56
+ source: `${remote}@${ref}`,
57
+ readPatch(patchRef) {
58
+ return (0, git_1.showFile)(projectDir, rev, normalizePatchRef(patchRef));
59
+ },
60
+ };
61
+ }
62
+ function resolveFeed(projectDir, log, options = {}) {
63
+ var _a, _b, _c, _d, _e;
64
+ if (options.manifestFile) {
65
+ return resolveLocalFeed(options.manifestFile);
66
+ }
67
+ const remote = (_a = options.remote) !== null && _a !== void 0 ? _a : (_b = log.template) === null || _b === void 0 ? void 0 : _b.remote;
68
+ const ref = (_e = (_c = options.ref) !== null && _c !== void 0 ? _c : (_d = log.template) === null || _d === void 0 ? void 0 : _d.ref) !== null && _e !== void 0 ? _e : 'develop';
69
+ if (!remote) {
70
+ throw new Error('No template remote configured. Run `nestled-update init --remote <git-url>`, ' +
71
+ 'set template.remote in .nestled/config.yaml, or pass --manifest <file> for local testing.');
72
+ }
73
+ return resolveGitFeed(projectDir, remote, ref);
74
+ }
75
+ //# sourceMappingURL=feed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feed.js","sourceRoot":"","sources":["../../../../upgrades/src/lib/feed.ts"],"names":[],"mappings":";;;AAkFA,kCAiBC;AAnGD,qCAAmD;AACnD,yCAAsD;AACtD,yCAA2E;AAC3E,+BAAyD;AAGzD,qDAAqD;AACxC,QAAA,QAAQ,GAAG,mBAAmB,CAAC;AAC/B,QAAA,aAAa,GAAG,GAAG,gBAAQ,gBAAgB,CAAC;AAC5C,QAAA,eAAe,GAAG,kBAAkB,CAAC;AAsBlD,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,gBAAQ,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC;IACzD,OAAO,GAAG,gBAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED;;;GAGG;AACH,SAAS,gBAAgB,CAAC,YAAoB;IAC5C,MAAM,Q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AG,EAAE,CAAC;IACxC,MAAM,YAAY,GAAG,IAAA,cAAQ,EAAC,UAAU,EAAE,GAAG,EAAE,qBAAa,CAAC,CAAC;IAC9D,IAAI,YAAY,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,MAAM,qBAAa,aAAa,GAAG,qDAAqD,CAAC,CAAC;IAC5G,CAAC;IACD,MAAM,QAAQ,GAAG,IAAA,wBAAa,EAAC,YAAY,CAAC,CAAC;IAC7C,OAAO;QACL,QAAQ;QACR,MAAM,EAAE,GAAG,MAAM,IAAI,GAAG,EAAE;QAC1B,SAAS,CAAC,QAAgB;YACxB,OAAO,IAAA,cAAQ,EAAC,UAAU,EAAE,GAAG,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAgB,WAAW,CACzB,UAAkB,EAClB,GAAe,EACf,UAA8B,EAAE;;IAEhC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO,gBAAgB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,MAAA,GAAG,CAAC,QAAQ,0CAAE,MAAM,CAAC;IACtD,MAAM,GAAG,GAAG,MAAA,MAAA,OAAO,CAAC,GAAG,mCAAI,MAAA,GAAG,CAAC,QAAQ,0CAAE,GAAG,mCAAI,SAAS,CAAC;IAC1D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,+EAA+E;YAC7E,2FAA2F,CAC9F,CAAC;IACJ,CAAC;IACD,OAAO,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,40 @@
1
+ export interface GitResult {
2
+ status: number;
3
+ stdout: string;
4
+ stderr: string;
5
+ }
6
+ export declare function git(cwd: string, args: string[]): GitResult;
7
+ export declare function gitOutput(cwd: string, args: string[]): string;
8
+ export declare function isGitRepo(cwd: string): boolean;
9
+ /** Uncommitted changes, ignoring our own `.nestled/` bookkeeping. */
10
+ export declare function hasUncommittedChanges(cwd: string): boolean;
11
+ export declare function currentBranch(cwd: string): string;
12
+ export declare function checkoutBranch(cwd: string, branch: string): void;
13
+ export declare function commitAll(cwd: string, message: string): string;
14
+ /**
15
+ * Restore a working tree that we dirtied, safe only when the caller verified the
16
+ * tree was clean before starting: reverts tracked edits and removes files our
17
+ * patches added, but preserves `.nestled/` so the log we are about to write
18
+ * survives. Never call this when the run started `--allow-dirty`.
19
+ */
20
+ export declare function resetWorktree(cwd: string): void;
21
+ export declare function ensureRemote(cwd: string, name: string, url: string): void;
22
+ export interface FetchOptions {
23
+ depth?: number;
24
+ filterBlobless?: boolean;
25
+ }
26
+ export declare function fetchRef(cwd: string, remote: string, ref: string, options?: FetchOptions): GitResult;
27
+ /** Read a file from a git rev (e.g. `remote/branch`) without a checkout. */
28
+ export declare function showFile(cwd: string, rev: string, repoPath: string): string | null;
29
+ export interface PrOptions {
30
+ branch: string;
31
+ base: string;
32
+ title: string;
33
+ body: string;
34
+ }
35
+ export interface PrResult {
36
+ status: 'created' | 'blocked';
37
+ url?: string;
38
+ reason?: string;
39
+ }
40
+ export declare function pushAndCreatePR(cwd: string, options: PrOptions): PrResult;
package/src/lib/git.js ADDED
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.git = git;
4
+ exports.gitOutput = gitOutput;
5
+ exports.isGitRepo = isGitRepo;
6
+ exports.hasUncommittedChanges = hasUncommittedChanges;
7
+ exports.currentBranch = currentBranch;
8
+ exports.checkoutBranch = checkoutBranch;
9
+ exports.commitAll = commitAll;
10
+ exports.resetWorktree = resetWorktree;
11
+ exports.ensureRemote = ensureRemote;
12
+ exports.fetchRef = fetchRef;
13
+ exports.showFile = showFile;
14
+ exports.pushAndCreatePR = pushAndCreatePR;
15
+ const node_child_process_1 = require("node:child_process");
16
+ function git(cwd, args) {
17
+ var _a, _b, _c;
18
+ const result = (0, node_child_process_1.spawnSync)('git', args, { cwd, encoding: 'utf8' });
19
+ return {
20
+ status: (_a = result.status) !== null && _a !== void 0 ? _a : 1,
21
+ stdout: (_b = result.stdout) !== null && _b !== void 0 ? _b : '',
22
+ stderr: (_c = result.stderr) !== null && _c !== void 0 ? _c : '',
23
+ };
24
+ }
25
+ function gitOutput(cwd, args) {
26
+ const result = git(cwd, args);
27
+ return result.status === 0 ? result.stdout.trim() : '';
28
+ }
29
+ function isGitRepo(cwd) {
30
+ return gitOutput(cwd, ['rev-parse', '--is-inside-work-tree']) === 'true';
31
+ }
32
+ /** Uncommitted changes, ignoring our own `.nestled/` bookkeeping. */
33
+ function hasUncommittedChanges(cwd) {
34
+ return gitOutput(cwd, ['status', '--porcelain'])
35
+ .split('\n')
36
+ .filter(Boolean)
37
+ .some((line) => !line.includes('.nestled/'));
38
+ }
39
+ function currentBranch(cwd) {
40
+ return gitOutput(cwd, ['rev-parse', '--abbrev-ref', 'HEAD']);
41
+ }
42
+ function checkoutBranch(cwd, branch) {
43
+ const existing = git(cwd, ['show-ref', '--verify', '--quiet', `refs/heads/${branch}`]);
44
+ const args = existing.status === 0 ? ['checkout', branch] : ['checkout', '-b', branch];
45
+ const result = git(cwd, args);
46
+ if (result.status !== 0) {
47
+ throw new Error(`Unable to checkout ${branch}: ${result.stderr || result.stdout}`);
48
+ }
49
+ }
50
+ function commitAll(cwd, message) {
51
+ if (!gitOutput(cwd, ['status', '--porcelain'])) {
52
+ return gitOutput(cwd, ['rev-parse', '--short', 'HEAD']);
53
+ }
54
+ if (git(cwd, ['add', '-A']).status !== 0)
55
+ return '';
56
+ if (git(cwd, ['commit', '--no-gpg-sign', '-m', message]).status !== 0)
57
+ return '';
58
+ return gitOutput(cwd, ['rev-parse', '--short', 'HEAD']);
59
+ }
60
+ /**
61
+ * Restore a working tree that we dirtied, safe only when the caller verified the
62
+ * tree was clean before starting: reverts tracked edits and removes files our
63
+ * patches added, but preserves `.nestled/` so the log we are about to write
64
+ * survives. Never call this when the run started `--allow-dirty`.
65
+ */
66
+ function resetWorktree(cwd) {
67
+ git(cwd, ['checkout', '--', '.']);
68
+ git(cwd, ['clean', '-fd', '-e', '.nestled']);
69
+ }
70
+ function ensureRemote(cwd, name, url) {
71
+ const existing = gitOutput(cwd, ['remote', 'get-url', name]);
72
+ if (!existing) {
73
+ git(cwd, ['remote', 'add', name, url]);
74
+ }
75
+ else if (url && existing !== url) {
76
+ git(cwd, ['remote', 'set-url', name, url]);
77
+ }
78
+ }
79
+ function fetchRef(cwd, remote, ref, options = {}) {
80
+ const args = ['fetch'];
81
+ if (options.depth)
82
+ args.push(`--depth=${options.depth}`);
83
+ if (options.filterBlobless)
84
+ args.push('--filter=blob:none');
85
+ args.push(remote, ref);
86
+ return git(cwd, args);
87
+ }
88
+ /** Read a file from a git rev (e.g. `remote/branch`) without a checkout. */
89
+ function showFile(cwd, rev, repoPath) {
90
+ const result = git(cwd, ['show', `${rev}:${repoPath}`]);
91
+ return result.status === 0 ? result.stdout : null;
92
+ }
93
+ function pushAndCreatePR(cwd, options) {
94
+ var _a, _b;
95
+ const push = git(cwd, ['push', '-u', 'origin', options.branch]);
96
+ if (push.status !== 0) {
97
+ return { status: 'blocked', reason: `Push failed: ${push.stderr || push.stdout}` };
98
+ }
99
+ const pr = (0, node_child_process_1.spawnSync)('gh', ['pr', 'create', '--title', options.title, '--base', options.base, '--head', options.branch, '--body', options.body], { cwd, encoding: 'utf8' });
100
+ if (((_a = pr.status) !== null && _a !== void 0 ? _a : 1) !== 0) {
101
+ return { status: 'blocked', reason: `PR creation failed: ${pr.stderr || pr.stdout}` };
102
+ }
103
+ return { status: 'created', url: ((_b = pr.stdout) !== null && _b !== void 0 ? _b : '').trim() };
104
+ }
105
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../../../upgr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