@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.
Files changed (60) hide show
  1. package/README.md +63 -24
  2. package/dist/args.d.ts +25 -10
  3. package/dist/args.d.ts.map +1 -1
  4. package/dist/args.js +112 -87
  5. package/dist/args.js.map +1 -1
  6. package/dist/client/index.d.ts +1 -0
  7. package/dist/client/index.d.ts.map +1 -1
  8. package/dist/client/index.js +1 -0
  9. package/dist/client/index.js.map +1 -1
  10. package/dist/client/maps.d.ts +8 -0
  11. package/dist/client/maps.d.ts.map +1 -1
  12. package/dist/client/maps.js +125 -29
  13. package/dist/client/maps.js.map +1 -1
  14. package/dist/client/project-scope.d.ts +87 -0
  15. package/dist/client/project-scope.d.ts.map +1 -0
  16. package/dist/client/project-scope.js +132 -0
  17. package/dist/client/project-scope.js.map +1 -0
  18. package/dist/client/projects.d.ts +31 -1
  19. package/dist/client/projects.d.ts.map +1 -1
  20. package/dist/client/projects.js +71 -10
  21. package/dist/client/projects.js.map +1 -1
  22. package/dist/client/status.d.ts +2 -0
  23. package/dist/client/status.d.ts.map +1 -1
  24. package/dist/client/status.js +16 -7
  25. package/dist/client/status.js.map +1 -1
  26. package/dist/client/wording.d.ts +4 -1
  27. package/dist/client/wording.d.ts.map +1 -1
  28. package/dist/client/wording.js +28 -6
  29. package/dist/client/wording.js.map +1 -1
  30. package/dist/cloud-commands.d.ts +4 -2
  31. package/dist/cloud-commands.d.ts.map +1 -1
  32. package/dist/cloud-commands.js +31 -25
  33. package/dist/cloud-commands.js.map +1 -1
  34. package/dist/cloud.d.ts +1 -1
  35. package/dist/cloud.d.ts.map +1 -1
  36. package/dist/cloud.js +2 -2
  37. package/dist/cloud.js.map +1 -1
  38. package/dist/commands.d.ts +14 -1
  39. package/dist/commands.d.ts.map +1 -1
  40. package/dist/commands.js +12 -59
  41. package/dist/commands.js.map +1 -1
  42. package/dist/credential.d.ts.map +1 -1
  43. package/dist/credential.js +6 -1
  44. package/dist/credential.js.map +1 -1
  45. package/dist/flags.d.ts +211 -0
  46. package/dist/flags.d.ts.map +1 -0
  47. package/dist/flags.js +410 -0
  48. package/dist/flags.js.map +1 -0
  49. package/dist/index.d.ts +6 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +27 -13
  52. package/dist/index.js.map +1 -1
  53. package/dist/team-namespace.d.ts +37 -2
  54. package/dist/team-namespace.d.ts.map +1 -1
  55. package/dist/team-namespace.js +20 -4
  56. package/dist/team-namespace.js.map +1 -1
  57. package/dist/third-party.d.ts.map +1 -1
  58. package/dist/third-party.js +10 -3
  59. package/dist/third-party.js.map +1 -1
  60. package/package.json +2 -2
