@astrofoundry/astrogate 0.1.3 → 0.1.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/cli/astrogate.sh CHANGED
@@ -6,6 +6,8 @@
6
6
  # the running core's verify-release.sh checks the core first, and
7
7
  # each tool download must match the sha256 in the core's tools.lock
8
8
  # sudo astrogate core rollback swaps the current core and the previous one, with their tools
9
+ # (sudo astrogate core activate <x.y.z> the second half of update: the new version's own code installs
10
+ # its tools and switches to it; update runs it, nobody else needs to)
9
11
  # astrogate tools each tool's installed version and the version the core pins
10
12
  # astrogate doctor read-only checks; exits 1 when one fails
11
13
  #
@@ -70,7 +72,7 @@ case "${1:-}" in
70
72
  action=${2:-status}
71
73
  case "$action" in
72
74
  status) [ $# -le 2 ] || usage ;;
73
- update)
75
+ update | activate)
74
76
  shift 2
75
77
  while [ $# -gt 0 ]; do
76
78
  case "$1" in
@@ -86,6 +88,7 @@ case "${1:-}" in
86
88
  ;;
87
89
  esac
88
90
  done
91
+ [ "$action" = update ] || [ -n "$version" ] || usage
89
92
  ;;
90
93
  rollback) [ $# -eq 2 ] || usage ;;
91
94
  *) usage ;;
@@ -354,6 +357,17 @@ core_status() {
354
357
  echo "core ${current:-not installed}${previous:+, previous $previous}, newest on npm ${latest:-unknown}"
355
358
  }
356
359
 
360
+ # Picks the signers file: root's copy, or on the first install the one named with --signers.
361
+ pick_signers() {
362
+ if [ -f "$SIGNERS" ]; then
363
+ [ -z "$signers_arg" ] || /usr/bin/cmp -s "$signers_arg" "$SIGNERS" || fail "$SIGNERS exists and differs from $signers_arg; replace it by hand when the signing key changes"
364
+ signers=$SIGNERS
365
+ else
366
+ [ -n "$signers_arg" ] && [ -f "$signers_arg" ] || fail "no $SIGNERS yet: the first install needs --signers <the repo's allowed_signers>"
367
+ signers=$signers_arg
368
+ fi
369
+ }
370
+
357
371
  core_update() {
358
372
  require_root
359
373
  check_root_dir /
@@ -362,13 +376,7 @@ core_update() {
362
376
  ensure_root_dir /usr/local/libexec
363
377
  ensure_root_dir "$BASE"
364
378
  ensure_root_dir "$BASE/versions"
365
- if [ -f "$SIGNERS" ]; then
366
- [ -z "$signers_arg" ] || /usr/bin/cmp -s "$signers_arg" "$SIGNERS" || fail "$SIGNERS exists and differs from $signers_arg; replace it by hand when the signing key changes"
367
- signers=$SIGNERS
368
- else
369
- [ -n "$signers_arg" ] && [ -f "$signers_arg" ] || fail "no $SIGNERS yet: the first install needs --signers <the repo's allowed_signers>"
370
- signers=$signers_arg
371
- fi
379
+ pick_signers
372
380
  current=$(link_version current)
373
381
  if [ -z "$version" ]; then
374
382
  version=$(latest_version)
@@ -400,7 +408,23 @@ core_update() {
400
408
  /bin/chmod 0755 "$target.new/cli/astrogate.sh" "$target.new/cli/verify-release.sh"
401
409
  /bin/rm -rf "$target"
402
410
  /bin/mv "$target.new" "$target"
403
- # Every tool the new core pins is in place before anything switches.
411
+ # The checked version's own code finishes, so a release's new install steps apply to itself.
412
+ /bin/rm -rf "$work"
413
+ trap - EXIT HUP INT TERM
414
+ exec /bin/sh "$target/cli/astrogate.sh" core activate "$version" ${signers_arg:+--signers "$signers_arg"}
415
+ }
416
+
417
+ # The second half of core update, run from the checked version it activates: every tool that
418
+ # version pins is in place before anything switches.
419
+ core_activate() {
420
+ require_root
421
+ pick_signers
422
+ target=$BASE/versions/$version
423
+ [ "$HERE" = "$target/cli" ] || fail "core activate runs only from the version it activates"
424
+ check_root_dir "$target"
425
+ current=$(link_version current)
426
+ [ "$version" != "$current" ] || fail "core $version is current already"
427
+ make_work
404
428
  stage_tools "$target"
405
429
  switch_to "$version"
406
430
  link_tools "$BASE/current"
@@ -515,6 +539,7 @@ doctor() {
515
539
  case "$action" in
516
540
  status) core_status ;;
517
541
  update) core_update ;;
542
+ activate) core_activate ;;
518
543
  rollback) core_rollback ;;
519
544
  tools) tools_status ;;
520
545
  doctor) doctor ;;
