@ricsam/r5d-worker 0.0.48 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/main.cjs +187 -170
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/workspace-sync.cjs +38 -0
- package/dist/mjs/main.mjs +183 -170
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/workspace-sync.mjs +37 -0
- package/dist/types/main.d.ts +45 -6
- package/dist/types/workspace-sync.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/package.json
CHANGED
|
@@ -30,6 +30,7 @@ var workspace_sync_exports = {};
|
|
|
30
30
|
__export(workspace_sync_exports, {
|
|
31
31
|
MAX_WORKSPACE_SYNC_DIFF_BYTES: () => MAX_WORKSPACE_SYNC_DIFF_BYTES,
|
|
32
32
|
WORKSPACE_BRANCH: () => WORKSPACE_BRANCH,
|
|
33
|
+
WORKSPACE_NATIVE_PLANS_RELATIVE_PATH: () => WORKSPACE_NATIVE_PLANS_RELATIVE_PATH,
|
|
33
34
|
WORKSPACE_PERIODIC_SCAN_INTERVAL_MS: () => WORKSPACE_PERIODIC_SCAN_INTERVAL_MS,
|
|
34
35
|
WorkspaceSyncSingleFlight: () => WorkspaceSyncSingleFlight,
|
|
35
36
|
assertCanonicalCheckoutIndexMatchesWorktree: () => assertCanonicalCheckoutIndexMatchesWorktree,
|
|
@@ -130,12 +131,16 @@ function workspaceProjectBranchRelativePath(projectId, branchName) {
|
|
|
130
131
|
function workspacePlansRelativePath(projectId, branchName) {
|
|
131
132
|
return import_node_path.default.posix.join("plans", projectId, encodeWorkspaceBranch(branchName));
|
|
132
133
|
}
|
|
134
|
+
const WORKSPACE_NATIVE_PLANS_RELATIVE_PATH = "workspace-plans";
|
|
133
135
|
function visibleProjectBranchPath(projectsRoot, manifest, branchName) {
|
|
134
136
|
return (0, import_managed_paths.managedBranchPath)(projectsRoot, manifest.checkoutPathSegments, branchName);
|
|
135
137
|
}
|
|
136
138
|
function localPlansBranchPath(plansRoot, projectId, branchName) {
|
|
137
139
|
return import_node_path.default.join(plansRoot, projectId, branchName);
|
|
138
140
|
}
|
|
141
|
+
function localWorkspacePlansPath(plansRoot) {
|
|
142
|
+
return import_node_path.default.join(plansRoot, "workspace");
|
|
143
|
+
}
|
|
139
144
|
function assertInside(root, candidate, label) {
|
|
140
145
|
const resolvedRoot = import_node_path.default.resolve(root);
|
|
141
146
|
const resolvedCandidate = import_node_path.default.resolve(candidate);
|
|
@@ -713,12 +718,43 @@ function mirrorShadowPlansToLocal(input, manifest, branchName) {
|
|
|
713
718
|
listFilesRecursively(targetRoot, planFilter)
|
|
714
719
|
);
|
|
715
720
|
}
|
|
721
|
+
function mirrorLocalWorkspacePlansToShadow(input) {
|
|
722
|
+
if (input.trigger.canonicalCheckoutOnly) return;
|
|
723
|
+
const sourceRoot = localWorkspacePlansPath(input.plansRoot);
|
|
724
|
+
if (!import_node_fs.default.existsSync(sourceRoot)) return;
|
|
725
|
+
const targetRoot = import_node_path.default.join(input.shadowRoot, WORKSPACE_NATIVE_PLANS_RELATIVE_PATH);
|
|
726
|
+
const planFilter = (relativePath) => relativePath.endsWith(".plan.md");
|
|
727
|
+
mirrorFileSet(sourceRoot, targetRoot, listFilesRecursively(sourceRoot, planFilter), listFilesRecursively(targetRoot, planFilter));
|
|
728
|
+
}
|
|
729
|
+
function mirrorShadowWorkspacePlansToLocal(input) {
|
|
730
|
+
if (input.trigger.canonicalCheckoutOnly) return;
|
|
731
|
+
const sourceRoot = import_node_path.default.join(input.shadowRoot, WORKSPACE_NATIVE_PLANS_RELATIVE_PATH);
|
|
732
|
+
const targetRoot = localWorkspacePlansPath(input.plansRoot);
|
|
733
|
+
const planFilter = (relativePath) => relativePath.endsWith(".plan.md");
|
|
734
|
+
mirrorFileSet(
|
|
735
|
+
sourceRoot,
|
|
736
|
+
targetRoot,
|
|
737
|
+
listShadowTrackedFiles(input, WORKSPACE_NATIVE_PLANS_RELATIVE_PATH).filter(planFilter),
|
|
738
|
+
listFilesRecursively(targetRoot, planFilter)
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
function reconcileWorkspaceNativePlans(input) {
|
|
742
|
+
if (input.trigger.canonicalCheckoutOnly) return;
|
|
743
|
+
if (import_node_fs.default.existsSync(localWorkspacePlansPath(input.plansRoot))) {
|
|
744
|
+
mirrorLocalWorkspacePlansToShadow(input);
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
if (listShadowTrackedFiles(input, WORKSPACE_NATIVE_PLANS_RELATIVE_PATH).length > 0 || restoreShadowRootFromRemote(input, WORKSPACE_NATIVE_PLANS_RELATIVE_PATH)) {
|
|
748
|
+
mirrorShadowWorkspacePlansToLocal(input);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
716
751
|
function mergeGitlinkProjection(target, source) {
|
|
717
752
|
target.entries.push(...source.entries);
|
|
718
753
|
target.opaqueRoots.push(...source.opaqueRoots);
|
|
719
754
|
}
|
|
720
755
|
function mirrorVisibleWorkspaceToShadow(input, excludedCheckouts = /* @__PURE__ */ new Set()) {
|
|
721
756
|
const projection = { entries: [], opaqueRoots: [] };
|
|
757
|
+
reconcileWorkspaceNativePlans(input);
|
|
722
758
|
for (const manifest of [...input.projects].sort((left, right) => left.projectId.localeCompare(right.projectId))) {
|
|
723
759
|
for (const branchName of [...new Set(manifest.branches)].sort()) {
|
|
724
760
|
if (excludedCheckouts.has(`${manifest.projectId}\0${branchName}`)) continue;
|
|
@@ -754,6 +790,7 @@ function reconcileNewVisibleCheckouts(input) {
|
|
|
754
790
|
return projection;
|
|
755
791
|
}
|
|
756
792
|
function mirrorShadowWorkspaceToVisible(input, opaqueWorkspaceRoots = []) {
|
|
793
|
+
mirrorShadowWorkspacePlansToLocal(input);
|
|
757
794
|
for (const manifest of [...input.projects].sort((left, right) => left.projectId.localeCompare(right.projectId))) {
|
|
758
795
|
for (const branchName of [...new Set(manifest.branches)].sort()) {
|
|
759
796
|
const relativeRoot = workspaceProjectBranchRelativePath(manifest.projectId, branchName);
|
|
@@ -1338,6 +1375,7 @@ class WorkspaceSyncSingleFlight {
|
|
|
1338
1375
|
0 && (module.exports = {
|
|
1339
1376
|
MAX_WORKSPACE_SYNC_DIFF_BYTES,
|
|
1340
1377
|
WORKSPACE_BRANCH,
|
|
1378
|
+
WORKSPACE_NATIVE_PLANS_RELATIVE_PATH,
|
|
1341
1379
|
WORKSPACE_PERIODIC_SCAN_INTERVAL_MS,
|
|
1342
1380
|
WorkspaceSyncSingleFlight,
|
|
1343
1381
|
assertCanonicalCheckoutIndexMatchesWorktree,
|