mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-05 02:30:26 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
716d1eb173 | ||
|
|
4bc9ffa907 | ||
|
|
c6c2f93e02 |
17
bin/cli.js
17
bin/cli.js
@@ -501,7 +501,7 @@ async function updateInstalledModules(installDir, tag, config, dryRun) {
|
||||
await fs.promises.mkdir(installDir, { recursive: true });
|
||||
for (const name of toUpdate) {
|
||||
process.stdout.write(`Updating module: ${name}\n`);
|
||||
const r = await applyModule(name, config, repoRoot, installDir, true);
|
||||
const r = await applyModule(name, config, repoRoot, installDir, true, tag);
|
||||
upsertModuleStatus(installDir, r);
|
||||
}
|
||||
} finally {
|
||||
@@ -560,6 +560,7 @@ async function promptMultiSelect(items, title) {
|
||||
function cleanup() {
|
||||
process.stdin.setRawMode(false);
|
||||
process.stdin.removeListener("keypress", onKey);
|
||||
process.stdin.pause();
|
||||
}
|
||||
|
||||
function onKey(_, key) {
|
||||
@@ -749,14 +750,16 @@ async function mergeDir(src, installDir, force) {
|
||||
return installed;
|
||||
}
|
||||
|
||||
function runInstallSh(repoRoot, installDir) {
|
||||
function runInstallSh(repoRoot, installDir, tag) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cmd = process.platform === "win32" ? "cmd.exe" : "bash";
|
||||
const args = process.platform === "win32" ? ["/c", "install.bat"] : ["install.sh"];
|
||||
const env = { ...process.env, INSTALL_DIR: installDir };
|
||||
if (tag) env.CODEAGENT_WRAPPER_VERSION = tag;
|
||||
const p = spawn(cmd, args, {
|
||||
cwd: repoRoot,
|
||||
stdio: "inherit",
|
||||
env: { ...process.env, INSTALL_DIR: installDir },
|
||||
env,
|
||||
});
|
||||
p.on("exit", (code) => {
|
||||
if (code === 0) resolve();
|
||||
@@ -774,7 +777,7 @@ async function rmTree(p) {
|
||||
await fs.promises.rmdir(p, { recursive: true });
|
||||
}
|
||||
|
||||
async function applyModule(moduleName, config, repoRoot, installDir, force) {
|
||||
async function applyModule(moduleName, config, repoRoot, installDir, force, tag) {
|
||||
const mod = config && config.modules && config.modules[moduleName];
|
||||
if (!mod) throw new Error(`Unknown module: ${moduleName}`);
|
||||
const ops = Array.isArray(mod.operations) ? mod.operations : [];
|
||||
@@ -800,7 +803,7 @@ async function applyModule(moduleName, config, repoRoot, installDir, force) {
|
||||
if (cmd !== "bash install.sh") {
|
||||
throw new Error(`Refusing run_command: ${cmd || "(empty)"}`);
|
||||
}
|
||||
await runInstallSh(repoRoot, installDir);
|
||||
await runInstallSh(repoRoot, installDir, tag);
|
||||
} else {
|
||||
throw new Error(`Unsupported operation type: ${type}`);
|
||||
}
|
||||
@@ -964,12 +967,12 @@ async function installSelected(picks, tag, config, installDir, force, dryRun) {
|
||||
for (const p of picks) {
|
||||
if (p.kind === "wrapper") {
|
||||
process.stdout.write("Installing codeagent-wrapper...\n");
|
||||
await runInstallSh(repoRoot, installDir);
|
||||
await runInstallSh(repoRoot, installDir, tag);
|
||||
continue;
|
||||
}
|
||||
if (p.kind === "module") {
|
||||
process.stdout.write(`Installing module: ${p.moduleName}\n`);
|
||||
const r = await applyModule(p.moduleName, config, repoRoot, installDir, force);
|
||||
const r = await applyModule(p.moduleName, config, repoRoot, installDir, force, tag);
|
||||
upsertModuleStatus(installDir, r);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,14 @@ package wrapper
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEnsureExecutableTempDir_Override(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("ensureExecutableTempDir is no-op on Windows")
|
||||
}
|
||||
restore := captureTempEnv()
|
||||
t.Cleanup(restore)
|
||||
|
||||
@@ -37,6 +41,9 @@ func TestEnsureExecutableTempDir_Override(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEnsureExecutableTempDir_FallbackWhenCurrentNotExecutable(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("ensureExecutableTempDir is no-op on Windows")
|
||||
}
|
||||
restore := captureTempEnv()
|
||||
t.Cleanup(restore)
|
||||
|
||||
|
||||
@@ -24,9 +24,13 @@ esac
|
||||
|
||||
# Build download URL
|
||||
REPO="cexll/myclaude"
|
||||
VERSION="latest"
|
||||
VERSION="${CODEAGENT_WRAPPER_VERSION:-latest}"
|
||||
BINARY_NAME="codeagent-wrapper-${OS}-${ARCH}"
|
||||
URL="https://github.com/${REPO}/releases/${VERSION}/download/${BINARY_NAME}"
|
||||
if [ "$VERSION" = "latest" ]; then
|
||||
URL="https://github.com/${REPO}/releases/latest/download/${BINARY_NAME}"
|
||||
else
|
||||
URL="https://github.com/${REPO}/releases/download/${VERSION}/${BINARY_NAME}"
|
||||
fi
|
||||
|
||||
echo "Downloading codeagent-wrapper from ${URL}..."
|
||||
if ! curl -fsSL "$URL" -o /tmp/codeagent-wrapper; then
|
||||
|
||||
@@ -29,7 +29,16 @@ project_dir="${CLAUDE_PROJECT_DIR:-$PWD}"
|
||||
state_dir="${project_dir}/.claude"
|
||||
|
||||
shopt -s nullglob
|
||||
state_files=("${state_dir}"/do.*.local.md)
|
||||
if [ -n "${DO_TASK_ID:-}" ]; then
|
||||
candidate="${state_dir}/do.${DO_TASK_ID}.local.md"
|
||||
if [ -f "$candidate" ]; then
|
||||
state_files=("$candidate")
|
||||
else
|
||||
state_files=()
|
||||
fi
|
||||
else
|
||||
state_files=("${state_dir}"/do.*.local.md)
|
||||
fi
|
||||
shopt -u nullglob
|
||||
|
||||
if [ ${#state_files[@]} -eq 0 ]; then
|
||||
|
||||
@@ -112,3 +112,4 @@ echo "Initialized: $state_file"
|
||||
echo "task_id: $task_id"
|
||||
echo "phase: 1/$max_phases ($phase_name)"
|
||||
echo "completion_promise: $completion_promise"
|
||||
echo "export DO_TASK_ID=$task_id"
|
||||
|
||||
Reference in New Issue
Block a user