@@ -44,6 +44,9 @@ describe("astrogate", () => {
44
44
  [["core", "update", "--signers", ""]],
45
45
  [["core", "update", "--signers", "a", "--signers", "b"]],
46
46
  [["core", "rollback", "1.2.3"]],
47
+ [["core", "activate"]],
48
+ [["core", "activate", "--signers", "x"]],
49
+ [["core", "activate", "1.2"]],
47
50
  [["doctor", "now"]],
48
51
  [["tools", "now"]],
49
52
  [["update"]],
@@ -53,7 +56,7 @@ describe("astrogate", () => {
53
56
  expect(result.stderr).toMatch(/^usage: astrogate/);
54
57
  });
55
58
 
56
- it.runIf(isMac && !isRoot).each([["update"], ["update", "1.2.3", "--signers", "x"], ["rollback"]])("refuses core %s without root", (...args) => {
59
+ it.runIf(isMac && !isRoot).each([["update"], ["update", "1.2.3", "--signers", "x"], ["rollback"], ["activate", "1.2.3"]])("refuses core %s without root", (...args) => {
57
60
  const result = astrogate("core", ...args);
58
61
  expect(result.status).toBe(1);
59
62
  expect(result.stderr).toContain("run it as root: sudo astrogate core");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrofoundry/astrogate",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Astrogate core: isolated agent workspaces with specialists, a foreman, and chat bridges, for the pi coding agent and Claude Code.",
5
5
  "packageManager": "pnpm@12.23.0",
6
6
  "scripts": {
package/release.sha256 CHANGED
@@ -3,8 +3,8 @@ b9b0f9fa90b9a230157de1fefef1aa5a624bfd7b50527b67ad86ecc62414aadb agents/foreman
3
3
  4091f50a5a9ff72e2f1571c6de054d9c891dbe294aa58e6a55ad9a1bff2f766a cli/astro-install.sh
4
4
  9f371247fdaea09e1551f940fd91eacb7d242baea343fce66f12fc8e22ba064b cli/astro.sh
5
5
  8e054f8286876b77e0887d0b0e2a62d4a048fd41bfa0048d126e0c9171869cf6 cli/astro.test.ts
6
- cc09e939b079cea163f5a88e5e3d67ff98e3c5e617cdb7cb40ae2bfc10c240da cli/astrogate.sh
7
- f32adea3492890fbb5c03a1b4a1bf1e55d37978141d3f7c684d77b3aa705914c cli/astrogate.test.ts
6
+ 01882995b53a4f528f39668c50256533c8b6aef1f882dbf7d4cd1ec82ff9969f cli/astrogate.sh
7
+ 1f8a0d0914b30582793399cf16cebcf6266d3c716f5925919073d2c7e85c4c6e cli/astrogate.test.ts
8
8
  07b9aef7e5d0ee43959e0c16e00ec3a202769c94faea4167257513bf15b9383c cli/verify-release.sh
9
9
  29614fd0eb1ad08215baf827b00ee2b98ccb73ca0ccf770bc5a0084c71da5926 cli/verify-release.test.ts
10
10
  369bc39629e3997f35ea22a4ba4d37f84da52c60ca3bf6fa5c623861a1a58329 dist/bridge.js
@@ -69,7 +69,7 @@ e76423d9c09263e064e48e6608c6eb07f70bc350841153f7c251376b8b424dc6 extensions/sub
69
69
  484c52d2e9d93dbe4aec878b5afc494f0076f5b79b5f4d24423933b39913bc3b harness/claude/main.ts
70
70
  e1d07bd981bd4ff6385246b6c1ad41349718c1e490b2bff675291dc7b568cd69 harness/claude/mcp.ts
71
71
  194b623038d56a2565ad42d30d1db72ca453e654bfc84996800362e8a972282b harness/claude/settings.ts
72
- df7a19e52965cab6b1f2d8b61087ca082efd7273e145206c5f9e85409e3fba89 package.json
72
+ b8421028591e11d11d3d96c368259d248bbe73afebdcdc81ae17ac87a9a77cc8 package.json
73
73
  642383b14db5dbfb7caa6a185591263e4294a73323bf4c78606f7b85f0817fd0 specialists/AGENTS.md
74
74
  a385cf5e3b59de30b5ed9b0840d6cf6198b577668f18dfd5de13a714fb047c3e specialists/README.md
75
75
  729f8c29d7cf716be5b01d5df869eeda6d4683f86a4915a52fb8adfdebe1f9d2 specialists/entry/specialist-cli.sh
@@ -1,6 +1,6 @@
1
1
  -----BEGIN SSH SIGNATURE-----
2
2
  U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgUteIwPdKqPwfNc4vHQPUE+JWMC
3
3
  nmuMUwttLeX5wtyIoAAAAOYXN0cm9nYXRlLWNvcmUAAAAAAAAABnNoYTUxMgAAAFMAAAAL
4
- c3NoLWVkMjU1MTkAAABAT9XJeDq5pjTkKw2BsXczy1z+M0gF/+I8QF8BZgYM7+8j7IAtqJ
5
- bosolZ798rX+LPeMbMe1q2DCngFQOdExI9Dw==
4
+ c3NoLWVkMjU1MTkAAABADRbtpiE2hBqARrEoR/Oq9VAmfIegWxcu1WKsiaZzhkkZkP7n72
5
+ XnZmHDgxR+wZjWHd9zdzsbs8afnXj4JLVkDw==
6
6
  -----END SSH SIGNATURE-----