@stage-labs/metro 0.1.0-beta.200 → 0.1.0-beta.201

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stage-labs/metro",
3
- "version": "0.1.0-beta.200",
3
+ "version": "0.1.0-beta.201",
4
4
  "description": "The metro command line. Sign in once per machine, then hand your MCP connector list to Claude Code without the credentials touching disk, argv or shell history.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro",
3
- "version": "0.1.0-beta.200",
3
+ "version": "0.1.0-beta.201",
4
4
  "description": "Metro for Claude Code, installed by the metro daemon on this machine: every connector the agent holds as its own MCP server relayed through the daemon, the orchestrator-only guard on the main thread, and the standing rules loaded at each session start. No vendor credential ever sits in a config file.",
5
5
  "author": {
6
6
  "name": "Bonustrack",
@@ -1,6 +1,8 @@
1
1
  import { spawn, spawnSync } from 'node:child_process';
2
2
  import { existsSync, readFileSync } from './agent-fs.js';
3
3
  import { join } from 'node:path';
4
+ import { chmodSync } from 'node:fs';
5
+ import { homedir } from 'node:os';
4
6
  import { errMsg, log } from '@metro-labs/core/log';
5
7
  import { isRecord } from '@metro-labs/core/is-record';
6
8
  import { copyIntoHome } from './home-fs.js';
@@ -19,9 +21,15 @@ function run(file: string, args: string[]): void {
19
21
  if (done.status !== 0) throw new Error(`${file} ${args.join(' ')}: ${done.stderr.trim() || `exit ${String(done.status)}`}`);
20
22
  }
21
23
 
24
+ function openMetroHome(): void {
25
+ chmodSync(homedir(), 0o711);
26
+ chmodSync(join(homedir(), '.metro'), 0o700);
27
+ }
28
+
22
29
  function ensureUser(): AgentUser | null {
23
30
  if (runningAsMetro()) {
24
31
  mustHelper(['ensure-agent']);
32
+ openMetroHome();
25
33
  forgetAgentUser();
26
34
  const user = agentUser();
27
35
  if (user !== null) run(...asUser(user, 'chmod', ['711', user.home]));
@@ -87,7 +87,7 @@ export function moveScript(port: string, spec: string, bun: string): string {
87
87
  'echo moving > "$DIR/state"',
88
88
  `id ${METRO_USER} >/dev/null 2>&1 || useradd --system --create-home --home-dir ${METRO_HOME} --shell /usr/sbin/nologin ${METRO_USER} || fail "useradd"`,
89
89
  `usermod -aG systemd-journal ${METRO_USER} || true`,
90
- `mkdir -p ${METRO_HOME} && chown ${METRO_USER}:${METRO_USER} ${METRO_HOME} && chmod 700 ${METRO_HOME}`,
90
+ `mkdir -p ${METRO_HOME} && chown ${METRO_USER}:${METRO_USER} ${METRO_HOME} && chmod 711 ${METRO_HOME}`,
91
91
  `B=${shellWord(bun)}; case "$B" in /root/*) install -m 755 "$B" /usr/local/bin/bun || fail "bun";; esac`,
92
92
  `su -s /bin/sh ${METRO_USER} -c ${shellWord(`cd / && npm install --global --prefix ${PREFIX} ${spec}`)} || fail "npm install for ${METRO_USER}"`,
93
93
  `for bin in node bun tailscale npm; do su -s /bin/sh ${METRO_USER} -c ${shellWord(`PATH=${PREFIX}/bin:/usr/local/bin:/usr/bin:/bin command -v "$1" >/dev/null`)} sh "$bin" || fail "${METRO_USER} cannot find $bin"; done`,
@@ -97,7 +97,7 @@ export function moveScript(port: string, spec: string, bun: string): string {
97
97
  'if [ -e "$NEW" ]; then mv "$NEW" "$NEW.old-$(date +%s)"; fi',
98
98
  'mv "$OLD" "$NEW" || { systemctl start metro; fail "move"; }',
99
99
  'rm -f "$NEW/runtime/runtime.json"',
100
- `chown -R ${METRO_USER}:${METRO_USER} ${METRO_HOME}`,
100
+ `chown -R ${METRO_USER}:${METRO_USER} ${METRO_HOME} && chmod 711 ${METRO_HOME} && chmod 700 "$NEW"`,
101
101
  `install -m 644 "$DIR/metro.service.new" ${UNIT_FILE}`,
102
102
  'systemctl daemon-reload && systemctl start metro',
103
103
  `if healthy ${METRO_USER}; then echo done > "$DIR/state"; echo "metro runs as ${METRO_USER}"; exit 0; fi`,
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.1.0-beta.200"
2
+ "version": "0.1.0-beta.201"
3
3
  }