spell the root derivation as resolve rather than dirname

resolve(process.cwd(), '..') instead of dirname(process.cwd()). Identical on
every input — checked including trailing slash and filesystem root — and it reads
as the path arithmetic it is. resolve was already imported here for SEED_PATH.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-12 23:23:10 +00:00
co-authored by Claude Opus 5
parent 3f071c0b24
commit 3bc06bba3c
+3 -3
View File
@@ -1,4 +1,4 @@
import { dirname, join, resolve } from 'node:path'; import { join, resolve } from 'node:path';
import { chmodSync, mkdirSync, readFileSync } from 'node:fs'; import { chmodSync, mkdirSync, readFileSync } from 'node:fs';
import { homedir } from 'node:os'; import { homedir } from 'node:os';
@@ -20,7 +20,7 @@ import { homedir } from 'node:os';
// This depends on the working directory being the repo, which is why pm2 pins `cwd` in // This depends on the working directory being the repo, which is why pm2 pins `cwd` in
// ecosystem.profile.cjs — read the comment there before changing either. `assertInstallLayout` below // ecosystem.profile.cjs — read the comment there before changing either. `assertInstallLayout` below
// is the check that says so out loud instead of silently writing to the wrong place. // is the check that says so out loud instead of silently writing to the wrong place.
export const OFFICER_ROOT = dirname(process.cwd()); export const OFFICER_ROOT = resolve(process.cwd(), '..');
export const DATA_PATH = join(OFFICER_ROOT, 'data'); export const DATA_PATH = join(OFFICER_ROOT, 'data');
@@ -32,7 +32,7 @@ export const OFFICER_ITEMS_DIR = join(OFFICER_ROOT, 'capabilities');
* Refuse to boot when the working directory is not the platform repo. * Refuse to boot when the working directory is not the platform repo.
* *
* Same posture as `assertCapabilityTotality` and `assertSecretsClosed`: a prerequisite that silently * Same posture as `assertCapabilityTotality` and `assertSecretsClosed`: a prerequisite that silently
* not holding is worse than one that fails. Every path in this file hangs off `dirname(process.cwd())`, * not holding is worse than one that fails. Every path in this file hangs off `resolve(process.cwd(), '..')`,
* so a process started from the wrong directory does not error — it computes a plausible root somewhere * so a process started from the wrong directory does not error — it computes a plausible root somewhere
* else and writes managed homes, capabilities and agent runs into it. The install looks empty and the * else and writes managed homes, capabilities and agent runs into it. The install looks empty and the
* data looks lost, with nothing naming the cause. * data looks lost, with nothing naming the cause.