@afokapu/atdd-bun 0.10.101 → 0.10.102
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/integrity.json +2 -2
- package/package.json +1 -1
- package/src/hooks.ts +5 -5
package/integrity.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.10.
|
|
2
|
+
"version": "0.10.102",
|
|
3
3
|
"files": {
|
|
4
4
|
"HOOK_AUDIT.md": "5329d840db37671b1918f688ead26865473b87db73dbc75f7c8b2a8bbe8d6d43",
|
|
5
5
|
"PLANNER_PORT.md": "fb5935bac8b7ac18994de21e43ace3a5ef8cd55f85b0e3349fca261280054f11",
|
|
@@ -1261,7 +1261,7 @@
|
|
|
1261
1261
|
"src/cli.ts": "395638ab87565bb10c2beb35988ff1acf686924d13515795156a2e8893b3da88",
|
|
1262
1262
|
"src/docs-capability.ts": "bdeeb414649049b1cd4fa8008cada3a576318be51c43bec91bfa46a8e250c270",
|
|
1263
1263
|
"src/enforce.ts": "e0c10519aeecd7080f2900ea230fad2f09482af47c1cee885d5de71573e29732",
|
|
1264
|
-
"src/hooks.ts": "
|
|
1264
|
+
"src/hooks.ts": "444b7ee224c5a8b4634815e20f1feeb3872c9cd6f9cf06051da05482e98c0b51",
|
|
1265
1265
|
"src/index.ts": "4081f8b08d1d3ee9e15a9964143e53d9cfb94a5616ab3e58a180d24cc16dc381",
|
|
1266
1266
|
"src/integrity.ts": "f1ede7cb04924ae88e11917047277e264af6596b9759e381bd9c497cd34a797d",
|
|
1267
1267
|
"src/journey-docs.ts": "994d229376244c84212cff951032823068a76565dd2fd427b9d44e341bd14853",
|
package/package.json
CHANGED
package/src/hooks.ts
CHANGED
|
@@ -411,7 +411,7 @@ async function branchCommit(root: string, branch: string) {
|
|
|
411
411
|
|
|
412
412
|
// A delivery commit must have one unambiguous non-protected exported bookmark.
|
|
413
413
|
// Ref ordering is never used as ownership authority.
|
|
414
|
-
async function branchForCommit(root: string, commit: string, protectedBranches: string[]) {
|
|
414
|
+
async function branchForCommit(root: string, commit: string, protectedBranches: string[]): Promise<{ error: string } | { branch: string }> {
|
|
415
415
|
const refs = await git(root, ["for-each-ref", "--format=%(refname:short)", "--points-at", commit, "refs/heads/"]);
|
|
416
416
|
if (refs.code) return { error: refs.err || refs.out };
|
|
417
417
|
const candidates = refs.out.split("\n").map(line => line.trim()).filter(Boolean)
|
|
@@ -433,7 +433,7 @@ async function jjLayout(root: string, cfg: HookPolicy): Promise<Layout | { error
|
|
|
433
433
|
return { primary, worktreeRoot: resolve(primary, cfg.worktrees.root.replaceAll("{repo}", basename(primary))), current };
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
async function noConflicts(root: string) {
|
|
436
|
+
async function noConflicts(root: string): Promise<{ error: string } | { error?: undefined }> {
|
|
437
437
|
const result = await jj(root, ["log", "-r", "@ & conflicts()", "--no-graph", "-T", "commit_id"]);
|
|
438
438
|
return result.code ? { error: result.err || result.out } : result.out ? { error: "workspace has unresolved conflicts" } : {};
|
|
439
439
|
}
|
|
@@ -444,7 +444,7 @@ async function preflight(root: string, cfg: HookPolicy): Promise<Layout | { erro
|
|
|
444
444
|
return version ? { error: version } : jjLayout(root, cfg);
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
async function startTarget(root: string, branch: string, state: Layout, cfg: HookPolicy) {
|
|
447
|
+
async function startTarget(root: string, branch: string, state: Layout, cfg: HookPolicy): Promise<{ error: string } | { leaf: string; target: string }> {
|
|
448
448
|
if (state.current !== state.primary) return { error: `start must run from the primary checkout ${state.primary}` };
|
|
449
449
|
if (!branch) return { error: "branch is required: atdd-bun worktree start <branch>" };
|
|
450
450
|
if ((await git(root, ["check-ref-format", "--branch", branch])).code) return { error: `invalid branch name ${JSON.stringify(branch)}` };
|
|
@@ -471,10 +471,10 @@ async function createWorkspace(state: Layout, target: { leaf: string; target: st
|
|
|
471
471
|
return bad(bookmark.err || bookmark.out || `bookmark ${branch} was not exported to the colocated Git repository`);
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
async function finishCandidate(state: Layout, cfg: HookPolicy) {
|
|
474
|
+
async function finishCandidate(state: Layout, cfg: HookPolicy): Promise<{ error: string } | { branch: string; tip: string; name: string }> {
|
|
475
475
|
if (state.current === state.primary || !inside(state.worktreeRoot, state.current)) return { error: `finish must run from a linked workspace beneath ${state.worktreeRoot}` };
|
|
476
476
|
const conflict = await noConflicts(state.current);
|
|
477
|
-
if (
|
|
477
|
+
if (conflict.error !== undefined) return conflict;
|
|
478
478
|
const current = await currentCommit(state.current);
|
|
479
479
|
if (!current) return { error: "could not resolve the current Jujutsu revision" };
|
|
480
480
|
let delivery = current, found = await branchForCommit(state.current, current, cfg.protected_branches);
|