agent-gate-installer 1.9.0 → 1.9.2
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/README.md +6 -0
- package/bin/install.mjs +25 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,12 @@ npx agent-gate-installer --update
|
|
|
44
44
|
|
|
45
45
|
Pulls the latest code and reinstalls packages.
|
|
46
46
|
|
|
47
|
+
## Maintainer release notes
|
|
48
|
+
|
|
49
|
+
- Use Conventional Commit messages for releasable changes (for example `fix(installer): ...` or `feat(installer): ...`).
|
|
50
|
+
- For `main` merges, prefer `Squash and merge` or `Rebase and merge`.
|
|
51
|
+
- Avoid `Create a merge commit` for releasable changes because merge commit subjects are not conventional commits and can be skipped by release-please parsing.
|
|
52
|
+
|
|
47
53
|
## Uninstall
|
|
48
54
|
|
|
49
55
|
```bash
|
package/bin/install.mjs
CHANGED
|
@@ -38,6 +38,22 @@ function run(command, options = {}) {
|
|
|
38
38
|
return execSync(command, { encoding: "utf8", stdio, ...options });
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
function getOriginDefaultBranch(installDirectory) {
|
|
42
|
+
const fullRemoteHead = run(`git -C "${installDirectory}" symbolic-ref --short refs/remotes/origin/HEAD`).trim();
|
|
43
|
+
const prefix = "origin/";
|
|
44
|
+
if (!fullRemoteHead.startsWith(prefix)) {
|
|
45
|
+
throw new Error(`Unexpected origin HEAD ref: ${fullRemoteHead}`);
|
|
46
|
+
}
|
|
47
|
+
return fullRemoteHead.slice(prefix.length);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function syncRepositoryToOriginDefaultBranch(installDirectory) {
|
|
51
|
+
run(`git -C "${installDirectory}" fetch --prune origin`);
|
|
52
|
+
const defaultBranch = getOriginDefaultBranch(installDirectory);
|
|
53
|
+
run(`git -C "${installDirectory}" checkout -B "${defaultBranch}" "origin/${defaultBranch}"`);
|
|
54
|
+
run(`git -C "${installDirectory}" reset --hard "origin/${defaultBranch}"`);
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
function detectPython() {
|
|
42
58
|
const candidates = IS_WINDOWS
|
|
43
59
|
? ["python", "python3", "py -3"]
|
|
@@ -214,11 +230,11 @@ async function install() {
|
|
|
214
230
|
registerMcpInClaudeJson(venvPython);
|
|
215
231
|
|
|
216
232
|
if (existsSync(join(INSTALL_DIR, ".git"))) {
|
|
217
|
-
log(" ~ agent-gate already cloned,
|
|
233
|
+
log(" ~ agent-gate already cloned, syncing latest...");
|
|
218
234
|
try {
|
|
219
|
-
|
|
235
|
+
syncRepositoryToOriginDefaultBranch(INSTALL_DIR);
|
|
220
236
|
} catch {
|
|
221
|
-
log(" !
|
|
237
|
+
log(" ! repository sync failed (continuing with existing checkout)");
|
|
222
238
|
}
|
|
223
239
|
} else {
|
|
224
240
|
log(" + Cloning agent-gate...");
|
|
@@ -334,10 +350,12 @@ function update() {
|
|
|
334
350
|
}
|
|
335
351
|
|
|
336
352
|
try {
|
|
337
|
-
|
|
338
|
-
log(" +
|
|
339
|
-
} catch {
|
|
340
|
-
|
|
353
|
+
syncRepositoryToOriginDefaultBranch(INSTALL_DIR);
|
|
354
|
+
log(" + Synced latest changes from origin default branch");
|
|
355
|
+
} catch (error) {
|
|
356
|
+
const message = error?.message || "Unknown git error";
|
|
357
|
+
log(`Error: repository sync failed. ${message}`);
|
|
358
|
+
log("Try rerunning with --verbose for command output.");
|
|
341
359
|
process.exit(1);
|
|
342
360
|
}
|
|
343
361
|
|