opencode-swarm 7.59.1 → 7.61.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/.opencode/skills/brainstorm/SKILL.md +28 -17
- package/.opencode/skills/council/SKILL.md +3 -2
- package/.opencode/skills/execute/SKILL.md +12 -0
- package/.opencode/skills/phase-wrap/SKILL.md +12 -3
- package/.opencode/skills/plan/SKILL.md +9 -7
- package/.opencode/skills/specify/SKILL.md +17 -41
- package/dist/cli/index.js +320 -229
- package/dist/commands/registry.d.ts +1 -1
- package/dist/config/constants.d.ts +2 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/schema.d.ts +37 -0
- package/dist/council/types.d.ts +8 -2
- package/dist/db/qa-gate-profile.d.ts +8 -5
- package/dist/hooks/delegation-gate.d.ts +9 -0
- package/dist/index.js +3172 -2676
- package/dist/state.d.ts +3 -3
- package/dist/tools/convene-council.d.ts +1 -0
- package/dist/tools/phase-complete/gates/phase-council-gate.d.ts +1 -1
- package/dist/tools/set-qa-gates.d.ts +1 -1
- package/dist/tools/submit-phase-council-verdicts.d.ts +1 -0
- package/dist/tools/update-task-status.d.ts +8 -5
- package/dist/tools/write-final-council-evidence.d.ts +1 -0
- package/dist/turbo/lean/merge-back.d.ts +4 -179
- package/dist/turbo/lean/worktree.d.ts +5 -191
- package/dist/worktree/core.d.ts +194 -0
- package/dist/worktree/index.d.ts +5 -0
- package/dist/worktree/merge.d.ts +183 -0
- package/dist/worktree/types.d.ts +46 -0
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { AutoCommitSkip, AutoCommitSuccess, CleanCheckFailure, CleanCheckSuccess, CleanFailure, CleanSuccess, ProvisionFailure, ProvisionSuccess, RemoveFailure, RemoveSuccess, } from './core';
|
|
2
|
+
export { _internals as coreInternals, assertCleanWorkingTree, autoCommitDirty, checkPathBudget, cleanUntrackedFiles, isCleanWorktree, makeWorktreeBranchName, provisionWorktree, removeWorktree, shortenWorktreePath, } from './core';
|
|
3
|
+
export type { CleanupFailure, CleanupSuccess, ConflictHandlingError, ConflictInfo, DirtyMergeFailure, DirtyMergePartial, DirtyMergeSuccess, MergeConflict, MergeFailure, MergeSuccess, OrphanCleanupResult, StartupRecoveryResult, } from './merge';
|
|
4
|
+
export { _internals as mergeInternals, attemptMergeBackFromDirty, cleanupOrphanedBranches, getMergeStrategy, handleMergeConflict, mergeLaneBranch, postMergeCleanup, startupOrphanRecovery, } from './merge';
|
|
5
|
+
export * from './types';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge-back operations for lean turbo parallel lanes.
|
|
3
|
+
*
|
|
4
|
+
* Provides four public functions for merging lane branches back into
|
|
5
|
+
* the primary worktree, cleaning up lane branches, and handling merge
|
|
6
|
+
* conflicts. All subprocess calls go through the `_internals` DI seam
|
|
7
|
+
* so tests can replace the real `bunSpawn` without leaking across Bun's
|
|
8
|
+
* shared test-runner process.
|
|
9
|
+
*
|
|
10
|
+
* @module merge-back
|
|
11
|
+
*/
|
|
12
|
+
import { bunSpawn } from '../utils/bun-compat';
|
|
13
|
+
import type { MergeStrategy } from './types';
|
|
14
|
+
/**
|
|
15
|
+
* Test-only dependency-injection seam. Production code calls
|
|
16
|
+
* `_internals.bunSpawn(...)` so tests can replace the function on this object
|
|
17
|
+
* without touching the real `../../utils/bun-compat` module — `mock.module`
|
|
18
|
+
* from `bun:test` leaks across files in Bun's shared test-runner process,
|
|
19
|
+
* which would corrupt unrelated suites that import `bun-compat`. Mutating this
|
|
20
|
+
* local object is file-scoped and trivially restorable via `afterEach`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const _internals: {
|
|
23
|
+
bunSpawn: typeof bunSpawn;
|
|
24
|
+
/** Test seam for process.platform — allows non-Windows CIs to exercise Windows paths. */
|
|
25
|
+
platform: string;
|
|
26
|
+
/** Test seam for sleep — allows tests to skip real delays. */
|
|
27
|
+
sleep: (ms: number) => Promise<void>;
|
|
28
|
+
};
|
|
29
|
+
export interface MergeSuccess {
|
|
30
|
+
merged: true;
|
|
31
|
+
strategy: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MergeConflict {
|
|
34
|
+
conflict: true;
|
|
35
|
+
files: string[];
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
export interface MergeFailure {
|
|
39
|
+
error: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CleanupSuccess {
|
|
42
|
+
cleaned: true;
|
|
43
|
+
}
|
|
44
|
+
export interface CleanupFailure {
|
|
45
|
+
error: string;
|
|
46
|
+
partial?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface ConflictInfo {
|
|
49
|
+
files: string[];
|
|
50
|
+
message: string;
|
|
51
|
+
aborted: true;
|
|
52
|
+
}
|
|
53
|
+
export interface ConflictHandlingError {
|
|
54
|
+
error: string;
|
|
55
|
+
aborted: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface DirtyMergeSuccess {
|
|
58
|
+
merged: true;
|
|
59
|
+
strategy: string;
|
|
60
|
+
autoCommitted: boolean;
|
|
61
|
+
cleaned: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface DirtyMergePartial {
|
|
64
|
+
partial: true;
|
|
65
|
+
stage: string;
|
|
66
|
+
autoCommitted: boolean;
|
|
67
|
+
cleaned: boolean;
|
|
68
|
+
message: string;
|
|
69
|
+
}
|
|
70
|
+
export interface DirtyMergeFailure {
|
|
71
|
+
failed: true;
|
|
72
|
+
stage: string;
|
|
73
|
+
message: string;
|
|
74
|
+
}
|
|
75
|
+
export interface OrphanCleanupResult {
|
|
76
|
+
removed: string[];
|
|
77
|
+
skipped: string[];
|
|
78
|
+
errors: Array<{
|
|
79
|
+
branch: string;
|
|
80
|
+
error: string;
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
export interface StartupRecoveryResult {
|
|
84
|
+
prunedWorktrees: boolean;
|
|
85
|
+
remainingBranches: string[];
|
|
86
|
+
warnings: string[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Reads the merge strategy from the lean turbo configuration.
|
|
90
|
+
*
|
|
91
|
+
* Returns `config.merge_strategy` if set, otherwise defaults to `'merge'`.
|
|
92
|
+
* This is a pure function — no subprocess calls.
|
|
93
|
+
*
|
|
94
|
+
* @param config - Lean turbo configuration.
|
|
95
|
+
* @returns The merge strategy to use: `'merge'`, `'rebase'`, or `'cherry-pick'`.
|
|
96
|
+
*/
|
|
97
|
+
export declare function getMergeStrategy(config: {
|
|
98
|
+
mergeStrategy?: MergeStrategy;
|
|
99
|
+
merge_strategy?: MergeStrategy;
|
|
100
|
+
}): MergeStrategy;
|
|
101
|
+
/**
|
|
102
|
+
* Merges a lane branch back into the primary worktree using the specified
|
|
103
|
+
* strategy.
|
|
104
|
+
*
|
|
105
|
+
* On conflict, automatically aborts the in-progress merge/rebase/cherry-pick
|
|
106
|
+
* to restore the working tree to a clean state, then returns conflict details.
|
|
107
|
+
*
|
|
108
|
+
* @param primaryDir - The main project root (cwd for all git commands).
|
|
109
|
+
* @param branchName - The lane branch name (e.g. `swarm-lane/<sessionId>/<laneId>`).
|
|
110
|
+
* @param strategy - Merge strategy to use.
|
|
111
|
+
* @returns Discriminated union: success, conflict, or failure.
|
|
112
|
+
*/
|
|
113
|
+
export declare function mergeLaneBranch(primaryDir: string, branchName: string, strategy: MergeStrategy): Promise<MergeSuccess | MergeConflict | MergeFailure>;
|
|
114
|
+
/**
|
|
115
|
+
* Cleans up a lane branch after a successful merge.
|
|
116
|
+
*
|
|
117
|
+
* Deletes the lane branch and prunes stale worktree metadata (DD-9).
|
|
118
|
+
* Reports partial success if branch deletion fails but worktree prune succeeds.
|
|
119
|
+
*
|
|
120
|
+
* @param directory - The project root (cwd for git commands).
|
|
121
|
+
* @param branchName - The lane branch name to delete.
|
|
122
|
+
* @returns Discriminated union: success, partial failure, or full failure.
|
|
123
|
+
*/
|
|
124
|
+
export declare function postMergeCleanup(directory: string, branchName: string): Promise<CleanupSuccess | CleanupFailure>;
|
|
125
|
+
/**
|
|
126
|
+
* Handles a merge conflict by listing conflicted files and aborting the
|
|
127
|
+
* in-progress operation to restore the working tree to a clean state.
|
|
128
|
+
*
|
|
129
|
+
* Uses a strategy-specific abort command so the correct git sub-command
|
|
130
|
+
* is invoked (`merge --abort`, `rebase --abort`, or `cherry-pick --abort`).
|
|
131
|
+
* Using the wrong abort command would leave the repository in a dirty state.
|
|
132
|
+
*
|
|
133
|
+
* @param primaryDir - The main project root (cwd for all git commands).
|
|
134
|
+
* @param branchName - The lane branch name that caused the conflict.
|
|
135
|
+
* Retained for logging and future conflict-reporting use.
|
|
136
|
+
* @param strategy - The merge strategy that is currently in progress.
|
|
137
|
+
* @returns Discriminated union: conflict info or handling error.
|
|
138
|
+
*/
|
|
139
|
+
export declare function handleMergeConflict(primaryDir: string, _branchName: string, strategy: MergeStrategy): Promise<ConflictInfo | ConflictHandlingError>;
|
|
140
|
+
/**
|
|
141
|
+
* Attempts to merge a lane branch back from a potentially dirty worktree
|
|
142
|
+
* using progressive cleanup (DD-7).
|
|
143
|
+
*
|
|
144
|
+
* Pipeline:
|
|
145
|
+
* 1. Auto-commit dirty state in the worktree
|
|
146
|
+
* 2. Clean untracked files
|
|
147
|
+
* 3. Attempt the merge-back
|
|
148
|
+
*
|
|
149
|
+
* Each step is fault-tolerant: failures log a warning and continue.
|
|
150
|
+
* Only when both auto-commit AND clean fail (not just skip) does the
|
|
151
|
+
* pipeline abandon early with `{ failed: true, stage: 'cleanup' }`.
|
|
152
|
+
*
|
|
153
|
+
* @param worktreePath - Absolute path to the lane worktree directory.
|
|
154
|
+
* @param branchName - The lane branch name (e.g. `swarm-lane/<sessionId>/<laneId>`).
|
|
155
|
+
* @param primaryDir - The main project root (cwd for merge commands).
|
|
156
|
+
* @param strategy - Merge strategy to use.
|
|
157
|
+
* @returns Discriminated union: success, partial, or failure.
|
|
158
|
+
*/
|
|
159
|
+
export declare function attemptMergeBackFromDirty(worktreePath: string, branchName: string, primaryDir: string, strategy: MergeStrategy): Promise<DirtyMergeSuccess | DirtyMergePartial | DirtyMergeFailure>;
|
|
160
|
+
/**
|
|
161
|
+
* Cleans up orphaned swarm-lane branches that do not belong to any active session.
|
|
162
|
+
*
|
|
163
|
+
* Lists all branches matching `swarm-lane/*`, identifies orphans (branches whose
|
|
164
|
+
* session ID is not in `activeSessionIds`), force-deletes them, and prunes stale
|
|
165
|
+
* worktree metadata.
|
|
166
|
+
*
|
|
167
|
+
* @param directory - The project root (cwd for all git commands).
|
|
168
|
+
* @param activeSessionIds - Session IDs that are still active; their branches are skipped.
|
|
169
|
+
* @returns Result with arrays of removed, skipped, and errored branch names.
|
|
170
|
+
*/
|
|
171
|
+
export declare function cleanupOrphanedBranches(directory: string, activeSessionIds?: string[]): Promise<OrphanCleanupResult>;
|
|
172
|
+
/**
|
|
173
|
+
* Performs startup orphan recovery: prunes stale worktrees, then identifies
|
|
174
|
+
* any remaining orphaned swarm-lane branches for warning.
|
|
175
|
+
*
|
|
176
|
+
* This is designed to run at session startup (DD-3). It does NOT delete branches —
|
|
177
|
+
* it reports them as warnings so the caller can decide on further action.
|
|
178
|
+
*
|
|
179
|
+
* @param directory - The project root (cwd for all git commands).
|
|
180
|
+
* @param activeSessionIds - Session IDs that are still active; their branches are expected.
|
|
181
|
+
* @returns Result indicating whether pruning happened, orphaned branches, and warnings.
|
|
182
|
+
*/
|
|
183
|
+
export declare function startupOrphanRecovery(directory: string, activeSessionIds?: string[]): Promise<StartupRecoveryResult>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type WorktreePurpose = 'lane' | 'session';
|
|
2
|
+
export type MergeStrategy = 'merge' | 'rebase' | 'cherry-pick';
|
|
3
|
+
export type DependencyPreparationStrategy = 'skip' | 'copy' | 'link';
|
|
4
|
+
export interface WorktreeOptions {
|
|
5
|
+
worktreeDir?: string;
|
|
6
|
+
mergeStrategy?: MergeStrategy;
|
|
7
|
+
purpose: WorktreePurpose;
|
|
8
|
+
depsStrategy?: DependencyPreparationStrategy;
|
|
9
|
+
/**
|
|
10
|
+
* `purpose` uses `swarm/<purpose>/<sessionId>/<id>`.
|
|
11
|
+
* `legacy-lane` preserves the PR #1188 Lean Turbo branch contract.
|
|
12
|
+
*/
|
|
13
|
+
branchStyle?: 'purpose' | 'legacy-lane';
|
|
14
|
+
}
|
|
15
|
+
export interface WorktreeHandle {
|
|
16
|
+
worktreePath: string;
|
|
17
|
+
branchName: string;
|
|
18
|
+
purpose: WorktreePurpose;
|
|
19
|
+
id: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
}
|
|
22
|
+
export interface WorktreeFailure {
|
|
23
|
+
error: string;
|
|
24
|
+
}
|
|
25
|
+
export type WorktreeProvisionResult = WorktreeHandle | WorktreeFailure;
|
|
26
|
+
export interface WorktreePolicyConfig {
|
|
27
|
+
policy: 'auto' | 'required' | 'disabled';
|
|
28
|
+
merge_strategy: MergeStrategy;
|
|
29
|
+
worktree_dir?: string;
|
|
30
|
+
deps_strategy: DependencyPreparationStrategy;
|
|
31
|
+
}
|
|
32
|
+
export interface ConflictReport {
|
|
33
|
+
branchName: string;
|
|
34
|
+
files: string[];
|
|
35
|
+
message: string;
|
|
36
|
+
}
|
|
37
|
+
export type MergeBackResult = {
|
|
38
|
+
merged: true;
|
|
39
|
+
strategy: MergeStrategy;
|
|
40
|
+
} | {
|
|
41
|
+
conflict: true;
|
|
42
|
+
files: string[];
|
|
43
|
+
message: string;
|
|
44
|
+
} | {
|
|
45
|
+
error: string;
|
|
46
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.61.0",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|