@mattstack/rt-client 0.2.0 → 0.3.0
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 +5 -2
- package/dist/client.d.ts +6 -2
- package/dist/commands.d.ts +138 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1123 -4
- package/dist/settings/exec.d.ts +26 -0
- package/dist/settings/identity.d.ts +56 -0
- package/dist/settings/paths.d.ts +42 -0
- package/dist/settings/registry-defs.d.ts +12 -0
- package/dist/settings/registry-machinery.d.ts +59 -0
- package/dist/settings/resolve.d.ts +141 -0
- package/dist/settings/stores.d.ts +53 -0
- package/dist/settings/write.d.ts +110 -0
- package/dist/transport.d.ts +7 -0
- package/package.json +10 -2
- package/src/client.ts +21 -2
- package/src/commands.ts +65 -1
- package/src/index.ts +26 -0
- package/src/repos.ts +6 -2
- package/src/settings/exec.ts +67 -0
- package/src/settings/identity.ts +125 -0
- package/src/settings/paths.ts +80 -0
- package/src/settings/registry-defs.ts +439 -0
- package/src/settings/registry-machinery.ts +141 -0
- package/src/settings/resolve.ts +608 -0
- package/src/settings/stores.ts +129 -0
- package/src/settings/write.ts +294 -0
- package/src/transport.ts +18 -3
package/README.md
CHANGED
|
@@ -17,8 +17,11 @@ const repos = await rtCommand(['repos', 'list']);
|
|
|
17
17
|
const mrs = await readProjectMRs('group/repo');
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Requires a running rt daemon. Install rt
|
|
21
|
-
then `rt verify`.
|
|
20
|
+
Requires a running rt daemon. Install rt from the latest GitHub Release
|
|
21
|
+
(`./rt --post-install`), then `rt verify`.
|
|
22
|
+
|
|
23
|
+
Bun-only: the settings exec path (`src/settings/exec.ts`) shells out via
|
|
24
|
+
`Bun.spawn`, so this package does not run under Node.
|
|
22
25
|
|
|
23
26
|
`@mattstack/glance` is a peer dependency: rt-client returns glance's forge types
|
|
24
27
|
so merge request shapes stay identical across rt, gitq, and mr-board.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RtResponse, RtClientOptions } from "./transport.ts";
|
|
2
|
-
import type { DemandDecl, ProjectMRsData, DiscussionsData, MrByBranchData, ForgeSlug, ForgeTokenData } from "./commands.ts";
|
|
2
|
+
import type { DemandDecl, ProjectMRsData, DiscussionsData, MrByBranchData, ForgeSlug, ForgeTokenData, RunSummary, RunDetail } from "./commands.ts";
|
|
3
3
|
/**
|
|
4
4
|
* One repo's project open-MR store. A cold repo forces a full paginated sync
|
|
5
5
|
* on the daemon side when maxAgeMs demands it, which can run tens of seconds
|
|
@@ -18,6 +18,10 @@ export declare function readMrsByBranch(repoName: string, branches: string[], op
|
|
|
18
18
|
* side: an untracked repo comes back `ok: false` with the `rt daemon track`
|
|
19
19
|
* command to run, which is the fail-closed shape callers should surface
|
|
20
20
|
* verbatim. Callers keep env-var precedence on their own side; this is the
|
|
21
|
-
* fallback that replaces reading ~/.rt/secrets.json directly.
|
|
21
|
+
* fallback that replaces reading ~/.mattstack/rt/secrets.json directly.
|
|
22
22
|
*/
|
|
23
23
|
export declare function resolveForgeToken(repoName: string, forge: ForgeSlug, opts?: RtClientOptions): Promise<RtResponse<ForgeTokenData>>;
|
|
24
|
+
export declare function listRuns(repo?: string, opts?: RtClientOptions): Promise<RtResponse<{
|
|
25
|
+
runs: RunSummary[];
|
|
26
|
+
}>>;
|
|
27
|
+
export declare function getRun(runId: string, repo?: string, opts?: RtClientOptions): Promise<RtResponse<RunDetail>>;
|
package/dist/commands.d.ts
CHANGED
|
@@ -45,6 +45,54 @@ export type ForgeSlug = "gitlab" | "github";
|
|
|
45
45
|
export interface ForgeTokenData {
|
|
46
46
|
token: string;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Duplicated shape on purpose (RT-44): rt-client cannot import daemon
|
|
50
|
+
* internals, so this mirrors lib/daemon/events-bus.ts's BusEvent.
|
|
51
|
+
*/
|
|
52
|
+
export interface EventsBusEvent {
|
|
53
|
+
id: number;
|
|
54
|
+
topic: string;
|
|
55
|
+
payload: unknown;
|
|
56
|
+
emittedAt: number;
|
|
57
|
+
}
|
|
58
|
+
export interface RunSummary {
|
|
59
|
+
id: string;
|
|
60
|
+
repo: string;
|
|
61
|
+
work_type: string;
|
|
62
|
+
pipeline: string;
|
|
63
|
+
status: string;
|
|
64
|
+
current_stage: string | null;
|
|
65
|
+
spawned_by: string | null;
|
|
66
|
+
started_at: number;
|
|
67
|
+
ended_at: number | null;
|
|
68
|
+
}
|
|
69
|
+
export interface RunStageRow {
|
|
70
|
+
name: string;
|
|
71
|
+
status: string;
|
|
72
|
+
attempt: number;
|
|
73
|
+
started_at: number | null;
|
|
74
|
+
ended_at: number | null;
|
|
75
|
+
}
|
|
76
|
+
export interface RunFieldRow {
|
|
77
|
+
key: string;
|
|
78
|
+
value: string;
|
|
79
|
+
produced_by: string;
|
|
80
|
+
at: number;
|
|
81
|
+
}
|
|
82
|
+
export interface RunDecisionRow {
|
|
83
|
+
contract: string;
|
|
84
|
+
scope: string;
|
|
85
|
+
selection: string;
|
|
86
|
+
decided_by: string;
|
|
87
|
+
decided_at: number;
|
|
88
|
+
}
|
|
89
|
+
export interface RunDetail {
|
|
90
|
+
run: RunSummary;
|
|
91
|
+
stages: RunStageRow[];
|
|
92
|
+
fields: RunFieldRow[];
|
|
93
|
+
decisions: RunDecisionRow[];
|
|
94
|
+
schemaAhead: boolean;
|
|
95
|
+
}
|
|
48
96
|
export interface Commands {
|
|
49
97
|
"project-mrs:read": {
|
|
50
98
|
payload: {
|
|
@@ -71,7 +119,7 @@ export interface Commands {
|
|
|
71
119
|
/**
|
|
72
120
|
* The forge token for one tracked repo (MAT-33). Repo-scoped on purpose:
|
|
73
121
|
* rt gates access per repo through repo-tracking.json, and this verb is
|
|
74
|
-
* what lets consumers stop reading ~/.rt/secrets.json directly, which
|
|
122
|
+
* what lets consumers stop reading ~/.mattstack/rt/secrets.json directly, which
|
|
75
123
|
* walked around that grant model entirely. An untracked repo is refused;
|
|
76
124
|
* the caller's env vars keep precedence on the caller's side.
|
|
77
125
|
*/
|
|
@@ -82,6 +130,95 @@ export interface Commands {
|
|
|
82
130
|
};
|
|
83
131
|
data: ForgeTokenData;
|
|
84
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* A per-`scope` whitelisted subset of secrets, each scope reading its own
|
|
135
|
+
* encrypted domain(s): "extension" (default, so the VS Code extension
|
|
136
|
+
* needs no change) is linearApiKey/gitlabToken from the `rt` domain;
|
|
137
|
+
* "deck" is cfApiToken/cfZoneId from the `deck` domain; "board" is
|
|
138
|
+
* cross-domain — slackToken/slackClientSecret/slackSigningSecret from the
|
|
139
|
+
* `board` domain plus gitlabToken/switchboardToken/switchboardAdminToken
|
|
140
|
+
* from the `rt` domain. `data` is a union of the per-scope shapes, not a
|
|
141
|
+
* merged bag of every key — that makes a caller narrowing on the wrong
|
|
142
|
+
* scope's fields a compile error instead of a silent `undefined`. Every
|
|
143
|
+
* key optional (present only when set). Not a general secrets export —
|
|
144
|
+
* extend a whitelist here, in lockstep with
|
|
145
|
+
* lib/daemon/handlers/secrets.ts and (for "extension")
|
|
146
|
+
* extensions/vscode/rt-context/src/secrets.ts, if a consumer needs another
|
|
147
|
+
* key.
|
|
148
|
+
*
|
|
149
|
+
* `token` is required and checked in the HANDLER (not a transport-layer
|
|
150
|
+
* gate alone), since this verb is reachable over the unauthenticated unix
|
|
151
|
+
* socket too — see lib/daemon/handlers/secrets.ts's doc comment. HTTP
|
|
152
|
+
* callers get it forwarded automatically from their X-RT-Token header;
|
|
153
|
+
* socket callers must read ~/.mattstack/rt/api-token themselves. The gate
|
|
154
|
+
* applies identically to every scope.
|
|
155
|
+
*/
|
|
156
|
+
"secrets:read": {
|
|
157
|
+
payload: {
|
|
158
|
+
token?: string;
|
|
159
|
+
scope?: "extension" | "deck" | "board";
|
|
160
|
+
};
|
|
161
|
+
data: {
|
|
162
|
+
linearApiKey?: string;
|
|
163
|
+
gitlabToken?: string;
|
|
164
|
+
} | {
|
|
165
|
+
cfApiToken?: string;
|
|
166
|
+
cfZoneId?: string;
|
|
167
|
+
} | {
|
|
168
|
+
slackToken?: string;
|
|
169
|
+
slackClientSecret?: string;
|
|
170
|
+
slackSigningSecret?: string;
|
|
171
|
+
gitlabToken?: string;
|
|
172
|
+
switchboardToken?: string;
|
|
173
|
+
switchboardAdminToken?: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
"events:emit": {
|
|
177
|
+
payload: {
|
|
178
|
+
topic: string;
|
|
179
|
+
payload?: unknown;
|
|
180
|
+
};
|
|
181
|
+
data: {
|
|
182
|
+
id: number;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
"events:wait": {
|
|
186
|
+
payload: {
|
|
187
|
+
pattern: string;
|
|
188
|
+
after?: number;
|
|
189
|
+
waitMs?: number;
|
|
190
|
+
};
|
|
191
|
+
data: {
|
|
192
|
+
events: EventsBusEvent[];
|
|
193
|
+
cursor: number;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
"events:list": {
|
|
197
|
+
payload: {
|
|
198
|
+
pattern: string;
|
|
199
|
+
after?: number;
|
|
200
|
+
limit?: number;
|
|
201
|
+
};
|
|
202
|
+
data: {
|
|
203
|
+
events: EventsBusEvent[];
|
|
204
|
+
cursor: number;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
"runs:list": {
|
|
208
|
+
payload: {
|
|
209
|
+
repo?: string;
|
|
210
|
+
};
|
|
211
|
+
data: {
|
|
212
|
+
runs: RunSummary[];
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
"runs:get": {
|
|
216
|
+
payload: {
|
|
217
|
+
runId: string;
|
|
218
|
+
repo?: string;
|
|
219
|
+
};
|
|
220
|
+
data: RunDetail;
|
|
221
|
+
};
|
|
85
222
|
}
|
|
86
223
|
export type CommandName = keyof Commands;
|
|
87
224
|
export declare const COMMAND_NAMES: readonly CommandName[];
|
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,13 @@ export type { Discussion, DemandDecl, ProjectMRsScope, ProjectMRsData, Discussio
|
|
|
6
6
|
export { subscribe, DEFAULT_WS_URL } from "./relay.ts";
|
|
7
7
|
export type { RelayEventType } from "./relay.ts";
|
|
8
8
|
export { repoNameForPath } from "./repos.ts";
|
|
9
|
+
export { getSetting, listSettings, explainSetting, expandVariables, SCOPE_ORDER } from "./settings/resolve.ts";
|
|
10
|
+
export type { Scope, Provenance, ResolveOpts, Resolved, InvalidScope, ListedSetting, ExplainRow, ExpandCtx, } from "./settings/resolve.ts";
|
|
11
|
+
export { setSetting } from "./settings/write.ts";
|
|
12
|
+
export type { SetSettingOpts } from "./settings/write.ts";
|
|
13
|
+
export { getDef, allDefs, validateValue, isMigrated } from "./settings/registry-machinery.ts";
|
|
14
|
+
export type { SettingDef, SettingScope } from "./settings/registry-machinery.ts";
|
|
15
|
+
export { REGISTRY } from "./settings/registry-defs.ts";
|
|
16
|
+
export { readStore, listTeams } from "./settings/stores.ts";
|
|
17
|
+
export type { StoreFile } from "./settings/stores.ts";
|
|
18
|
+
export { normalizeRemote, identityFromRemote, deriveRepoIdentity, clearIdentityMemo } from "./settings/identity.ts";
|