@context-forge/core 0.19.1 → 0.19.3
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/config/ConfigKeys.js +2 -2
- package/dist/config/ConfigKeys.js.map +1 -1
- package/dist/config/guideExclude.d.ts +7 -1
- package/dist/config/guideExclude.d.ts.map +1 -1
- package/dist/config/guideExclude.js +27 -7
- package/dist/config/guideExclude.js.map +1 -1
- package/dist/guides/GuideDetector.d.ts.map +1 -1
- package/dist/guides/GuideDetector.js +8 -39
- package/dist/guides/GuideDetector.js.map +1 -1
- package/dist/guides/GuideManager.d.ts +15 -6
- package/dist/guides/GuideManager.d.ts.map +1 -1
- package/dist/guides/GuideManager.js +37 -7
- package/dist/guides/GuideManager.js.map +1 -1
- package/dist/guides/configExcludeCommit.d.ts +23 -0
- package/dist/guides/configExcludeCommit.d.ts.map +1 -0
- package/dist/guides/configExcludeCommit.js +65 -0
- package/dist/guides/configExcludeCommit.js.map +1 -0
- package/dist/guides/gitExec.d.ts +1 -1
- package/dist/guides/gitExec.d.ts.map +1 -1
- package/dist/guides/gitExec.js +1 -1
- package/dist/guides/gitExec.js.map +1 -1
- package/dist/guides/guideTreeDiff.d.ts +8 -0
- package/dist/guides/guideTreeDiff.d.ts.map +1 -0
- package/dist/guides/guideTreeDiff.js +86 -0
- package/dist/guides/guideTreeDiff.js.map +1 -0
- package/dist/guides/index.d.ts +1 -1
- package/dist/guides/index.d.ts.map +1 -1
- package/dist/guides/index.js.map +1 -1
- package/dist/guides/strategies/TarballStrategy.d.ts +20 -38
- package/dist/guides/strategies/TarballStrategy.d.ts.map +1 -1
- package/dist/guides/strategies/TarballStrategy.js +119 -172
- package/dist/guides/strategies/TarballStrategy.js.map +1 -1
- package/dist/guides/strategies/tarballSwap.d.ts +12 -0
- package/dist/guides/strategies/tarballSwap.d.ts.map +1 -0
- package/dist/guides/strategies/tarballSwap.js +66 -0
- package/dist/guides/strategies/tarballSwap.js.map +1 -0
- package/dist/guides/tarballSource.d.ts +68 -0
- package/dist/guides/tarballSource.d.ts.map +1 -0
- package/dist/guides/tarballSource.js +171 -0
- package/dist/guides/tarballSource.js.map +1 -0
- package/dist/guides/types.d.ts +41 -4
- package/dist/guides/types.d.ts.map +1 -1
- package/dist/guides/types.js +7 -2
- package/dist/guides/types.js.map +1 -1
- package/dist/guides/versionTags.d.ts +3 -0
- package/dist/guides/versionTags.d.ts.map +1 -0
- package/dist/guides/versionTags.js +17 -0
- package/dist/guides/versionTags.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/introspection/mergeCheckResults.d.ts +6 -6
- package/dist/introspection/mergeCheckResults.js +6 -6
- package/dist/services/WorktreeService.d.ts +17 -5
- package/dist/services/WorktreeService.d.ts.map +1 -1
- package/dist/services/WorktreeService.js +88 -12
- package/dist/services/WorktreeService.js.map +1 -1
- package/dist/storage/FileProjectStore.d.ts.map +1 -1
- package/dist/storage/FileProjectStore.js +21 -1
- package/dist/storage/FileProjectStore.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/worktree.d.ts +40 -2
- package/dist/types/worktree.d.ts.map +1 -1
- package/dist/types/worktree.js +12 -1
- package/dist/types/worktree.js.map +1 -1
- package/dist/utils/defaultWorktree.d.ts +35 -0
- package/dist/utils/defaultWorktree.d.ts.map +1 -0
- package/dist/utils/defaultWorktree.js +77 -0
- package/dist/utils/defaultWorktree.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Label forward migration gives the default worktree. After the load
|
|
3
|
+
* migration below, no code reads this name: the stored `isDefault` flag
|
|
4
|
+
* identifies the default.
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_WORKTREE_NAME = 'default';
|
|
7
|
+
/** True only for the worktree marked `isDefault`. Never reads the name. */
|
|
8
|
+
export function isDefaultWorktree(wt) {
|
|
9
|
+
return wt.isDefault === true;
|
|
10
|
+
}
|
|
11
|
+
function describeWorktree(wt) {
|
|
12
|
+
return `'${wt.name}' (${wt.id})`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Find the project's one default worktree, ignoring `excludeId` (the worktree
|
|
16
|
+
* being updated). The exclusion applies before the duplicate check, so
|
|
17
|
+
* excluding one of two marked worktrees hides the duplicate for that call.
|
|
18
|
+
* Throws when more than one marked worktree remains.
|
|
19
|
+
*/
|
|
20
|
+
export function findDefaultWorktree(worktrees, projectName, excludeId) {
|
|
21
|
+
const marked = worktrees.filter((wt) => isDefaultWorktree(wt) && wt.id !== excludeId);
|
|
22
|
+
if (marked.length > 1) {
|
|
23
|
+
throw new Error(`Project '${projectName}' has more than one default worktree: ` +
|
|
24
|
+
`${marked.map(describeWorktree).join(', ')}. ` +
|
|
25
|
+
`Set "isDefault": true on only one of them in projects.json.`);
|
|
26
|
+
}
|
|
27
|
+
return marked[0];
|
|
28
|
+
}
|
|
29
|
+
function recoverySentence(projectsJsonPath) {
|
|
30
|
+
return ('Range narrowing and restore are off for this project. ' +
|
|
31
|
+
`To turn them on, set "isDefault": true on the intended worktree in ${projectsJsonPath}.`);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve every absent `isDefault` value on a project's worktrees (see the
|
|
35
|
+
* slice 934 design, "Migration rule"). The name `default` is read here and
|
|
36
|
+
* nowhere else: data from before the flag has no other record of which
|
|
37
|
+
* worktree is the default. Existing values are never changed. When the
|
|
38
|
+
* outcome is probably not what the user wants (ambiguous candidates, or a
|
|
39
|
+
* probable renamed default), nothing is marked and a warning says how to
|
|
40
|
+
* recover.
|
|
41
|
+
*/
|
|
42
|
+
export function markLegacyDefaultWorktree(project, projectsJsonPath) {
|
|
43
|
+
const worktrees = project.worktrees ?? [];
|
|
44
|
+
const absent = worktrees.filter((wt) => wt.isDefault === undefined);
|
|
45
|
+
if (absent.length === 0)
|
|
46
|
+
return { project, changed: false, warnings: [] };
|
|
47
|
+
const warnings = [];
|
|
48
|
+
const markedIds = new Set();
|
|
49
|
+
if (!worktrees.some(isDefaultWorktree)) {
|
|
50
|
+
const candidates = absent.filter((wt) => wt.name.toLowerCase() === DEFAULT_WORKTREE_NAME);
|
|
51
|
+
const atProjectPath = (wt) => project.projectPath !== undefined && wt.worktreePath === project.projectPath;
|
|
52
|
+
if (candidates.length === 1) {
|
|
53
|
+
markedIds.add(candidates[0].id);
|
|
54
|
+
}
|
|
55
|
+
else if (candidates.length > 1) {
|
|
56
|
+
const narrowed = candidates.filter(atProjectPath);
|
|
57
|
+
if (narrowed.length === 1) {
|
|
58
|
+
markedIds.add(narrowed[0].id);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
warnings.push(`Project '${project.name}' has several worktrees that could be the default: ` +
|
|
62
|
+
`${candidates.map(describeWorktree).join(', ')}. None was marked. ${recoverySentence(projectsJsonPath)}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const atRoot = absent.filter(atProjectPath);
|
|
67
|
+
if (atRoot.length > 0) {
|
|
68
|
+
warnings.push(`Project '${project.name}' has no worktree named '${DEFAULT_WORKTREE_NAME}', but ` +
|
|
69
|
+
`${atRoot.map(describeWorktree).join(', ')} is at the project path and may be a renamed default. ` +
|
|
70
|
+
`None was marked. ${recoverySentence(projectsJsonPath)}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const migrated = worktrees.map((wt) => wt.isDefault === undefined ? { ...wt, isDefault: markedIds.has(wt.id) } : wt);
|
|
75
|
+
return { project: { ...project, worktrees: migrated }, changed: true, warnings };
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=defaultWorktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultWorktree.js","source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