@@ -0,0 +1,211 @@
1
+ export interface CommandSpec {
2
+ /** A top-level command, or a group with its action (`maps pull`). */
3
+ readonly key: string;
4
+ /** Reaches the network. Listed after the offline commands in `--help`. */
5
+ readonly cloud: boolean;
6
+ /** Its lines in the COMMANDS section of `--help`. */
7
+ readonly help: readonly {
8
+ readonly usage: string;
9
+ readonly text: string;
10
+ }[];
11
+ }
12
+ /** In the order `--help` prints them. */
13
+ export declare const COMMAND_SPECS: readonly [{
14
+ readonly key: "scrub";
15
+ readonly cloud: false;
16
+ readonly help: readonly [{
17
+ readonly usage: "scrub --team";
18
+ readonly text: "Number new placeholders from the team's allocation.";
19
+ }, {
20
+ readonly usage: "scrub [files...]";
21
+ readonly text: "Mask identifiers and redact credentials. Reads stdin when no file is given. Writes the symbol map to .veilio/map.json.";
22
+ }];
23
+ }, {
24
+ readonly key: "restore";
25
+ readonly cloud: false;
26
+ readonly help: readonly [{
27
+ readonly usage: "restore [files...]";
28
+ readonly text: "Swap placeholders back and strip AI-generated noise.";
29
+ }];
30
+ }, {
31
+ readonly key: "scan";
32
+ readonly cloud: false;
33
+ readonly help: readonly [{
34
+ readonly usage: "scan [files...]";
35
+ readonly text: "Detect credentials only; never rewrites. Exits 1 on a credential (with --strict, on any finding) — use it in a pre-commit hook or CI.";
36
+ }];
37
+ }, {
38
+ readonly key: "map";
39
+ readonly cloud: false;
40
+ readonly help: readonly [{
41
+ readonly usage: "map";
42
+ readonly text: "Show the current symbol map (--clear to wipe it).";
43
+ }];
44
+ }, {
45
+ readonly key: "login";
46
+ readonly cloud: true;
47
+ readonly help: readonly [{
48
+ readonly usage: "login";
49
+ readonly text: "Sign in to Veilio Cloud (--instance for self-hosted, --device to approve in a browser).";
50
+ }];
51
+ }, {
52
+ readonly key: "logout";
53
+ readonly cloud: true;
54
+ readonly help: readonly [{
55
+ readonly usage: "logout";
56
+ readonly text: "Revoke the session and forget the credential.";
57
+ }];
58
+ }, {
59
+ readonly key: "whoami";
60
+ readonly cloud: true;
61
+ readonly help: readonly [{
62
+ readonly usage: "whoami";
63
+ readonly text: "Show the signed-in account. Answers from disk; makes no request, so it works with the instance down.";
64
+ }];
65
+ }, {
66
+ readonly key: "maps list";
67
+ readonly cloud: true;
68
+ readonly help: readonly [{
69
+ readonly usage: "maps list";
70
+ readonly text: "List the maps this account holds in Cloud.";
71
+ }];
72
+ }, {
73
+ readonly key: "maps pull";
74
+ readonly cloud: true;
75
+ readonly help: readonly [{
76
+ readonly usage: "maps pull <id>";
77
+ readonly text: "Fetch one into the local store. A personal map is decrypted here — the passphrase never leaves the machine. A team map opens with the key from `team unlock`.";
78
+ }];
79
+ }, {
80
+ readonly key: "maps push";
81
+ readonly cloud: true;
82
+ readonly help: readonly [{
83
+ readonly usage: "maps push [name]";
84
+ readonly text: "Encrypt the local map and upload it as a new map.";
85
+ }, {
86
+ readonly usage: "maps push --team";
87
+ readonly text: "Publish it as the TEAM's shared map instead.";
88
+ }];
89
+ }, {
90
+ readonly key: "maps update";
91
+ readonly cloud: true;
92
+ readonly help: readonly [{
93
+ readonly usage: "maps update <id>";
94
+ readonly text: "Replace a Cloud map's entries with the local map's, in place: same id, name and project. Refuses to drop entries unless --allow-drop is given.";
95
+ }];
96
+ }, {
97
+ readonly key: "maps rm";
98
+ readonly cloud: true;
99
+ readonly help: readonly [{
100
+ readonly usage: "maps rm <id>";
101
+ readonly text: "Remove a map from Cloud.";
102
+ }];
103
+ }, {
104
+ readonly key: "team unlock";
105
+ readonly cloud: true;
106
+ readonly help: readonly [{
107
+ readonly usage: "team unlock";
108
+ readonly text: "Open this account's team keys with the vault passphrase and keep them on this machine (7 days), so team maps - and the MCP server's shared namespace - work unattended.";
109
+ }];
110
+ }, {
111
+ readonly key: "team lock";
112
+ readonly cloud: true;
113
+ readonly help: readonly [{
114
+ readonly usage: "team lock";
115
+ readonly text: "Remove the unlocked team keys from this machine.";
116
+ }];
117
+ }, {
118
+ readonly key: "vault unlock";
119
+ readonly cloud: true;
120
+ readonly help: readonly [{
121
+ readonly usage: "vault unlock";
122
+ readonly text: "Unlock the personal-maps key with the vault passphrase and keep only that key here (7 days), so personal maps - and the MCP server's map tools - work without a passphrase. Re-seals older personal maps under it.";
123
+ }];
124
+ }, {
125
+ readonly key: "vault lock";
126
+ readonly cloud: true;
127
+ readonly help: readonly [{
128
+ readonly usage: "vault lock";
129
+ readonly text: "Remove the personal-maps key from this machine.";
130
+ }];
131
+ }, {
132
+ readonly key: "projects";
133
+ readonly cloud: true;
134
+ readonly help: readonly [{
135
+ readonly usage: "projects";
136
+ readonly text: "List the projects your team works in; * marks the one in use. A team map belongs to exactly one project.";
137
+ }];
138
+ }, {
139
+ readonly key: "projects list";
140
+ readonly cloud: true;
141
+ readonly help: readonly [{
142
+ readonly usage: "projects list";
143
+ readonly text: "The same as `projects`.";
144
+ }];
145
+ }, {
146
+ readonly key: "projects use";
147
+ readonly cloud: true;
148
+ readonly help: readonly [{
149
+ readonly usage: "projects use <name>";
150
+ readonly text: "Work in that project: team maps, pushes, updates and scrub --team use it only. Kept with the sign-in, so the MCP server uses it too. VEILIO_PROJECT=<name|id> overrides it for one shell, CI job or MCP server.";
151
+ }];
152
+ }, {
153
+ readonly key: "rules pull";
154
+ readonly cloud: true;
155
+ readonly help: readonly [{
156
+ readonly usage: "rules pull";
157
+ readonly text: "Fetch this account's custom rules (personal and team). `scrub` then applies them offline, as the web app does.";
158
+ }];
159
+ }];
160
+ /** The command a flag is checked against: a top-level command, or a group
161
+ * command with its action (`maps pull`). */
162
+ export type CommandKey = (typeof COMMAND_SPECS)[number]['key'];
163
+ /** The first word of a key: `maps` for `maps pull`. */
164
+ export type CommandWord<K extends string = CommandKey> = K extends `${infer W} ${string}` ? W : K;
165
+ /** The actions of a group: `'list' | 'pull' | …` for `maps`. */
166
+ export type ActionOf<G extends string> = CommandKey extends infer K ? K extends `${G} ${infer A}` ? A : never : never;
167
+ export declare const COMMAND_KEYS: readonly CommandKey[];
168
+ /** Every top-level word the parser accepts as a command, in table order. */
169
+ export declare const COMMAND_WORDS: readonly string[];
170
+ /** The actions of a group, in table order. Empty for a plain command. */
171
+ export declare function actionsOf(word: string): string[];
172
+ /** Whether a group can also run with no action (`projects` lists). */
173
+ export declare function runsBare(word: string): boolean;
174
+ /** `list, pull, push, update or rm`, for the messages that name the actions. */
175
+ export declare function actionList(word: string): string;
176
+ export interface FlagSpec {
177
+ long: string;
178
+ short?: string;
179
+ /** The value's placeholder in `--help` (`<lang>`). Absent: a switch. */
180
+ value?: string;
181
+ /** What the flag does, and the notes a user needs. Wrapped by `--help`. */
182
+ help: string;
183
+ /** The commands this flag belongs to. `'all'`: every command. */
184
+ commands: readonly CommandKey[] | 'all';
185
+ /** The ParsedArgs field it sets. The table-vs-code test reads it. */
186
+ field?: string;
187
+ }
188
+ export declare const FLAGS: readonly FlagSpec[];
189
+ /** The flag a spelling (`-l` or `--language`) names, if any. */
190
+ export declare function flagFor(spelling: string): FlagSpec | undefined;
191
+ export declare function belongsTo(flag: FlagSpec, command: CommandKey): boolean;
192
+ /** The flags a command takes, the ones for every command included. */
193
+ export declare function flagsOf(command: CommandKey): FlagSpec[];
194
+ /** `--language (-l)`, for an error message. */
195
+ export declare function spell(flag: FlagSpec): string;
196
+ /** Every line of `--help` fits in this many columns. */
197
+ export declare const HELP_WIDTH = 80;
198
+ /** Words of `text`, in lines no wider than `width`. */
199
+ export declare function wrap(text: string, width: number): string[];
200
+ /** The OPTIONS block for some flags: each flag, its text, and the commands
201
+ * it belongs to, every line within HELP_WIDTH. */
202
+ export declare function optionsHelp(flags?: readonly FlagSpec[]): string;
203
+ /** The COMMANDS block for some commands. */
204
+ export declare function commandsHelp(specs: readonly CommandSpec[]): string;
205
+ /** The COMMANDS section of the general help: the offline commands, a note,
206
+ * then the ones that reach the network. */
207
+ export declare function allCommandsHelp(): string;
208
+ /** `veilio scrub --help`: that command's lines and its own options. For a
209
+ * group with no action (`veilio maps --help`), every action of the group. */
210
+ export declare function commandHelp(topic: string): string;
211
+ //# sourceMappingURL=flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC5E;AAED,yCAAyC;AACzC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwKiB,CAAA;AAE3C;6CAC6C;AAC7C,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAA;AAE9D,uDAAuD;AACvD,MAAM,MAAM,WAAW,CAAC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E,wBAAgB,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,QAAQ,EAAE,CAEvD;AAED,+CAA+C;AAC/C,wBAAgB,KAAK,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAE5C;AAED,wDAAwD;AACxD,eAAO,MAAM,UAAU,KAAK,CAAA;AAE5B,uDAAuD;AACvD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAW1D;AAuBD;mDACmD;AACnD,wBAAgB,WAAW,CAAC,KAAK,GAAE,SAAS,QAAQ,EAAU,GAAG,MAAM,CAUtE;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,CAKlE;AAED;4CAC4C;AAC5C,wBAAgB,eAAe,IAAI,MAAM,CAUxC;AAED;8EAC8E;AAC9E,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASjD"}
package/dist/flags.js ADDED
@@ -0,0 +1,410 @@
1
+ /**
2
+ * Every command and every flag, in one table. The parser reads its commands,
3
+ * group verbs and flags from here. `--help` (general and per command) is
4
+ * rendered from here. The docs test reads it. So a new action or flag is
5
+ * added in one place, and the parser, the help and the docs check cannot drift
6
+ * apart.
7
+ *
8
+ * Before this table, the parser took any flag on any command and ignored the
9
+ * ones that did not apply: `veilio scrub --days 3` ran, and `--days` did
10
+ * nothing. That is the same silent failure as the engine's removed
11
+ * `options.style`. A reader who writes a flag into a script believes it does
12
+ * something. Now a flag on a command it does not belong to is refused, with
13
+ * exit code 2 and the list of options that command does take.
14
+ */
15
+ import { BIN_NAME, STORE_DIR } from '@veilio-inc/engine';
16
+ /** In the order `--help` prints them. */
17
+ export const COMMAND_SPECS = [
18
+ {
19
+ key: 'scrub',
20
+ cloud: false,
21
+ help: [
22
+ { usage: 'scrub --team', text: "Number new placeholders from the team's allocation." },
23
+ {
24
+ usage: 'scrub [files...]',
25
+ text: `Mask identifiers and redact credentials. Reads stdin when no file is given. Writes the symbol map to ${STORE_DIR}/map.json.`,
26
+ },
27
+ ],
28
+ },
29
+ {
30
+ key: 'restore',
31
+ cloud: false,
32
+ help: [
33
+ {
34
+ usage: 'restore [files...]',
35
+ text: 'Swap placeholders back and strip AI-generated noise.',
36
+ },
37
+ ],
38
+ },
39
+ {
40
+ key: 'scan',
41
+ cloud: false,
42
+ help: [
43
+ {
44
+ usage: 'scan [files...]',
45
+ text: 'Detect credentials only; never rewrites. Exits 1 on a credential (with --strict, on any finding) — use it in a pre-commit hook or CI.',
46
+ },
47
+ ],
48
+ },
49
+ {
50
+ key: 'map',
51
+ cloud: false,
52
+ help: [{ usage: 'map', text: 'Show the current symbol map (--clear to wipe it).' }],
53
+ },
54
+ {
55
+ key: 'login',
56
+ cloud: true,
57
+ help: [
58
+ {
59
+ usage: 'login',
60
+ text: 'Sign in to Veilio Cloud (--instance for self-hosted, --device to approve in a browser).',
61
+ },
62
+ ],
63
+ },
64
+ {
65
+ key: 'logout',
66
+ cloud: true,
67
+ help: [{ usage: 'logout', text: 'Revoke the session and forget the credential.' }],
68
+ },
69
+ {
70
+ key: 'whoami',
71
+ cloud: true,
72
+ help: [
73
+ {
74
+ usage: 'whoami',
75
+ text: 'Show the signed-in account. Answers from disk; makes no request, so it works with the instance down.',
76
+ },
77
+ ],
78
+ },
79
+ {
80
+ key: 'maps list',
81
+ cloud: true,
82
+ help: [{ usage: 'maps list', text: 'List the maps this account holds in Cloud.' }],
83
+ },
84
+ {
85
+ key: 'maps pull',
86
+ cloud: true,
87
+ help: [
88
+ {
89
+ usage: 'maps pull <id>',
90
+ text: 'Fetch one into the local store. A personal map is decrypted here — the passphrase never leaves the machine. A team map opens with the key from `team unlock`.',
91
+ },
92
+ ],
93
+ },
94
+ {
95
+ key: 'maps push',
96
+ cloud: true,
97
+ help: [
98
+ {
99
+ usage: 'maps push [name]',
100
+ text: 'Encrypt the local map and upload it as a new map.',
101
+ },
102
+ { usage: 'maps push --team', text: "Publish it as the TEAM's shared map instead." },
103
+ ],
104
+ },
105
+ {
106
+ key: 'maps update',
107
+ cloud: true,
108
+ help: [
109
+ {
110
+ usage: 'maps update <id>',
111
+ text: "Replace a Cloud map's entries with the local map's, in place: same id, name and project. Refuses to drop entries unless --allow-drop is given.",
112
+ },
113
+ ],
114
+ },
115
+ {
116
+ key: 'maps rm',
117
+ cloud: true,
118
+ help: [{ usage: 'maps rm <id>', text: 'Remove a map from Cloud.' }],
119
+ },
120
+ {
121
+ key: 'team unlock',
122
+ cloud: true,
123
+ help: [
124
+ {
125
+ usage: 'team unlock',
126
+ text: "Open this account's team keys with the vault passphrase and keep them on this machine (7 days), so team maps - and the MCP server's shared namespace - work unattended.",
127
+ },
128
+ ],
129
+ },
130
+ {
131
+ key: 'team lock',
132
+ cloud: true,
133
+ help: [{ usage: 'team lock', text: 'Remove the unlocked team keys from this machine.' }],
134
+ },
135
+ {
136
+ key: 'vault unlock',
137
+ cloud: true,
138
+ help: [
139
+ {
140
+ usage: 'vault unlock',
141
+ text: "Unlock the personal-maps key with the vault passphrase and keep only that key here (7 days), so personal maps - and the MCP server's map tools - work without a passphrase. Re-seals older personal maps under it.",
142
+ },
143
+ ],
144
+ },
145
+ {
146
+ key: 'vault lock',
147
+ cloud: true,
148
+ help: [{ usage: 'vault lock', text: 'Remove the personal-maps key from this machine.' }],
149
+ },
150
+ {
151
+ key: 'projects',
152
+ cloud: true,
153
+ help: [
154
+ {
155
+ usage: 'projects',
156
+ text: 'List the projects your team works in; * marks the one in use. A team map belongs to exactly one project.',
157
+ },
158
+ ],
159
+ },
160
+ {
161
+ key: 'projects list',
162
+ cloud: true,
163
+ help: [{ usage: 'projects list', text: 'The same as `projects`.' }],
164
+ },
165
+ {
166
+ key: 'projects use',
167
+ cloud: true,
168
+ help: [
169
+ {
170
+ usage: 'projects use <name>',
171
+ text: 'Work in that project: team maps, pushes, updates and scrub --team use it only. Kept with the sign-in, so the MCP server uses it too. VEILIO_PROJECT=<name|id> overrides it for one shell, CI job or MCP server.',
172
+ },
173
+ ],
174
+ },
175
+ {
176
+ key: 'rules pull',
177
+ cloud: true,
178
+ help: [
179
+ {
180
+ usage: 'rules pull',
181
+ text: "Fetch this account's custom rules (personal and team). `scrub` then applies them offline, as the web app does.",
182
+ },
183
+ ],
184
+ },
185
+ ];
186
+ export const COMMAND_KEYS = COMMAND_SPECS.map((c) => c.key);
187
+ /** Every top-level word the parser accepts as a command, in table order. */
188
+ export const COMMAND_WORDS = [
189
+ ...new Set(COMMAND_KEYS.map((k) => k.split(' ')[0])),
190
+ ];
191
+ /** The actions of a group, in table order. Empty for a plain command. */
192
+ export function actionsOf(word) {
193
+ return COMMAND_KEYS.filter((k) => k.startsWith(`${word} `)).map((k) => k.split(' ')[1]);
194
+ }
195
+ /** Whether a group can also run with no action (`projects` lists). */
196
+ export function runsBare(word) {
197
+ return COMMAND_KEYS.includes(word);
198
+ }
199
+ /** `list, pull, push, update or rm`, for the messages that name the actions. */
200
+ export function actionList(word) {
201
+ const actions = actionsOf(word);
202
+ return actions.length > 1
203
+ ? `${actions.slice(0, -1).join(', ')} or ${actions[actions.length - 1]}`
204
+ : (actions[0] ?? '');
205
+ }
206
+ export const FLAGS = [
207
+ {
208
+ long: '--language',
209
+ short: '-l',
210
+ value: '<lang>',
211
+ help: 'auto (default), typescript, python, go, java, csharp, rust, ruby, php, c, sql',
212
+ commands: ['scrub'],
213
+ field: 'language',
214
+ },
215
+ {
216
+ long: '--secrets',
217
+ short: '-s',
218
+ value: '<policy>',
219
+ help: 'redact (default) | warn | off',
220
+ commands: ['scrub'],
221
+ field: 'secrets',
222
+ },
223
+ {
224
+ long: '--preamble',
225
+ short: '-p',
226
+ help: 'Prepend the downstream-AI note and placeholder legend',
227
+ commands: ['scrub'],
228
+ field: 'preamble',
229
+ },
230
+ {
231
+ long: '--map',
232
+ short: '-m',
233
+ value: '<path>',
234
+ help: 'Use a specific map file',
235
+ commands: ['scrub', 'restore', 'map', 'maps pull', 'maps push', 'maps update'],
236
+ field: 'mapPath',
237
+ },
238
+ {
239
+ long: '--json',
240
+ help: 'Machine-readable output',
241
+ commands: ['scan', 'map'],
242
+ field: 'json',
243
+ },
244
+ {
245
+ long: '--strict',
246
+ help: 'scan: also fail on advisory findings. restore: write nothing and exit 1 if a placeholder would be left',
247
+ commands: ['scan', 'restore'],
248
+ field: 'strict',
249
+ },
250
+ {
251
+ long: '--keep-docs',
252
+ help: 'Keep JSDoc blocks the model wrote',
253
+ commands: ['restore'],
254
+ field: 'keepDocs',
255
+ },
256
+ {
257
+ long: '--clear',
258
+ help: 'Wipe the symbol map',
259
+ commands: ['map'],
260
+ field: 'clear',
261
+ },
262
+ {
263
+ long: '--force',
264
+ short: '-f',
265
+ help: 'Allow a map write that would drop existing entries',
266
+ commands: ['scrub', 'maps pull'],
267
+ field: 'force',
268
+ },
269
+ {
270
+ long: '--team',
271
+ help: "scrub: number new placeholders out of the team's shared allocation, for a map you intend to publish. maps push: publish as the team's shared map",
272
+ commands: ['scrub', 'maps push'],
273
+ field: 'team',
274
+ },
275
+ {
276
+ long: '--days',
277
+ value: '<n>',
278
+ help: 'Keep the key for n days (1 to 30; 7 by default)',
279
+ commands: ['team unlock', 'vault unlock'],
280
+ field: 'days',
281
+ },
282
+ {
283
+ long: '--allow-drop',
284
+ help: 'Allow dropping entries the Cloud map has and the local map does not',
285
+ commands: ['maps update'],
286
+ field: 'allowDrop',
287
+ },
288
+ {
289
+ long: '--quiet',
290
+ short: '-q',
291
+ help: 'Suppress the all-clear summary (findings always show)',
292
+ commands: ['scrub', 'restore', 'scan'],
293
+ field: 'quiet',
294
+ },
295
+ {
296
+ long: '--device',
297
+ help: 'Sign in through a browser instead of typing a password here. Required for an SSO-bound account, and used automatically when the instance asks for a CAPTCHA',
298
+ commands: ['login'],
299
+ field: 'device',
300
+ },
301
+ {
302
+ long: '--instance',
303
+ value: '<url>',
304
+ help: 'The Veilio instance to sign in to. Defaults to the public Cloud; https required (localhost excepted)',
305
+ // Only `login` reads it. Every later command takes the instance from the
306
+ // stored sign-in, so a command cannot be pointed at another host while it
307
+ // holds the first one's token. Accepting it elsewhere would let
308
+ // `veilio whoami --instance …` look like a check of that host.
309
+ commands: ['login'],
310
+ field: 'instance',
311
+ },
312
+ { long: '--help', short: '-h', help: 'Show this help', commands: 'all' },
313
+ { long: '--version', short: '-v', help: 'Show the version', commands: 'all' },
314
+ ];
315
+ const BY_SPELLING = new Map();
316
+ for (const f of FLAGS) {
317
+ BY_SPELLING.set(f.long, f);
318
+ if (f.short)
319
+ BY_SPELLING.set(f.short, f);
320
+ }
321
+ /** The flag a spelling (`-l` or `--language`) names, if any. */
322
+ export function flagFor(spelling) {
323
+ return BY_SPELLING.get(spelling);
324
+ }
325
+ export function belongsTo(flag, command) {
326
+ return flag.commands === 'all' || flag.commands.includes(command);
327
+ }
328
+ /** The flags a command takes, the ones for every command included. */
329
+ export function flagsOf(command) {
330
+ return FLAGS.filter((f) => belongsTo(f, command));
331
+ }
332
+ /** `--language (-l)`, for an error message. */
333
+ export function spell(flag) {
334
+ return flag.short ? `${flag.long} (${flag.short})` : flag.long;
335
+ }
336
+ /** Every line of `--help` fits in this many columns. */
337
+ export const HELP_WIDTH = 80;
338
+ /** Words of `text`, in lines no wider than `width`. */
339
+ export function wrap(text, width) {
340
+ const lines = [];
341
+ let line = '';
342
+ for (const word of text.split(/\s+/).filter(Boolean)) {
343
+ if (line && line.length + 1 + word.length > width) {
344
+ lines.push(line);
345
+ line = word;
346
+ }
347
+ else
348
+ line = line ? `${line} ${word}` : word;
349
+ }
350
+ if (line)
351
+ lines.push(line);
352
+ return lines;
353
+ }
354
+ /** A two-column block: each name, then its text wrapped under a column. */
355
+ function columns(rows, column) {
356
+ const out = [];
357
+ for (const { name, text } of rows) {
358
+ const body = wrap(text, HELP_WIDTH - column);
359
+ const first = name.length + 2 < column ? ` ${name.padEnd(column - 2)}${body[0] ?? ''}` : ` ${name}`;
360
+ out.push(first);
361
+ const rest = name.length + 2 < column ? body.slice(1) : body;
362
+ for (const line of rest)
363
+ out.push(`${' '.repeat(column)}${line}`);
364
+ }
365
+ return out.join('\n');
366
+ }
367
+ const OPTION_COLUMN = 26;
368
+ const COMMAND_COLUMN = 23;
369
+ function optionName(f) {
370
+ return `${f.short ? `${f.short}, ` : ' '}${f.long}${f.value ? ` ${f.value}` : ''}`;
371
+ }
372
+ /** The OPTIONS block for some flags: each flag, its text, and the commands
373
+ * it belongs to, every line within HELP_WIDTH. */
374
+ export function optionsHelp(flags = FLAGS) {
375
+ const out = [];
376
+ for (const f of flags) {
377
+ out.push(columns([{ name: optionName(f), text: f.help }], OPTION_COLUMN));
378
+ if (f.commands !== 'all') {
379
+ const forLines = wrap(`For: ${f.commands.join(', ')}`, HELP_WIDTH - OPTION_COLUMN);
380
+ for (const line of forLines)
381
+ out.push(`${' '.repeat(OPTION_COLUMN)}${line}`);
382
+ }
383
+ }
384
+ return out.join('\n');
385
+ }
386
+ /** The COMMANDS block for some commands. */
387
+ export function commandsHelp(specs) {
388
+ return columns(specs.flatMap((c) => c.help.map((h) => ({ name: h.usage, text: h.text }))), COMMAND_COLUMN);
389
+ }
390
+ /** The COMMANDS section of the general help: the offline commands, a note,
391
+ * then the ones that reach the network. */
392
+ export function allCommandsHelp() {
393
+ const offline = COMMAND_SPECS.filter((c) => !c.cloud);
394
+ const cloud = COMMAND_SPECS.filter((c) => c.cloud);
395
+ const note = wrap('Everything above works offline, with no account. The commands below connect a Veilio Cloud subscription and are the only ones that touch the network.', HELP_WIDTH - 2)
396
+ .map((l) => ` ${l}`)
397
+ .join('\n');
398
+ return `${commandsHelp(offline)}\n\n${note}\n\n${commandsHelp(cloud)}`;
399
+ }
400
+ /** `veilio scrub --help`: that command's lines and its own options. For a
401
+ * group with no action (`veilio maps --help`), every action of the group. */
402
+ export function commandHelp(topic) {
403
+ const specs = COMMAND_SPECS.filter((c) => c.key === topic || c.key.startsWith(`${topic} `));
404
+ const keys = specs.map((c) => c.key);
405
+ const flags = FLAGS.filter((f) => keys.some((k) => belongsTo(f, k)));
406
+ return (`${BIN_NAME} ${topic}\n\nUSAGE\n${specs
407
+ .flatMap((c) => c.help.map((h) => ` ${BIN_NAME} ${h.usage}`))
408
+ .join('\n')}\n\n` + `COMMANDS\n${commandsHelp(specs)}\n\nOPTIONS\n${optionsHelp(flags)}\n`);
409
+ }
410
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAWxD,yCAAyC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE;YACJ,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,qDAAqD,EAAE;YACtF;gBACE,KAAK,EAAE,kBAAkB;gBACzB,IAAI,EAAE,wGAAwG,SAAS,YAAY;aACpI;SACF;KACF;IACD;QACE,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE;YACJ;gBACE,KAAK,EAAE,oBAAoB;gBAC3B,IAAI,EAAE,sDAAsD;aAC7D;SACF;KACF;IACD;QACE,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE;YACJ;gBACE,KAAK,EAAE,iBAAiB;gBACxB,IAAI,EAAE,uIAAuI;aAC9I;SACF;KACF;IACD;QACE,GAAG,EAAE,KAAK;QACV,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,mDAAmD,EAAE,CAAC;KACpF;IACD;QACE,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACJ;gBACE,KAAK,EAAE,OAAO;g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AI,KAAK,cAAc,KAAK;SACpC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;SAC7D,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,aAAa,YAAY,CAAC,KAAK,CAAC,gBAAgB,WAAW,CAAC,KAAK,CAAC,IAAI,CAC7F,CAAA;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  #!/usr/bin/env node
2
+ import { type ParsedArgs } from './args.js';
2
3
  import { type Io } from './commands.js';
3
4
  import { VERSION } from './version.js';
4
5
  export { VERSION };
5
6
  /** Testable entry point: everything that touches the process is injected. */
6
7
  export declare function main(argv: readonly string[], io: Io): Promise<number>;
8
+ /**
9
+ * Run parsed arguments. Separate from \`main\` so a test can hand it \`args\`
10
+ * wrapped in a Proxy and see every field each command reads.
11
+ */
12
+ export declare function run(args: ParsedArgs, io: Io): Promise<number>;
7
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAA2D,KAAK,EAAE,EAAE,MAAM,eAAe,CAAA;AAyBhG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,OAAO,EAAE,CAAA;AAElB,6EAA6E;AAC7E,wBAAsB,IAAI,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwF3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AAE/E,OAAO,EAA2D,KAAK,EAAE,EAAE,MAAM,eAAe,CAAA;AA0BhG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,OAAO,EAAE,CAAA;AAElB,6EAA6E;AAC7E,wBAAsB,IAAI,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB3E;AAED;;;GAGG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA+EnE"}