@lumenflow/core 1.0.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/LICENSE +190 -0
- package/README.md +119 -0
- package/dist/active-wu-detector.d.ts +33 -0
- package/dist/active-wu-detector.js +106 -0
- package/dist/adapters/filesystem-metrics.adapter.d.ts +108 -0
- package/dist/adapters/filesystem-metrics.adapter.js +519 -0
- package/dist/adapters/terminal-renderer.adapter.d.ts +106 -0
- package/dist/adapters/terminal-renderer.adapter.js +337 -0
- package/dist/arg-parser.d.ts +63 -0
- package/dist/arg-parser.js +560 -0
- package/dist/backlog-editor.d.ts +98 -0
- package/dist/backlog-editor.js +179 -0
- package/dist/backlog-generator.d.ts +111 -0
- package/dist/backlog-generator.js +381 -0
- package/dist/backlog-parser.d.ts +45 -0
- package/dist/backlog-parser.js +102 -0
- package/dist/backlog-sync-validator.d.ts +78 -0
- package/dist/backlog-sync-validator.js +294 -0
- package/dist/branch-drift.d.ts +34 -0
- package/dist/branch-drift.js +51 -0
- package/dist/cleanup-install-config.d.ts +33 -0
- package/dist/cleanup-install-config.js +37 -0
- package/dist/cleanup-lock.d.ts +139 -0
- package/dist/cleanup-lock.js +313 -0
- package/dist/code-path-validator.d.ts +146 -0
- package/dist/code-path-validator.js +537 -0
- package/dist/code-paths-overlap.d.ts +55 -0
- package/dist/code-paths-overlap.js +245 -0
- package/dist/commands-logger.d.ts +77 -0
- package/dist/commands-logger.js +254 -0
- package/dist/commit-message-utils.d.ts +25 -0
- package/dist/commit-message-utils.js +41 -0
- package/dist/compliance-parser.d.ts +150 -0
- package/dist/compliance-parser.js +507 -0
- package/dist/constants/backlog-patterns.d.ts +20 -0
- package/dist/constants/backlog-patterns.js +23 -0
- package/dist/constants/dora-constants.d.ts +49 -0
- package/dist/constants/dora-constants.js +53 -0
- package/dist/constants/gate-constants.d.ts +15 -0
- package/dist/constants/gate-constants.js +15 -0
- package/dist/constants/linter-constants.d.ts +16 -0
- package/dist/constants/linter-constants.js +16 -0
- package/dist/constants/tokenizer-constants.d.ts +15 -0
- package/dist/constants/tokenizer-constants.js +15 -0
- package/dist/core/scope-checker.d.ts +97 -0
- package/dist/core/scope-checker.js +163 -0
- package/dist/core/tool-runner.d.ts +161 -0
- package/dist/core/tool-runner.js +393 -0
- package/dist/core/tool.constants.d.ts +105 -0
- package/dist/core/tool.constants.js +101 -0
- package/dist/core/tool.schemas.d.ts +226 -0
- package/dist/core/tool.schemas.js +226 -0
- package/dist/core/worktree-guard.d.ts +130 -0
- package/dist/core/worktree-guard.js +242 -0
- package/dist/coverage-gate.d.ts +108 -0
- package/dist/coverage-gate.js +196 -0
- package/dist/date-utils.d.ts +75 -0
- package/dist/date-utils.js +140 -0
- package/dist/dependency-graph.d.ts +142 -0
- package/dist/dependency-graph.js +550 -0
- package/dist/dependency-guard.d.ts +54 -0
- package/dist/dependency-guard.js +142 -0
- package/dist/dependency-validator.d.ts +105 -0
- package/dist/dependency-validator.js +154 -0
- package/dist/docs-path-validator.d.ts +36 -0
- package/dist/docs-path-validator.js +95 -0
- package/dist/domain/orchestration.constants.d.ts +99 -0
- package/dist/domain/orchestration.constants.js +97 -0
- package/dist/domain/orchestration.schemas.d.ts +280 -0
- package/dist/domain/orchestration.schemas.js +211 -0
- package/dist/domain/orchestration.types.d.ts +133 -0
- package/dist/domain/orchestration.types.js +12 -0
- package/dist/error-handler.d.ts +116 -0
- package/dist/error-handler.js +136 -0
- package/dist/file-classifiers.d.ts +62 -0
- package/dist/file-classifiers.js +108 -0
- package/dist/gates-agent-mode.d.ts +81 -0
- package/dist/gates-agent-mode.js +94 -0
- package/dist/generate-traceability.d.ts +107 -0
- package/dist/generate-traceability.js +411 -0
- package/dist/git-adapter.d.ts +395 -0
- package/dist/git-adapter.js +649 -0
- package/dist/git-staged-validator.d.ts +32 -0
- package/dist/git-staged-validator.js +48 -0
- package/dist/hardcoded-strings.d.ts +61 -0
- package/dist/hardcoded-strings.js +270 -0
- package/dist/incremental-lint.d.ts +78 -0
- package/dist/incremental-lint.js +129 -0
- package/dist/incremental-test.d.ts +39 -0
- package/dist/incremental-test.js +61 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +61 -0
- package/dist/invariants/check-automated-tests.d.ts +50 -0
- package/dist/invariants/check-automated-tests.js +166 -0
- package/dist/invariants-runner.d.ts +103 -0
- package/dist/invariants-runner.js +527 -0
- package/dist/lane-checker.d.ts +50 -0
- package/dist/lane-checker.js +319 -0
- package/dist/lane-inference.d.ts +39 -0
- package/dist/lane-inference.js +195 -0
- package/dist/lane-lock.d.ts +211 -0
- package/dist/lane-lock.js +474 -0
- package/dist/lane-validator.d.ts +48 -0
- package/dist/lane-validator.js +114 -0
- package/dist/logs-lib.d.ts +104 -0
- package/dist/logs-lib.js +207 -0
- package/dist/lumenflow-config-schema.d.ts +272 -0
- package/dist/lumenflow-config-schema.js +207 -0
- package/dist/lumenflow-config.d.ts +95 -0
- package/dist/lumenflow-config.js +236 -0
- package/dist/manual-test-validator.d.ts +80 -0
- package/dist/manual-test-validator.js +200 -0
- package/dist/merge-lock.d.ts +115 -0
- package/dist/merge-lock.js +251 -0
- package/dist/micro-worktree.d.ts +159 -0
- package/dist/micro-worktree.js +427 -0
- package/dist/migration-deployer.d.ts +69 -0
- package/dist/migration-deployer.js +151 -0
- package/dist/orchestration-advisory-loader.d.ts +28 -0
- package/dist/orchestration-advisory-loader.js +87 -0
- package/dist/orchestration-advisory.d.ts +58 -0
- package/dist/orchestration-advisory.js +94 -0
- package/dist/orchestration-di.d.ts +48 -0
- package/dist/orchestration-di.js +57 -0
- package/dist/orchestration-rules.d.ts +57 -0
- package/dist/orchestration-rules.js +201 -0
- package/dist/orphan-detector.d.ts +131 -0
- package/dist/orphan-detector.js +226 -0
- package/dist/path-classifiers.d.ts +57 -0
- package/dist/path-classifiers.js +93 -0
- package/dist/piped-command-detector.d.ts +34 -0
- package/dist/piped-command-detector.js +64 -0
- package/dist/ports/dashboard-renderer.port.d.ts +112 -0
- package/dist/ports/dashboard-renderer.port.js +25 -0
- package/dist/ports/metrics-collector.port.d.ts +132 -0
- package/dist/ports/metrics-collector.port.js +26 -0
- package/dist/process-detector.d.ts +84 -0
- package/dist/process-detector.js +172 -0
- package/dist/prompt-linter.d.ts +72 -0
- package/dist/prompt-linter.js +312 -0
- package/dist/prompt-monitor.d.ts +15 -0
- package/dist/prompt-monitor.js +205 -0
- package/dist/rebase-artifact-cleanup.d.ts +145 -0
- package/dist/rebase-artifact-cleanup.js +433 -0
- package/dist/retry-strategy.d.ts +189 -0
- package/dist/retry-strategy.js +283 -0
- package/dist/risk-detector.d.ts +108 -0
- package/dist/risk-detector.js +252 -0
- package/dist/rollback-utils.d.ts +76 -0
- package/dist/rollback-utils.js +104 -0
- package/dist/section-headings.d.ts +43 -0
- package/dist/section-headings.js +49 -0
- package/dist/spawn-escalation.d.ts +90 -0
- package/dist/spawn-escalation.js +253 -0
- package/dist/spawn-monitor.d.ts +229 -0
- package/dist/spawn-monitor.js +672 -0
- package/dist/spawn-recovery.d.ts +82 -0
- package/dist/spawn-recovery.js +298 -0
- package/dist/spawn-registry-schema.d.ts +98 -0
- package/dist/spawn-registry-schema.js +108 -0
- package/dist/spawn-registry-store.d.ts +146 -0
- package/dist/spawn-registry-store.js +273 -0
- package/dist/spawn-tree.d.ts +121 -0
- package/dist/spawn-tree.js +285 -0
- package/dist/stamp-status-validator.d.ts +84 -0
- package/dist/stamp-status-validator.js +134 -0
- package/dist/stamp-utils.d.ts +100 -0
- package/dist/stamp-utils.js +229 -0
- package/dist/state-machine.d.ts +26 -0
- package/dist/state-machine.js +83 -0
- package/dist/system-map-validator.d.ts +80 -0
- package/dist/system-map-validator.js +272 -0
- package/dist/telemetry.d.ts +80 -0
- package/dist/telemetry.js +213 -0
- package/dist/token-counter.d.ts +51 -0
- package/dist/token-counter.js +145 -0
- package/dist/usecases/get-dashboard-data.usecase.d.ts +52 -0
- package/dist/usecases/get-dashboard-data.usecase.js +61 -0
- package/dist/usecases/get-suggestions.usecase.d.ts +100 -0
- package/dist/usecases/get-suggestions.usecase.js +153 -0
- package/dist/user-normalizer.d.ts +41 -0
- package/dist/user-normalizer.js +141 -0
- package/dist/validators/phi-constants.d.ts +97 -0
- package/dist/validators/phi-constants.js +152 -0
- package/dist/validators/phi-scanner.d.ts +58 -0
- package/dist/validators/phi-scanner.js +215 -0
- package/dist/worktree-ownership.d.ts +50 -0
- package/dist/worktree-ownership.js +74 -0
- package/dist/worktree-scanner.d.ts +103 -0
- package/dist/worktree-scanner.js +168 -0
- package/dist/worktree-symlink.d.ts +99 -0
- package/dist/worktree-symlink.js +359 -0
- package/dist/wu-backlog-updater.d.ts +17 -0
- package/dist/wu-backlog-updater.js +37 -0
- package/dist/wu-checkpoint.d.ts +124 -0
- package/dist/wu-checkpoint.js +233 -0
- package/dist/wu-claim-helpers.d.ts +26 -0
- package/dist/wu-claim-helpers.js +63 -0
- package/dist/wu-claim-resume.d.ts +106 -0
- package/dist/wu-claim-resume.js +276 -0
- package/dist/wu-consistency-checker.d.ts +95 -0
- package/dist/wu-consistency-checker.js +567 -0
- package/dist/wu-constants.d.ts +1275 -0
- package/dist/wu-constants.js +1382 -0
- package/dist/wu-create-validators.d.ts +42 -0
- package/dist/wu-create-validators.js +93 -0
- package/dist/wu-done-branch-only.d.ts +63 -0
- package/dist/wu-done-branch-only.js +191 -0
- package/dist/wu-done-messages.d.ts +119 -0
- package/dist/wu-done-messages.js +185 -0
- package/dist/wu-done-pr.d.ts +72 -0
- package/dist/wu-done-pr.js +174 -0
- package/dist/wu-done-retry-helpers.d.ts +85 -0
- package/dist/wu-done-retry-helpers.js +172 -0
- package/dist/wu-done-ui.d.ts +37 -0
- package/dist/wu-done-ui.js +69 -0
- package/dist/wu-done-validators.d.ts +411 -0
- package/dist/wu-done-validators.js +1229 -0
- package/dist/wu-done-worktree.d.ts +182 -0
- package/dist/wu-done-worktree.js +1097 -0
- package/dist/wu-helpers.d.ts +128 -0
- package/dist/wu-helpers.js +248 -0
- package/dist/wu-lint.d.ts +70 -0
- package/dist/wu-lint.js +234 -0
- package/dist/wu-paths.d.ts +171 -0
- package/dist/wu-paths.js +178 -0
- package/dist/wu-preflight-validators.d.ts +86 -0
- package/dist/wu-preflight-validators.js +251 -0
- package/dist/wu-recovery.d.ts +138 -0
- package/dist/wu-recovery.js +341 -0
- package/dist/wu-repair-core.d.ts +131 -0
- package/dist/wu-repair-core.js +669 -0
- package/dist/wu-schema-normalization.d.ts +17 -0
- package/dist/wu-schema-normalization.js +82 -0
- package/dist/wu-schema.d.ts +793 -0
- package/dist/wu-schema.js +881 -0
- package/dist/wu-spawn-helpers.d.ts +121 -0
- package/dist/wu-spawn-helpers.js +271 -0
- package/dist/wu-spawn.d.ts +158 -0
- package/dist/wu-spawn.js +1306 -0
- package/dist/wu-state-schema.d.ts +213 -0
- package/dist/wu-state-schema.js +156 -0
- package/dist/wu-state-store.d.ts +264 -0
- package/dist/wu-state-store.js +691 -0
- package/dist/wu-status-transition.d.ts +63 -0
- package/dist/wu-status-transition.js +382 -0
- package/dist/wu-status-updater.d.ts +25 -0
- package/dist/wu-status-updater.js +116 -0
- package/dist/wu-transaction-collectors.d.ts +116 -0
- package/dist/wu-transaction-collectors.js +272 -0
- package/dist/wu-transaction.d.ts +170 -0
- package/dist/wu-transaction.js +273 -0
- package/dist/wu-validation-constants.d.ts +60 -0
- package/dist/wu-validation-constants.js +66 -0
- package/dist/wu-validation.d.ts +118 -0
- package/dist/wu-validation.js +243 -0
- package/dist/wu-validator.d.ts +62 -0
- package/dist/wu-validator.js +325 -0
- package/dist/wu-yaml-fixer.d.ts +97 -0
- package/dist/wu-yaml-fixer.js +264 -0
- package/dist/wu-yaml.d.ts +86 -0
- package/dist/wu-yaml.js +222 -0
- package/package.json +114 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file git-adapter.mjs
|
|
3
|
+
* @description Git operations adapter using simple-git library
|
|
4
|
+
* WU-1082: Extract shared utilities (eliminate run() duplication)
|
|
5
|
+
* WU-1213: Refactor to use simple-git library (eliminate execSync)
|
|
6
|
+
* WU-2242: Add runtime type assertions to prevent silent API misuse
|
|
7
|
+
*
|
|
8
|
+
* Replaces run() function in:
|
|
9
|
+
* - tools/wu-claim.mjs
|
|
10
|
+
* - tools/wu-done.mjs
|
|
11
|
+
* - tools/wu-block.mjs
|
|
12
|
+
* - tools/wu-unblock.mjs
|
|
13
|
+
* - tools/wu-create.mjs
|
|
14
|
+
* - tools/wu-cleanup.mjs
|
|
15
|
+
* - tools/gates-pre-commit.mjs
|
|
16
|
+
* - tools/validate.mjs
|
|
17
|
+
* - tools/guard-worktree-commit.mjs
|
|
18
|
+
*/
|
|
19
|
+
import { type SimpleGit } from 'simple-git';
|
|
20
|
+
interface GitAdapterOptions {
|
|
21
|
+
git?: SimpleGit;
|
|
22
|
+
baseDir?: string;
|
|
23
|
+
}
|
|
24
|
+
interface PushOptions {
|
|
25
|
+
setUpstream?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface MergeOptions {
|
|
28
|
+
ffOnly?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface WorktreeRemoveOptions {
|
|
31
|
+
force?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface DeleteBranchOptions {
|
|
34
|
+
force?: boolean;
|
|
35
|
+
}
|
|
36
|
+
interface ResetOptions {
|
|
37
|
+
hard?: boolean;
|
|
38
|
+
}
|
|
39
|
+
interface LogOptions {
|
|
40
|
+
maxCount?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Git operations adapter with dependency injection support
|
|
44
|
+
* @class GitAdapter
|
|
45
|
+
*/
|
|
46
|
+
export declare class GitAdapter {
|
|
47
|
+
private readonly git;
|
|
48
|
+
/**
|
|
49
|
+
* Create a GitAdapter instance
|
|
50
|
+
* @param {object} [options] - Configuration options
|
|
51
|
+
* @param {object} [options.git] - simple-git instance (for testing)
|
|
52
|
+
* @param {string} [options.baseDir] - Base directory for git operations
|
|
53
|
+
*/
|
|
54
|
+
constructor(options?: GitAdapterOptions);
|
|
55
|
+
/**
|
|
56
|
+
* Get current branch name
|
|
57
|
+
* @returns {Promise<string>} Current branch name
|
|
58
|
+
* @example
|
|
59
|
+
* await git.getCurrentBranch(); // "lane/operations/wu-1213"
|
|
60
|
+
*/
|
|
61
|
+
getCurrentBranch(): Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Get git status (porcelain format string for compatibility)
|
|
64
|
+
* @returns {Promise<string>} Status output in porcelain format
|
|
65
|
+
* @example
|
|
66
|
+
* await git.getStatus(); // " M file.txt\n?? untracked.txt"
|
|
67
|
+
*/
|
|
68
|
+
getStatus(): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Check if a branch exists
|
|
71
|
+
* @param {string} branch - Branch name
|
|
72
|
+
* @returns {Promise<boolean>} True if branch exists
|
|
73
|
+
* @throws {TypeError} If branch is not a string
|
|
74
|
+
* @throws {Error} If branch is empty
|
|
75
|
+
* @example
|
|
76
|
+
* await git.branchExists('main'); // true
|
|
77
|
+
* await git.branchExists('nonexistent'); // false
|
|
78
|
+
*/
|
|
79
|
+
branchExists(branch: string): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* Fetch from remote
|
|
82
|
+
* @param {string} [remote] - Remote name (defaults to fetching all)
|
|
83
|
+
* @param {string} [branch] - Branch name
|
|
84
|
+
* @throws {TypeError} If remote or branch is not a string (when provided)
|
|
85
|
+
* @example
|
|
86
|
+
* await git.fetch('origin', 'main');
|
|
87
|
+
* await git.fetch(); // Fetch all remotes
|
|
88
|
+
*/
|
|
89
|
+
fetch(remote?: string, branch?: string): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Pull from remote branch
|
|
92
|
+
* @param {string} remote - Remote name
|
|
93
|
+
* @param {string} branch - Branch name
|
|
94
|
+
* @throws {TypeError} If remote or branch is not a string
|
|
95
|
+
* @example
|
|
96
|
+
* await git.pull('origin', 'main');
|
|
97
|
+
*/
|
|
98
|
+
pull(remote: string, branch: string): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Get git config value
|
|
101
|
+
* @param {string} key - Config key (e.g., 'user.email')
|
|
102
|
+
* @returns {Promise<string>} Config value
|
|
103
|
+
* @example
|
|
104
|
+
* await git.getConfigValue('user.email'); // "user@example.com"
|
|
105
|
+
*/
|
|
106
|
+
getConfigValue(key: string): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Check if working tree is clean (no uncommitted changes)
|
|
109
|
+
* @returns {Promise<boolean>} True if clean
|
|
110
|
+
* @example
|
|
111
|
+
* await git.isClean(); // true or false
|
|
112
|
+
*/
|
|
113
|
+
isClean(): Promise<boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* Add files to staging area
|
|
116
|
+
* @param {string|string[]} files - Files to add
|
|
117
|
+
* @throws {TypeError} If files is not a string or array
|
|
118
|
+
* @throws {Error} If files is empty string or empty array
|
|
119
|
+
* @example
|
|
120
|
+
* await git.add('file.txt');
|
|
121
|
+
* await git.add(['file1.txt', 'file2.txt']);
|
|
122
|
+
* await git.add('.'); // Add all
|
|
123
|
+
*/
|
|
124
|
+
add(files: string | string[]): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Add files to staging area including deletions
|
|
127
|
+
*
|
|
128
|
+
* WU-1813: Stages modifications, additions, AND deletions for specified files.
|
|
129
|
+
* Unlike add(), this uses `git add -A` which properly handles tracked file deletions.
|
|
130
|
+
*
|
|
131
|
+
* When files array is empty, stages all changes in the working directory (git add -A .)
|
|
132
|
+
* to catch any deletions that might not have been explicitly listed.
|
|
133
|
+
*
|
|
134
|
+
* @param {string[]} files - Files to add (empty array = add all)
|
|
135
|
+
* @example
|
|
136
|
+
* await git.addWithDeletions(['modified.txt', 'deleted.txt']);
|
|
137
|
+
* await git.addWithDeletions([]); // Add all changes including deletions
|
|
138
|
+
*/
|
|
139
|
+
addWithDeletions(files: string[]): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Commit changes
|
|
142
|
+
* @param {string} message - Commit message
|
|
143
|
+
* @throws {TypeError} If message is not a string
|
|
144
|
+
* @throws {Error} If message is empty
|
|
145
|
+
* @example
|
|
146
|
+
* await git.commit('feat: add new feature');
|
|
147
|
+
*/
|
|
148
|
+
commit(message: string): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Push to remote
|
|
151
|
+
* @param {string} [remote='origin'] - Remote name
|
|
152
|
+
* @param {string} [branch] - Branch name (uses current branch if not specified)
|
|
153
|
+
* @param {object} [options] - Push options
|
|
154
|
+
* @param {boolean} [options.setUpstream] - Set upstream tracking (-u flag)
|
|
155
|
+
* @throws {TypeError} If remote or branch is not a string (when provided)
|
|
156
|
+
* @example
|
|
157
|
+
* await git.push('origin', 'main');
|
|
158
|
+
* await git.push('origin', 'feature', { setUpstream: true });
|
|
159
|
+
*/
|
|
160
|
+
push(remote?: string, branch?: string, options?: PushOptions): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Push using refspec to push local ref to different remote ref
|
|
163
|
+
*
|
|
164
|
+
* WU-1435: Enables push-only pattern to keep local main pristine.
|
|
165
|
+
* Pushes directly to origin/main without updating local main.
|
|
166
|
+
*
|
|
167
|
+
* @param {string} remote - Remote name (e.g., 'origin')
|
|
168
|
+
* @param {string} localRef - Local ref to push (e.g., 'tmp/wu-claim/wu-123')
|
|
169
|
+
* @param {string} remoteRef - Remote ref to update (e.g., 'main')
|
|
170
|
+
* @example
|
|
171
|
+
* await git.pushRefspec('origin', 'tmp/wu-claim/wu-123', 'main');
|
|
172
|
+
* // Equivalent to: git push origin tmp/wu-claim/wu-123:main
|
|
173
|
+
*/
|
|
174
|
+
pushRefspec(remote: string, localRef: string, remoteRef: string): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Create and checkout a new branch
|
|
177
|
+
* @param {string} branch - Branch name
|
|
178
|
+
* @param {string} [startPoint] - Starting commit (defaults to HEAD)
|
|
179
|
+
* @throws {TypeError} If branch is not a string, or startPoint is not a string (when provided)
|
|
180
|
+
* @throws {Error} If branch is empty
|
|
181
|
+
* @example
|
|
182
|
+
* await git.createBranch('feature/new-feature');
|
|
183
|
+
* await git.createBranch('hotfix/bug', 'main');
|
|
184
|
+
*/
|
|
185
|
+
createBranch(branch: string, startPoint?: string): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Checkout a branch
|
|
188
|
+
* @param {string} branch - Branch name
|
|
189
|
+
* @throws {TypeError} If branch is not a string
|
|
190
|
+
* @throws {Error} If branch is empty
|
|
191
|
+
* @example
|
|
192
|
+
* await git.checkout('main');
|
|
193
|
+
*/
|
|
194
|
+
checkout(branch: string): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Get commit hash
|
|
197
|
+
* @param {string} [ref='HEAD'] - Git ref
|
|
198
|
+
* @returns {Promise<string>} Commit hash
|
|
199
|
+
* @example
|
|
200
|
+
* await git.getCommitHash(); // "a1b2c3d..."
|
|
201
|
+
* await git.getCommitHash('main'); // "e4f5g6h..."
|
|
202
|
+
*/
|
|
203
|
+
getCommitHash(ref?: string): Promise<string>;
|
|
204
|
+
/**
|
|
205
|
+
* Merge a branch
|
|
206
|
+
*
|
|
207
|
+
* WU-1749: Bug 1 fix - Return success status and handle false positive failures.
|
|
208
|
+
* simple-git's merge() returns a MergeSummary that we now properly handle.
|
|
209
|
+
*
|
|
210
|
+
* @param {string} branch - Branch to merge
|
|
211
|
+
* @param {object} [options] - Merge options
|
|
212
|
+
* @param {boolean} [options.ffOnly] - Fast-forward only merge
|
|
213
|
+
* @returns {Promise<{success: boolean}>} Merge result
|
|
214
|
+
* @throws {TypeError} If branch is not a string
|
|
215
|
+
* @throws {Error} If branch is empty
|
|
216
|
+
* @example
|
|
217
|
+
* await git.merge('feature-branch');
|
|
218
|
+
* await git.merge('feature-branch', { ffOnly: true });
|
|
219
|
+
*/
|
|
220
|
+
merge(branch: string, options?: MergeOptions): Promise<{
|
|
221
|
+
success: boolean;
|
|
222
|
+
}>;
|
|
223
|
+
/**
|
|
224
|
+
* Get commit log
|
|
225
|
+
*
|
|
226
|
+
* WU-1749: Bug 4 fix - Add log() method for counting commits.
|
|
227
|
+
* Used by wu-done-retry-helpers.mjs to count previous completion attempts.
|
|
228
|
+
*
|
|
229
|
+
* @param {object} [options] - Log options
|
|
230
|
+
* @param {number} [options.maxCount] - Maximum number of commits to return
|
|
231
|
+
* @returns {Promise<{all: Array<{hash: string, message: string}>, total: number}>} Log result
|
|
232
|
+
* @example
|
|
233
|
+
* await git.log({ maxCount: 50 });
|
|
234
|
+
*/
|
|
235
|
+
log(options?: LogOptions): Promise<import("simple-git").LogResult<import("simple-git").DefaultLogFields>>;
|
|
236
|
+
/**
|
|
237
|
+
* Find common ancestor (merge base) of two refs
|
|
238
|
+
* @param {string} ref1 - First ref
|
|
239
|
+
* @param {string} ref2 - Second ref
|
|
240
|
+
* @returns {Promise<string>} Common ancestor commit hash
|
|
241
|
+
* @throws {TypeError} If ref1 or ref2 is not a string
|
|
242
|
+
* @example
|
|
243
|
+
* await git.mergeBase('main', 'feature'); // "abc123def456"
|
|
244
|
+
*/
|
|
245
|
+
mergeBase(ref1: string, ref2: string): Promise<string>;
|
|
246
|
+
/**
|
|
247
|
+
* Simulate merge and detect conflicts without touching working tree
|
|
248
|
+
* @param {string} base - Base commit hash
|
|
249
|
+
* @param {string} ref1 - First ref to merge
|
|
250
|
+
* @param {string} ref2 - Second ref to merge
|
|
251
|
+
* @returns {Promise<string>} Merge tree output (contains conflict markers if conflicts exist)
|
|
252
|
+
* @example
|
|
253
|
+
* await git.mergeTree('base123', 'main', 'feature');
|
|
254
|
+
*/
|
|
255
|
+
mergeTree(base: string, ref1: string, ref2: string): Promise<string>;
|
|
256
|
+
/**
|
|
257
|
+
* List commits with various options
|
|
258
|
+
* @param {string[]} args - Arguments to pass to git rev-list
|
|
259
|
+
* @returns {Promise<string>} Rev-list output
|
|
260
|
+
* @example
|
|
261
|
+
* await git.revList(['--count', '--left-right', 'main...feature']); // "5\t0"
|
|
262
|
+
*/
|
|
263
|
+
revList(args: string[]): Promise<string>;
|
|
264
|
+
/**
|
|
265
|
+
* Add a worktree with new branch
|
|
266
|
+
* @param {string} path - Worktree path
|
|
267
|
+
* @param {string} branch - Branch name
|
|
268
|
+
* @param {string} [startPoint] - Starting commit (defaults to HEAD)
|
|
269
|
+
* @throws {TypeError} If path or branch is not a string
|
|
270
|
+
* @throws {Error} If path or branch is empty
|
|
271
|
+
* @example
|
|
272
|
+
* await git.worktreeAdd('worktrees/feature', 'feature-branch', 'main');
|
|
273
|
+
*/
|
|
274
|
+
worktreeAdd(path: string, branch: string, startPoint?: string): Promise<void>;
|
|
275
|
+
/**
|
|
276
|
+
* Remove a worktree
|
|
277
|
+
*
|
|
278
|
+
* WU-1476: Layer 1 defense - explicit directory cleanup after git worktree remove.
|
|
279
|
+
* Git worktree remove can leave orphan directories when:
|
|
280
|
+
* - The worktree was forcefully removed
|
|
281
|
+
* - Git worktree metadata was corrupted
|
|
282
|
+
* - Previous wu:done failed mid-workflow
|
|
283
|
+
*
|
|
284
|
+
* @param {string} worktreePath - Worktree path
|
|
285
|
+
* @param {object} [options] - Remove options
|
|
286
|
+
* @param {boolean} [options.force] - Force removal
|
|
287
|
+
* @example
|
|
288
|
+
* await git.worktreeRemove('worktrees/feature');
|
|
289
|
+
* await git.worktreeRemove('worktrees/feature', { force: true });
|
|
290
|
+
*/
|
|
291
|
+
worktreeRemove(worktreePath: string, options?: WorktreeRemoveOptions): Promise<void>;
|
|
292
|
+
/**
|
|
293
|
+
* List all worktrees
|
|
294
|
+
* @returns {Promise<string>} Worktree list in porcelain format
|
|
295
|
+
* @example
|
|
296
|
+
* await git.worktreeList();
|
|
297
|
+
*/
|
|
298
|
+
worktreeList(): Promise<string>;
|
|
299
|
+
/**
|
|
300
|
+
* Delete a branch
|
|
301
|
+
* @param {string} branch - Branch name
|
|
302
|
+
* @param {object} [options] - Delete options
|
|
303
|
+
* @param {boolean} [options.force] - Force delete (use -D instead of -d)
|
|
304
|
+
* @throws {TypeError} If branch is not a string
|
|
305
|
+
* @throws {Error} If branch is empty
|
|
306
|
+
* @example
|
|
307
|
+
* await git.deleteBranch('feature');
|
|
308
|
+
* await git.deleteBranch('feature', { force: true });
|
|
309
|
+
*/
|
|
310
|
+
deleteBranch(branch: string, options?: DeleteBranchOptions): Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Create a branch WITHOUT switching to it (WU-1262)
|
|
313
|
+
* Used for micro-worktree pattern where main checkout stays on main
|
|
314
|
+
* @param {string} branch - Branch name to create
|
|
315
|
+
* @param {string} [startPoint] - Starting commit (defaults to HEAD)
|
|
316
|
+
* @example
|
|
317
|
+
* await git.createBranchNoCheckout('tmp/wu-create/wu-123', 'main');
|
|
318
|
+
*/
|
|
319
|
+
createBranchNoCheckout(branch: string, startPoint?: string): Promise<void>;
|
|
320
|
+
/**
|
|
321
|
+
* Add a worktree for an EXISTING branch (WU-1262)
|
|
322
|
+
* Unlike worktreeAdd, this doesn't create a new branch
|
|
323
|
+
* @param {string} path - Worktree path
|
|
324
|
+
* @param {string} branch - Existing branch name
|
|
325
|
+
* @example
|
|
326
|
+
* await git.worktreeAddExisting('/tmp/wu-create-xyz', 'tmp/wu-create/wu-123');
|
|
327
|
+
*/
|
|
328
|
+
worktreeAddExisting(path: string, branch: string): Promise<void>;
|
|
329
|
+
/**
|
|
330
|
+
* Rebase current branch onto target (WU-1262)
|
|
331
|
+
* Used in micro-worktree to rebase temp branch when main moves
|
|
332
|
+
* @param {string} onto - Target ref to rebase onto
|
|
333
|
+
* @throws {TypeError} If onto is not a string
|
|
334
|
+
* @throws {Error} If onto is empty
|
|
335
|
+
* @example
|
|
336
|
+
* await git.rebase('main');
|
|
337
|
+
*/
|
|
338
|
+
rebase(onto: string): Promise<void>;
|
|
339
|
+
/**
|
|
340
|
+
* Reset HEAD to specified commit
|
|
341
|
+
* @param {string} [ref] - Commit ref to reset to (defaults to HEAD)
|
|
342
|
+
* @param {object} [options] - Reset options
|
|
343
|
+
* @param {boolean} [options.hard] - Hard reset (--hard flag)
|
|
344
|
+
* @example
|
|
345
|
+
* await git.reset('abc123', { hard: true });
|
|
346
|
+
*/
|
|
347
|
+
reset(ref?: string, options?: ResetOptions): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* Execute arbitrary git command via raw()
|
|
350
|
+
* @param {string[]} args - Git command arguments
|
|
351
|
+
* @returns {Promise<string>} Command output
|
|
352
|
+
* @throws {TypeError} If args is not an array
|
|
353
|
+
* @example
|
|
354
|
+
* await git.raw(['status', '--porcelain']);
|
|
355
|
+
*/
|
|
356
|
+
raw(args: string[]): Promise<string>;
|
|
357
|
+
/**
|
|
358
|
+
* @deprecated Use async methods directly instead
|
|
359
|
+
* Legacy method for backward compatibility
|
|
360
|
+
* Execute a git command and return trimmed output
|
|
361
|
+
* @param {string} cmd - Command to execute
|
|
362
|
+
* @returns {string} Trimmed command output
|
|
363
|
+
*/
|
|
364
|
+
run(cmd: string): never;
|
|
365
|
+
/**
|
|
366
|
+
* @deprecated Use worktreeAdd() instead
|
|
367
|
+
*/
|
|
368
|
+
addWorktree(path: string, branch: string, startPoint?: string): Promise<void>;
|
|
369
|
+
/**
|
|
370
|
+
* @deprecated Use worktreeRemove() instead
|
|
371
|
+
*/
|
|
372
|
+
removeWorktree(path: string, options?: WorktreeRemoveOptions): Promise<void>;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Create a GitAdapter for a specific directory
|
|
376
|
+
* Use this when you need git operations in an explicit path (e.g., worktree vs main)
|
|
377
|
+
* @param {string} baseDir - Directory for git operations
|
|
378
|
+
* @returns {GitAdapter} New GitAdapter instance for the specified directory
|
|
379
|
+
* @example
|
|
380
|
+
* const gitWorktree = createGitForPath('/path/to/worktree');
|
|
381
|
+
* const gitMain = createGitForPath('/path/to/main');
|
|
382
|
+
*/
|
|
383
|
+
export declare function createGitForPath(baseDir: string): GitAdapter;
|
|
384
|
+
/**
|
|
385
|
+
* Create a GitAdapter for the current working directory
|
|
386
|
+
* Captures process.cwd() at call time (not import time)
|
|
387
|
+
* Use this after process.chdir() to get an adapter for the new directory
|
|
388
|
+
* @returns {GitAdapter} New GitAdapter instance for current process.cwd()
|
|
389
|
+
* @example
|
|
390
|
+
* process.chdir(worktreePath);
|
|
391
|
+
* const git = getGitForCwd(); // Uses new directory
|
|
392
|
+
*/
|
|
393
|
+
export declare function getGitForCwd(): GitAdapter;
|
|
394
|
+
export declare const git: GitAdapter;
|
|
395
|
+
export {};
|