@atbash/cli 0.5.15-dev.0 → 0.5.15-dev.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 +26 -5
- package/dist/bin/atbash.js +4 -1
- package/dist/bin/atbash.js.map +1 -1
- package/dist/commands/connect.d.ts +0 -23
- package/dist/commands/connect.js +7 -53
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/mcp-cmd.d.ts +13 -0
- package/dist/commands/mcp-cmd.js +216 -0
- package/dist/commands/mcp-cmd.js.map +1 -0
- package/dist/commands/setup.d.ts +104 -1
- package/dist/commands/setup.js +505 -78
- package/dist/commands/setup.js.map +1 -1
- package/dist/shared/atbash-targets.d.ts +49 -0
- package/dist/shared/atbash-targets.js +63 -0
- package/dist/shared/atbash-targets.js.map +1 -0
- package/package.json +3 -3
package/dist/commands/setup.d.ts
CHANGED
|
@@ -20,7 +20,27 @@ interface KeyMaterial {
|
|
|
20
20
|
export declare function parseKeyMaterial(raw: string): KeyMaterial | null;
|
|
21
21
|
/** Normalize to the lowercase 64-hex the SDK validates, or "" if it is not one. */
|
|
22
22
|
export declare function normalizePrivkey(raw: string): string;
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Files in a directory that plausibly hold an Atbash agent key, newest first.
|
|
25
|
+
*
|
|
26
|
+
* TWO PASSES, and the second one is the point.
|
|
27
|
+
*
|
|
28
|
+
* By name first — `guard-client-key`, `agent-keys-*.txt` and friends — because
|
|
29
|
+
* matching the name is cheap and unambiguous. But a name-only match is a cliff:
|
|
30
|
+
* rename the download, or export from a wallet UI that picks its own filename,
|
|
31
|
+
* and the operator gets "no key file found" while the key sits right there in the
|
|
32
|
+
* directory they explicitly pointed at.
|
|
33
|
+
*
|
|
34
|
+
* So if no name matches, read the small files and keep the ones that actually
|
|
35
|
+
* PARSE as key material. That is a narrow test — `privkey=`, the documented JSON
|
|
36
|
+
* shape, or a file that is nothing but a 64-hex key — not "contains something
|
|
37
|
+
* hex-looking", so an unrelated file does not get mistaken for an identity.
|
|
38
|
+
*
|
|
39
|
+
* Reading files the operator did not name individually is justified by the flag
|
|
40
|
+
* itself: `--keys-dir` is an explicit instruction to look in that directory. It
|
|
41
|
+
* is bounded to small regular files and a file count, nothing is transmitted, and
|
|
42
|
+
* the caller prints WHICH file it used before doing anything with it.
|
|
43
|
+
*/
|
|
24
44
|
export declare function keyCandidatesInDir(dir: string): string[];
|
|
25
45
|
interface KeySource {
|
|
26
46
|
material: KeyMaterial;
|
|
@@ -101,6 +121,89 @@ export declare function isJsonc(text: string): boolean;
|
|
|
101
121
|
* does not exist and a plugin that never loads.
|
|
102
122
|
*/
|
|
103
123
|
export declare function mergeOpenclawConfig(config: Record<string, unknown>, home: string): Record<string, unknown>;
|
|
124
|
+
/**
|
|
125
|
+
* Detect the indentation a JSON file already uses, so a merge does not reformat
|
|
126
|
+
* the parts it did not touch.
|
|
127
|
+
*
|
|
128
|
+
* Without this, `JSON.stringify(obj, null, 2)` re-indents a tab-indented or
|
|
129
|
+
* 4-space config from top to bottom. The RESULT is still correct, but the diff
|
|
130
|
+
* shown for approval becomes every line in the file, which buries the two lines
|
|
131
|
+
* that actually changed — and the operator's own formatting choice is collateral
|
|
132
|
+
* damage in a file we were asked to make one addition to.
|
|
133
|
+
*
|
|
134
|
+
* Falls back to two spaces, which is what the published docs show.
|
|
135
|
+
*/
|
|
136
|
+
export declare function detectIndent(text: string | null): string | number;
|
|
137
|
+
/**
|
|
138
|
+
* Serialize a merged config the way the file was already written: same
|
|
139
|
+
* indentation, and a trailing newline only if the original had one.
|
|
140
|
+
*/
|
|
141
|
+
export declare function serializeLike(original: string | null, value: unknown): string;
|
|
142
|
+
interface McpClient {
|
|
143
|
+
label: string;
|
|
144
|
+
file: string;
|
|
145
|
+
format: "json" | "toml";
|
|
146
|
+
/** Which key holds the server map — VS Code and some others use `servers`. */
|
|
147
|
+
serversKey: "mcpServers" | "servers";
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* MCP client configs present under this home directory.
|
|
151
|
+
*
|
|
152
|
+
* Paths come from the shared MCP_CONFIGS so the writer and the scanner cannot
|
|
153
|
+
* drift: a client the scan reports but setup cannot find would look like a bug in
|
|
154
|
+
* whichever of the two the operator happened to trust.
|
|
155
|
+
*/
|
|
156
|
+
export declare function detectMcpClients(home: string): McpClient[];
|
|
157
|
+
/**
|
|
158
|
+
* Find the Python interpreter that actually runs Hermes.
|
|
159
|
+
*
|
|
160
|
+
* This is the difference between installing the plugin and only appearing to.
|
|
161
|
+
* `pip install atbash-hermes-plugin` puts the package wherever the *shell's*
|
|
162
|
+
* `pip` points — commonly a system or conda Python — while Hermes typically runs
|
|
163
|
+
* from its own virtualenv. The install succeeds, prints nothing alarming, and the
|
|
164
|
+
* plugin is invisible to Hermes forever. Nobody can debug that from the output.
|
|
165
|
+
*
|
|
166
|
+
* The launcher knows the answer. A pip-installed console script begins with a
|
|
167
|
+
* shebang naming the interpreter that created it:
|
|
168
|
+
*
|
|
169
|
+
* $ head -1 $(command -v hermes)
|
|
170
|
+
* #!/Users/me/.hermes/hermes-agent/venv/bin/python3
|
|
171
|
+
*
|
|
172
|
+
* So resolve `hermes`, read its first line, and use that interpreter directly via
|
|
173
|
+
* `-m pip`. Falls back to the conventional venv location under ~/.hermes, then to
|
|
174
|
+
* null — and a null becomes a printed command rather than a guess, because a
|
|
175
|
+
* wrong guess here is the silent failure this whole function exists to avoid.
|
|
176
|
+
*/
|
|
177
|
+
export declare function findHermesPython(home: string): {
|
|
178
|
+
python: string;
|
|
179
|
+
how: string;
|
|
180
|
+
} | null;
|
|
181
|
+
/**
|
|
182
|
+
* The env vars the Hermes plugin documents, merged into an existing `.env`.
|
|
183
|
+
*
|
|
184
|
+
* A `.env` is line-oriented and hand-maintained, so this is a line merge rather
|
|
185
|
+
* than a parse-and-reserialize: keys Atbash owns are replaced in place (keeping
|
|
186
|
+
* their position), keys it does not own are never touched, and anything else in
|
|
187
|
+
* the file — comments, blank lines, unrelated settings, ordering — survives
|
|
188
|
+
* exactly as written. Reformatting someone's .env to add four lines would be a
|
|
189
|
+
* poor trade.
|
|
190
|
+
*
|
|
191
|
+
* Values are from the published plugin README (PyPI atbash-hermes-plugin 0.4.5).
|
|
192
|
+
* `ATBASH_ORG_NAME` is deliberately NOT written: its value is the operator's org,
|
|
193
|
+
* which this command has no reliable way to know, and a wrong org sends the SDK
|
|
194
|
+
* at the wrong chain. It is called out in the manual step instead.
|
|
195
|
+
*/
|
|
196
|
+
export declare function mergeHermesEnv(existing: string | null): string;
|
|
197
|
+
/**
|
|
198
|
+
* Does this config's existing Atbash entry carry a key in its `env` block?
|
|
199
|
+
*
|
|
200
|
+
* True means the operator hand-wired it from the published docs and their private
|
|
201
|
+
* key is sitting in that file today. Setup takes it out, but the backup it writes
|
|
202
|
+
* first still has it — so this exists to make that sayable rather than silently
|
|
203
|
+
* relocating the leak.
|
|
204
|
+
*/
|
|
205
|
+
export declare function hadInlineKey(config: Record<string, unknown>, serversKey?: "mcpServers" | "servers"): boolean;
|
|
206
|
+
export declare function mergeMcpServer(config: Record<string, unknown>, serversKey?: "mcpServers" | "servers"): Record<string, unknown>;
|
|
104
207
|
/**
|
|
105
208
|
* Work out everything that needs doing on this machine, without doing any of it.
|
|
106
209
|
*
|