ghostrail 0.14.0 → 0.15.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/README.md +2 -2
- package/dist/board/server.d.ts +9 -2
- package/dist/board/server.d.ts.map +1 -1
- package/dist/board/server.js +10 -3
- package/dist/board/server.js.map +1 -1
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +160 -13
- package/dist/cli/commands.js.map +1 -1
- package/dist/commands/help.js +3 -3
- package/dist/commands/help.js.map +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +7 -5
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +15 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +5 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/dashboard/server.d.ts +2 -2
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +8 -4
- package/dist/dashboard/server.js.map +1 -1
- package/dist/factory/build.d.ts +22 -2
- package/dist/factory/build.d.ts.map +1 -1
- package/dist/factory/build.js +11 -6
- package/dist/factory/build.js.map +1 -1
- package/dist/factory/checkout.d.ts +41 -0
- package/dist/factory/checkout.d.ts.map +1 -0
- package/dist/factory/checkout.js +90 -0
- package/dist/factory/checkout.js.map +1 -0
- package/dist/factory/state.d.ts +85 -0
- package/dist/factory/state.d.ts.map +1 -0
- package/dist/factory/state.js +157 -0
- package/dist/factory/state.js.map +1 -0
- package/dist/global/index.d.ts +3 -1
- package/dist/global/index.d.ts.map +1 -1
- package/dist/global/index.js +3 -1
- package/dist/global/index.js.map +1 -1
- package/dist/global/registry.d.ts +84 -5
- package/dist/global/registry.d.ts.map +1 -1
- package/dist/global/registry.js +101 -14
- package/dist/global/registry.js.map +1 -1
- package/dist/global/repo-id.d.ts +50 -0
- package/dist/global/repo-id.d.ts.map +1 -0
- package/dist/global/repo-id.js +149 -0
- package/dist/global/repo-id.js.map +1 -0
- package/dist/global/state-dir.d.ts +32 -0
- package/dist/global/state-dir.d.ts.map +1 -0
- package/dist/global/state-dir.js +43 -0
- package/dist/global/state-dir.js.map +1 -0
- package/dist/global/store.d.ts +2 -0
- package/dist/global/store.d.ts.map +1 -1
- package/dist/global/store.js.map +1 -1
- package/dist/loop/advice.d.ts +11 -0
- package/dist/loop/advice.d.ts.map +1 -0
- package/dist/loop/advice.js +48 -0
- package/dist/loop/advice.js.map +1 -0
- package/dist/loop/control.d.ts +15 -1
- package/dist/loop/control.d.ts.map +1 -1
- package/dist/loop/control.js +8 -1
- package/dist/loop/control.js.map +1 -1
- package/dist/loop/index.d.ts +1 -0
- package/dist/loop/index.d.ts.map +1 -1
- package/dist/loop/index.js +1 -0
- package/dist/loop/index.js.map +1 -1
- package/dist/service/manager.d.ts +2 -0
- package/dist/service/manager.d.ts.map +1 -1
- package/dist/service/manager.js +2 -1
- package/dist/service/manager.js.map +1 -1
- package/dist/service/unit.d.ts +16 -7
- package/dist/service/unit.d.ts.map +1 -1
- package/dist/service/unit.js +11 -7
- package/dist/service/unit.js.map +1 -1
- package/dist/store/file-store.d.ts +5 -18
- package/dist/store/file-store.d.ts.map +1 -1
- package/dist/store/file-store.js +1 -1
- package/dist/store/file-store.js.map +1 -1
- package/dist/store/index.d.ts +2 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js.map +1 -1
- package/dist/store/port.d.ts +53 -0
- package/dist/store/port.d.ts.map +1 -0
- package/dist/store/port.js +2 -0
- package/dist/store/port.js.map +1 -0
- package/package.json +1 -1
- package/skill/ghostrail/SKILL.md +2 -2
- package/templates/{code-local → code}/README.md +2 -2
- package/templates/{code-local → code}/ghostrail.toml +2 -2
- package/templates/{content-loop → content}/README.md +2 -2
- package/templates/{content-loop → content}/ghostrail.toml +1 -1
- /package/templates/{code-local → code}/prompts/resolve-issue.md +0 -0
- /package/templates/{code-local → code}/prompts/respond.md +0 -0
- /package/templates/{code-local → code}/prompts/triage.md +0 -0
- /package/templates/{content-loop → content}/prompts/draft.md +0 -0
- /package/templates/{content-loop → content}/prompts/respond.md +0 -0
|
@@ -10,7 +10,24 @@
|
|
|
10
10
|
export interface Ghostrail {
|
|
11
11
|
/** Display name, from `[factory].name` or the directory. Never an identity. */
|
|
12
12
|
name: string;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The repo this ghostrail is for, canonical (`host/owner/name`), or
|
|
15
|
+
* `local:<path>` for a repo with no usable remote. **This is the identity.**
|
|
16
|
+
*
|
|
17
|
+
* Optional only for backward compatibility: a registry written before repo
|
|
18
|
+
* identities existed has none, and an entry without one falls back to being
|
|
19
|
+
* keyed on its `path`, exactly as it was. This file is advertised as
|
|
20
|
+
* hand-editable, and refusing to read yesterday's one would be the worst
|
|
21
|
+
* possible reading of that promise.
|
|
22
|
+
*/
|
|
23
|
+
repo?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Absolute path to the checkout most recently used for this repo.
|
|
26
|
+
*
|
|
27
|
+
* A hint, for a human reading the file and for a local-worktree run that
|
|
28
|
+
* needs somewhere to make worktrees from. Not the identity: two checkouts of
|
|
29
|
+
* one repo are one ghostrail, which is the whole point of `repo`.
|
|
30
|
+
*/
|
|
14
31
|
path: string;
|
|
15
32
|
/** ISO date the entry was added, for the operator. Nothing reads it. */
|
|
16
33
|
added: string;
|
|
@@ -36,9 +53,10 @@ export declare const REGISTRY_FILE = "ghostrails.toml";
|
|
|
36
53
|
* than fatal, so a registry written by a later ghostrail still reads here.
|
|
37
54
|
* Order is preserved exactly, and the array is fresh on every call.
|
|
38
55
|
*
|
|
39
|
-
* Two entries
|
|
40
|
-
* registry never contains duplicate
|
|
41
|
-
* `
|
|
56
|
+
* Two entries for the same ghostrail are malformed for the same reason: a
|
|
57
|
+
* parsed registry never contains duplicate keys, which is what lets `upsert`
|
|
58
|
+
* and `findByKey` stay as simple as they are. The key is the repo identity, or
|
|
59
|
+
* the path for an entry written before identities existed.
|
|
42
60
|
*/
|
|
43
61
|
export declare function parseRegistry(toml: string): Ghostrail[] | undefined;
|
|
44
62
|
/**
|
|
@@ -51,13 +69,74 @@ export declare function parseRegistry(toml: string): Ghostrail[] | undefined;
|
|
|
51
69
|
* the header invites them to do.
|
|
52
70
|
*/
|
|
53
71
|
export declare function renderRegistry(entries: readonly Ghostrail[]): string;
|
|
72
|
+
/**
|
|
73
|
+
* What an entry is keyed on: its repo identity, or its path when it has none.
|
|
74
|
+
*
|
|
75
|
+
* One function so the parser, `findByKey`, and `upsert` cannot disagree about
|
|
76
|
+
* what "the same ghostrail" means, which is exactly the kind of drift that let
|
|
77
|
+
* two checkouts become two ghostrails in the first place.
|
|
78
|
+
*/
|
|
79
|
+
export declare function entryKey(entry: Ghostrail): string;
|
|
54
80
|
/** The entry at `path`, or undefined. Exact string equality; callers resolve first. */
|
|
55
81
|
export declare function findByPath(entries: readonly Ghostrail[], path: string): Ghostrail | undefined;
|
|
82
|
+
/** The entry for a repo identity (or a path, for an entry that has none). */
|
|
83
|
+
export declare function findByKey(entries: readonly Ghostrail[], key: string): Ghostrail | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* The entry for this repo, whether or not it knows its own identity yet.
|
|
86
|
+
*
|
|
87
|
+
* By identity first, then by path. The path fallback exists for one case: an
|
|
88
|
+
* entry written before identities did, which can never match a lookup by
|
|
89
|
+
* identity because its key *is* its path. Without it, registering a repo that
|
|
90
|
+
* is already registered appends a second entry, and two entries for one repo
|
|
91
|
+
* each get a service unit, which is the failure this whole change removes,
|
|
92
|
+
* arriving by way of the upgrade rather than a second clone.
|
|
93
|
+
*
|
|
94
|
+
* The order matters and is not interchangeable. Two checkouts of one repo must
|
|
95
|
+
* resolve to the identity match; falling to the path first would give each
|
|
96
|
+
* checkout its own answer again.
|
|
97
|
+
*/
|
|
98
|
+
export declare function findForRepo(entries: readonly Ghostrail[], repoId: string, path: string): Ghostrail | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* {@link findForRepo}, extended to recognise a legacy entry registered at a
|
|
101
|
+
* *different* checkout of the same repo.
|
|
102
|
+
*
|
|
103
|
+
* The pure version can only match a legacy entry by its path, so registering
|
|
104
|
+
* from a second checkout while the registry is still legacy would miss it and
|
|
105
|
+
* append: one repo, two entries, two units, which is the whole failure again.
|
|
106
|
+
* Deciding whether some other directory is the same repo means asking git what
|
|
107
|
+
* its origin is, so the resolver is injected rather than imported and this
|
|
108
|
+
* stays testable without a filesystem.
|
|
109
|
+
*
|
|
110
|
+
* Only legacy entries are resolved. One with an identity already answered for
|
|
111
|
+
* itself, and re-deriving it would turn a registry read into a subprocess per
|
|
112
|
+
* ghostrail. A path that no longer exists resolves to its own `local:` identity
|
|
113
|
+
* and simply does not match, so a deleted checkout cannot produce a false hit.
|
|
114
|
+
*/
|
|
115
|
+
export declare function findForRepoResolving(entries: readonly Ghostrail[], repoId: string, path: string, resolveRepoId: (path: string) => Promise<string>): Promise<Ghostrail | undefined>;
|
|
56
116
|
/**
|
|
57
|
-
* Add `entry`, or replace the one
|
|
117
|
+
* Add `entry`, or replace the one with the same identity.
|
|
118
|
+
*
|
|
119
|
+
* Keyed on the repo, so `init` in a second checkout of a known repo updates
|
|
120
|
+
* that ghostrail (adopting the new checkout as its `path`) instead of adding a
|
|
121
|
+
* second one. An entry with no identity still matches on path, so a
|
|
122
|
+
* pre-identity registry keeps working.
|
|
58
123
|
*
|
|
59
124
|
* A replacement keeps its position so a diff of the file shows a changed block
|
|
60
125
|
* rather than a move; a new entry appends. Neither argument is mutated.
|
|
61
126
|
*/
|
|
62
127
|
export declare function upsert(entries: readonly Ghostrail[], entry: Ghostrail): Ghostrail[];
|
|
128
|
+
/**
|
|
129
|
+
* Replace the entry keyed `previousKey` with `entry`, or append when there is
|
|
130
|
+
* none.
|
|
131
|
+
*
|
|
132
|
+
* Needed because adopting a legacy entry *changes its key*: it was keyed on its
|
|
133
|
+
* path, and gaining a repo identity re-keys it. `upsert` looks up by the new
|
|
134
|
+
* entry's own key, finds nothing, and appends, leaving one repo with two
|
|
135
|
+
* entries and therefore two service units. The caller already knows which entry
|
|
136
|
+
* it means, so it says so.
|
|
137
|
+
*
|
|
138
|
+
* A replacement keeps its position, so a diff of the file shows a changed block
|
|
139
|
+
* rather than a move. Neither argument is mutated.
|
|
140
|
+
*/
|
|
141
|
+
export declare function replaceEntry(entries: readonly Ghostrail[], previousKey: string, entry: Ghostrail): Ghostrail[];
|
|
63
142
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/global/registry.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,sCAAsC;AACtC,MAAM,WAAW,SAAS;IACxB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/global/registry.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,sCAAsC;AACtC,MAAM,WAAW,SAAS;IACxB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,uCAAuC;AACvC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AA2B/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,SAAS,CA4BnE;AAOD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAcpE;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEjD;AAED,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE7F;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE3F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,SAAS,EAAE,EAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,SAAS,GAAG,SAAS,CAKvB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,SAAS,SAAS,EAAE,EAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAC/C,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAQhC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,CAEnF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,SAAS,EAAE,EAC7B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,SAAS,GACf,SAAS,EAAE,CAMb"}
|
package/dist/global/registry.js
CHANGED
|
@@ -17,12 +17,15 @@ function isRecord(value) {
|
|
|
17
17
|
function parseEntry(raw) {
|
|
18
18
|
if (!isRecord(raw))
|
|
19
19
|
return undefined;
|
|
20
|
-
const { name, path, added, watch } = raw;
|
|
20
|
+
const { name, repo, path, added, watch } = raw;
|
|
21
21
|
if (typeof name !== "string" || typeof path !== "string")
|
|
22
22
|
return undefined;
|
|
23
23
|
if (typeof added !== "string" || typeof watch !== "boolean")
|
|
24
24
|
return undefined;
|
|
25
|
-
|
|
25
|
+
// Absent is legal (a pre-identity registry); present but not a string is not.
|
|
26
|
+
if (repo !== undefined && typeof repo !== "string")
|
|
27
|
+
return undefined;
|
|
28
|
+
return { name, ...(repo === undefined ? {} : { repo }), path, added, watch };
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Parse the registry, or undefined when it cannot be trusted.
|
|
@@ -38,9 +41,10 @@ function parseEntry(raw) {
|
|
|
38
41
|
* than fatal, so a registry written by a later ghostrail still reads here.
|
|
39
42
|
* Order is preserved exactly, and the array is fresh on every call.
|
|
40
43
|
*
|
|
41
|
-
* Two entries
|
|
42
|
-
* registry never contains duplicate
|
|
43
|
-
* `
|
|
44
|
+
* Two entries for the same ghostrail are malformed for the same reason: a
|
|
45
|
+
* parsed registry never contains duplicate keys, which is what lets `upsert`
|
|
46
|
+
* and `findByKey` stay as simple as they are. The key is the repo identity, or
|
|
47
|
+
* the path for an entry written before identities existed.
|
|
44
48
|
*/
|
|
45
49
|
export function parseRegistry(toml) {
|
|
46
50
|
let root;
|
|
@@ -58,18 +62,19 @@ export function parseRegistry(toml) {
|
|
|
58
62
|
if (!Array.isArray(raw))
|
|
59
63
|
return undefined;
|
|
60
64
|
const entries = [];
|
|
61
|
-
const
|
|
65
|
+
const keys = new Set();
|
|
62
66
|
for (const item of raw) {
|
|
63
67
|
const entry = parseEntry(item);
|
|
64
68
|
if (entry === undefined)
|
|
65
69
|
return undefined;
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
|
|
70
|
+
// Two blocks claiming one ghostrail is a contradiction rather than a
|
|
71
|
+
// preference to resolve. Copying a block and forgetting to change the repo
|
|
72
|
+
// is a plausible hand-edit, and honouring either one of them would silently
|
|
73
|
+
// ignore an edit the operator clearly meant.
|
|
74
|
+
const key = entryKey(entry);
|
|
75
|
+
if (keys.has(key))
|
|
71
76
|
return undefined;
|
|
72
|
-
|
|
77
|
+
keys.add(key);
|
|
73
78
|
entries.push(entry);
|
|
74
79
|
}
|
|
75
80
|
return entries;
|
|
@@ -91,6 +96,7 @@ export function renderRegistry(entries) {
|
|
|
91
96
|
const blocks = entries.map((entry) => [
|
|
92
97
|
"[[ghostrail]]",
|
|
93
98
|
`name = ${quote(entry.name)}`,
|
|
99
|
+
...(entry.repo === undefined ? [] : [`repo = ${quote(entry.repo)}`]),
|
|
94
100
|
`path = ${quote(entry.path)}`,
|
|
95
101
|
`added = ${quote(entry.added)}`,
|
|
96
102
|
`watch = ${entry.watch}`,
|
|
@@ -99,18 +105,99 @@ export function renderRegistry(entries) {
|
|
|
99
105
|
// run together the blocks are hard to read and give noisier diffs.
|
|
100
106
|
return `${[HEADER, ...blocks].join("\n\n")}\n`;
|
|
101
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* What an entry is keyed on: its repo identity, or its path when it has none.
|
|
110
|
+
*
|
|
111
|
+
* One function so the parser, `findByKey`, and `upsert` cannot disagree about
|
|
112
|
+
* what "the same ghostrail" means, which is exactly the kind of drift that let
|
|
113
|
+
* two checkouts become two ghostrails in the first place.
|
|
114
|
+
*/
|
|
115
|
+
export function entryKey(entry) {
|
|
116
|
+
return entry.repo ?? entry.path;
|
|
117
|
+
}
|
|
102
118
|
/** The entry at `path`, or undefined. Exact string equality; callers resolve first. */
|
|
103
119
|
export function findByPath(entries, path) {
|
|
104
120
|
return entries.find((entry) => entry.path === path);
|
|
105
121
|
}
|
|
122
|
+
/** The entry for a repo identity (or a path, for an entry that has none). */
|
|
123
|
+
export function findByKey(entries, key) {
|
|
124
|
+
return entries.find((entry) => entryKey(entry) === key);
|
|
125
|
+
}
|
|
106
126
|
/**
|
|
107
|
-
*
|
|
127
|
+
* The entry for this repo, whether or not it knows its own identity yet.
|
|
128
|
+
*
|
|
129
|
+
* By identity first, then by path. The path fallback exists for one case: an
|
|
130
|
+
* entry written before identities did, which can never match a lookup by
|
|
131
|
+
* identity because its key *is* its path. Without it, registering a repo that
|
|
132
|
+
* is already registered appends a second entry, and two entries for one repo
|
|
133
|
+
* each get a service unit, which is the failure this whole change removes,
|
|
134
|
+
* arriving by way of the upgrade rather than a second clone.
|
|
135
|
+
*
|
|
136
|
+
* The order matters and is not interchangeable. Two checkouts of one repo must
|
|
137
|
+
* resolve to the identity match; falling to the path first would give each
|
|
138
|
+
* checkout its own answer again.
|
|
139
|
+
*/
|
|
140
|
+
export function findForRepo(entries, repoId, path) {
|
|
141
|
+
return (findByKey(entries, repoId) ??
|
|
142
|
+
entries.find((entry) => entry.repo === undefined && entry.path === path));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* {@link findForRepo}, extended to recognise a legacy entry registered at a
|
|
146
|
+
* *different* checkout of the same repo.
|
|
147
|
+
*
|
|
148
|
+
* The pure version can only match a legacy entry by its path, so registering
|
|
149
|
+
* from a second checkout while the registry is still legacy would miss it and
|
|
150
|
+
* append: one repo, two entries, two units, which is the whole failure again.
|
|
151
|
+
* Deciding whether some other directory is the same repo means asking git what
|
|
152
|
+
* its origin is, so the resolver is injected rather than imported and this
|
|
153
|
+
* stays testable without a filesystem.
|
|
154
|
+
*
|
|
155
|
+
* Only legacy entries are resolved. One with an identity already answered for
|
|
156
|
+
* itself, and re-deriving it would turn a registry read into a subprocess per
|
|
157
|
+
* ghostrail. A path that no longer exists resolves to its own `local:` identity
|
|
158
|
+
* and simply does not match, so a deleted checkout cannot produce a false hit.
|
|
159
|
+
*/
|
|
160
|
+
export async function findForRepoResolving(entries, repoId, path, resolveRepoId) {
|
|
161
|
+
const direct = findForRepo(entries, repoId, path);
|
|
162
|
+
if (direct !== undefined)
|
|
163
|
+
return direct;
|
|
164
|
+
for (const entry of entries) {
|
|
165
|
+
if (entry.repo !== undefined)
|
|
166
|
+
continue;
|
|
167
|
+
if ((await resolveRepoId(entry.path)) === repoId)
|
|
168
|
+
return entry;
|
|
169
|
+
}
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Add `entry`, or replace the one with the same identity.
|
|
174
|
+
*
|
|
175
|
+
* Keyed on the repo, so `init` in a second checkout of a known repo updates
|
|
176
|
+
* that ghostrail (adopting the new checkout as its `path`) instead of adding a
|
|
177
|
+
* second one. An entry with no identity still matches on path, so a
|
|
178
|
+
* pre-identity registry keeps working.
|
|
108
179
|
*
|
|
109
180
|
* A replacement keeps its position so a diff of the file shows a changed block
|
|
110
181
|
* rather than a move; a new entry appends. Neither argument is mutated.
|
|
111
182
|
*/
|
|
112
183
|
export function upsert(entries, entry) {
|
|
113
|
-
|
|
184
|
+
return replaceEntry(entries, entryKey(entry), entry);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Replace the entry keyed `previousKey` with `entry`, or append when there is
|
|
188
|
+
* none.
|
|
189
|
+
*
|
|
190
|
+
* Needed because adopting a legacy entry *changes its key*: it was keyed on its
|
|
191
|
+
* path, and gaining a repo identity re-keys it. `upsert` looks up by the new
|
|
192
|
+
* entry's own key, finds nothing, and appends, leaving one repo with two
|
|
193
|
+
* entries and therefore two service units. The caller already knows which entry
|
|
194
|
+
* it means, so it says so.
|
|
195
|
+
*
|
|
196
|
+
* A replacement keeps its position, so a diff of the file shows a changed block
|
|
197
|
+
* rather than a move. Neither argument is mutated.
|
|
198
|
+
*/
|
|
199
|
+
export function replaceEntry(entries, previousKey, entry) {
|
|
200
|
+
const index = entries.findIndex((existing) => entryKey(existing) === previousKey);
|
|
114
201
|
if (index === -1)
|
|
115
202
|
return [...entries, entry];
|
|
116
203
|
const next = [...entries];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/global/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/global/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EA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AAU,oBAAoB,CACxC,OAA6B,EAC7B,MAAc,EACd,IAAY,EACZ,aAAgD;IAEhD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAClD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;YAAE,SAAS;QACvC,IAAI,CAAC,MAAM,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;IACjE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,OAA6B,EAAE,KAAgB;IACpE,OAAO,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAC1B,OAA6B,EAC7B,WAAmB,EACnB,KAAgB;IAEhB,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,WAAW,CAAC,CAAC;IAClF,IAAI,KAAK,KAAK,CAAC,CAAC;QAAE,OAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACpB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical identity of the repo a git remote points at, as
|
|
3
|
+
* `host[:port]/path/to/repo`, or undefined when the remote is not one.
|
|
4
|
+
*
|
|
5
|
+
* The point is that every spelling of one repo collapses to one string:
|
|
6
|
+
* scp-like and URL forms, with or without `.git`, with or without a default
|
|
7
|
+
* port, are the same repo and must key the same ghostrail.
|
|
8
|
+
*
|
|
9
|
+
* Strict everywhere except case. Anything unrecognised is undefined rather than
|
|
10
|
+
* guessed, because the two failure directions are not symmetric: wrongly
|
|
11
|
+
* merging two repos pools their history and cannot be undone, while wrongly
|
|
12
|
+
* separating two clones only leaves today's behavior in place. The exception is
|
|
13
|
+
* lowercasing, which is deliberately lenient: hosts are case-insensitive and so
|
|
14
|
+
* are repos on the forges people use, so `Owner/Repo` and `owner/repo` are one
|
|
15
|
+
* repo. On a case-sensitive host that could merge two repos differing only in
|
|
16
|
+
* case, which is judged far less likely than someone typing a clone URL with
|
|
17
|
+
* different capitalisation.
|
|
18
|
+
*
|
|
19
|
+
* Never throws. A remote that cannot be read is a missing identity, and the
|
|
20
|
+
* caller falls back to {@link localRepoId}.
|
|
21
|
+
*/
|
|
22
|
+
export declare function canonicalRepoId(remote: string): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The identity of a repo with no usable remote, from its absolute path.
|
|
25
|
+
*
|
|
26
|
+
* The `local:` prefix means it can never collide with a `host/...` identity,
|
|
27
|
+
* and makes a path-keyed entry visibly path-keyed rather than silently so. The
|
|
28
|
+
* path is kept verbatim: it is already absolute, and case-folding it would be
|
|
29
|
+
* wrong on a case-sensitive filesystem.
|
|
30
|
+
*/
|
|
31
|
+
export declare function localRepoId(path: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Whether an identity is path-keyed rather than derived from a remote.
|
|
34
|
+
*
|
|
35
|
+
* Checks `local:/`, not `local:`. The shorter prefix looks like the marker and
|
|
36
|
+
* is not one: a host genuinely named `local` on a non-default port produces
|
|
37
|
+
* `local:22/owner/repo`, which is an ordinary canonical identity.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isLocalRepoId(id: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* A filesystem-safe directory name for an identity.
|
|
42
|
+
*
|
|
43
|
+
* The hash is not decoration. Folding characters and truncating both lose
|
|
44
|
+
* information, so two different identities can reduce to the same readable
|
|
45
|
+
* stem; the hash of the *full* identity is what keeps the key unique. The stem
|
|
46
|
+
* is there so a human browsing the state directory can tell what they are
|
|
47
|
+
* looking at.
|
|
48
|
+
*/
|
|
49
|
+
export declare function repoKey(id: string): string;
|
|
50
|
+
//# sourceMappingURL=repo-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-id.d.ts","sourceRoot":"","sources":["../../src/global/repo-id.ts"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBlE;AAqDD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAU1C"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
/**
|
|
3
|
+
* What identifies a ghostrail: the repo it works on, not the directory it was
|
|
4
|
+
* set up from. Pure, so the normalization rules that decide whether two clones
|
|
5
|
+
* are one repo can be checked without a git repository.
|
|
6
|
+
*/
|
|
7
|
+
/** Ports that carry no information, per scheme. */
|
|
8
|
+
const DEFAULT_PORTS = {
|
|
9
|
+
ssh: "22",
|
|
10
|
+
git: "9418",
|
|
11
|
+
http: "80",
|
|
12
|
+
https: "443",
|
|
13
|
+
};
|
|
14
|
+
/** Longest readable stem in a {@link repoKey}, before the hash is appended. */
|
|
15
|
+
const MAX_STEM = 48;
|
|
16
|
+
/**
|
|
17
|
+
* The canonical identity of the repo a git remote points at, as
|
|
18
|
+
* `host[:port]/path/to/repo`, or undefined when the remote is not one.
|
|
19
|
+
*
|
|
20
|
+
* The point is that every spelling of one repo collapses to one string:
|
|
21
|
+
* scp-like and URL forms, with or without `.git`, with or without a default
|
|
22
|
+
* port, are the same repo and must key the same ghostrail.
|
|
23
|
+
*
|
|
24
|
+
* Strict everywhere except case. Anything unrecognised is undefined rather than
|
|
25
|
+
* guessed, because the two failure directions are not symmetric: wrongly
|
|
26
|
+
* merging two repos pools their history and cannot be undone, while wrongly
|
|
27
|
+
* separating two clones only leaves today's behavior in place. The exception is
|
|
28
|
+
* lowercasing, which is deliberately lenient: hosts are case-insensitive and so
|
|
29
|
+
* are repos on the forges people use, so `Owner/Repo` and `owner/repo` are one
|
|
30
|
+
* repo. On a case-sensitive host that could merge two repos differing only in
|
|
31
|
+
* case, which is judged far less likely than someone typing a clone URL with
|
|
32
|
+
* different capitalisation.
|
|
33
|
+
*
|
|
34
|
+
* Never throws. A remote that cannot be read is a missing identity, and the
|
|
35
|
+
* caller falls back to {@link localRepoId}.
|
|
36
|
+
*/
|
|
37
|
+
export function canonicalRepoId(remote) {
|
|
38
|
+
const trimmed = remote.trim();
|
|
39
|
+
if (trimmed.length === 0)
|
|
40
|
+
return undefined;
|
|
41
|
+
const parsed = splitRemote(trimmed);
|
|
42
|
+
if (parsed === undefined)
|
|
43
|
+
return undefined;
|
|
44
|
+
const path = parsed.path
|
|
45
|
+
.split("/")
|
|
46
|
+
.filter((segment) => segment.length > 0)
|
|
47
|
+
.join("/")
|
|
48
|
+
.replace(/\.git$/i, "");
|
|
49
|
+
// A bare host names no repo, and neither does a path that was only slashes.
|
|
50
|
+
if (path.length === 0)
|
|
51
|
+
return undefined;
|
|
52
|
+
return `${parsed.host}/${path}`.toLowerCase();
|
|
53
|
+
}
|
|
54
|
+
/** Host (with any non-default port) and raw path, or undefined. */
|
|
55
|
+
function splitRemote(remote) {
|
|
56
|
+
// A local path is not a remote. Checked first so `/srv/git/repo` and
|
|
57
|
+
// `C:\repos\thing` never reach the URL branch and acquire a bogus host.
|
|
58
|
+
if (remote.startsWith("/") || remote.startsWith(".") || /^[a-z]:[\\/]/i.test(remote)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const url = remote.match(/^([a-z][a-z0-9+.-]*):\/\/([^/\s]+)(\/.*)?$/i);
|
|
62
|
+
if (url !== null) {
|
|
63
|
+
const [, scheme = "", authority = "", path = ""] = url;
|
|
64
|
+
// `file://` addresses a directory, not a remote repo identity.
|
|
65
|
+
if (scheme.toLowerCase() === "file")
|
|
66
|
+
return undefined;
|
|
67
|
+
return { host: stripPort(dropUserinfo(authority), scheme.toLowerCase()), path };
|
|
68
|
+
}
|
|
69
|
+
// scp-like: [user@]host:path. The colon must not be followed by `/`, which
|
|
70
|
+
// would make it a scheme, and the host must carry no slash.
|
|
71
|
+
const scp = remote.match(/^([^/\s]+):(?!\/)(.+)$/);
|
|
72
|
+
if (scp !== null) {
|
|
73
|
+
const [, authority = "", path = ""] = scp;
|
|
74
|
+
return { host: stripPort(dropUserinfo(authority), "ssh"), path };
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
/** Drop `user@` and any password: a credential is not part of an identity. */
|
|
79
|
+
function dropUserinfo(authority) {
|
|
80
|
+
const at = authority.lastIndexOf("@");
|
|
81
|
+
return at === -1 ? authority : authority.slice(at + 1);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Drop the scheme's default port, and any empty one. Keep every other.
|
|
85
|
+
*
|
|
86
|
+
* The empty case is not a curiosity. `ssh://local:/owner/repo` left the host as
|
|
87
|
+
* `local:` and produced `local:/owner/repo`, which is character-for-character a
|
|
88
|
+
* {@link localRepoId} for `/owner/repo`: a remote repo and a path-keyed one
|
|
89
|
+
* colliding on a single identity. A trailing colon with no digits is not a
|
|
90
|
+
* port, and treating it as part of the host was the whole bug.
|
|
91
|
+
*/
|
|
92
|
+
function stripPort(host, scheme) {
|
|
93
|
+
const empty = host.match(/^(.*):$/);
|
|
94
|
+
if (empty !== null)
|
|
95
|
+
return empty[1] ?? host;
|
|
96
|
+
const match = host.match(/^(.*):(\d+)$/);
|
|
97
|
+
if (match === null)
|
|
98
|
+
return host;
|
|
99
|
+
const [, name = "", port = ""] = match;
|
|
100
|
+
return port === DEFAULT_PORTS[scheme] ? name : host;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The identity of a repo with no usable remote, from its absolute path.
|
|
104
|
+
*
|
|
105
|
+
* The `local:` prefix means it can never collide with a `host/...` identity,
|
|
106
|
+
* and makes a path-keyed entry visibly path-keyed rather than silently so. The
|
|
107
|
+
* path is kept verbatim: it is already absolute, and case-folding it would be
|
|
108
|
+
* wrong on a case-sensitive filesystem.
|
|
109
|
+
*/
|
|
110
|
+
export function localRepoId(path) {
|
|
111
|
+
// Always `local:/...`, never bare `local:`. A canonical identity puts a port
|
|
112
|
+
// after the colon and a path segment after that, so `local:22/a/a` is a real
|
|
113
|
+
// canonical id for a host named `local`. The two can never be equal, but only
|
|
114
|
+
// because a local id's colon is always followed by `/` and a canonical one's
|
|
115
|
+
// never is. Guaranteeing that here, rather than relying on every caller to
|
|
116
|
+
// pass an absolute path, is what makes {@link isLocalRepoId} safe.
|
|
117
|
+
return path.startsWith("/") ? `local:${path}` : `local:/${path}`;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Whether an identity is path-keyed rather than derived from a remote.
|
|
121
|
+
*
|
|
122
|
+
* Checks `local:/`, not `local:`. The shorter prefix looks like the marker and
|
|
123
|
+
* is not one: a host genuinely named `local` on a non-default port produces
|
|
124
|
+
* `local:22/owner/repo`, which is an ordinary canonical identity.
|
|
125
|
+
*/
|
|
126
|
+
export function isLocalRepoId(id) {
|
|
127
|
+
return id.startsWith("local:/");
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A filesystem-safe directory name for an identity.
|
|
131
|
+
*
|
|
132
|
+
* The hash is not decoration. Folding characters and truncating both lose
|
|
133
|
+
* information, so two different identities can reduce to the same readable
|
|
134
|
+
* stem; the hash of the *full* identity is what keeps the key unique. The stem
|
|
135
|
+
* is there so a human browsing the state directory can tell what they are
|
|
136
|
+
* looking at.
|
|
137
|
+
*/
|
|
138
|
+
export function repoKey(id) {
|
|
139
|
+
const hash = createHash("sha256").update(id, "utf8").digest("hex").slice(0, 8);
|
|
140
|
+
const stem = id
|
|
141
|
+
.toLowerCase()
|
|
142
|
+
.replace(/[^a-z0-9._-]+/g, "-")
|
|
143
|
+
.replace(/-+/g, "-")
|
|
144
|
+
.replace(/^-+|-+$/g, "")
|
|
145
|
+
.slice(0, MAX_STEM)
|
|
146
|
+
.replace(/-+$/, "");
|
|
147
|
+
return stem.length === 0 ? hash : `${stem}-${hash}`;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=repo-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-id.js","sourceRoot":"","sources":["../../src/global/repo-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;GAIG;AAEH,mDAAmD;AACnD,MAAM,aAAa,GAA2B;IAC5C,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;CACb,CAAC;AAEF,+EAA+E;AAC/E,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAE3C,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAE3C,MAAM,IAAI,GAAG,MAAM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C,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,OAAO,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CAAC,EAAU;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/E,MAAM,IAAI,GAAG,EAAE;SACZ,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;SAC9B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC;SAClB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { GlobalEnv } from "./store.js";
|
|
2
|
+
/**
|
|
3
|
+
* Where a ghostrail's state lives: its runs, events, artifacts, lock, pause
|
|
4
|
+
* flag, and respond watermarks.
|
|
5
|
+
*
|
|
6
|
+
* Outside the repo, keyed by the repo's identity. Inside the checkout, all of
|
|
7
|
+
* it was per-directory, so two clones of one repo had two stores and two locks
|
|
8
|
+
* and therefore raced each other, split their history, and each got a full
|
|
9
|
+
* `max_cost_usd_per_run` ceiling of their own.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The root for ghostrail's state, honouring `$XDG_STATE_HOME`.
|
|
13
|
+
*
|
|
14
|
+
* State, not config, so this is the state dir rather than the config dir the
|
|
15
|
+
* registry and `secrets.env` live in. The XDG spec is explicit that state is
|
|
16
|
+
* for data that persists between runs but is neither configuration nor a cache,
|
|
17
|
+
* which is exactly a run history.
|
|
18
|
+
*
|
|
19
|
+
* `GHOSTRAIL_HOME` still wins, as it does for the global dir: a caller who has
|
|
20
|
+
* pinned everything to one directory means it, and splitting their state
|
|
21
|
+
* somewhere else would be a surprise. Tests rely on this too.
|
|
22
|
+
*/
|
|
23
|
+
export declare function stateHome(env: GlobalEnv, homedir: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* The state directory for one repo: `<stateHome>/repos/<key>`.
|
|
26
|
+
*
|
|
27
|
+
* `repos/` rather than the root so the layout has room for state that belongs
|
|
28
|
+
* to the account rather than to a repo, without a future addition colliding
|
|
29
|
+
* with a repo whose key happens to match.
|
|
30
|
+
*/
|
|
31
|
+
export declare function repoStateDir(repoId: string, env: GlobalEnv, homedir: string): string;
|
|
32
|
+
//# sourceMappingURL=state-dir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-dir.d.ts","sourceRoot":"","sources":["../../src/global/state-dir.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CASjE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { repoKey } from "./repo-id.js";
|
|
3
|
+
/**
|
|
4
|
+
* Where a ghostrail's state lives: its runs, events, artifacts, lock, pause
|
|
5
|
+
* flag, and respond watermarks.
|
|
6
|
+
*
|
|
7
|
+
* Outside the repo, keyed by the repo's identity. Inside the checkout, all of
|
|
8
|
+
* it was per-directory, so two clones of one repo had two stores and two locks
|
|
9
|
+
* and therefore raced each other, split their history, and each got a full
|
|
10
|
+
* `max_cost_usd_per_run` ceiling of their own.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The root for ghostrail's state, honouring `$XDG_STATE_HOME`.
|
|
14
|
+
*
|
|
15
|
+
* State, not config, so this is the state dir rather than the config dir the
|
|
16
|
+
* registry and `secrets.env` live in. The XDG spec is explicit that state is
|
|
17
|
+
* for data that persists between runs but is neither configuration nor a cache,
|
|
18
|
+
* which is exactly a run history.
|
|
19
|
+
*
|
|
20
|
+
* `GHOSTRAIL_HOME` still wins, as it does for the global dir: a caller who has
|
|
21
|
+
* pinned everything to one directory means it, and splitting their state
|
|
22
|
+
* somewhere else would be a surprise. Tests rely on this too.
|
|
23
|
+
*/
|
|
24
|
+
export function stateHome(env, homedir) {
|
|
25
|
+
if (env.GHOSTRAIL_HOME !== undefined && env.GHOSTRAIL_HOME.length > 0) {
|
|
26
|
+
return join(env.GHOSTRAIL_HOME, "state");
|
|
27
|
+
}
|
|
28
|
+
const base = env.XDG_STATE_HOME !== undefined && env.XDG_STATE_HOME.length > 0
|
|
29
|
+
? env.XDG_STATE_HOME
|
|
30
|
+
: join(homedir, ".local", "state");
|
|
31
|
+
return join(base, "ghostrail");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The state directory for one repo: `<stateHome>/repos/<key>`.
|
|
35
|
+
*
|
|
36
|
+
* `repos/` rather than the root so the layout has room for state that belongs
|
|
37
|
+
* to the account rather than to a repo, without a future addition colliding
|
|
38
|
+
* with a repo whose key happens to match.
|
|
39
|
+
*/
|
|
40
|
+
export function repoStateDir(repoId, env, homedir) {
|
|
41
|
+
return join(stateHome(env, homedir), "repos", repoKey(repoId));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=state-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-dir.js","sourceRoot":"","sources":["../../src/global/state-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,GAAc,EAAE,OAAe;IACvD,IAAI,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtE,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,IAAI,GACR,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC;QAC/D,CAAC,CAAC,GAAG,CAAC,cAAc;QACpB,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,GAAc,EAAE,OAAe;IAC1E,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/global/store.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type Ghostrail } from "./registry.js";
|
|
|
2
2
|
export interface GlobalEnv {
|
|
3
3
|
GHOSTRAIL_HOME?: string;
|
|
4
4
|
XDG_CONFIG_HOME?: string;
|
|
5
|
+
/** Where run state goes. Config and state are different XDG directories. */
|
|
6
|
+
XDG_STATE_HOME?: string;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* Resolve the global ghostrail config directory that holds account-level
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/global/store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAgD,MAAM,eAAe,CAAC;AAE7F,MAAM,WAAW,SAAS;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/global/store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAgD,MAAM,eAAe,CAAC;AAE7F,MAAM,WAAW,SAAS;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOxE;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,GAAG,EAAE,MAAM;IAIvB,YAAY,IAAI,MAAM;IAItB,mEAAmE;IAC7D,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQjD,wDAAwD;IAClD,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQxC,YAAY,IAAI,MAAM;IAItB;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC,SAAS,EAAE,GAAG,SAAS,CAAC;IAUtD,8EAA8E;IACxE,aAAa,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjE,4EAA4E;IACtE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAU9D"}
|
package/dist/global/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/global/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAkB,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/global/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAkB,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAS7F;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAc,EAAE,OAAe;IAC9D,IAAI,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,cAAc,CAAC;IACjG,MAAM,IAAI,GACR,GAAG,CAAC,eAAe,KAAK,SAAS,IAAI,GAAG,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;QACjE,CAAC,CAAC,GAAG,CAAC,eAAe;QACrB,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AACjC,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,gBAAgB,CAAC,I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