@try-works/dsh-recursive-mode 0.1.17 → 0.2.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/lib/client.js +0 -1
- package/lib/git-context.d.ts +53 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +666 -20
- package/lib/init-templates.d.ts +4 -0
- package/lib/recursive_worktree.tool.d.ts +7 -0
- package/lib/runtime.d.ts +28 -1
- package/lib/ts-lint.d.ts +8 -0
- package/lib/worktree.d.ts +59 -0
- package/package.json +1 -1
- package/src/client/use-live.ts +5 -4
- package/src/commands.ts +46 -0
- package/src/git-context.ts +132 -0
- package/src/index.ts +3 -0
- package/src/init-templates.ts +15 -2
- package/src/recursive_init.tool.ts +9 -3
- package/src/recursive_worktree.tool.ts +54 -0
- package/src/runtime.ts +57 -6
- package/src/ts-lint.ts +31 -0
- package/src/worktree.ts +229 -0
package/lib/client.js
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Normalized git facts about one checkout directory. */
|
|
2
|
+
export interface GitRepoFacts {
|
|
3
|
+
/** SHA of HEAD^{commit}, or null when unresolvable (empty/non-git repo). */
|
|
4
|
+
headSha: string | null;
|
|
5
|
+
/** Current branch short name via `git symbolic-ref --short HEAD`, null when detached. */
|
|
6
|
+
branch: string | null;
|
|
7
|
+
/** True when HEAD is detached (no symbolic ref). */
|
|
8
|
+
detached: boolean;
|
|
9
|
+
/** True when the cwd is a linked worktree (git-dir != git-common-dir). */
|
|
10
|
+
isWorktree: boolean;
|
|
11
|
+
/** `git rev-parse --git-dir` output (may be relative). */
|
|
12
|
+
gitDir: string | null;
|
|
13
|
+
/** `git rev-parse --git-common-dir` output (may be relative). */
|
|
14
|
+
commonDir: string | null;
|
|
15
|
+
/** `git rev-parse --show-toplevel` output, or null. */
|
|
16
|
+
toplevel: string | null;
|
|
17
|
+
/** Upstream branch with remote prefix stripped (origin/main -> main), null when none/detached. */
|
|
18
|
+
upstreamBranch: string | null;
|
|
19
|
+
}
|
|
20
|
+
/** Run git in a repo dir; return trimmed stdout or null on any failure. */
|
|
21
|
+
export declare function gitRun(repoRoot: string, ...args: string[]): string | null;
|
|
22
|
+
/** True when a non-equal git-dir vs git-common-dir marks a linked worktree. */
|
|
23
|
+
export declare function isLinkedWorktree(gitDir: string | null, commonDir: string | null): boolean;
|
|
24
|
+
/** Strip a remote ref prefix (origin/main -> main, remotes/origin/main -> main). */
|
|
25
|
+
export declare function stripRemotePrefix(ref: string | null): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Gather normalized git facts about `repoRoot`. Total: any git failure
|
|
28
|
+
* degrades to neutral values (false / null), never throws.
|
|
29
|
+
*/
|
|
30
|
+
export declare function gitFacts(repoRoot: string): GitRepoFacts;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the effective base branch for a checkout. In a linked worktree this
|
|
33
|
+
* is the branch the work is based on — best inferred from the upstream target
|
|
34
|
+
* (dev/stage/main promotion source) when one is configured; otherwise fall
|
|
35
|
+
* back to the current branch. Returns null only when no branch exists.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveBaseBranch(facts: GitRepoFacts): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Verify a worktree branch is (still) based on the recorded base branch.
|
|
40
|
+
* Returns { ok, reason }. Fails when the base branch no longer exists, or the
|
|
41
|
+
* worktree branch no longer contains it (merge-base --is-ancestor fails).
|
|
42
|
+
* A missing/unresolvable branch degrades to ok:false with a reason; a
|
|
43
|
+
* non-git dir degrades to ok:true (defer — nothing to verify).
|
|
44
|
+
*/
|
|
45
|
+
export declare function verifyBranchBase(repoRoot: string, baseBranch: string | null, worktreeBranch: string | null): {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
reason: string | null;
|
|
48
|
+
};
|
|
49
|
+
/** Verify the recorded worktree branch matches the live HEAD branch. */
|
|
50
|
+
export declare function verifyWorktreeBranch(repoRoot: string, recordedBranch: string | null): {
|
|
51
|
+
ok: boolean;
|
|
52
|
+
reason: string | null;
|
|
53
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { createRecursiveLockTool } from './recursive_lock.tool.ts';
|
|
|
7
7
|
export { createRecursiveLintTool } from './recursive_lint.tool.ts';
|
|
8
8
|
export { createRecursiveCloseoutTool } from './recursive_closeout.tool.ts';
|
|
9
9
|
export { createRecursiveScratchTool } from './recursive_scratch.tool.ts';
|
|
10
|
+
export { createRecursiveWorktreeTool } from './recursive_worktree.tool.ts';
|
|
10
11
|
export * from './status.ts';
|
|
11
12
|
export { PHASE_SEQUENCE, OPTIONAL_PHASES, normalizeForLockHash, lockHashFromContent, phaseIndex, isCoreArtifact, getPrerequisites, getLockStatus, getPrerequisiteBlockers, receiptPath, readReceipt, writeReceipt, invalidateReceipt, getStaleDownstreamPhases, getNextLegalPhase, getAllStaleReceipts, validateChain, } from './lock.ts';
|
|
12
13
|
export type { LockReceipt, LockStatus, PrerequisiteBlocker, StaleDownstream, ChainPhaseResult, LockChainResult, } from './lock.ts';
|