@bridge4dev/runner 0.51.0 → 0.53.0

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/git.d.ts CHANGED
@@ -1,8 +1,42 @@
1
+ /**
2
+ * Why git stopped, in a sentence a person can act on.
3
+ *
4
+ * `git worktree add` prints its progress to stderr as carriage-return-overwritten
5
+ * frames, so a process killed mid-checkout leaves «Updating files: 1% (51/2693)»
6
+ * as the last thing anybody sees — a number, with no verb. The real cause lives
7
+ * on the error object (`killed`, `signal`, `code`) and nobody was reading it
8
+ * (#360). Keep the last progress frame, because «how far did it get» is the one
9
+ * useful thing in it, and put the cause in front of it.
10
+ */
11
+ export declare function describeGitFailure(error: unknown, context?: {
12
+ timeoutMs?: number;
13
+ }): string;
14
+ /** What went wrong while building the session's workplace, in one machine-readable word. */
15
+ export type WorktreePrepareCode = 'worktree_prepare_failed' | 'branch_taken' | 'worktree_cleanup_failed';
16
+ /**
17
+ * A preparation failure that already knows its own fork point.
18
+ *
19
+ * The fork point matters precisely BECAUSE preparation failed: without it the
20
+ * API keeps `base_sha = null` for the session's whole life, and «Continue» can
21
+ * never prove that the branch it is about to adopt is the empty one this very
22
+ * session created a moment ago (#360, plan Р6).
23
+ */
24
+ export declare class WorktreePrepareError extends Error {
25
+ readonly code: WorktreePrepareCode;
26
+ readonly baseBranch?: string;
27
+ readonly baseSha?: string;
28
+ constructor(message: string, code: WorktreePrepareCode, base?: {
29
+ baseBranch?: string;
30
+ baseSha?: string;
31
+ });
32
+ }
1
33
  export interface PathValidation {
2
34
  ok: boolean;
3
35
  exists: boolean;
4
36
  isGitRepo: boolean;
5
37
  branch?: string;
38
+ /** The repository's own main branch, as this machine can see it without the network. */
39
+ defaultBranch?: string;
6
40
  error?: string;
7
41
  }
8
42
  /**
@@ -16,6 +50,23 @@ export interface PathValidation {
16
50
  * '/opt/ids'». That sentence is true and unactionable.
17
51
  */
18
52
  export declare function validateWorkspacePath(workspacePath: string): Promise<PathValidation>;
53
+ /**
54
+ * The repository's main branch, read locally (ADR 0004).
55
+ *
56
+ * `origin/HEAD` is the honest answer and it is already on disk — set by `clone`,
57
+ * refreshed by `git remote set-head`. Never asked over the network: this runs
58
+ * inside a 4-second probe budget, and a repository whose origin is unreachable
59
+ * must still bind.
60
+ */
61
+ export declare function remoteDefaultBranch(workspacePath: string): Promise<string | null>;
62
+ /**
63
+ * `main`, then `master`, and only if the repository really has one.
64
+ *
65
+ * The order and the list are one decision, not two: `gitops.ts` asks the same
66
+ * question when «Apply» has no pinned base, and two copies would drift the day
67
+ * somebody adds `develop` to one of them (ADR 0004).
68
+ */
69
+ export declare function firstConventionalBranch(workspacePath: string): Promise<string | null>;
19
70
  export declare function sessionShortId(sessionId: string): string;
20
71
  export declare function sessionWorktreePath(sessionId: string): string;
21
72
  /**
@@ -69,6 +120,19 @@ export declare function ensureSessionWorktree(workspacePath: string, sessionId:
69
120
  requireExistingBranch?: boolean;
70
121
  plan?: BranchPlan;
71
122
  }): Promise<SessionWorktree>;
123
+ /**
124
+ * Delete a session branch that provably carries no commits (#360).
125
+ *
126
+ * Shares its safety rungs with {@link deleteSessionBranch} — prune, then the
127
+ * folder's own branch, then the holder — and adds the one this caller needs:
128
+ * the tip must still be exactly the fork point we started from. `-D`, not `-d`,
129
+ * because `-d` asks «is it merged into the branch THIS folder is on», which is
130
+ * a different question and answers «no» for a branch that is empty.
131
+ */
132
+ export declare function dropEmptySessionBranch(workspacePath: string, branch: string, expectedSha: string): Promise<{
133
+ removed: boolean;
134
+ leftover?: string;
135
+ }>;
72
136
  /**
73
137
  * DIRECT mode (session 16): the session's workplace IS the project folder.
74
138
  *