@graftsync/core 0.0.0-stage → 0.1.1

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/dist/diff.d.ts +62 -0
  3. package/dist/diff.d.ts.map +1 -0
  4. package/dist/diff.js +160 -0
  5. package/dist/diff.js.map +1 -0
  6. package/dist/errors.d.ts +12 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +21 -0
  9. package/dist/errors.js.map +1 -0
  10. package/dist/index.d.ts +13 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +13 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/install.d.ts +22 -0
  15. package/dist/install.d.ts.map +1 -0
  16. package/dist/install.js +100 -0
  17. package/dist/install.js.map +1 -0
  18. package/dist/operations.d.ts +90 -0
  19. package/dist/operations.d.ts.map +1 -0
  20. package/dist/operations.js +254 -0
  21. package/dist/operations.js.map +1 -0
  22. package/dist/oracle.d.ts +49 -0
  23. package/dist/oracle.d.ts.map +1 -0
  24. package/dist/oracle.js +106 -0
  25. package/dist/oracle.js.map +1 -0
  26. package/dist/outdated.d.ts +23 -0
  27. package/dist/outdated.d.ts.map +1 -0
  28. package/dist/outdated.js +45 -0
  29. package/dist/outdated.js.map +1 -0
  30. package/dist/project.d.ts +78 -0
  31. package/dist/project.d.ts.map +1 -0
  32. package/dist/project.js +214 -0
  33. package/dist/project.js.map +1 -0
  34. package/dist/replay.d.ts +24 -0
  35. package/dist/replay.d.ts.map +1 -0
  36. package/dist/replay.js +38 -0
  37. package/dist/replay.js.map +1 -0
  38. package/dist/scaffold.d.ts +61 -0
  39. package/dist/scaffold.d.ts.map +1 -0
  40. package/dist/scaffold.js +167 -0
  41. package/dist/scaffold.js.map +1 -0
  42. package/dist/sync.d.ts +98 -0
  43. package/dist/sync.d.ts.map +1 -0
  44. package/dist/sync.js +476 -0
  45. package/dist/sync.js.map +1 -0
  46. package/dist/types.d.ts +285 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +2 -0
  49. package/dist/types.js.map +1 -0
  50. package/dist/upstream.d.ts +83 -0
  51. package/dist/upstream.d.ts.map +1 -0
  52. package/dist/upstream.js +182 -0
  53. package/dist/upstream.js.map +1 -0
  54. package/package.json +46 -3
  55. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Brandon Roberts
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/diff.d.ts ADDED
@@ -0,0 +1,62 @@
1
+ import type { ScopedFileDiff } from './types.js';
2
+ /** A region of interest for narrowing a diff, typically one located anchor. */
3
+ export interface AnchorRegion {
4
+ name: string;
5
+ /** 1-based inclusive line span in the old version, if the anchor was located there. */
6
+ old?: [number, number];
7
+ /** 1-based inclusive line span in the new version, if the anchor was located there. */
8
+ new?: [number, number];
9
+ /** Identifiers/strings that identify the anchor; hunks mentioning them are kept. */
10
+ symbols?: string[];
11
+ }
12
+ export interface ScopeFileOptions {
13
+ file: string;
14
+ oldText: string | undefined;
15
+ newText: string | undefined;
16
+ regions: AnchorRegion[];
17
+ /** Lines of slack around anchor spans when deciding if a hunk is "near". Default 40. */
18
+ window?: number;
19
+ /** Context lines in each hunk. Default 3. */
20
+ context?: number;
21
+ }
22
+ /** Diff one target file and keep only hunks near or mentioning the given anchor regions. */
23
+ export declare function scopeFileDiff(options: ScopeFileOptions): ScopedFileDiff;
24
+ /** Render scoped file diffs as a unified patch. */
25
+ export declare function renderPatch(files: ScopedFileDiff[], labels: {
26
+ from: string;
27
+ to: string;
28
+ }): string;
29
+ /** Find files under `dir` (excluding node_modules) whose text contains any of `symbols`. */
30
+ export declare function findFilesMentioning(dir: string, symbols: string[], limit?: number): Promise<string[]>;
31
+ /**
32
+ * Distinctive text in some source lines, for finding where removed code moved: trimmed lines
33
+ * worth matching (not blank, not bare punctuation like `}` or `});`, at least 8 characters, and
34
+ * containing an identifier) and identifiers of 4+ characters that are not common keywords.
35
+ */
36
+ export declare function distinctiveText(lines: string[]): {
37
+ lines: string[];
38
+ identifiers: string[];
39
+ };
40
+ export interface RankFilesOptions {
41
+ /** Trimmed lines to look for (each counts once per file). */
42
+ lines: string[];
43
+ /** Identifiers to look for; break ties between files matching the same number of lines. */
44
+ identifiers?: string[];
45
+ /** Maximum files returned. Default 10. */
46
+ limit?: number;
47
+ /** File name pattern to scan. Default: JavaScript (.js/.cjs/.mjs). */
48
+ include?: RegExp;
49
+ /** Paths (relative to `dir`) to skip. */
50
+ exclude?: string[];
51
+ }
52
+ /**
53
+ * Rank files under `dir` (excluding node_modules and dot-directories) by how many of `lines`
54
+ * they contain, then by how many identifiers. Files matching nothing are left out.
55
+ */
56
+ export declare function rankFilesByContent(dir: string, options: RankFilesOptions): Promise<string[]>;
57
+ /** 1-based line and column of a UTF-16 offset. */
58
+ export declare function lineColumn(text: string, offset: number): {
59
+ line: number;
60
+ column: number;
61
+ };
62
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvB,uFAAuF;IACvF,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvB,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAwCvE;AAED,mDAAmD;AACnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAkBjG;AAID,4FAA4F;AAC5F,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAmBvG;AAMD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAW3F;AAED,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAyBlG;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAUzF"}
package/dist/diff.js ADDED
@@ -0,0 +1,160 @@
1
+ import { readdir, readFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { structuredPatch } from 'diff';
4
+ const overlaps = (a, b) => a[0] <= b[1] && b[0] <= a[1];
5
+ /** Diff one target file and keep only hunks near or mentioning the given anchor regions. */
6
+ export function scopeFileDiff(options) {
7
+ const { file, oldText, newText, regions } = options;
8
+ const window = options.window ?? 40;
9
+ if (oldText === undefined && newText === undefined) {
10
+ return { file, status: 'removed', totalHunks: 0, hunks: [], narrowed: false };
11
+ }
12
+ const status = oldText === undefined ? 'added' : newText === undefined ? 'removed' : oldText === newText ? 'unchanged' : 'modified';
13
+ if (status === 'unchanged')
14
+ return { file, status, totalHunks: 0, hunks: [], narrowed: true };
15
+ const patch = structuredPatch(file, file, oldText ?? '', newText ?? '', '', '', {
16
+ context: options.context ?? 3,
17
+ });
18
+ const hunks = patch.hunks.map((h) => ({
19
+ oldStart: h.oldStart,
20
+ oldLines: h.oldLines,
21
+ newStart: h.newStart,
22
+ newLines: h.newLines,
23
+ lines: h.lines,
24
+ anchors: [],
25
+ }));
26
+ const located = regions.some((r) => r.old || r.new || r.symbols?.length);
27
+ if (!located || status !== 'modified') {
28
+ return { file, status, totalHunks: hunks.length, hunks, narrowed: false };
29
+ }
30
+ for (const hunk of hunks) {
31
+ const oldSpan = [hunk.oldStart, hunk.oldStart + Math.max(hunk.oldLines - 1, 0)];
32
+ const newSpan = [hunk.newStart, hunk.newStart + Math.max(hunk.newLines - 1, 0)];
33
+ const changed = hunk.lines.filter((l) => l[0] === '+' || l[0] === '-').join('\n');
34
+ for (const region of regions) {
35
+ const near = (region.old && overlaps(oldSpan, [region.old[0] - window, region.old[1] + window])) ||
36
+ (region.new && overlaps(newSpan, [region.new[0] - window, region.new[1] + window]));
37
+ const mentions = region.symbols?.some((s) => s && changed.includes(s));
38
+ if (near || mentions)
39
+ hunk.anchors.push(region.name);
40
+ }
41
+ }
42
+ return { file, status, totalHunks: hunks.length, hunks: hunks.filter((h) => h.anchors.length > 0), narrowed: true };
43
+ }
44
+ /** Render scoped file diffs as a unified patch. */
45
+ export function renderPatch(files, labels) {
46
+ const out = [];
47
+ for (const f of files) {
48
+ if (f.status === 'unchanged')
49
+ continue;
50
+ out.push(`--- a/${f.file}\t(${labels.from})`, `+++ b/${f.file}\t(${labels.to})`);
51
+ if (f.status === 'removed' && f.hunks.length === 0)
52
+ out.push(`# target removed in ${labels.to}`);
53
+ if (f.narrowed && f.hunks.length < f.totalHunks) {
54
+ out.push(`# narrowed: showing ${f.hunks.length} of ${f.totalHunks} hunks (those near anchors)`);
55
+ }
56
+ for (const h of f.hunks) {
57
+ const note = h.anchors.length ? ` anchors: ${h.anchors.join(', ')}` : '';
58
+ out.push(`@@ -${h.oldStart},${h.oldLines} +${h.newStart},${h.newLines} @@${note}`, ...h.lines);
59
+ }
60
+ if (f.candidates?.length) {
61
+ out.push(`# candidate files in ${labels.to} that contain the removed target's patched code (best match first):`, ...f.candidates.map((c) => `# ${c}`));
62
+ }
63
+ }
64
+ return out.join('\n') + (out.length ? '\n' : '');
65
+ }
66
+ const CODE_EXT = /\.(c|m)?js$/;
67
+ /** Find files under `dir` (excluding node_modules) whose text contains any of `symbols`. */
68
+ export async function findFilesMentioning(dir, symbols, limit = 10) {
69
+ const wanted = symbols.filter((s) => s.length >= 3);
70
+ if (!wanted.length)
71
+ return [];
72
+ const hits = [];
73
+ const walk = async (rel) => {
74
+ const entries = await readdir(path.join(dir, rel), { withFileTypes: true }).catch(() => []);
75
+ for (const e of entries) {
76
+ if (hits.length >= limit)
77
+ return;
78
+ const child = rel ? `${rel}/${e.name}` : e.name;
79
+ if (e.isDirectory()) {
80
+ if (e.name !== 'node_modules' && !e.name.startsWith('.'))
81
+ await walk(child);
82
+ }
83
+ else if (CODE_EXT.test(e.name)) {
84
+ const text = await readFile(path.join(dir, child), 'utf8').catch(() => '');
85
+ if (wanted.some((s) => text.includes(s)))
86
+ hits.push(child);
87
+ }
88
+ }
89
+ };
90
+ await walk('');
91
+ return hits;
92
+ }
93
+ const KEYWORDS = new Set('this that from with true false null undefined const function return export import default async await else case break continue throw catch finally typeof instanceof void delete while switch class extends super static yield require module exports Object Array String Number Boolean Promise prototype length push call apply bind then value'.split(' '));
94
+ /**
95
+ * Distinctive text in some source lines, for finding where removed code moved: trimmed lines
96
+ * worth matching (not blank, not bare punctuation like `}` or `});`, at least 8 characters, and
97
+ * containing an identifier) and identifiers of 4+ characters that are not common keywords.
98
+ */
99
+ export function distinctiveText(lines) {
100
+ const keptLines = new Set();
101
+ const identifiers = new Set();
102
+ for (const raw of lines) {
103
+ const line = raw.trim();
104
+ const ids = (line.match(/[A-Za-z_$][\w$]{3,}/g) ?? []).filter((id) => !KEYWORDS.has(id));
105
+ for (const id of ids)
106
+ identifiers.add(id);
107
+ if (line.length >= 8 && /[A-Za-z_$][\w$]{2,}/.test(line))
108
+ keptLines.add(line);
109
+ }
110
+ // Longer lines are more distinctive; check them first.
111
+ return { lines: [...keptLines].sort((a, b) => b.length - a.length), identifiers: [...identifiers] };
112
+ }
113
+ /**
114
+ * Rank files under `dir` (excluding node_modules and dot-directories) by how many of `lines`
115
+ * they contain, then by how many identifiers. Files matching nothing are left out.
116
+ */
117
+ export async function rankFilesByContent(dir, options) {
118
+ const wantedLines = options.lines.filter((l) => l.trim().length > 0);
119
+ const wantedIds = (options.identifiers ?? []).filter((s) => s.length >= 4);
120
+ if (!wantedLines.length && !wantedIds.length)
121
+ return [];
122
+ const include = options.include ?? CODE_EXT;
123
+ const exclude = new Set(options.exclude ?? []);
124
+ const scored = [];
125
+ const walk = async (rel) => {
126
+ const entries = await readdir(path.join(dir, rel), { withFileTypes: true }).catch(() => []);
127
+ for (const e of entries) {
128
+ const child = rel ? `${rel}/${e.name}` : e.name;
129
+ if (e.isDirectory()) {
130
+ if (e.name !== 'node_modules' && !e.name.startsWith('.'))
131
+ await walk(child);
132
+ }
133
+ else if (include.test(e.name) && !exclude.has(child)) {
134
+ const text = await readFile(path.join(dir, child), 'utf8').catch(() => '');
135
+ if (!text)
136
+ continue;
137
+ const lines = wantedLines.filter((l) => text.includes(l)).length;
138
+ const ids = wantedIds.filter((s) => text.includes(s)).length;
139
+ if (lines || ids)
140
+ scored.push({ file: child, lines, ids });
141
+ }
142
+ }
143
+ };
144
+ await walk('');
145
+ scored.sort((a, b) => b.lines - a.lines || b.ids - a.ids || (a.file < b.file ? -1 : a.file > b.file ? 1 : 0));
146
+ return scored.slice(0, options.limit ?? 10).map((s) => s.file);
147
+ }
148
+ /** 1-based line and column of a UTF-16 offset. */
149
+ export function lineColumn(text, offset) {
150
+ let line = 1;
151
+ let last = -1;
152
+ for (let i = 0; i < offset && i < text.length; i++) {
153
+ if (text.charCodeAt(i) === 10) {
154
+ line++;
155
+ last = i;
156
+ }
157
+ }
158
+ return { line, column: offset - last };
159
+ }
160
+ //# s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AAC;YAC7D,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9G,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAc;IACrD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnD,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;YAC9B,IAAI,EAAE,CAAC;YACP,IAAI,GAAG,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** Base class for errors caused by tooling/config problems (CLI exit code 2). */
2
+ export declare class GraftError extends Error {
3
+ readonly code: string;
4
+ constructor(message: string, code?: string);
5
+ }
6
+ /** Thrown when an anchor does not match. A graft must never silently apply nothing. */
7
+ export declare class AnchorMissError extends GraftError {
8
+ readonly graft: string;
9
+ readonly anchors: string[];
10
+ constructor(message: string, graft: string, anchors: string[]);
11
+ }
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,qBAAa,UAAW,SAAQ,KAAK;IAGjC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAFvB,YACE,OAAO,EAAE,MAAM,EACN,IAAI,GAAE,MAAsB,EAItC;CACF;AAED,uFAAuF;AACvF,qBAAa,eAAgB,SAAQ,UAAU;IAG3C,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE;IAH5B,YACE,OAAO,EAAE,MAAM,EACN,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,EAI3B;CACF"}
package/dist/errors.js ADDED
@@ -0,0 +1,21 @@
1
+ /** Base class for errors caused by tooling/config problems (CLI exit code 2). */
2
+ export class GraftError extends Error {
3
+ code;
4
+ constructor(message, code = 'graft/error') {
5
+ super(message);
6
+ this.code = code;
7
+ this.name = 'GraftError';
8
+ }
9
+ }
10
+ /** Thrown when an anchor does not match. A graft must never silently apply nothing. */
11
+ export class AnchorMissError extends GraftError {
12
+ graft;
13
+ anchors;
14
+ constructor(message, graft, anchors) {
15
+ super(message, 'graft/anchor-miss');
16
+ this.graft = graft;
17
+ this.anchors = anchors;
18
+ this.name = 'AnchorMissError';
19
+ }
20
+ }
21
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,OAAO,UAAW,SAAQ,KAAK;IAGxB,IAAI;IAFf,YACE,OAAe,EACN,IAAI,GAAW,aAAa;QAErC,KAAK,CAAC,OAAO,CAAC,CAAC;oBAFN,IAAI;QAGb,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED,uFAAuF;AACvF,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAGlC,KAAK;IACL,OAAO;IAHlB,YACE,OAAe,EACN,KAAa,EACb,OAAiB;QAE1B,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;qBAH3B,KAAK;uBACL,OAAO;QAGhB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ export * from './types.js';
2
+ export * from './errors.js';
3
+ export * from './upstream.js';
4
+ export * from './project.js';
5
+ export * from './oracle.js';
6
+ export * from './diff.js';
7
+ export * from './operations.js';
8
+ export * from './install.js';
9
+ export * from './sync.js';
10
+ export * from './scaffold.js';
11
+ export * from './outdated.js';
12
+ export * from './replay.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ export * from './types.js';
2
+ export * from './errors.js';
3
+ export * from './upstream.js';
4
+ export * from './project.js';
5
+ export * from './oracle.js';
6
+ export * from './diff.js';
7
+ export * from './operations.js';
8
+ export * from './install.js';
9
+ export * from './sync.js';
10
+ export * from './scaffold.js';
11
+ export * from './outdated.js';
12
+ export * from './replay.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** `yarn` is yarn classic (1.x); `yarn-berry` is yarn 2+ (Plug'n'Play or `nodeLinker: node-modules`). */
2
+ export type PackageManager = 'pnpm' | 'yarn' | 'yarn-berry' | 'npm' | 'bun' | 'upm';
3
+ /**
4
+ * Is the yarn project in `dir` yarn 2+ (berry)? Berry projects carry a `.yarnrc.yml` or a
5
+ * Plug'n'Play runtime (`.pnp.cjs`), and berry's yarn.lock starts with a `__metadata:` block;
6
+ * yarn classic has none of these.
7
+ */
8
+ export declare function isYarnBerry(dir: string): boolean;
9
+ /** The package manager Graft assumes when a project gives no signal. */
10
+ export declare const DEFAULT_PACKAGE_MANAGER: PackageManager;
11
+ /**
12
+ * Detect the package manager, walking up from `root`. In each directory: an explicit
13
+ * package.json `packageManager` (e.g. "pnpm@10.28.0") wins; otherwise lockfiles in the order
14
+ * pnpm, npm, upm, yarn, bun. With no signal anywhere, npm. yarn is `yarn-berry` for
15
+ * `packageManager: yarn@2+`, or a yarn.lock next to berry's markers (see {@link isYarnBerry}).
16
+ */
17
+ export declare function detectPackageManager(root: string): PackageManager;
18
+ /** Install `spec` (e.g. `lib@1.2.3`), keeping it in the manifest(s) and dependency field that already declare it. */
19
+ export declare function installPackage(root: string, pkg: string, spec: string): Promise<string>;
20
+ /** Reinstall the project's dependencies (so package-manager patch config takes effect). */
21
+ export declare function reinstall(root: string): Promise<string>;
22
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAMA,yGAAyG;AACzG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAcpF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOhD;AAED,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,EAAE,cAAsB,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAoBjE;AAED,qHAAqH;AACrH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB7F;AAED,2FAA2F;AAC3F,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK7D"}
@@ -0,0 +1,100 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { readFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { GraftError } from './errors.js';
5
+ import { runCommand } from './oracle.js';
6
+ /**
7
+ * Precedence when a directory has several lockfiles: pnpm first, then npm, then upm.
8
+ * yarn and bun remain supported after those. A project with no signal at all is npm.
9
+ */
10
+ const LOCKFILE_PRECEDENCE = [
11
+ ['pnpm', ['pnpm-lock.yaml', 'pnpm-workspace.yaml']],
12
+ ['npm', ['package-lock.json', 'npm-shrinkwrap.json']],
13
+ ['upm', ['upm.lock']],
14
+ ['yarn', ['yarn.lock']],
15
+ ['bun', ['bun.lock', 'bun.lockb']],
16
+ ];
17
+ /**
18
+ * Is the yarn project in `dir` yarn 2+ (berry)? Berry projects carry a `.yarnrc.yml` or a
19
+ * Plug'n'Play runtime (`.pnp.cjs`), and berry's yarn.lock starts with a `__metadata:` block;
20
+ * yarn classic has none of these.
21
+ */
22
+ export function isYarnBerry(dir) {
23
+ if (['.yarnrc.yml', '.pnp.cjs', '.pnp.js'].some((f) => existsSync(path.join(dir, f))))
24
+ return true;
25
+ try {
26
+ return /^__metadata:/m.test(readFileSync(path.join(dir, 'yarn.lock'), 'utf8').slice(0, 4096));
27
+ }
28
+ catch {
29
+ return false;
30
+ }
31
+ }
32
+ /** The package manager Graft assumes when a project gives no signal. */
33
+ export const DEFAULT_PACKAGE_MANAGER = 'npm';
34
+ /**
35
+ * Detect the package manager, walking up from `root`. In each directory: an explicit
36
+ * package.json `packageManager` (e.g. "pnpm@10.28.0") wins; otherwise lockfiles in the order
37
+ * pnpm, npm, upm, yarn, bun. With no signal anywhere, npm. yarn is `yarn-berry` for
38
+ * `packageManager: yarn@2+`, or a yarn.lock next to berry's markers (see {@link isYarnBerry}).
39
+ */
40
+ export function detectPackageManager(root) {
41
+ let dir = path.resolve(root);
42
+ for (;;) {
43
+ const manifest = path.join(dir, 'package.json');
44
+ if (existsSync(manifest)) {
45
+ try {
46
+ const declared = /^(pnpm|yarn|npm|bun|upm)@(\d+)?/.exec(String(JSON.parse(readFileSync(manifest, 'utf8')).packageManager ?? ''));
47
+ if (declared?.[1] === 'yarn')
48
+ return (declared[2] ? Number(declared[2]) >= 2 : isYarnBerry(dir)) ? 'yarn-berry' : 'yarn';
49
+ if (declared)
50
+ return declared[1];
51
+ }
52
+ catch {
53
+ // unreadable manifest: fall through to lockfile detection
54
+ }
55
+ }
56
+ for (const [pm, files] of LOCKFILE_PRECEDENCE) {
57
+ if (files.some((f) => existsSync(path.join(dir, f))))
58
+ return pm === 'yarn' && isYarnBerry(dir) ? 'yarn-berry' : pm;
59
+ }
60
+ const parent = path.dirname(dir);
61
+ if (parent === dir)
62
+ return DEFAULT_PACKAGE_MANAGER;
63
+ dir = parent;
64
+ }
65
+ }
66
+ /** Install `spec` (e.g. `lib@1.2.3`), keeping it in the manifest(s) and dependency field that already declare it. */
67
+ export async function installPackage(root, pkg, spec) {
68
+ const manifest = JSON.parse(await readFile(path.join(root, 'package.json'), 'utf8'));
69
+ const dev = !!manifest.devDependencies?.[pkg];
70
+ const pm = detectPackageManager(root);
71
+ const quoted = `'${spec.replaceAll("'", "'\\''")}'`;
72
+ const command = {
73
+ // `update -r` bumps the package wherever it is already declared (workspace-aware)
74
+ // instead of adding it to the root manifest.
75
+ pnpm: `pnpm update -r ${quoted}`,
76
+ yarn: `yarn add ${dev ? '-D ' : ''}${quoted}`,
77
+ // berry: `up` bumps the package in every workspace that declares it, keeping its field.
78
+ 'yarn-berry': `yarn up ${quoted}`,
79
+ bun: `bun add ${dev ? '-d ' : ''}${quoted}`,
80
+ upm: `upm add ${dev ? '--dev ' : ''}${quoted}`,
81
+ npm: `npm install ${dev ? '--save-dev ' : ''}${quoted}`,
82
+ }[pm];
83
+ const result = await runCommand(command, { cwd: root, timeoutMs: 10 * 60_000 });
84
+ if (!result.passed)
85
+ throw new GraftError(`\`${command}\` failed:\n${result.output}`, 'install/failed');
86
+ // npm and yarn classic run the project's own lifecycle scripts (e.g. a patch-package
87
+ // postinstall) only on a bare install, not when adding a specific package.
88
+ if (pm === 'npm' || pm === 'yarn')
89
+ return `${command} && ${await reinstall(root)}`;
90
+ return command;
91
+ }
92
+ /** Reinstall the project's dependencies (so package-manager patch config takes effect). */
93
+ export async function reinstall(root) {
94
+ const command = { pnpm: 'pnpm install', yarn: 'yarn install', 'yarn-berry': 'yarn install', bun: 'bun install', upm: 'upm install', npm: 'npm install' }[detectPackageManager(root)];
95
+ const result = await runCommand(command, { cwd: root, timeoutMs: 10 * 60_000 });
96
+ if (!result.passed)
97
+ throw new GraftError(`\`${command}\` failed:\n${result.output}`, 'install/failed');
98
+ return command;
99
+ }
100
+ //# sourceMappingURL=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AAC,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAChF,IAAI,CAAC,MAAM,CAAC,MAAM;QAAE,MAAM,IAAI,UAAU,CAAC,KAAK,OAAO,eAAe,MAAM,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC;IACvG,qFAAqF;IACrF,2EAA2E;IAC3E,IAAI,EAAE,KAAK,KAAK,IAAI,EAAE,KAAK,MAAM;QAAE,OAAO,GAAG,OAAO,OAAO,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IACnF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAY;IAC1C,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACrL,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAChF,IAAI,CAAC,MAAM,CAAC,MAAM;QAAE,MAAM,IAAI,UAAU,CAAC,KAAK,OAAO,eAAe,MAAM,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC;IACvG,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { type GraftStatus } from '@graftsync/spec';
2
+ import type { Project } from './project.js';
3
+ import type { GraftUpdate, InstalledApplyReport, AnchorReport, ApplyOptions, ApplyResult, Graft, ScopedDiff, VariantInput } from './types.js';
4
+ /** Resolve a version argument, defaulting to the installed version of the graft's rootstock. */
5
+ export declare function resolveVersion(project: Project, graft: Graft, version?: string): Promise<string>;
6
+ export declare function checkAnchors(project: Project, id: string, version?: string): Promise<AnchorReport>;
7
+ export declare function applyGraft(project: Project, id: string, options?: ApplyOptions): Promise<ApplyResult>;
8
+ export declare function scopeDiff(project: Project, id: string, from?: string, to?: string): Promise<ScopedDiff>;
9
+ export interface UpdateStatusInput extends GraftUpdate {
10
+ status?: GraftStatus;
11
+ }
12
+ export declare function updateGraft(project: Project, id: string, input: UpdateStatusInput): Promise<Graft>;
13
+ export interface RecordVariantOptions {
14
+ /** Refuse to record unless all anchors match at this version (the record is rolled back). */
15
+ verifyVersion?: string;
16
+ /** Extra text for the History entry (what moved upstream, how the variant differs). */
17
+ note?: string;
18
+ }
19
+ export interface RecordVariantResult {
20
+ graft: Graft;
21
+ /** Existing variants whose ranges were narrowed: index → new range. */
22
+ narrowed: {
23
+ module: string;
24
+ from: string;
25
+ to: string;
26
+ }[];
27
+ anchors?: AnchorReport;
28
+ }
29
+ /**
30
+ * Register a new variant for a version range. Never edits existing variant modules;
31
+ * may narrow open-ended ranges of existing variants so ranges stay disjoint.
32
+ */
33
+ export declare function recordVariant(project: Project, id: string, input: VariantInput, options?: RecordVariantOptions): Promise<RecordVariantResult>;
34
+ /** One line for a report: errors, then missed anchors grouped by file (long lists are cut). */
35
+ export declare function summarizeMisses(report: AnchorReport, maxFiles?: number): string;
36
+ export interface GraftStatusEntry {
37
+ id: string;
38
+ package: string;
39
+ mechanism: string;
40
+ status: GraftStatus;
41
+ verified: string;
42
+ installed?: string;
43
+ /** Anchor health against the installed version; absent for inactive grafts or when not installed. */
44
+ anchors?: AnchorReport;
45
+ error?: string;
46
+ }
47
+ /** Status of every graft, with anchor health against installed versions. */
48
+ export declare function projectStatus(project: Project): Promise<{
49
+ grafts: GraftStatusEntry[];
50
+ invalid: {
51
+ id: string;
52
+ errors: string[];
53
+ }[];
54
+ }>;
55
+ export interface ApplyToProjectResult {
56
+ /** Grafts whose package-manager configuration was pointed at their selected variant. */
57
+ configured: {
58
+ id: string;
59
+ package: string;
60
+ version: string;
61
+ variant: string;
62
+ }[];
63
+ /** Reinstall command that was run, if any. */
64
+ installCommand?: string;
65
+ /** Anchor reports at the installed versions, after configuring and reinstalling. */
66
+ anchors: AnchorReport[];
67
+ errors: {
68
+ id: string;
69
+ error: string;
70
+ }[];
71
+ }
72
+ /**
73
+ * Make the project actually use its grafts: point the package manager at the variant selected
74
+ * for each installed version (e.g. pnpm patchedDependencies), reinstall, and re-check anchors.
75
+ */
76
+ export declare function applyToProject(project: Project, options?: {
77
+ ids?: string[];
78
+ install?: boolean;
79
+ }): Promise<ApplyToProjectResult>;
80
+ /**
81
+ * Apply every active graft directly to the installed packages (Graft's built-in applier, run
82
+ * from postinstall). Offline and idempotent; returns per-graft reports.
83
+ */
84
+ export declare function applyInstalled(project: Project, options?: {
85
+ ids?: string[];
86
+ }): Promise<{
87
+ reports: InstalledApplyReport[];
88
+ ok: boolean;
89
+ }>;
90
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuC,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9I,gGAAgG;AAChG,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAatG;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CA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