@crvouga/homelab 0.27.0 → 0.27.1
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/bootstrap/shell-path.ts +27 -43
- package/docs/machine-setup.md +11 -0
- package/package.json +2 -2
package/bootstrap/shell-path.ts
CHANGED
|
@@ -25,7 +25,7 @@ export function miseDataDir(
|
|
|
25
25
|
|
|
26
26
|
function persistWindowsPath(bin: string, shims: string): void {
|
|
27
27
|
const script =
|
|
28
|
-
"$paths = @($env:
|
|
28
|
+
"$paths = @($env:WORKSPACE_TOOL_BIN, $env:WORKSPACE_TOOL_SHIMS); $old = [Environment]::GetEnvironmentVariable('Path', 'User'); $new = (($paths + ($old -split ';') | Where-Object { $_ } | Select-Object -Unique) -join ';'); [Environment]::SetEnvironmentVariable('Path', $new, 'User')";
|
|
29
29
|
const result = spawnSync(
|
|
30
30
|
'powershell.exe',
|
|
31
31
|
['-NoProfile', '-Command', script],
|
|
@@ -50,20 +50,9 @@ export function configurePosixShellPath(
|
|
|
50
50
|
home = homedir(),
|
|
51
51
|
zdotdir = process.env['ZDOTDIR'] || home
|
|
52
52
|
): void {
|
|
53
|
-
// Earlier releases put a worker's agent launchers before the shims; what
|
|
54
|
-
// they wrote is removed wherever it stands.
|
|
55
|
-
const agents = join(
|
|
56
|
-
home,
|
|
57
|
-
'.local',
|
|
58
|
-
'share',
|
|
59
|
-
'personal',
|
|
60
|
-
'fleet',
|
|
61
|
-
'agent-commands'
|
|
62
|
-
);
|
|
63
53
|
const quote = (value: string) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
64
|
-
const paths = quote(`${
|
|
65
|
-
const
|
|
66
|
-
const block = `# homelab toolchain\ncase ":$PATH:" in\n *${quote(`:${shims}:${bin}:`)}*) ;;\n *) export PATH=${paths}:"$PATH" ;;\nesac`;
|
|
54
|
+
const paths = quote(`${bin}:${shims}`);
|
|
55
|
+
const block = `# homelab toolchain\ncase ":$PATH:" in\n *${quote(`:${bin}:${shims}:`)}*) ;;\n *) export PATH=${paths}:"$PATH" ;;\nesac`;
|
|
67
56
|
const targets = new Set([
|
|
68
57
|
join(home, '.profile'),
|
|
69
58
|
...['.bash_profile', '.bash_login']
|
|
@@ -73,41 +62,27 @@ export function configurePosixShellPath(
|
|
|
73
62
|
join(zdotdir, '.zshenv'),
|
|
74
63
|
join(zdotdir, '.zshrc'),
|
|
75
64
|
]);
|
|
76
|
-
// Version managers and vendor installers (nvm, a native Claude installer's
|
|
77
|
-
// ~/.local/bin) prepend their own directories later in these files; the
|
|
78
|
-
// last line puts the pinned shims back in front, so every shell and the
|
|
79
|
-
// apps that inherit its PATH (T3) run the locked tool versions.
|
|
80
|
-
// Guarded like the block above so nested shells do not grow PATH.
|
|
81
|
-
const unguarded = `${TAIL_MARKER}\nexport PATH=${quote(shims)}:"$PATH"\n`;
|
|
82
|
-
const agentsFirst = (marker: string) =>
|
|
83
|
-
`${marker}\nif [ -d ${quote(agents)} ]; then\n case "$PATH" in\n ${quote(agents)}:*) ;;\n *) export PATH=${quote(agents)}:"$PATH" ;;\n esac\nfi\n`;
|
|
84
|
-
const earlierHead = `${block}\n${agentsFirst(AGENTS_MARKER)}`;
|
|
85
|
-
const shimsOnly = `${TAIL_MARKER}\ncase "$PATH" in\n ${quote(shims)}:*) ;;\n *) export PATH=${quote(shims)}:"$PATH" ;;\nesac\n`;
|
|
86
|
-
const earlierTail = `${TAIL_MARKER}\ncase "$PATH" in\n ${quote(shims)}:*|${quote(agents)}:${quote(shims)}:*) ;;\n *) export PATH=${quote(shims)}:"$PATH" ;;\nesac\n${agentsFirst(AGENTS_TAIL_MARKER)}`;
|
|
87
|
-
const head = block;
|
|
88
|
-
const tail = shimsOnly;
|
|
89
65
|
for (const path of targets) {
|
|
90
66
|
const current = existsSync(path) ? readFileSync(path, 'utf8') : '';
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
`${block}\n`,
|
|
96
|
-
legacy,
|
|
97
|
-
shimsOnly,
|
|
98
|
-
unguarded,
|
|
99
|
-
].reduce((text, earlier) => text.split(earlier).join(''), current);
|
|
100
|
-
const next = `${head}\n${body.replace(/\n*$/, '\n')}${tail}`;
|
|
67
|
+
const body = removeManagedPathBlocks(current);
|
|
68
|
+
// User/vendor PATH edits later in the file keep their precedence. Never
|
|
69
|
+
// force retired harness shims in front of an externally installed CLI.
|
|
70
|
+
const next = `${block}\n${body.replace(/\n*$/, '\n')}`;
|
|
101
71
|
if (next === current) continue;
|
|
102
72
|
mkdirSync(dirname(path), { recursive: true });
|
|
103
73
|
writeFileSync(path, next);
|
|
104
74
|
}
|
|
105
75
|
}
|
|
106
76
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
77
|
+
/** Remove complete blocks written by this toolchain and its earlier names,
|
|
78
|
+
* including old launcher precedence. Leave unmarked user configuration alone.
|
|
79
|
+
*/
|
|
80
|
+
function removeManagedPathBlocks(text: string): string {
|
|
81
|
+
return text.replace(
|
|
82
|
+
/^# (?:homelab toolchain|dev-fleet toolchain|crvouga\/workspace toolchain|pinned tool shims first \((?:homelab|dev-fleet|crvouga\/workspace), keep this last\)|a worker's agent commands(?: before them)? \((?:homelab|dev-fleet)(?:, keep this last)?\))\n(?:export PATH=[^\n]*\n?|case [\s\S]*?^esac\n?|if [\s\S]*?^fi\n?)/gm,
|
|
83
|
+
''
|
|
84
|
+
);
|
|
85
|
+
}
|
|
111
86
|
|
|
112
87
|
export function configureShellPath(): void {
|
|
113
88
|
const bin = join(homedir(), '.local', 'bin');
|
|
@@ -119,8 +94,17 @@ export function configureShellPath(): void {
|
|
|
119
94
|
configurePosixShellPath(bin, shims);
|
|
120
95
|
const fishQuote = (value: string) =>
|
|
121
96
|
`'${value.replaceAll('\\', '\\\\').replaceAll("'", "\\'")}'`;
|
|
97
|
+
const fish = join(homedir(), '.config/fish/config.fish');
|
|
98
|
+
if (existsSync(fish)) {
|
|
99
|
+
const current = readFileSync(fish, 'utf8');
|
|
100
|
+
const next = current.replace(
|
|
101
|
+
/^# (?:homelab|dev-fleet|crvouga\/workspace) toolchain\nfish_add_path --prepend [^\n]*\n?/gm,
|
|
102
|
+
''
|
|
103
|
+
);
|
|
104
|
+
if (next !== current) writeFileSync(fish, next);
|
|
105
|
+
}
|
|
122
106
|
appendOnce(
|
|
123
|
-
|
|
124
|
-
`# homelab toolchain\nfish_add_path --prepend ${fishQuote(
|
|
107
|
+
fish,
|
|
108
|
+
`# homelab toolchain\nfish_add_path --prepend ${fishQuote(bin)} ${fishQuote(shims)}`
|
|
125
109
|
);
|
|
126
110
|
}
|
package/docs/machine-setup.md
CHANGED
|
@@ -483,3 +483,14 @@ cannot bind one address is held to the tailnet with `tailnetOnlyPorts`. See
|
|
|
483
483
|
The source-owned `worker-auth.ts` timer renews the worker's existing Vault token
|
|
484
484
|
and can restore the declared GitHub account from its authorized Vault service
|
|
485
485
|
credential, without copying another machine's login directory.
|
|
486
|
+
|
|
487
|
+
## Handing agent commands to their external owner
|
|
488
|
+
|
|
489
|
+
Shell setup removes historical homelab, dev-fleet and workspace PATH blocks,
|
|
490
|
+
places the user bin directory ahead of mise shims, and preserves later vendor
|
|
491
|
+
PATH additions. Coding-agent executables and credentials belong to T3 Code or
|
|
492
|
+
the chosen meta-harness. A removed mise pin does not install a replacement:
|
|
493
|
+
verify the external owner's command from home and a project before removing
|
|
494
|
+
the old installation. Restart login shells after migrating PATH; restart a
|
|
495
|
+
background app only after its active turns have drained. Run setup on the
|
|
496
|
+
manager and every worker to migrate their shell files.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/homelab",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"description": "Keeps a set of development machines in sync: one manager and many workers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github:crvouga/homelab",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=22"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "14c34c8ca19a7151da17ad834da001074df8951c",
|
|
77
77
|
"gitCommittedAt": "2026-12-03"
|
|
78
78
|
}
|