pushwork 2.0.0-a.sub.1 → 2.0.0-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/branches.d.ts +19 -0
- package/dist/branches.d.ts.map +1 -0
- package/dist/branches.js +111 -0
- package/dist/branches.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +238 -272
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +84 -0
- package/dist/config.js.map +1 -0
- package/dist/fs-tree.d.ts +6 -0
- package/dist/fs-tree.d.ts.map +1 -0
- package/dist/fs-tree.js +99 -0
- package/dist/fs-tree.js.map +1 -0
- package/dist/ignore.d.ts +6 -0
- package/dist/ignore.d.ts.map +1 -0
- package/dist/ignore.js +74 -0
- package/dist/ignore.js.map +1 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts +3 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +14 -0
- package/dist/log.js.map +1 -0
- package/dist/pushwork.d.ts +115 -0
- package/dist/pushwork.d.ts.map +1 -0
- package/dist/pushwork.js +918 -0
- package/dist/pushwork.js.map +1 -0
- package/dist/repo.d.ts +14 -0
- package/dist/repo.d.ts.map +1 -0
- package/dist/repo.js +60 -0
- package/dist/repo.js.map +1 -0
- package/dist/shapes/custom.d.ts +3 -0
- package/dist/shapes/custom.d.ts.map +1 -0
- package/dist/shapes/custom.js +57 -0
- package/dist/shapes/custom.js.map +1 -0
- package/dist/shapes/file.d.ts +20 -0
- package/dist/shapes/file.d.ts.map +1 -0
- package/dist/shapes/file.js +140 -0
- package/dist/shapes/file.js.map +1 -0
- package/dist/shapes/index.d.ts +10 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +35 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/patchwork-folder.d.ts +3 -0
- package/dist/shapes/patchwork-folder.d.ts.map +1 -0
- package/dist/shapes/patchwork-folder.js +160 -0
- package/dist/shapes/patchwork-folder.js.map +1 -0
- package/dist/shapes/types.d.ts +37 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +52 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shapes/vfs.d.ts +3 -0
- package/dist/shapes/vfs.d.ts.map +1 -0
- package/dist/shapes/vfs.js +88 -0
- package/dist/shapes/vfs.js.map +1 -0
- package/dist/stash.d.ts +23 -0
- package/dist/stash.d.ts.map +1 -0
- package/dist/stash.js +118 -0
- package/dist/stash.js.map +1 -0
- package/flake.lock +128 -0
- package/flake.nix +66 -0
- package/package.json +15 -48
- package/patches/@automerge__automerge-repo@2.6.0-subduction.15.patch +26 -0
- package/pnpm-workspace.yaml +5 -0
- package/src/branches.ts +93 -0
- package/src/cli.ts +258 -408
- package/src/config.ts +64 -0
- package/src/fs-tree.ts +70 -0
- package/src/ignore.ts +33 -0
- package/src/index.ts +38 -4
- package/src/log.ts +8 -0
- package/src/pushwork.ts +1055 -0
- package/src/repo.ts +76 -0
- package/src/shapes/custom.ts +29 -0
- package/src/shapes/file.ts +115 -0
- package/src/shapes/index.ts +19 -0
- package/src/shapes/patchwork-folder.ts +156 -0
- package/src/shapes/types.ts +79 -0
- package/src/shapes/vfs.ts +93 -0
- package/src/stash.ts +106 -0
- package/test/integration/branches.test.ts +389 -0
- package/test/integration/pushwork.test.ts +547 -0
- package/test/setup.ts +29 -0
- package/test/unit/doc-shape.test.ts +612 -0
- package/tsconfig.json +2 -3
- package/vitest.config.ts +14 -0
- package/ARCHITECTURE-ACCORDING-TO-CLAUDE.md +0 -248
- package/CLAUDE.md +0 -141
- package/README.md +0 -221
- package/babel.config.js +0 -5
- package/dist/cli/commands.d.ts +0 -71
- package/dist/cli/commands.d.ts.map +0 -1
- package/dist/cli/commands.js +0 -794
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -19
- package/dist/cli/index.js.map +0 -1
- package/dist/commands.d.ts +0 -61
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -861
- package/dist/commands.js.map +0 -1
- package/dist/config/index.d.ts +0 -71
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -314
- package/dist/config/index.js.map +0 -1
- package/dist/core/change-detection.d.ts +0 -80
- package/dist/core/change-detection.d.ts.map +0 -1
- package/dist/core/change-detection.js +0 -523
- package/dist/core/change-detection.js.map +0 -1
- package/dist/core/config.d.ts +0 -81
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js +0 -258
- package/dist/core/config.js.map +0 -1
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -6
- package/dist/core/index.js.map +0 -1
- package/dist/core/move-detection.d.ts +0 -34
- package/dist/core/move-detection.d.ts.map +0 -1
- package/dist/core/move-detection.js +0 -121
- package/dist/core/move-detection.js.map +0 -1
- package/dist/core/snapshot.d.ts +0 -105
- package/dist/core/snapshot.d.ts.map +0 -1
- package/dist/core/snapshot.js +0 -217
- package/dist/core/snapshot.js.map +0 -1
- package/dist/core/sync-engine.d.ts +0 -157
- package/dist/core/sync-engine.d.ts.map +0 -1
- package/dist/core/sync-engine.js +0 -1379
- package/dist/core/sync-engine.js.map +0 -1
- package/dist/types/config.d.ts +0 -99
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js +0 -5
- package/dist/types/config.js.map +0 -1
- package/dist/types/documents.d.ts +0 -88
- package/dist/types/documents.d.ts.map +0 -1
- package/dist/types/documents.js +0 -20
- package/dist/types/documents.js.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +0 -1
- package/dist/types/snapshot.d.ts +0 -64
- package/dist/types/snapshot.d.ts.map +0 -1
- package/dist/types/snapshot.js +0 -2
- package/dist/types/snapshot.js.map +0 -1
- package/dist/utils/content-similarity.d.ts +0 -53
- package/dist/utils/content-similarity.d.ts.map +0 -1
- package/dist/utils/content-similarity.js +0 -155
- package/dist/utils/content-similarity.js.map +0 -1
- package/dist/utils/content.d.ts +0 -10
- package/dist/utils/content.d.ts.map +0 -1
- package/dist/utils/content.js +0 -31
- package/dist/utils/content.js.map +0 -1
- package/dist/utils/directory.d.ts +0 -24
- package/dist/utils/directory.d.ts.map +0 -1
- package/dist/utils/directory.js +0 -52
- package/dist/utils/directory.js.map +0 -1
- package/dist/utils/fs.d.ts +0 -74
- package/dist/utils/fs.d.ts.map +0 -1
- package/dist/utils/fs.js +0 -248
- package/dist/utils/fs.js.map +0 -1
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -5
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/mime-types.d.ts +0 -13
- package/dist/utils/mime-types.d.ts.map +0 -1
- package/dist/utils/mime-types.js +0 -209
- package/dist/utils/mime-types.js.map +0 -1
- package/dist/utils/network-sync.d.ts +0 -36
- package/dist/utils/network-sync.d.ts.map +0 -1
- package/dist/utils/network-sync.js +0 -250
- package/dist/utils/network-sync.js.map +0 -1
- package/dist/utils/node-polyfills.d.ts +0 -9
- package/dist/utils/node-polyfills.d.ts.map +0 -1
- package/dist/utils/node-polyfills.js +0 -9
- package/dist/utils/node-polyfills.js.map +0 -1
- package/dist/utils/output.d.ts +0 -129
- package/dist/utils/output.d.ts.map +0 -1
- package/dist/utils/output.js +0 -368
- package/dist/utils/output.js.map +0 -1
- package/dist/utils/repo-factory.d.ts +0 -13
- package/dist/utils/repo-factory.d.ts.map +0 -1
- package/dist/utils/repo-factory.js +0 -46
- package/dist/utils/repo-factory.js.map +0 -1
- package/dist/utils/string-similarity.d.ts +0 -14
- package/dist/utils/string-similarity.d.ts.map +0 -1
- package/dist/utils/string-similarity.js +0 -39
- package/dist/utils/string-similarity.js.map +0 -1
- package/dist/utils/text-diff.d.ts +0 -37
- package/dist/utils/text-diff.d.ts.map +0 -1
- package/dist/utils/text-diff.js +0 -93
- package/dist/utils/text-diff.js.map +0 -1
- package/dist/utils/trace.d.ts +0 -19
- package/dist/utils/trace.d.ts.map +0 -1
- package/dist/utils/trace.js +0 -63
- package/dist/utils/trace.js.map +0 -1
- package/src/commands.ts +0 -1134
- package/src/core/change-detection.ts +0 -712
- package/src/core/config.ts +0 -313
- package/src/core/index.ts +0 -5
- package/src/core/move-detection.ts +0 -169
- package/src/core/snapshot.ts +0 -275
- package/src/core/sync-engine.ts +0 -1795
- package/src/types/config.ts +0 -111
- package/src/types/documents.ts +0 -91
- package/src/types/index.ts +0 -3
- package/src/types/snapshot.ts +0 -67
- package/src/utils/content.ts +0 -34
- package/src/utils/directory.ts +0 -73
- package/src/utils/fs.ts +0 -297
- package/src/utils/index.ts +0 -4
- package/src/utils/mime-types.ts +0 -244
- package/src/utils/network-sync.ts +0 -319
- package/src/utils/node-polyfills.ts +0 -8
- package/src/utils/output.ts +0 -450
- package/src/utils/repo-factory.ts +0 -73
- package/src/utils/string-similarity.ts +0 -54
- package/src/utils/text-diff.ts +0 -101
- package/src/utils/trace.ts +0 -70
- package/test/integration/README.md +0 -328
- package/test/integration/clone-test.sh +0 -310
- package/test/integration/conflict-resolution-test.sh +0 -309
- package/test/integration/debug-both-nested.sh +0 -74
- package/test/integration/debug-concurrent-nested.sh +0 -87
- package/test/integration/debug-nested.sh +0 -73
- package/test/integration/deletion-behavior-test.sh +0 -487
- package/test/integration/deletion-sync-test-simple.sh +0 -193
- package/test/integration/deletion-sync-test.sh +0 -297
- package/test/integration/exclude-patterns.test.ts +0 -144
- package/test/integration/full-integration-test.sh +0 -363
- package/test/integration/fuzzer.test.ts +0 -818
- package/test/integration/in-memory-sync.test.ts +0 -830
- package/test/integration/init-sync.test.ts +0 -89
- package/test/integration/manual-sync-test.sh +0 -84
- package/test/integration/sync-deletion.test.ts +0 -280
- package/test/integration/sync-flow.test.ts +0 -291
- package/test/jest.setup.ts +0 -34
- package/test/run-tests.sh +0 -225
- package/test/unit/deletion-behavior.test.ts +0 -249
- package/test/unit/enhanced-mime-detection.test.ts +0 -244
- package/test/unit/snapshot.test.ts +0 -404
- package/test/unit/sync-convergence.test.ts +0 -298
- package/test/unit/sync-timing.test.ts +0 -134
- package/test/unit/utils.test.ts +0 -366
package/dist/config.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.storageDir = exports.pushworkDir = exports.CONFIG_VERSION = void 0;
|
|
37
|
+
exports.readConfig = readConfig;
|
|
38
|
+
exports.writeConfig = writeConfig;
|
|
39
|
+
exports.configExists = configExists;
|
|
40
|
+
const fs = __importStar(require("fs/promises"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
exports.CONFIG_VERSION = 3;
|
|
43
|
+
const DIR = ".pushwork";
|
|
44
|
+
const CONFIG = "config.json";
|
|
45
|
+
const STORAGE = "storage";
|
|
46
|
+
const pushworkDir = (root) => path.join(root, DIR);
|
|
47
|
+
exports.pushworkDir = pushworkDir;
|
|
48
|
+
const storageDir = (root) => path.join(root, DIR, STORAGE);
|
|
49
|
+
exports.storageDir = storageDir;
|
|
50
|
+
async function readConfig(root) {
|
|
51
|
+
const text = await fs.readFile(path.join(root, DIR, CONFIG), "utf8");
|
|
52
|
+
const parsed = JSON.parse(text);
|
|
53
|
+
if (parsed.version !== exports.CONFIG_VERSION) {
|
|
54
|
+
throw new Error(`pushwork config version mismatch: expected ${exports.CONFIG_VERSION}, got ${parsed.version ?? "(missing)"}`);
|
|
55
|
+
}
|
|
56
|
+
if (!parsed.rootUrl)
|
|
57
|
+
throw new Error("pushwork config missing rootUrl");
|
|
58
|
+
if (!parsed.backend)
|
|
59
|
+
throw new Error("pushwork config missing backend");
|
|
60
|
+
if (!parsed.shape)
|
|
61
|
+
throw new Error("pushwork config missing shape");
|
|
62
|
+
return {
|
|
63
|
+
version: exports.CONFIG_VERSION,
|
|
64
|
+
rootUrl: parsed.rootUrl,
|
|
65
|
+
backend: parsed.backend,
|
|
66
|
+
shape: parsed.shape,
|
|
67
|
+
artifactDirectories: parsed.artifactDirectories ?? [],
|
|
68
|
+
branches: parsed.branches ?? true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async function writeConfig(root, config) {
|
|
72
|
+
await fs.mkdir(path.join(root, DIR), { recursive: true });
|
|
73
|
+
await fs.writeFile(path.join(root, DIR, CONFIG), JSON.stringify(config, null, 2) + "\n");
|
|
74
|
+
}
|
|
75
|
+
async function configExists(root) {
|
|
76
|
+
try {
|
|
77
|
+
await fs.access(path.join(root, DIR, CONFIG));
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,gCAmBC;AAED,kCASC;AAED,oCAOC;AA/DD,gDAAkC;AAClC,2CAA6B;AAKhB,QAAA,cAAc,GAAG,CAAC,CAAC;AAWhC,MAAM,GAAG,GAAG,WAAW,CAAC;AACxB,MAAM,MAAM,GAAG,aAAa,CAAC;AAC7B,MAAM,OAAO,GAAG,SAAS,CAAC;AAEnB,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAArD,QAAA,WAAW,eAA0C;AAC3D,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAA7D,QAAA,UAAU,cAAmD;AAEnE,KAAK,UAAU,UAAU,CAAC,IAAY;IAC5C,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IA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,KAAK,UAAU,YAAY,CAAC,IAAY;IAC9C,IAAI,CAAC;QACJ,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Ignore } from "ignore";
|
|
2
|
+
export type FileTree = Map<string, Uint8Array>;
|
|
3
|
+
export declare function walkDir(root: string, ig: Ignore): Promise<FileTree>;
|
|
4
|
+
export declare function byteEq(a: Uint8Array | undefined, b: Uint8Array): boolean;
|
|
5
|
+
export declare function writeFileAtomic(target: string, bytes: Uint8Array): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=fs-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-tree.d.ts","sourceRoot":"","sources":["../src/fs-tree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMrC,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAI/C,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAMzE;AAqCD,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAKxE;AAED,wBAAsB,eAAe,CACpC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,GACf,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
package/dist/fs-tree.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.walkDir = walkDir;
|
|
37
|
+
exports.byteEq = byteEq;
|
|
38
|
+
exports.writeFileAtomic = writeFileAtomic;
|
|
39
|
+
const fs = __importStar(require("fs/promises"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const ignore_js_1 = require("./ignore.js");
|
|
42
|
+
const log_js_1 = require("./log.js");
|
|
43
|
+
const dlog = (0, log_js_1.log)("fs-tree");
|
|
44
|
+
const toPosix = (p) => p.split(path.sep).join("/");
|
|
45
|
+
async function walkDir(root, ig) {
|
|
46
|
+
dlog("walkDir root=%s", root);
|
|
47
|
+
const tree = new Map();
|
|
48
|
+
await walk(root, root, ig, tree);
|
|
49
|
+
dlog("walkDir done: %d files", tree.size);
|
|
50
|
+
return tree;
|
|
51
|
+
}
|
|
52
|
+
async function walk(root, current, ig, tree) {
|
|
53
|
+
let names;
|
|
54
|
+
try {
|
|
55
|
+
names = await fs.readdir(current);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
for (const name of names) {
|
|
61
|
+
const full = path.join(current, name);
|
|
62
|
+
const rel = toPosix(path.relative(root, full));
|
|
63
|
+
if ((0, ignore_js_1.isIgnored)(ig, rel)) {
|
|
64
|
+
dlog("skip ignored: %s", rel);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
let stat;
|
|
68
|
+
try {
|
|
69
|
+
stat = await fs.lstat(full);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (stat.isSymbolicLink())
|
|
75
|
+
continue;
|
|
76
|
+
if (stat.isDirectory()) {
|
|
77
|
+
await walk(root, full, ig, tree);
|
|
78
|
+
}
|
|
79
|
+
else if (stat.isFile()) {
|
|
80
|
+
const bytes = await fs.readFile(full);
|
|
81
|
+
tree.set(rel, new Uint8Array(bytes));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function byteEq(a, b) {
|
|
86
|
+
if (!a)
|
|
87
|
+
return false;
|
|
88
|
+
if (a.length !== b.length)
|
|
89
|
+
return false;
|
|
90
|
+
for (let i = 0; i < a.length; i++)
|
|
91
|
+
if (a[i] !== b[i])
|
|
92
|
+
return false;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
async function writeFileAtomic(target, bytes) {
|
|
96
|
+
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
97
|
+
await fs.writeFile(target, bytes);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=fs-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-tree.js","sourceRoot":"","sources":["../src/fs-tree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,0BAMC;AAqCD,wBAKC;AAED,0CAMC;AApED,gDAAkC;AAClC,2CAA6B;AAE7B,2CAAwC;AACxC,qCAA+B;AAE/B,MAAM,IAAI,GAAG,IAAA,YAAG,EAAC,SAAS,CAAC,CAAC;AAI5B,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEpD,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,EAAU;IACrD,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAa,IAAI,GAAG,EAAE,CAAC;IACjC,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC;AACb,CAAC;AAED,KAAK,UAAU,IAAI,CAClB,IAAY,EACZ,OAAe,EACf,EAAU,EACV,IAAc;IAEd,IAAI,KAAe,CAAC;IACpB,IAAI,CAAC;QACJ,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO;IACR,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,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AAO,KAAK,CAAC;IACnE,OAAO,IAAI,CAAC;AACb,CAAC;AAEM,KAAK,UAAU,eAAe,CACpC,MAAc,EACd,KAAiB;IAEjB,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,MAAM,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/ignore.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Ignore } from "ignore";
|
|
2
|
+
export declare const ALWAYS_IGNORE: string[];
|
|
3
|
+
export declare const IGNORE_FILE = ".pushworkignore";
|
|
4
|
+
export declare function loadIgnore(root: string): Promise<Ignore>;
|
|
5
|
+
export declare function isIgnored(ig: Ignore, relativePath: string): boolean;
|
|
6
|
+
//# sourceMappingURL=ignore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../src/ignore.ts"],"names":[],"mappings":"AAEA,OAAe,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAK7C,eAAO,MAAM,aAAa,UAAwC,CAAC;AACnE,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAE7C,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB9D;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAGnE"}
|
package/dist/ignore.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.IGNORE_FILE = exports.ALWAYS_IGNORE = void 0;
|
|
40
|
+
exports.loadIgnore = loadIgnore;
|
|
41
|
+
exports.isIgnored = isIgnored;
|
|
42
|
+
const fs = __importStar(require("fs/promises"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const ignore_1 = __importDefault(require("ignore"));
|
|
45
|
+
const log_js_1 = require("./log.js");
|
|
46
|
+
const dlog = (0, log_js_1.log)("ignore");
|
|
47
|
+
exports.ALWAYS_IGNORE = [".pushwork", ".git", "node_modules"];
|
|
48
|
+
exports.IGNORE_FILE = ".pushworkignore";
|
|
49
|
+
async function loadIgnore(root) {
|
|
50
|
+
const ig = (0, ignore_1.default)().add(exports.ALWAYS_IGNORE);
|
|
51
|
+
dlog("always-ignored: %o", exports.ALWAYS_IGNORE);
|
|
52
|
+
try {
|
|
53
|
+
const text = await fs.readFile(path.join(root, exports.IGNORE_FILE), "utf8");
|
|
54
|
+
const patterns = text
|
|
55
|
+
.split(/\r?\n/)
|
|
56
|
+
.map((l) => l.trim())
|
|
57
|
+
.filter((l) => l && !l.startsWith("#"));
|
|
58
|
+
ig.add(patterns);
|
|
59
|
+
dlog("loaded %d patterns from %s", patterns.length, exports.IGNORE_FILE);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
const e = err;
|
|
63
|
+
if (e.code !== "ENOENT")
|
|
64
|
+
throw err;
|
|
65
|
+
dlog("no %s in %s", exports.IGNORE_FILE, root);
|
|
66
|
+
}
|
|
67
|
+
return ig;
|
|
68
|
+
}
|
|
69
|
+
function isIgnored(ig, relativePath) {
|
|
70
|
+
if (relativePath === "" || relativePath === ".")
|
|
71
|
+
return false;
|
|
72
|
+
return ig.ignores(relativePath);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=ignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../src/ignore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,gCAiBC;AAED,8BAGC;AAhCD,gDAAkC;AAClC,2CAA6B;AAC7B,oDAA6C;AAC7C,qCAA+B;AAE/B,MAAM,IAAI,GAAG,IAAA,YAAG,EAAC,QAAQ,CAAC,CAAC;AA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AC;AACjC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export { init, clone, sync, save, status, diff, url, currentBranch, createBranch, switchBranch, listBranches, mergeBranch, previewMerge, cutWorkdir, pasteStash, showStashes, } from "./pushwork.js";
|
|
2
|
+
export type { MergeReport, MergePreview, MergePreviewEntry } from "./pushwork.js";
|
|
3
|
+
export type { Stash, StashEntry } from "./stash.js";
|
|
4
|
+
export type { Backend, PushworkConfig } from "./config.js";
|
|
5
|
+
export { CONFIG_VERSION } from "./config.js";
|
|
6
|
+
export type { Shape, VfsNode, UnixFileEntry } from "./shapes/index.js";
|
|
7
|
+
export { vfsShape, patchworkFolderShape, isInArtifactDir, normalizeArtifactDir, pinUrl, stripHeads, } from "./shapes/index.js";
|
|
8
|
+
export { DEFAULT_BRANCH, detectDocType, isBranchesDoc, resolveEffectiveRoot, type BranchesDoc, } from "./branches.js";
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,GAAG,EACH,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClF,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EACN,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,MAAM,EACN,UAAU,GACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,cAAc,EACd,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,KAAK,WAAW,GAChB,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveEffectiveRoot = exports.isBranchesDoc = exports.detectDocType = exports.DEFAULT_BRANCH = exports.stripHeads = exports.pinUrl = exports.normalizeArtifactDir = exports.isInArtifactDir = exports.patchworkFolderShape = exports.vfsShape = exports.CONFIG_VERSION = exports.showStashes = exports.pasteStash = exports.cutWorkdir = exports.previewMerge = exports.mergeBranch = exports.listBranches = exports.switchBranch = exports.createBranch = exports.currentBranch = exports.url = exports.diff = exports.status = exports.save = exports.sync = exports.clone = exports.init = void 0;
|
|
4
|
+
var pushwork_js_1 = require("./pushwork.js");
|
|
5
|
+
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return pushwork_js_1.init; } });
|
|
6
|
+
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return pushwork_js_1.clone; } });
|
|
7
|
+
Object.defineProperty(exports, "sync", { enumerable: true, get: function () { return pushwork_js_1.sync; } });
|
|
8
|
+
Object.defineProperty(exports, "save", { enumerable: true, get: function () { return pushwork_js_1.save; } });
|
|
9
|
+
Object.defineProperty(exports, "status", { enumerable: true, get: function () { return pushwork_js_1.status; } });
|
|
10
|
+
Object.defineProperty(exports, "diff", { enumerable: true, get: function () { return pushwork_js_1.diff; } });
|
|
11
|
+
Object.defineProperty(exports, "url", { enumerable: true, get: function () { return pushwork_js_1.url; } });
|
|
12
|
+
Object.defineProperty(exports, "currentBranch", { enumerable: true, get: function () { return pushwork_js_1.currentBranch; } });
|
|
13
|
+
Object.defineProperty(exports, "createBranch", { enumerable: true, get: function () { return pushwork_js_1.createBranch; } });
|
|
14
|
+
Object.defineProperty(exports, "switchBranch", { enumerable: true, get: function () { return pushwork_js_1.switchBranch; } });
|
|
15
|
+
Object.defineProperty(exports, "listBranches", { enumerable: true, get: function () { return pushwork_js_1.listBranches; } });
|
|
16
|
+
Object.defineProperty(exports, "mergeBranch", { enumerable: true, get: function () { return pushwork_js_1.mergeBranch; } });
|
|
17
|
+
Object.defineProperty(exports, "previewMerge", { enumerable: true, get: function () { return pushwork_js_1.previewMerge; } });
|
|
18
|
+
Object.defineProperty(exports, "cutWorkdir", { enumerable: true, get: function () { return pushwork_js_1.cutWorkdir; } });
|
|
19
|
+
Object.defineProperty(exports, "pasteStash", { enumerable: true, get: function () { return pushwork_js_1.pasteStash; } });
|
|
20
|
+
Object.defineProperty(exports, "showStashes", { enumerable: true, get: function () { return pushwork_js_1.showStashes; } });
|
|
21
|
+
var config_js_1 = require("./config.js");
|
|
22
|
+
Object.defineProperty(exports, "CONFIG_VERSION", { enumerable: true, get: function () { return config_js_1.CONFIG_VERSION; } });
|
|
23
|
+
var index_js_1 = require("./shapes/index.js");
|
|
24
|
+
Object.defineProperty(exports, "vfsShape", { enumerable: true, get: function () { return index_js_1.vfsShape; } });
|
|
25
|
+
Object.defineProperty(exports, "patchworkFolderShape", { enumerable: true, get: function () { return index_js_1.patchworkFolderShape; } });
|
|
26
|
+
Object.defineProperty(exports, "isInArtifactDir", { enumerable: true, get: function () { return index_js_1.isInArtifactDir; } });
|
|
27
|
+
Object.defineProperty(exports, "normalizeArtifactDir", { enumerable: true, get: function () { return index_js_1.normalizeArtifactDir; } });
|
|
28
|
+
Object.defineProperty(exports, "pinUrl", { enumerable: true, get: function () { return index_js_1.pinUrl; } });
|
|
29
|
+
Object.defineProperty(exports, "stripHeads", { enumerable: true, get: function () { return index_js_1.stripHeads; } });
|
|
30
|
+
var branches_js_1 = require("./branches.js");
|
|
31
|
+
Object.defineProperty(exports, "DEFAULT_BRANCH", { enumerable: true, get: function () { return branches_js_1.DEFAULT_BRANCH; } });
|
|
32
|
+
Object.defineProperty(exports, "detectDocType", { enumerable: true, get: function () { return branches_js_1.detectDocType; } });
|
|
33
|
+
Object.defineProperty(exports, "isBranchesDoc", { enumerable: true, get: function () { return branches_js_1.isBranchesDoc; } });
|
|
34
|
+
Object.defineProperty(exports, "resolveEffectiveRoot", { enumerable: true, get: function () { return branches_js_1.resolveEffectiveRoot; } });
|
|
5
35
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6CAiBuB;AAhBtB,mGAAA,IAAI,OAAA;AACJ,oGAAA,KAAK,OAAA;AACL,mGAAA,IAAI,OAAA;AACJ,mGAAA,IAAI,OAAA;AACJ,qGAAA,MAAM,OAAA;AACN,mGAAA,IAAI,OAAA;AACJ,kGAAA,GAAG,OAAA;AACH,4GAAA,aAAa,OAAA;AACb,2GAAA,YAAY,OAAA;AACZ,2GAAA,YAAY,OAAA;AACZ,2GAAA,YAAY,OAAA;AACZ,0GAAA,WAAW,OAAA;AACX,2GAAA,YAAY,OAAA;AACZ,yGAAA,UAAU,OAAA;AACV,yGAAA,UAAU,OAAA;AACV,0GAAA,WAAW,OAAA;AAKZ,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AAEvB,8CAO2B;AAN1B,oGAAA,QAAQ,OAAA;AACR,gHAAA,oBAAoB,OAAA;AACpB,2GAAA,eAAe,OAAA;AACf,gHAAA,oBAAoB,OAAA;AACpB,kGAAA,MAAM,OAAA;AACN,sGAAA,UAAU,OAAA;AAEX,6CAMuB;AALtB,6GAAA,cAAc,OAAA;AACd,4GAAA,aAAa,OAAA;AACb,4GAAA,aAAa,OAAA;AACb,mHAAA,oBAAoB,OAAA"}
|
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,eAAO,MAAM,GAAG,GAAI,IAAI,MAAM,mBAA4B,CAAC"}
|
package/dist/log.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.log = void 0;
|
|
7
|
+
const debug_1 = __importDefault(require("debug"));
|
|
8
|
+
if (process.env.DEBUG === "true") {
|
|
9
|
+
process.env.DEBUG = "*";
|
|
10
|
+
debug_1.default.enable("*");
|
|
11
|
+
}
|
|
12
|
+
const log = (ns) => (0, debug_1.default)(`pushwork:${ns}`);
|
|
13
|
+
exports.log = log;
|
|
14
|
+
//# sourceMappingURL=log.js.map
|
package/dist/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC;IACxB,eAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAEM,MAAM,GAAG,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAA,eAAK,EAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAA9C,QAAA,GAAG,OAA2C"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type AutomergeUrl } from "@automerge/automerge-repo";
|
|
2
|
+
import { type Backend, type PushworkConfig } from "./config.js";
|
|
3
|
+
import { deleteBranchFile } from "./branches.js";
|
|
4
|
+
import { type Stash } from "./stash.js";
|
|
5
|
+
import { type Shape, type UnixFileEntry, type VfsNode } from "./shapes/index.js";
|
|
6
|
+
export type InitOpts = {
|
|
7
|
+
dir: string;
|
|
8
|
+
backend: Backend;
|
|
9
|
+
shape: string;
|
|
10
|
+
artifactDirectories?: readonly string[];
|
|
11
|
+
branches?: boolean;
|
|
12
|
+
online?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type CloneOpts = {
|
|
15
|
+
url: string;
|
|
16
|
+
dir: string;
|
|
17
|
+
backend: Backend;
|
|
18
|
+
shape: string;
|
|
19
|
+
artifactDirectories?: readonly string[];
|
|
20
|
+
branch?: string;
|
|
21
|
+
online?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type Diff = {
|
|
24
|
+
added: string[];
|
|
25
|
+
modified: string[];
|
|
26
|
+
deleted: string[];
|
|
27
|
+
};
|
|
28
|
+
export declare function init(opts: InitOpts): Promise<AutomergeUrl>;
|
|
29
|
+
export declare function clone(opts: CloneOpts): Promise<void>;
|
|
30
|
+
export declare function url(cwd: string): Promise<AutomergeUrl>;
|
|
31
|
+
export declare function sync(cwd: string): Promise<void>;
|
|
32
|
+
export declare function save(cwd: string): Promise<void>;
|
|
33
|
+
export declare function status(cwd: string): Promise<{
|
|
34
|
+
branch: string | null;
|
|
35
|
+
diff: Diff;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function diff(cwd: string, limitToPath?: string): Promise<Array<{
|
|
38
|
+
path: string;
|
|
39
|
+
kind: "added" | "modified" | "deleted";
|
|
40
|
+
before?: Uint8Array;
|
|
41
|
+
after?: Uint8Array;
|
|
42
|
+
}>>;
|
|
43
|
+
export declare function listBranches(cwd: string): Promise<{
|
|
44
|
+
current: string | null;
|
|
45
|
+
names: string[];
|
|
46
|
+
}>;
|
|
47
|
+
export declare function currentBranch(cwd: string): Promise<string | null>;
|
|
48
|
+
export declare function createBranch(cwd: string, name: string): Promise<AutomergeUrl>;
|
|
49
|
+
export type MergeReport = {
|
|
50
|
+
source: string;
|
|
51
|
+
target: string;
|
|
52
|
+
merged: string[];
|
|
53
|
+
added: string[];
|
|
54
|
+
};
|
|
55
|
+
export type MergePreviewEntry = {
|
|
56
|
+
path: string;
|
|
57
|
+
kind: "merged" | "added";
|
|
58
|
+
before?: Uint8Array;
|
|
59
|
+
after: Uint8Array;
|
|
60
|
+
};
|
|
61
|
+
export type MergePreview = {
|
|
62
|
+
source: string;
|
|
63
|
+
target: string;
|
|
64
|
+
entries: MergePreviewEntry[];
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Apply changes from `source` branch onto the current branch.
|
|
68
|
+
*
|
|
69
|
+
* For each path:
|
|
70
|
+
* - In both branches: their UnixFileEntry docs share Automerge history (deep
|
|
71
|
+
* cloned at branch creation), so we Automerge-merge source's content into
|
|
72
|
+
* target's. Concurrent edits are CRDT-merged inside each file doc.
|
|
73
|
+
* - Only in source: deep-clone the source's file doc into a new doc and add
|
|
74
|
+
* it to target's folder. Editing on either branch afterward stays isolated.
|
|
75
|
+
* - Only in target: untouched. We don't propagate deletions from source — the
|
|
76
|
+
* user can do that explicitly.
|
|
77
|
+
*
|
|
78
|
+
* Refuses if the working tree has uncommitted changes against the current
|
|
79
|
+
* branch (run `pushwork save` first). Offline only — propagation happens on
|
|
80
|
+
* the next `pushwork sync`.
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* Compute what `merge <source>` would do without mutating any docs or the
|
|
84
|
+
* working tree. For paths in both branches we apply the merge to a *clone*
|
|
85
|
+
* of the target's file doc to learn the merged bytes; for paths only in
|
|
86
|
+
* source we just read source's bytes.
|
|
87
|
+
*/
|
|
88
|
+
export declare function previewMerge(cwd: string, source: string): Promise<MergePreview>;
|
|
89
|
+
export declare function mergeBranch(cwd: string, source: string): Promise<MergeReport>;
|
|
90
|
+
/**
|
|
91
|
+
* Capture the working tree's changes against the current branch's saved
|
|
92
|
+
* state into a local stash, then reset the working tree to the saved state.
|
|
93
|
+
* Stashes live in `.pushwork/stash.json` and are never synced.
|
|
94
|
+
*/
|
|
95
|
+
export declare function cutWorkdir(cwd: string, opts?: {
|
|
96
|
+
name?: string;
|
|
97
|
+
}): Promise<{
|
|
98
|
+
id: number;
|
|
99
|
+
entries: number;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Apply a stash on top of the current working tree, then remove the stash
|
|
103
|
+
* entry. Refuses if the working tree has uncommitted changes (caller can
|
|
104
|
+
* `pushwork save` or `pushwork cut` first).
|
|
105
|
+
*/
|
|
106
|
+
export declare function pasteStash(cwd: string, selector?: string): Promise<{
|
|
107
|
+
id: number;
|
|
108
|
+
entries: number;
|
|
109
|
+
name?: string;
|
|
110
|
+
}>;
|
|
111
|
+
export declare function showStashes(cwd: string): Promise<Stash[]>;
|
|
112
|
+
export declare function switchBranch(cwd: string, name: string): Promise<void>;
|
|
113
|
+
export type { Shape, UnixFileEntry, VfsNode, PushworkConfig };
|
|
114
|
+
export { deleteBranchFile };
|
|
115
|
+
//# sourceMappingURL=pushwork.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushwork.d.ts","sourceRoot":"","sources":["../src/pushwork.ts"],"names":[],"mappings":"AAGA,OAAO,EAGN,KAAK,YAAY,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAON,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEN,gBAAgB,EAQhB,MAAM,eAAe,CAAC;AAKvB,OA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