@crewhaus/harness-registry 0.8.0 → 0.8.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 +15 -1
- package/dist/hangar-root.d.ts +24 -0
- package/dist/hangar-root.js +60 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,15 @@ Pure registry-file layer by design: it never parses specs (callers supply
|
|
|
14
14
|
|
|
15
15
|
- Registry root: the directory containing `harnesses.json` —
|
|
16
16
|
`CREWHAUS_REGISTRY_ROOT`, default `~/.crewhaus`. An explicit `root`
|
|
17
|
-
option wins over the env var.
|
|
17
|
+
option wins over the env var. The runtime-state floor protects the file
|
|
18
|
+
there and `~/.crewhaus/harnesses.json` always (`registryStateFiles`).
|
|
19
|
+
- Hangar root: where Hangar (`crewhaus hangar`) keeps its token, settings,
|
|
20
|
+
cache and job ledger — `CREWHAUS_HANGAR_ROOT`, else
|
|
21
|
+
`<registryRoot>/hangar`, so `~/.crewhaus/hangar` by default. The CLI, the
|
|
22
|
+
fleet tools and the runtime-state floor all resolve it with this package's
|
|
23
|
+
`resolveHangarRoot`. The floor protects every Hangar root the run's
|
|
24
|
+
environment names and `~/.crewhaus/hangar` always, so these two variables
|
|
25
|
+
can add a protected root and never move one.
|
|
18
26
|
- `CREWHAUS_NO_REGISTRY=1` — global opt-out: every write becomes a no-op
|
|
19
27
|
while reads keep working.
|
|
20
28
|
|
|
@@ -66,6 +74,12 @@ registerHook, seedFromWatchme }`.
|
|
|
66
74
|
self-registration entry point for CLI hooks: it never throws (any failure
|
|
67
75
|
collapses into `{ ok: false }`, because a registry write must never fail
|
|
68
76
|
the command that triggered it) and respects `CREWHAUS_NO_REGISTRY`.
|
|
77
|
+
- `resolveRegistryRoot(env?)` and `resolveHangarRoot(env?)` return the two
|
|
78
|
+
roots above for an environment (default `process.env`).
|
|
79
|
+
- `hangarStateRoots(env?)` lists every Hangar root that environment names,
|
|
80
|
+
absolute and without repeats: `resolveHangarRoot(env)`,
|
|
81
|
+
`<registryRoot>/hangar` and `~/.crewhaus/hangar`. It is the list the
|
|
82
|
+
runtime-state floor protects.
|
|
69
83
|
|
|
70
84
|
## watchme interop
|
|
71
85
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Hangar root: `CREWHAUS_HANGAR_ROOT` when it is set and not empty,
|
|
3
|
+
* resolved to an absolute path, else `<registryRoot>/hangar` — which is the
|
|
4
|
+
* server's own `~/.crewhaus/hangar` default under the default registry root,
|
|
5
|
+
* and keeps everything under one temp root in tests.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveHangarRoot(env?: Readonly<Record<string, string | undefined>>): string;
|
|
8
|
+
/**
|
|
9
|
+
* Every Hangar root `env` can name, absolute and without repeats, in this
|
|
10
|
+
* order: the one {@link resolveHangarRoot} picks, `<registryRoot>/hangar`,
|
|
11
|
+
* and `~/.crewhaus/hangar` always. The runtime-state floor protects each of
|
|
12
|
+
* them, so a variable set for a run adds a protected directory and never
|
|
13
|
+
* takes the default's protection away. No link is followed here: the runtime
|
|
14
|
+
* adds the other spellings of each root.
|
|
15
|
+
*/
|
|
16
|
+
export declare function hangarStateRoots(env?: Readonly<Record<string, string | undefined>>): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The registry files `env` can name, absolute and without repeats:
|
|
19
|
+
* `<registryRoot>/harnesses.json`, and `~/.crewhaus/harnesses.json` always. The
|
|
20
|
+
* runtime-state floor protects each, so `CREWHAUS_REGISTRY_ROOT` adds a
|
|
21
|
+
* protected file and never takes the default's protection away. No link is
|
|
22
|
+
* followed here: the runtime adds the other spellings of each.
|
|
23
|
+
*/
|
|
24
|
+
export declare function registryStateFiles(env?: Readonly<Record<string, string | undefined>>): string[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Hangar root: the directory where Hangar (`crewhaus hangar`) keeps its own
|
|
3
|
+
* files — its token, its settings, its cache and its job ledger.
|
|
4
|
+
*
|
|
5
|
+
* One resolver serves the CLI, the fleet tools and the runtime-state floor,
|
|
6
|
+
* so the console, the tools that read its ledger and the floor that keeps an
|
|
7
|
+
* agent's tools out of it always name the same directory.
|
|
8
|
+
*
|
|
9
|
+
* The floor protects every Hangar root the run's environment names, and the
|
|
10
|
+
* default (`~/.crewhaus/hangar`) always: these two variables,
|
|
11
|
+
* `CREWHAUS_HANGAR_ROOT` and `CREWHAUS_REGISTRY_ROOT`, can add a protected
|
|
12
|
+
* root and never move one. The default comes from the home directory
|
|
13
|
+
* (`homedir()`), as the server's own fallback does.
|
|
14
|
+
*/
|
|
15
|
+
import { homedir } from "node:os";
|
|
16
|
+
import { join, resolve } from "node:path";
|
|
17
|
+
import { REGISTRY_FILENAME } from "./doc.js";
|
|
18
|
+
import { resolveRegistryRoot } from "./registry.js";
|
|
19
|
+
/**
|
|
20
|
+
* The Hangar root: `CREWHAUS_HANGAR_ROOT` when it is set and not empty,
|
|
21
|
+
* resolved to an absolute path, else `<registryRoot>/hangar` — which is the
|
|
22
|
+
* server's own `~/.crewhaus/hangar` default under the default registry root,
|
|
23
|
+
* and keeps everything under one temp root in tests.
|
|
24
|
+
*/
|
|
25
|
+
export function resolveHangarRoot(env = process.env) {
|
|
26
|
+
const explicit = env["CREWHAUS_HANGAR_ROOT"];
|
|
27
|
+
if (explicit !== undefined && explicit !== "")
|
|
28
|
+
return resolve(explicit);
|
|
29
|
+
return join(resolveRegistryRoot(env), "hangar");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Every Hangar root `env` can name, absolute and without repeats, in this
|
|
33
|
+
* order: the one {@link resolveHangarRoot} picks, `<registryRoot>/hangar`,
|
|
34
|
+
* and `~/.crewhaus/hangar` always. The runtime-state floor protects each of
|
|
35
|
+
* them, so a variable set for a run adds a protected directory and never
|
|
36
|
+
* takes the default's protection away. No link is followed here: the runtime
|
|
37
|
+
* adds the other spellings of each root.
|
|
38
|
+
*/
|
|
39
|
+
export function hangarStateRoots(env = process.env) {
|
|
40
|
+
const roots = [
|
|
41
|
+
resolveHangarRoot(env),
|
|
42
|
+
join(resolveRegistryRoot(env), "hangar"),
|
|
43
|
+
join(homedir(), ".crewhaus", "hangar"),
|
|
44
|
+
];
|
|
45
|
+
return [...new Set(roots.map((root) => resolve(root)))];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The registry files `env` can name, absolute and without repeats:
|
|
49
|
+
* `<registryRoot>/harnesses.json`, and `~/.crewhaus/harnesses.json` always. The
|
|
50
|
+
* runtime-state floor protects each, so `CREWHAUS_REGISTRY_ROOT` adds a
|
|
51
|
+
* protected file and never takes the default's protection away. No link is
|
|
52
|
+
* followed here: the runtime adds the other spellings of each.
|
|
53
|
+
*/
|
|
54
|
+
export function registryStateFiles(env = process.env) {
|
|
55
|
+
const files = [
|
|
56
|
+
join(resolveRegistryRoot(env), REGISTRY_FILENAME),
|
|
57
|
+
join(homedir(), ".crewhaus", REGISTRY_FILENAME),
|
|
58
|
+
];
|
|
59
|
+
return [...new Set(files.map((file) => resolve(file)))];
|
|
60
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,5 +15,6 @@
|
|
|
15
15
|
* API.
|
|
16
16
|
*/
|
|
17
17
|
export { HARNESS_ID_RE, REGISTRY_FILENAME } from "./doc.js";
|
|
18
|
+
export { hangarStateRoots, registryStateFiles, resolveHangarRoot } from "./hangar-root.js";
|
|
18
19
|
export { openHangarRegistry, registerHarnessHook, resolveRegistryRoot, sortGroupMembers, type HangarRegistry, type ListOptions, type OpenHangarRegistryOptions, type RegisterHookFields, type RegisterHookResult, type UpsertFields, } from "./registry.js";
|
|
19
20
|
export type { GroupDef, HangarHarnessEntry, HangarRegistryDoc, HarnessKind, HarnessOrigin, ScanRoot, } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,5 @@
|
|
|
15
15
|
* API.
|
|
16
16
|
*/
|
|
17
17
|
export { HARNESS_ID_RE, REGISTRY_FILENAME } from "./doc.js";
|
|
18
|
+
export { hangarStateRoots, registryStateFiles, resolveHangarRoot } from "./hangar-root.js";
|
|
18
19
|
export { openHangarRegistry, registerHarnessHook, resolveRegistryRoot, sortGroupMembers, } from "./registry.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewhaus/harness-registry",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Machine-wide harness registry (harnesses.json v2) — stable hrn_ ids, groups/tags/pins, scan roots, missing-dir stamping, and watchme registry interop behind the harness manager",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"test": "bun test src"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@crewhaus/watchme-store": "0.8.
|
|
19
|
+
"@crewhaus/watchme-store": "0.8.2"
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"author": {
|