@oxgeneral/orch 1.0.2 → 1.0.4
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/App-SSYYVFGW.js +22 -0
- package/dist/agent-Q34L27AY.js +9 -0
- package/dist/agent-shop-D2RS4BZK.js +2 -0
- package/dist/chunk-4MMHVHA6.js +112 -0
- package/dist/chunk-64WUDYEM.js +6 -0
- package/dist/chunk-6MJ7V6VY.js +2 -0
- package/dist/{chunk-DAVHOWGD.js → chunk-BCPUTULS.js} +16 -188
- package/dist/{chunk-INZ4O2RI.js → chunk-BSJVYRI3.js} +5 -2
- package/dist/chunk-BSJVYRI3.js.map +1 -0
- package/dist/chunk-CDFA4IIQ.js +2 -0
- package/dist/chunk-CHRW4CLD.js +2 -0
- package/dist/chunk-HMMPM7MF.js +3 -0
- package/dist/chunk-HXOMNULD.js +2 -0
- package/dist/chunk-IKNBPOQL.js +2 -0
- package/dist/chunk-KFQTWMZI.js +3 -0
- package/dist/chunk-LXNRCJ22.js +2 -0
- package/dist/{chunk-C6XZ3FJT.js → chunk-MOWC2CHX.js} +7 -4
- package/dist/chunk-MOWC2CHX.js.map +1 -0
- package/dist/chunk-P4JTJBWO.js +2 -0
- package/dist/chunk-PJ5DKXGR.js +2 -0
- package/dist/chunk-QNZ6D63E.js +4 -0
- package/dist/chunk-RHFRHCN5.js +16 -0
- package/dist/chunk-RHFRHCN5.js.map +1 -0
- package/dist/chunk-TPTHLFOB.js +2 -0
- package/dist/chunk-UMZEA3JT.js +5 -0
- package/dist/chunk-X54D5JZG.js +11 -0
- package/dist/{chunk-O2OQCSBL.js → chunk-YHIYJ5OL.js} +105 -29
- package/dist/chunk-YHIYJ5OL.js.map +1 -0
- package/dist/{claude-WUJU5KIE.js → claude-4R6L6BWY.js} +4 -4
- package/dist/{claude-WUJU5KIE.js.map → claude-4R6L6BWY.js.map} +1 -1
- package/dist/claude-ZLVOLRUG.js +2 -0
- package/dist/cli.js +1 -213
- package/dist/clipboard-service-WVON5ZN4.js +25 -0
- package/dist/{codex-NYJWEPRQ.js → codex-IMOW5ZUZ.js} +4 -4
- package/dist/{codex-NYJWEPRQ.js.map → codex-IMOW5ZUZ.js.map} +1 -1
- package/dist/codex-YRSODLH4.js +2 -0
- package/dist/config-OOB7QEKM.js +2 -0
- package/dist/container-FJI7RN2L.js +4 -0
- package/dist/context-FXRERFSP.js +7 -0
- package/dist/cursor-2HILMNM3.js +2 -0
- package/dist/{cursor-3YHVD4NP.js → cursor-NHV7X3WG.js} +4 -4
- package/dist/{cursor-3YHVD4NP.js.map → cursor-NHV7X3WG.js.map} +1 -1
- package/dist/doctor-GKTV4YYD.js +2 -0
- package/dist/doctor-service-PB7YBH3F.js +2 -0
- package/dist/editor-7IFRWVTL.js +8 -0
- package/dist/goal-RNNZYMNR.js +8 -0
- package/dist/index.d.ts +26 -8
- package/dist/index.js +247 -75
- package/dist/index.js.map +1 -1
- package/dist/init-56QC5QVX.js +53 -0
- package/dist/logs-4ISTWUWV.js +12 -0
- package/dist/msg-4ELI7Q52.js +9 -0
- package/dist/opencode-3S4VDXRG.js +2 -0
- package/dist/{opencode-FAMPSA6X.js → opencode-ULT6DYCT.js} +6 -5
- package/dist/opencode-ULT6DYCT.js.map +1 -0
- package/dist/orchestrator-PM4BW7W5.js +13 -0
- package/dist/orchestrator-QFNYZ6AH.js +6 -0
- package/dist/{orchestrator-X2CWGFCL.js.map → orchestrator-QFNYZ6AH.js.map} +1 -1
- package/dist/org-WAK3CDPG.js +3 -0
- package/dist/process-manager-33H27MQF.js +2 -0
- package/dist/registry-BO2PPRNG.js +2 -0
- package/dist/run-NE5E4JPW.js +3 -0
- package/dist/shell-OBHIVC2H.js +2 -0
- package/dist/{shell-NJNW3O6K.js → shell-UXEJRK3D.js} +4 -4
- package/dist/{shell-NJNW3O6K.js.map → shell-UXEJRK3D.js.map} +1 -1
- package/dist/shop-picker-LE3SKFOX.js +5 -0
- package/dist/status-NYHZ7Q5G.js +2 -0
- package/dist/task-SZBYNAZP.js +20 -0
- package/dist/team-VCJSUDWX.js +4 -0
- package/dist/template-engine-42PKL5KD.js +2 -0
- package/dist/tui-4VRDSRVB.js +2 -0
- package/dist/update-FFKCOV63.js +2 -0
- package/dist/update-check-HGMBDYHL.js +2 -0
- package/dist/{workspace-manager-2SFPKPLZ.js → workspace-manager-ABXFBL2A.js} +3 -3
- package/dist/{workspace-manager-2SFPKPLZ.js.map → workspace-manager-ABXFBL2A.js.map} +1 -1
- package/dist/workspace-manager-Q6WWXSTR.js +3 -0
- package/package.json +1 -1
- package/dist/App-YQOT4LBE.js +0 -6727
- package/dist/agent-7ZJ3ZDJ7.js +0 -183
- package/dist/agent-shop-YN2BSLHM.js +0 -2
- package/dist/chunk-2C2TFQ7K.js +0 -136
- package/dist/chunk-45K2XID7.js +0 -29
- package/dist/chunk-4IFIOMCW.js +0 -86
- package/dist/chunk-7X2GI5OV.js +0 -181
- package/dist/chunk-C6XZ3FJT.js.map +0 -1
- package/dist/chunk-CHIP7O6V.js +0 -83
- package/dist/chunk-FRTKB575.js +0 -87
- package/dist/chunk-HXYAZGLP.js +0 -15
- package/dist/chunk-I3SMISEF.js +0 -29
- package/dist/chunk-INZ4O2RI.js.map +0 -1
- package/dist/chunk-ITLJKMTP.js +0 -297
- package/dist/chunk-K6DMQERQ.js +0 -89
- package/dist/chunk-MGGSRXWJ.js +0 -69
- package/dist/chunk-O2OQCSBL.js.map +0 -1
- package/dist/chunk-P6ATSXGL.js +0 -107
- package/dist/chunk-PNE6LQRF.js +0 -5
- package/dist/chunk-U2VDNUZL.js +0 -52
- package/dist/chunk-VXS2CJFH.js +0 -273
- package/dist/chunk-XDVMX2FO.js +0 -8
- package/dist/chunk-XDVMX2FO.js.map +0 -1
- package/dist/chunk-XJTJ2TJV.js +0 -221
- package/dist/claude-ZUEKJJ4X.js +0 -5
- package/dist/clipboard-service-RTDUUQQU.js +0 -200
- package/dist/codex-7IXXXG5U.js +0 -123
- package/dist/config-OTAVSMOD.js +0 -75
- package/dist/container-IZZVO4AH.js +0 -1596
- package/dist/context-OL4BVUV5.js +0 -83
- package/dist/cursor-622RBRHH.js +0 -97
- package/dist/doctor-SETNAS4S.js +0 -67
- package/dist/doctor-service-TPOMFAIG.js +0 -2
- package/dist/goal-C6YGSX5D.js +0 -143
- package/dist/init-SWAAXP5H.js +0 -199
- package/dist/logs-PHPYWQ6I.js +0 -207
- package/dist/msg-FUWWLEKM.js +0 -95
- package/dist/opencode-FAMPSA6X.js.map +0 -1
- package/dist/opencode-WOR53TSC.js +0 -98
- package/dist/orchestrator-O6MFMATT.js +0 -1448
- package/dist/orchestrator-X2CWGFCL.js +0 -5
- package/dist/org-JSMMBZHI.js +0 -249
- package/dist/process-manager-HUVNAPQV.js +0 -2
- package/dist/registry-PQWRVNF2.js +0 -2
- package/dist/run-N72G5V2H.js +0 -95
- package/dist/shell-DVFHHYAZ.js +0 -5
- package/dist/shop-picker-2HY67UWP.js +0 -79
- package/dist/status-RZWN2C6C.js +0 -56
- package/dist/task-XNYZHPCS.js +0 -221
- package/dist/team-PFLP4PPL.js +0 -97
- package/dist/template-engine-AWIS56BL.js +0 -3
- package/dist/tui-JW3DOOKH.js +0 -245
- package/dist/update-YLP7FPNY.js +0 -64
- package/dist/update-check-4YKLGBFB.js +0 -2
- package/dist/workspace-manager-ESPU7WOH.js +0 -215
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { sanitizeId, validateWorkspacePath, ensureDir } from './chunk-ITLJKMTP.js';
|
|
3
|
-
import { WorkspaceError } from './chunk-2C2TFQ7K.js';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import fs from 'fs/promises';
|
|
6
|
-
|
|
7
|
-
// src/infrastructure/workspace/merge-strategy.ts
|
|
8
|
-
var MergeStrategy = class {
|
|
9
|
-
constructor(projectRoot, processManager) {
|
|
10
|
-
this.projectRoot = projectRoot;
|
|
11
|
-
this.processManager = processManager;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Merge a branch into the current branch with --no-ff.
|
|
15
|
-
* On conflict, aborts the merge and returns conflict info.
|
|
16
|
-
*/
|
|
17
|
-
async mergeBack(branch) {
|
|
18
|
-
return new Promise((resolve) => {
|
|
19
|
-
const { process: proc } = this.processManager.spawn(
|
|
20
|
-
"git",
|
|
21
|
-
["merge", "--no-ff", branch, "-m", `Merge ${branch}`],
|
|
22
|
-
{ cwd: this.projectRoot }
|
|
23
|
-
);
|
|
24
|
-
let output = "";
|
|
25
|
-
const maxOutputLen = 2e3;
|
|
26
|
-
const appendOutput = (chunk) => {
|
|
27
|
-
if (output.length < maxOutputLen) output += chunk.toString();
|
|
28
|
-
};
|
|
29
|
-
proc.stdout?.on("data", appendOutput);
|
|
30
|
-
proc.stderr?.on("data", appendOutput);
|
|
31
|
-
proc.on("close", (code) => {
|
|
32
|
-
if (code === 0) {
|
|
33
|
-
resolve({ success: true });
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const trimmedOutput = output.slice(0, 1e3);
|
|
37
|
-
const isConflict = trimmedOutput.includes("CONFLICT") || trimmedOutput.includes("Merge conflict");
|
|
38
|
-
if (!isConflict) {
|
|
39
|
-
resolve({ success: false, conflictInfo: trimmedOutput });
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
const { process: abortProc } = this.processManager.spawn(
|
|
44
|
-
"git",
|
|
45
|
-
["merge", "--abort"],
|
|
46
|
-
{ cwd: this.projectRoot }
|
|
47
|
-
);
|
|
48
|
-
abortProc.on("close", () => {
|
|
49
|
-
resolve({ success: false, conflictInfo: trimmedOutput });
|
|
50
|
-
});
|
|
51
|
-
abortProc.on("error", () => {
|
|
52
|
-
resolve({ success: false, conflictInfo: trimmedOutput });
|
|
53
|
-
});
|
|
54
|
-
} catch {
|
|
55
|
-
resolve({ success: false, conflictInfo: trimmedOutput });
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
proc.on("error", (err) => {
|
|
59
|
-
resolve({ success: false, conflictInfo: err.message });
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// src/infrastructure/workspace/workspace-manager.ts
|
|
66
|
-
var WorkspaceManager = class {
|
|
67
|
-
constructor(projectRoot, orchestryDir, processManager) {
|
|
68
|
-
this.projectRoot = projectRoot;
|
|
69
|
-
this.orchestryDir = orchestryDir;
|
|
70
|
-
this.processManager = processManager;
|
|
71
|
-
this.mergeStrategy = new MergeStrategy(projectRoot, processManager);
|
|
72
|
-
}
|
|
73
|
-
mergeStrategy;
|
|
74
|
-
gitRepoChecked = false;
|
|
75
|
-
isGitRepo = false;
|
|
76
|
-
async prepare(task, agent, config) {
|
|
77
|
-
const mode = this.resolveMode(task, agent, config);
|
|
78
|
-
if (mode !== "shared") {
|
|
79
|
-
await this.requireGitRepo(mode);
|
|
80
|
-
}
|
|
81
|
-
switch (mode) {
|
|
82
|
-
case "shared":
|
|
83
|
-
return { path: this.projectRoot };
|
|
84
|
-
case "worktree":
|
|
85
|
-
return this.prepareWorktree(task);
|
|
86
|
-
case "isolated":
|
|
87
|
-
return { path: await this.prepareIsolated(task) };
|
|
88
|
-
default:
|
|
89
|
-
return { path: this.projectRoot };
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async requireGitRepo(mode) {
|
|
93
|
-
if (!this.gitRepoChecked) {
|
|
94
|
-
try {
|
|
95
|
-
const { process: proc } = this.processManager.spawn(
|
|
96
|
-
"git",
|
|
97
|
-
["rev-parse", "--is-inside-work-tree"],
|
|
98
|
-
{ cwd: this.projectRoot }
|
|
99
|
-
);
|
|
100
|
-
const code = await new Promise((resolve) => {
|
|
101
|
-
proc.on("close", resolve);
|
|
102
|
-
proc.on("error", () => resolve(1));
|
|
103
|
-
});
|
|
104
|
-
this.isGitRepo = code === 0;
|
|
105
|
-
} catch {
|
|
106
|
-
this.isGitRepo = false;
|
|
107
|
-
}
|
|
108
|
-
if (this.isGitRepo) this.gitRepoChecked = true;
|
|
109
|
-
}
|
|
110
|
-
if (!this.isGitRepo) {
|
|
111
|
-
throw new WorkspaceError(
|
|
112
|
-
`workspace_mode "${mode}" requires a git repository`,
|
|
113
|
-
'Run: git init && git add -A && git commit -m "Initial commit"\n Or set workspace_mode: shared in .orchestry/config.yml'
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async mergeBack(branch) {
|
|
118
|
-
return this.mergeStrategy.mergeBack(branch);
|
|
119
|
-
}
|
|
120
|
-
async cleanup(taskId) {
|
|
121
|
-
const workspacePath = path.join(this.orchestryDir, "workspaces", sanitizeId(taskId));
|
|
122
|
-
try {
|
|
123
|
-
const { process: proc } = this.processManager.spawn(
|
|
124
|
-
"git",
|
|
125
|
-
["worktree", "remove", "--force", workspacePath],
|
|
126
|
-
{ cwd: this.projectRoot }
|
|
127
|
-
);
|
|
128
|
-
await new Promise((resolve) => {
|
|
129
|
-
proc.on("close", () => resolve());
|
|
130
|
-
proc.on("error", () => resolve());
|
|
131
|
-
});
|
|
132
|
-
} catch {
|
|
133
|
-
}
|
|
134
|
-
try {
|
|
135
|
-
await fs.rm(workspacePath, { recursive: true, force: true });
|
|
136
|
-
} catch {
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
validate(workspacePath, projectRoot) {
|
|
140
|
-
validateWorkspacePath(workspacePath, projectRoot);
|
|
141
|
-
}
|
|
142
|
-
resolveMode(task, agent, config) {
|
|
143
|
-
return task.workspace_mode ?? agent.config.workspace_mode ?? config.defaults.agent.workspace_mode ?? "worktree";
|
|
144
|
-
}
|
|
145
|
-
async prepareWorktree(task) {
|
|
146
|
-
const workspacePath = path.join(
|
|
147
|
-
this.orchestryDir,
|
|
148
|
-
"workspaces",
|
|
149
|
-
sanitizeId(task.id)
|
|
150
|
-
);
|
|
151
|
-
await ensureDir(path.dirname(workspacePath));
|
|
152
|
-
const titleSlug = sanitizeTitle(task.title) || sanitizeId(task.id);
|
|
153
|
-
const branchName = `orchestry/${sanitizeId(task.id)}/${titleSlug}`;
|
|
154
|
-
const { process: proc } = this.processManager.spawn(
|
|
155
|
-
"git",
|
|
156
|
-
["worktree", "add", workspacePath, "-b", branchName],
|
|
157
|
-
{ cwd: this.projectRoot }
|
|
158
|
-
);
|
|
159
|
-
await new Promise((resolve, reject) => {
|
|
160
|
-
proc.on("close", (code) => {
|
|
161
|
-
if (code === 0) resolve();
|
|
162
|
-
else reject(new Error(`git worktree add failed with code ${code}`));
|
|
163
|
-
});
|
|
164
|
-
proc.on("error", reject);
|
|
165
|
-
});
|
|
166
|
-
const worktreeOrchestry = path.join(workspacePath, ".orchestry");
|
|
167
|
-
await fs.rm(worktreeOrchestry, { recursive: true, force: true }).catch(() => {
|
|
168
|
-
});
|
|
169
|
-
return { path: workspacePath, branch: branchName };
|
|
170
|
-
}
|
|
171
|
-
async prepareIsolated(task) {
|
|
172
|
-
const workspacePath = path.join(
|
|
173
|
-
this.orchestryDir,
|
|
174
|
-
"workspaces",
|
|
175
|
-
sanitizeId(task.id)
|
|
176
|
-
);
|
|
177
|
-
await ensureDir(path.dirname(workspacePath));
|
|
178
|
-
try {
|
|
179
|
-
const { process: proc } = this.processManager.spawn(
|
|
180
|
-
"git",
|
|
181
|
-
["clone", "--local", "--no-hardlinks", ".", workspacePath],
|
|
182
|
-
{ cwd: this.projectRoot }
|
|
183
|
-
);
|
|
184
|
-
await new Promise((resolve, reject) => {
|
|
185
|
-
proc.on("close", (code) => {
|
|
186
|
-
if (code === 0) resolve();
|
|
187
|
-
else reject(new Error("git clone failed"));
|
|
188
|
-
});
|
|
189
|
-
proc.on("error", reject);
|
|
190
|
-
});
|
|
191
|
-
} catch {
|
|
192
|
-
const excludeFile = path.join(this.orchestryDir, "workspace-exclude");
|
|
193
|
-
const args = ["-a", `--exclude-from=${excludeFile}`, "./", `${workspacePath}/`];
|
|
194
|
-
const { process: proc } = this.processManager.spawn("rsync", args, {
|
|
195
|
-
cwd: this.projectRoot
|
|
196
|
-
});
|
|
197
|
-
await new Promise((resolve, reject) => {
|
|
198
|
-
proc.on("close", (code) => {
|
|
199
|
-
if (code === 0) resolve();
|
|
200
|
-
else reject(new Error(`rsync failed with code ${code}`));
|
|
201
|
-
});
|
|
202
|
-
proc.on("error", reject);
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
const clonedOrchestry = path.join(workspacePath, ".orchestry");
|
|
206
|
-
await fs.rm(clonedOrchestry, { recursive: true, force: true }).catch(() => {
|
|
207
|
-
});
|
|
208
|
-
return workspacePath;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
function sanitizeTitle(title) {
|
|
212
|
-
return title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export { WorkspaceManager };
|