@veilio-inc/cli 0.6.0 → 0.7.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 +63 -24
- package/dist/args.d.ts +25 -10
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +112 -87
- package/dist/args.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/maps.d.ts +8 -0
- package/dist/client/maps.d.ts.map +1 -1
- package/dist/client/maps.js +125 -29
- package/dist/client/maps.js.map +1 -1
- package/dist/client/project-scope.d.ts +87 -0
- package/dist/client/project-scope.d.ts.map +1 -0
- package/dist/client/project-scope.js +132 -0
- package/dist/client/project-scope.js.map +1 -0
- package/dist/client/projects.d.ts +31 -1
- package/dist/client/projects.d.ts.map +1 -1
- package/dist/client/projects.js +71 -10
- package/dist/client/projects.js.map +1 -1
- package/dist/client/status.d.ts +2 -0
- package/dist/client/status.d.ts.map +1 -1
- package/dist/client/status.js +16 -7
- package/dist/client/status.js.map +1 -1
- package/dist/client/wording.d.ts +4 -1
- package/dist/client/wording.d.ts.map +1 -1
- package/dist/client/wording.js +28 -6
- package/dist/client/wording.js.map +1 -1
- package/dist/cloud-commands.d.ts +4 -2
- package/dist/cloud-commands.d.ts.map +1 -1
- package/dist/cloud-commands.js +31 -25
- package/dist/cloud-commands.js.map +1 -1
- package/dist/cloud.d.ts +1 -1
- package/dist/cloud.d.ts.map +1 -1
- package/dist/cloud.js +2 -2
- package/dist/cloud.js.map +1 -1
- package/dist/commands.d.ts +14 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +12 -59
- package/dist/commands.js.map +1 -1
- package/dist/credential.d.ts.map +1 -1
- package/dist/credential.js +6 -1
- package/dist/credential.js.map +1 -1
- package/dist/flags.d.ts +211 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +410 -0
- package/dist/flags.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -13
- package/dist/index.js.map +1 -1
- package/dist/team-namespace.d.ts +37 -2
- package/dist/team-namespace.d.ts.map +1 -1
- package/dist/team-namespace.js +20 -4
- package/dist/team-namespace.js.map +1 -1
- package/dist/third-party.d.ts.map +1 -1
- package/dist/third-party.js +10 -3
- package/dist/third-party.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ signed-in `scrub` offline, `veilio logout` first.
|
|
|
31
31
|
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
32
|
| `scrub [files...]` | Mask identifiers, redact credentials. Reads stdin when given no file. |
|
|
33
33
|
| `restore [files...]` | Swap placeholders back, strip AI-generated noise. Signed in, also a teammate's placeholders — see below. Names anything it could not restore; `--strict` writes nothing if a placeholder would be left. |
|
|
34
|
-
| `scan [files...]` | Detect credentials only. Never rewrites. Exits 1 on
|
|
34
|
+
| `scan [files...]` | Detect credentials only. Never rewrites. Exits 1 on a credential; with `--strict`, on any finding. |
|
|
35
35
|
| `map` | Show the symbol map (`--clear` to wipe it). |
|
|
36
36
|
|
|
37
37
|
## Cloud sync (Individual plan and above)
|
|
@@ -88,6 +88,23 @@ chooses the one this sign-in works in: listing, pushing, updating and
|
|
|
88
88
|
`scrub --team` then use that project's team maps only, and the MCP server uses
|
|
89
89
|
the same choice. With none chosen, team maps of every project are used.
|
|
90
90
|
|
|
91
|
+
**`VEILIO_PROJECT`.** Set to a project's name or id, it overrides the stored
|
|
92
|
+
choice for that process only, and is never written down. That is what a CI job
|
|
93
|
+
needs: a runner starts clean, with no `projects use` behind it.
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
VEILIO_PROJECT=billing veilio scrub src/ledger.ts
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The order is `VEILIO_PROJECT`, then the stored choice, then none. An empty
|
|
100
|
+
value counts as unset. A value that names no project your team works in, or a
|
|
101
|
+
name two projects share, is refused, naming the value: nothing falls back to
|
|
102
|
+
the stored choice or the default, and `scrub` and `restore` refuse rather than
|
|
103
|
+
number from the local map. Lines that name the project say so, as in "team maps
|
|
104
|
+
of project billing (from VEILIO_PROJECT)". `veilio projects` marks the one the
|
|
105
|
+
variable picked, and `veilio projects use` still stores a choice, but warns that
|
|
106
|
+
the variable overrides it in that shell. Signed out, it changes nothing.
|
|
107
|
+
|
|
91
108
|
**The personal-maps key.** `veilio vault unlock` asks for the vault passphrase
|
|
92
109
|
once and keeps, on this machine, only a key that opens personal maps - not the
|
|
93
110
|
passphrase, not the vault key, which also unlocks your team keys. The first time,
|
|
@@ -143,8 +160,8 @@ with the real names:
|
|
|
143
160
|
own map, not against a team namespace of four hundred entries.
|
|
144
161
|
|
|
145
162
|
The map commands are clients of `GET /api/maps`, `GET /api/maps/:id`,
|
|
146
|
-
`POST /api/maps` and `
|
|
147
|
-
same entitlement check. There is no CLI-shaped API and nothing here can reach
|
|
163
|
+
`POST /api/maps`, `PATCH /api/maps/:id` and `DELETE /api/maps/:id` — the exact
|
|
164
|
+
same routes the browser uses, behind the exact same entitlement check. There is no CLI-shaped API and nothing here can reach
|
|
148
165
|
a plan feature the web app couldn't.
|
|
149
166
|
|
|
150
167
|
## Options
|
|
@@ -152,31 +169,55 @@ a plan feature the web app couldn't.
|
|
|
152
169
|
```
|
|
153
170
|
-l, --language <lang> auto (default), typescript, python, go, java, csharp,
|
|
154
171
|
rust, ruby, php, c, sql
|
|
172
|
+
For: scrub
|
|
155
173
|
-s, --secrets <policy> redact (default) | warn | off
|
|
174
|
+
For: scrub
|
|
156
175
|
-p, --preamble Prepend the downstream-AI note and placeholder legend
|
|
176
|
+
For: scrub
|
|
157
177
|
-m, --map <path> Use a specific map file
|
|
158
|
-
|
|
178
|
+
For: scrub, restore, map, maps pull, maps push, maps
|
|
179
|
+
update
|
|
180
|
+
--json Machine-readable output
|
|
181
|
+
For: scan, map
|
|
159
182
|
--strict scan: also fail on advisory findings. restore: write
|
|
160
183
|
nothing and exit 1 if a placeholder would be left
|
|
161
|
-
|
|
184
|
+
For: scan, restore
|
|
185
|
+
--keep-docs Keep JSDoc blocks the model wrote
|
|
186
|
+
For: restore
|
|
187
|
+
--clear Wipe the symbol map
|
|
188
|
+
For: map
|
|
162
189
|
-f, --force Allow a map write that would drop existing entries
|
|
163
|
-
|
|
164
|
-
(1 to 30; 7 by default)
|
|
165
|
-
--allow-drop maps update: allow dropping entries the Cloud map has
|
|
166
|
-
and the local map does not
|
|
167
|
-
--device login: sign in through a browser instead of typing a
|
|
168
|
-
password here. Required for an SSO-bound account, and
|
|
169
|
-
used automatically when the instance asks for a CAPTCHA
|
|
190
|
+
For: scrub, maps pull
|
|
170
191
|
--team scrub: number new placeholders out of the team's
|
|
171
192
|
shared allocation, for a map you intend to publish.
|
|
172
193
|
maps push: publish as the team's shared map
|
|
194
|
+
For: scrub, maps push
|
|
195
|
+
--days <n> Keep the key for n days (1 to 30; 7 by default)
|
|
196
|
+
For: team unlock, vault unlock
|
|
197
|
+
--allow-drop Allow dropping entries the Cloud map has and the local
|
|
198
|
+
map does not
|
|
199
|
+
For: maps update
|
|
173
200
|
-q, --quiet Suppress the all-clear summary (findings always show)
|
|
174
|
-
|
|
175
|
-
|
|
201
|
+
For: scrub, restore, scan
|
|
202
|
+
--device Sign in through a browser instead of typing a password
|
|
203
|
+
here. Required for an SSO-bound account, and used
|
|
204
|
+
automatically when the instance asks for a CAPTCHA
|
|
205
|
+
For: login
|
|
206
|
+
--instance <url> The Veilio instance to sign in to. Defaults to the
|
|
207
|
+
public Cloud; https required (localhost excepted)
|
|
208
|
+
For: login
|
|
176
209
|
-h, --help Show this help
|
|
177
210
|
-v, --version Show the version
|
|
178
211
|
```
|
|
179
212
|
|
|
213
|
+
Each command takes only the options listed for it. A flag on a command it
|
|
214
|
+
does not belong to is refused with exit code 2, and the error lists the
|
|
215
|
+
options that command does take. Given `--days 3`, `scrub` stops with
|
|
216
|
+
`--days is not an option for scrub. Options for scrub: …`. Flags may come
|
|
217
|
+
before the command and are checked against it. `--help` anywhere on the line
|
|
218
|
+
shows that command's help and exits 0; `--help` and `--version` work with any
|
|
219
|
+
command.
|
|
220
|
+
|
|
180
221
|
`restore --strict` is for pipelines that write the restored text somewhere: if a
|
|
181
222
|
placeholder would be left in it — one the AI invented, one whose shape it changed
|
|
182
223
|
(`__fn__1`), one the team's maps disagree on, or one the team's maps could not be
|
|
@@ -237,6 +278,10 @@ git diff --cached | veilio scan || {
|
|
|
237
278
|
|
|
238
279
|
Redacted credentials are **not** in the map. `restore` cannot bring them back, by construction.
|
|
239
280
|
|
|
281
|
+
## Every file is judged strictly
|
|
282
|
+
|
|
283
|
+
`scrub` and `scan` read every file as real source, test, fixture and example files included: a weak password in a secret position (`PGPASSWORD=Summer24`, `mysql -pSummer24`, the password in a URL, an auth header) is redacted wherever it is. The MCP server and the Claude Code guard do the same. A committed fixture cannot be told from a copy of `.env` in `tests/` safely enough to leave its passwords in place, so no Veilio client tries.
|
|
284
|
+
|
|
240
285
|
## In CI
|
|
241
286
|
|
|
242
287
|
### GitHub Action
|
|
@@ -268,17 +313,11 @@ contain the credential it is reporting.
|
|
|
268
313
|
|
|
269
314
|
### Pre-commit
|
|
270
315
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
repos:
|
|
275
|
-
- repo: https://github.com/veilio-inc/veilio
|
|
276
|
-
rev: v0.1.0
|
|
277
|
-
hooks:
|
|
278
|
-
- id: veilio-scan
|
|
279
|
-
```
|
|
316
|
+
The [pre-commit framework](https://pre-commit.com) is not supported yet. This
|
|
317
|
+
repository has no `.pre-commit-hooks.yaml`, so there is no `veilio-scan` hook
|
|
318
|
+
to name, and no `v*` tag to pin it to.
|
|
280
319
|
|
|
281
|
-
|
|
320
|
+
Use a plain git hook:
|
|
282
321
|
|
|
283
322
|
```bash
|
|
284
323
|
cp packages/cli/hooks/pre-commit .git/hooks/pre-commit
|
package/dist/args.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type LanguageOption } from '@veilio-inc/engine';
|
|
2
2
|
import type { SecretPolicy } from '@veilio-inc/engine';
|
|
3
|
-
|
|
3
|
+
import { type ActionOf, type CommandWord } from './flags.js';
|
|
4
|
+
/** A top-level command word (from the command table), or what a flag asks
|
|
5
|
+
* for when no command does work: `help` or `version`. */
|
|
6
|
+
export type Command = CommandWord | 'help' | 'version';
|
|
4
7
|
export interface ParsedArgs {
|
|
5
8
|
command: Command;
|
|
6
9
|
/** Positional file paths. Empty means read stdin (or, for `scan`, error). */
|
|
@@ -49,7 +52,7 @@ export interface ParsedArgs {
|
|
|
49
52
|
* reads like they are the same thing. `maps <verb>` keeps the cloud surface
|
|
50
53
|
* visibly separate from the offline one.
|
|
51
54
|
*/
|
|
52
|
-
mapsAction: '
|
|
55
|
+
mapsAction: ActionOf<'maps'> | null;
|
|
53
56
|
/**
|
|
54
57
|
* `maps update --allow-drop`: let an update remove entries the Cloud map
|
|
55
58
|
* holds and the local map does not (spec 052 FR-005). Its own flag rather
|
|
@@ -64,20 +67,20 @@ export interface ParsedArgs {
|
|
|
64
67
|
* not say what it unlocks, and what it unlocks is specifically the team's
|
|
65
68
|
* keys rather than the account or the local store.
|
|
66
69
|
*/
|
|
67
|
-
teamAction: '
|
|
70
|
+
teamAction: ActionOf<'team'> | null;
|
|
68
71
|
/**
|
|
69
72
|
* `vault unlock` / `vault lock` (spec 052): the personal-maps key, kept on
|
|
70
73
|
* this machine so personal maps open without a passphrase - for the MCP
|
|
71
74
|
* server above all. `vault`, not `team`: it is the account's own key.
|
|
72
75
|
*/
|
|
73
|
-
vaultAction: '
|
|
76
|
+
vaultAction: ActionOf<'vault'> | null;
|
|
74
77
|
/** `vault unlock --days N`, `team unlock --days N`: how long the unlock
|
|
75
78
|
* lasts. Null: the default, 7 days. */
|
|
76
79
|
days: number | null;
|
|
77
80
|
/** `projects` (or `projects list`) and `projects use <name|id>`. */
|
|
78
|
-
projectsAction: '
|
|
81
|
+
projectsAction: ActionOf<'projects'> | null;
|
|
79
82
|
/** `rules pull`. */
|
|
80
|
-
rulesAction: '
|
|
83
|
+
rulesAction: ActionOf<'rules'> | null;
|
|
81
84
|
/**
|
|
82
85
|
* Base URL of the Veilio instance to sign in to. Null means the public Cloud.
|
|
83
86
|
*
|
|
@@ -86,15 +89,27 @@ export interface ParsedArgs {
|
|
|
86
89
|
* host while still holding the first one's token.
|
|
87
90
|
*/
|
|
88
91
|
instance: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* What `--help` was asked about: a command key (`maps pull`), a group with no
|
|
94
|
+
* action (`maps`), or null for the general help. Set only when `command` is
|
|
95
|
+
* `help`.
|
|
96
|
+
*/
|
|
97
|
+
helpTopic: string | null;
|
|
89
98
|
}
|
|
90
99
|
export declare class UsageError extends Error {
|
|
100
|
+
/** The command the error is about, when there is one: the CLI then prints
|
|
101
|
+
* `veilio scrub: …` rather than `veilio: …`. */
|
|
102
|
+
readonly command: string | undefined;
|
|
103
|
+
/** Print the general help with the error: a line of flags and no command. */
|
|
104
|
+
readonly showHelp: boolean;
|
|
105
|
+
constructor(message: string, command?: string, showHelp?: boolean);
|
|
91
106
|
}
|
|
92
107
|
/**
|
|
93
|
-
* The commands that reach the network
|
|
94
|
-
*
|
|
95
|
-
* command without deciding which side of the line it falls on is a compile
|
|
96
|
-
* error rather than an accident.
|
|
108
|
+
* The commands that reach the network, from the command table. Adding a
|
|
109
|
+
* command to the table means deciding which side of the line it is on.
|
|
97
110
|
*/
|
|
98
111
|
export declare const CLOUD_COMMANDS: Set<Command>;
|
|
112
|
+
/** `maps needs an action — list, pull, push, update or rm.` */
|
|
113
|
+
export declare function needsAction(word: string): string;
|
|
99
114
|
export declare function parseArgs(argv: readonly string[]): ParsedArgs;
|
|
100
115
|
//# sourceMappingURL=args.d.ts.map
|
package/dist/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAIA,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAIA,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAUL,KAAK,QAAQ,EAEb,KAAK,WAAW,EACjB,MAAM,YAAY,CAAA;AAEnB;0DAC0D;AAC1D,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAAA;AAEtD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,cAAc,CAAA;IACxB,OAAO,EAAE,YAAY,CAAA;IACrB,qEAAqE;IACrE,QAAQ,EAAE,OAAO,CAAA;IACjB,uCAAuC;IACvC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,sCAAsC;IACtC,IAAI,EAAE,OAAO,CAAA;IACb,qDAAqD;IACrD,KAAK,EAAE,OAAO,CAAA;IACd,qCAAqC;IACrC,KAAK,EAAE,OAAO,CAAA;IACd,6DAA6D;IAC7D,MAAM,EAAE,OAAO,CAAA;IACf,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAA;IACjB,iEAAiE;IACjE,KAAK,EAAE,OAAO,CAAA;IACd;;;;;;;OAOG;IACH,MAAM,EAAE,OAAO,CAAA;IACf;;;;;;;OAOG;IACH,IAAI,EAAE,OAAO,CAAA;IACb;;;;;;;OAOG;IACH,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IACnC;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAA;IAElB;;;;;;OAMG;IACH,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IACnC;;;;OAIG;IACH,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IACrC;4CACwC;IACxC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,oEAAoE;IACpE,cAAc,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,CAAA;IAC3C,oBAAoB;IACpB,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IAErC;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAEvB;;;;OAIG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,qBAAa,UAAW,SAAQ,KAAK;IACnC;qDACiD;IACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;gBAEd,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,UAAQ;CAKhE;AA0BD;;;GAGG;AACH,eAAO,MAAM,cAAc,cAE1B,CAAA;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAYD,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAwN7D"}
|
package/dist/args.js
CHANGED
|
@@ -2,40 +2,46 @@
|
|
|
2
2
|
// privacy invariant (an audited supply chain is the point), and a CLI that
|
|
3
3
|
// wraps it should not undo that for the sake of flag parsing.
|
|
4
4
|
import { LANGUAGES } from '@veilio-inc/engine';
|
|
5
|
+
import { COMMAND_SPECS, COMMAND_WORDS, actionList, actionsOf, belongsTo, flagFor, flagsOf, runsBare, spell, } from './flags.js';
|
|
5
6
|
export class UsageError extends Error {
|
|
7
|
+
/** The command the error is about, when there is one: the CLI then prints
|
|
8
|
+
* `veilio scrub: …` rather than `veilio: …`. */
|
|
9
|
+
command;
|
|
10
|
+
/** Print the general help with the error: a line of flags and no command. */
|
|
11
|
+
showHelp;
|
|
12
|
+
constructor(message, command, showHelp = false) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.command = command;
|
|
15
|
+
this.showHelp = showHelp;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** The one wording for a flag a command does not take, known or not: it
|
|
19
|
+
* names the command and lists the options it does take. */
|
|
20
|
+
function refusedFlag(spelling, command, known) {
|
|
21
|
+
const options = flagsOf(command);
|
|
22
|
+
const what = known
|
|
23
|
+
? `${spelling} is not an option for ${command}.`
|
|
24
|
+
: `unknown option ${spelling}.`;
|
|
25
|
+
return new UsageError(`${what} Options for ${command}: ${options.map(spell).join(', ')}.`, command);
|
|
6
26
|
}
|
|
7
|
-
const COMMANDS = new Set(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
|
|
16
|
-
'team',
|
|
17
|
-
'vault',
|
|
18
|
-
'projects',
|
|
19
|
-
'rules',
|
|
20
|
-
'help',
|
|
21
|
-
'version',
|
|
22
|
-
]);
|
|
27
|
+
const COMMANDS = new Set(COMMAND_WORDS);
|
|
28
|
+
/** Where each group keeps its action in ParsedArgs. */
|
|
29
|
+
const ACTION_FIELD = {
|
|
30
|
+
maps: 'mapsAction',
|
|
31
|
+
team: 'teamAction',
|
|
32
|
+
vault: 'vaultAction',
|
|
33
|
+
projects: 'projectsAction',
|
|
34
|
+
rules: 'rulesAction',
|
|
35
|
+
};
|
|
23
36
|
/**
|
|
24
|
-
* The commands that reach the network
|
|
25
|
-
*
|
|
26
|
-
* command without deciding which side of the line it falls on is a compile
|
|
27
|
-
* error rather than an accident.
|
|
37
|
+
* The commands that reach the network, from the command table. Adding a
|
|
38
|
+
* command to the table means deciding which side of the line it is on.
|
|
28
39
|
*/
|
|
29
|
-
export const CLOUD_COMMANDS = new Set([
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'team',
|
|
35
|
-
'vault',
|
|
36
|
-
'projects',
|
|
37
|
-
'rules',
|
|
38
|
-
]);
|
|
40
|
+
export const CLOUD_COMMANDS = new Set(COMMAND_SPECS.filter((c) => c.cloud).map((c) => c.key.split(' ')[0]));
|
|
41
|
+
/** `maps needs an action — list, pull, push, update or rm.` */
|
|
42
|
+
export function needsAction(word) {
|
|
43
|
+
return `${word} needs an action — ${actionList(word)}.`;
|
|
44
|
+
}
|
|
39
45
|
const SECRET_POLICIES = new Set(['redact', 'warn', 'off']);
|
|
40
46
|
const LANGUAGE_VALUES = new Set([...LANGUAGES, 'auto']);
|
|
41
47
|
function requireValue(flag, value) {
|
|
@@ -68,76 +74,92 @@ export function parseArgs(argv) {
|
|
|
68
74
|
projectsAction: null,
|
|
69
75
|
days: null,
|
|
70
76
|
rulesAction: null,
|
|
77
|
+
helpTopic: null,
|
|
71
78
|
};
|
|
72
79
|
if (argv.length === 0)
|
|
73
80
|
return parsed;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
// The command is the first word that is neither a flag nor a flag's value,
|
|
82
|
+
// wherever it sits: `veilio -q scrub a.ts` and `veilio --json scan x` are
|
|
83
|
+
// read as `scrub -q a.ts` and `scan --json x`, and checked the same way.
|
|
84
|
+
const taken = new Set();
|
|
85
|
+
let commandAt = -1;
|
|
86
|
+
for (let j = 0; j < argv.length; j++) {
|
|
87
|
+
const arg = argv[j];
|
|
88
|
+
if (arg.startsWith('-') && arg !== '-') {
|
|
89
|
+
if (flagFor(arg)?.value !== undefined)
|
|
90
|
+
j++;
|
|
91
|
+
continue;
|
|
79
92
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
parsed.mapsAction = verb;
|
|
95
|
-
i = 2;
|
|
96
|
-
}
|
|
93
|
+
commandAt = j;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
const wantsHelp = argv.some((a) => a === '--help' || a === '-h');
|
|
97
|
+
const word = commandAt === -1 ? null : argv[commandAt];
|
|
98
|
+
// `--help` anywhere on the line wins, before anything else can refuse it:
|
|
99
|
+
// `veilio scrub --days 3 -h` shows scrub's help, not an error.
|
|
100
|
+
if (wantsHelp) {
|
|
101
|
+
parsed.command = 'help';
|
|
102
|
+
if (word !== null && COMMANDS.has(word)) {
|
|
103
|
+
const verb = argv[commandAt + 1];
|
|
104
|
+
parsed.helpTopic =
|
|
105
|
+
verb !== undefined && actionsOf(word).includes(verb) ? `${word} ${verb}` : word;
|
|
97
106
|
}
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
return parsed;
|
|
108
|
+
}
|
|
109
|
+
let key = null;
|
|
110
|
+
if (word !== null) {
|
|
111
|
+
if (!COMMANDS.has(word))
|
|
112
|
+
throw new UsageError(`unknown command "${word}"`);
|
|
113
|
+
parsed.command = word;
|
|
114
|
+
taken.add(commandAt);
|
|
115
|
+
// A group takes a verb. Read here rather than as a positional later, so
|
|
116
|
+
// that `veilio maps pull abc` does not treat `pull` as a file.
|
|
117
|
+
const actions = actionsOf(word);
|
|
118
|
+
if (actions.length > 0) {
|
|
119
|
+
const verb = argv[commandAt + 1];
|
|
100
120
|
if (verb !== undefined && !verb.startsWith('-')) {
|
|
101
|
-
if (verb
|
|
102
|
-
throw new UsageError(`unknown
|
|
121
|
+
if (!actions.includes(verb)) {
|
|
122
|
+
throw new UsageError(`unknown ${word} action "${verb}" — expected ${actionList(word)}`);
|
|
103
123
|
}
|
|
104
|
-
|
|
105
|
-
|
|
124
|
+
const field = ACTION_FIELD[word];
|
|
125
|
+
parsed[field] = verb;
|
|
126
|
+
taken.add(commandAt + 1);
|
|
127
|
+
key = `${word} ${verb}`;
|
|
106
128
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const verb = argv[1];
|
|
110
|
-
if (verb !== undefined && !verb.startsWith('-')) {
|
|
111
|
-
if (verb !== 'unlock' && verb !== 'lock') {
|
|
112
|
-
throw new UsageError(`unknown vault action "${verb}" — expected unlock or lock`);
|
|
113
|
-
}
|
|
114
|
-
parsed.vaultAction = verb;
|
|
115
|
-
i = 2;
|
|
129
|
+
else if (runsBare(word)) {
|
|
130
|
+
key = word;
|
|
116
131
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (verb !== undefined && !verb.startsWith('-')) {
|
|
121
|
-
if (verb !== 'list' && verb !== 'use') {
|
|
122
|
-
throw new UsageError(`unknown projects action "${verb}" — expected list or use`);
|
|
123
|
-
}
|
|
124
|
-
parsed.projectsAction = verb;
|
|
125
|
-
i = 2;
|
|
132
|
+
else {
|
|
133
|
+
// `veilio maps` alone has nothing to run, whatever flags follow.
|
|
134
|
+
throw new UsageError(needsAction(word));
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (verb !== undefined && !verb.startsWith('-')) {
|
|
131
|
-
if (verb !== 'pull') {
|
|
132
|
-
throw new UsageError(`unknown rules action "${verb}" — expected pull`);
|
|
133
|
-
}
|
|
134
|
-
parsed.rulesAction = verb;
|
|
135
|
-
i = 2;
|
|
136
|
-
}
|
|
137
|
+
else {
|
|
138
|
+
key = word;
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
|
-
|
|
141
|
+
// A line of flags and no command. --help and --version answer on their
|
|
142
|
+
// own; any other known flag has no command to belong to.
|
|
143
|
+
let commandless = null;
|
|
144
|
+
for (let i = 0; i < argv.length; i++) {
|
|
145
|
+
if (taken.has(i))
|
|
146
|
+
continue;
|
|
140
147
|
const arg = argv[i];
|
|
148
|
+
if (arg.startsWith('-') && arg !== '-') {
|
|
149
|
+
const flag = flagFor(arg);
|
|
150
|
+
if (key !== null && !flag) {
|
|
151
|
+
throw refusedFlag(arg, key, false);
|
|
152
|
+
}
|
|
153
|
+
else if (key !== null && flag && !belongsTo(flag, key)) {
|
|
154
|
+
// A flag that exists but is not this command's is refused, not
|
|
155
|
+
// ignored. `veilio scrub --days 3` used to run with `--days` doing
|
|
156
|
+
// nothing.
|
|
157
|
+
throw refusedFlag(arg, key, true);
|
|
158
|
+
}
|
|
159
|
+
else if (key === null && flag && flag.commands !== 'all') {
|
|
160
|
+
commandless ??= arg;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
141
163
|
switch (arg) {
|
|
142
164
|
case '-h':
|
|
143
165
|
case '--help':
|
|
@@ -189,13 +211,13 @@ export function parseArgs(argv) {
|
|
|
189
211
|
case '--keep-docs':
|
|
190
212
|
parsed.keepDocs = true;
|
|
191
213
|
break;
|
|
192
|
-
case '-f':
|
|
193
214
|
case '--team':
|
|
194
215
|
parsed.team = true;
|
|
195
216
|
break;
|
|
196
217
|
case '--device':
|
|
197
218
|
parsed.device = true;
|
|
198
219
|
break;
|
|
220
|
+
case '-f':
|
|
199
221
|
case '--force':
|
|
200
222
|
parsed.force = true;
|
|
201
223
|
break;
|
|
@@ -237,6 +259,9 @@ export function parseArgs(argv) {
|
|
|
237
259
|
parsed.files.push(arg);
|
|
238
260
|
}
|
|
239
261
|
}
|
|
262
|
+
if (commandless !== null) {
|
|
263
|
+
throw new UsageError(`${commandless} needs a command`, undefined, true);
|
|
264
|
+
}
|
|
240
265
|
return parsed;
|
|
241
266
|
}
|
|
242
267
|
//# sourceMappingURL=args.js.map
|
package/dist/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,gFAAgF;AA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dist/client/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export * from './maps.js';
|
|
|
4
4
|
export * from './keys.js';
|
|
5
5
|
export * from './projects.js';
|
|
6
6
|
export * from './status.js';
|
|
7
|
+
export * from './project-scope.js';
|
|
7
8
|
export { personalMapsKeyExpiry, personalMapsKeyPath, readPersonalMapsKey, removePersonalMapsKey, } from './personal-maps-key.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AACpF,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AACpF,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,wBAAwB,CAAA"}
|
package/dist/client/index.js
CHANGED
|
@@ -8,5 +8,6 @@ export * from './maps.js';
|
|
|
8
8
|
export * from './keys.js';
|
|
9
9
|
export * from './projects.js';
|
|
10
10
|
export * from './status.js';
|
|
11
|
+
export * from './project-scope.js';
|
|
11
12
|
export { personalMapsKeyExpiry, personalMapsKeyPath, readPersonalMapsKey, removePersonalMapsKey, } from './personal-maps-key.js';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,6DAA6D;AAE7D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAuB,MAAM,aAAa,CAAA;AACpF,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,6DAA6D;AAE7D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAuB,MAAM,aAAa,CAAA;AACpF,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,wBAAwB,CAAA"}
|
package/dist/client/maps.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Env } from './project-scope.js';
|
|
1
2
|
import { type Outcome } from './wording.js';
|
|
2
3
|
export interface ClientContext {
|
|
3
4
|
/** Home directory the credential and unlocked keys live under. */
|
|
@@ -8,6 +9,11 @@ export interface ClientContext {
|
|
|
8
9
|
* opens personal maps with the personal-maps key or not at all (FR-011).
|
|
9
10
|
*/
|
|
10
11
|
passphrase?: () => Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Where `VEILIO_PROJECT` is read from (FR-012a). Undefined: this process's
|
|
14
|
+
* environment. The MCP server passes its own; tests pass theirs.
|
|
15
|
+
*/
|
|
16
|
+
env?: Env;
|
|
11
17
|
}
|
|
12
18
|
export interface ListedMap {
|
|
13
19
|
id: string;
|
|
@@ -23,6 +29,8 @@ export declare function listCloudMaps(ctx: ClientContext): Promise<Outcome<{
|
|
|
23
29
|
maps: ListedMap[];
|
|
24
30
|
teamId: string | null;
|
|
25
31
|
project: string | null;
|
|
32
|
+
/** VEILIO_PROJECT chose `project`: `projects use` does not change it here. */
|
|
33
|
+
projectFromEnv: boolean;
|
|
26
34
|
}>>;
|
|
27
35
|
export declare function pullCloudMap(ctx: ClientContext, id: string | null, opts: {
|
|
28
36
|
mapPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maps.d.ts","sourceRoot":"","sources":["../../src/client/maps.ts"],"names":[],"mappings":"AAwDA,OAAO,EAAiC,KAAK,OAAO,EAAgB,MAAM,cAAc,CAAA;AAExF,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"maps.d.ts","sourceRoot":"","sources":["../../src/client/maps.ts"],"names":[],"mappings":"AAwDA,OAAO,EAKL,KAAK,GAAG,EAET,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAiC,KAAK,OAAO,EAAgB,MAAM,cAAc,CAAA;AAExF,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,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