@jjlabsio/claude-crew 0.1.44 → 0.1.45
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.
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"name": "claude-crew",
|
|
12
12
|
"source": "./",
|
|
13
13
|
"description": "오케스트레이터 + PM, 플래너, 개발, QA, 마케팅 에이전트 팀으로 단일 제품의 개발과 마케팅을 통합 관리",
|
|
14
|
-
"version": "0.1.
|
|
14
|
+
"version": "0.1.45",
|
|
15
15
|
"author": {
|
|
16
16
|
"name": "Jaejin Song",
|
|
17
17
|
"email": "wowlxx28@gmail.com"
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"category": "workflow"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
|
-
"version": "0.1.
|
|
31
|
+
"version": "0.1.45"
|
|
32
32
|
}
|
package/package.json
CHANGED
package/scripts/lib/dispatch.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { execFile, spawn } from "node:child_process";
|
|
2
2
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { basename, join } from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
|
|
7
8
|
import { persistCrewArtifact, ArtifactPersistError } from "./artifacts.mjs";
|
|
@@ -11,6 +12,8 @@ import { renderPrompt } from "./render.mjs";
|
|
|
11
12
|
const DEFAULT_COMPANION = fileURLToPath(
|
|
12
13
|
new URL("../crew-codex-companion.mjs", import.meta.url)
|
|
13
14
|
);
|
|
15
|
+
const execFileAsync = promisify(execFile);
|
|
16
|
+
const AUTO_GIT_DIFF = "AUTO_GIT_DIFF";
|
|
14
17
|
const AGENT_RESULT_STATUSES = new Set([
|
|
15
18
|
"complete",
|
|
16
19
|
"blocked_on_user",
|
|
@@ -33,6 +36,70 @@ export function formatDispatchProviderGuardMessage(role, provider) {
|
|
|
33
36
|
return `dispatch is for Codex provider only. Resolved provider for role '${role}' is '${provider}'. Use 'render' + Agent tool for Claude provider (see crew-agent-runner SKILL.md).`;
|
|
34
37
|
}
|
|
35
38
|
|
|
39
|
+
export async function resolveAutoGitDiffInputs(request, options = {}) {
|
|
40
|
+
if (!hasAutoGitDiffInput(request)) {
|
|
41
|
+
return request;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const diff =
|
|
45
|
+
options.diff ??
|
|
46
|
+
(await generateAutoGitDiff({ cwd: options.cwd ?? process.cwd() }));
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
...request,
|
|
50
|
+
inputs: request.inputs.map((item) => {
|
|
51
|
+
if (item?.content !== AUTO_GIT_DIFF) {
|
|
52
|
+
return item;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
...item,
|
|
57
|
+
content: diff
|
|
58
|
+
};
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function hasAutoGitDiffInput(request) {
|
|
64
|
+
return Array.isArray(request?.inputs)
|
|
65
|
+
? request.inputs.some((item) => item?.content === AUTO_GIT_DIFF)
|
|
66
|
+
: false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function generateAutoGitDiff({ cwd = process.cwd() } = {}) {
|
|
70
|
+
await git(["rev-parse", "--is-inside-work-tree"], cwd);
|
|
71
|
+
|
|
72
|
+
const [staged, unstaged] = await Promise.all([
|
|
73
|
+
git(["diff", "--no-ext-diff", "--staged"], cwd),
|
|
74
|
+
git(["diff", "--no-ext-diff"], cwd)
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
const sections = [
|
|
78
|
+
["staged", staged],
|
|
79
|
+
["unstaged", unstaged]
|
|
80
|
+
]
|
|
81
|
+
.filter(([, content]) => content.trim().length > 0)
|
|
82
|
+
.map(([label, content]) => `# git diff (${label})\n${content.trimEnd()}`);
|
|
83
|
+
|
|
84
|
+
if (sections.length > 0) {
|
|
85
|
+
return sections.join("\n\n");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
const previousCommitDiff = await git(
|
|
90
|
+
["diff", "--no-ext-diff", "HEAD~1"],
|
|
91
|
+
cwd
|
|
92
|
+
);
|
|
93
|
+
if (previousCommitDiff.trim().length > 0) {
|
|
94
|
+
return `# git diff (HEAD~1)\n${previousCommitDiff.trimEnd()}`;
|
|
95
|
+
}
|
|
96
|
+
} catch {
|
|
97
|
+
// Repositories with fewer than two commits have no HEAD~1 fallback.
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return "# git diff\nNo git diff available.";
|
|
101
|
+
}
|
|
102
|
+
|
|
36
103
|
export async function dispatch(input) {
|
|
37
104
|
if (input.resolved?.provider !== "codex") {
|
|
38
105
|
throw new DispatchError(
|
|
@@ -46,6 +113,7 @@ export async function dispatch(input) {
|
|
|
46
113
|
|
|
47
114
|
const companion = resolveCompanion(input);
|
|
48
115
|
await assertResumeCandidate(input.resumeHandle, companion);
|
|
116
|
+
const request = await resolveAutoGitDiffInputs(input.request);
|
|
49
117
|
|
|
50
118
|
const tmpDir = await mkdtemp(join(tmpdir(), "claude-crew-dispatch-"));
|
|
51
119
|
const promptFile = join(tmpDir, `${input.role}-prompt.md`);
|
|
@@ -55,7 +123,7 @@ export async function dispatch(input) {
|
|
|
55
123
|
promptFile,
|
|
56
124
|
renderPrompt({
|
|
57
125
|
role: input.role,
|
|
58
|
-
request
|
|
126
|
+
request,
|
|
59
127
|
contract: input.contract
|
|
60
128
|
}),
|
|
61
129
|
"utf8"
|
|
@@ -137,6 +205,15 @@ export async function runCompanion(companion, args) {
|
|
|
137
205
|
});
|
|
138
206
|
}
|
|
139
207
|
|
|
208
|
+
async function git(args, cwd) {
|
|
209
|
+
const { stdout } = await execFileAsync("git", args, {
|
|
210
|
+
cwd,
|
|
211
|
+
encoding: "utf8",
|
|
212
|
+
maxBuffer: 50 * 1024 * 1024
|
|
213
|
+
});
|
|
214
|
+
return stdout;
|
|
215
|
+
}
|
|
216
|
+
|
|
140
217
|
async function assertResumeCandidate(resumeHandle, companion) {
|
|
141
218
|
if (!resumeHandle) {
|
|
142
219
|
return;
|