@veilio-inc/cli 0.6.1 → 0.7.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 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 findings. |
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)
@@ -160,8 +160,8 @@ with the real names:
160
160
  own map, not against a team namespace of four hundred entries.
161
161
 
162
162
  The map commands are clients of `GET /api/maps`, `GET /api/maps/:id`,
163
- `POST /api/maps` and `PATCH /api/maps/:id` — the exact same routes the browser uses, behind the exact
164
- 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
165
165
  a plan feature the web app couldn't.
166
166
 
167
167
  ## Options
@@ -169,31 +169,55 @@ a plan feature the web app couldn't.
169
169
  ```
170
170
  -l, --language <lang> auto (default), typescript, python, go, java, csharp,
171
171
  rust, ruby, php, c, sql
172
+ For: scrub
172
173
  -s, --secrets <policy> redact (default) | warn | off
174
+ For: scrub
173
175
  -p, --preamble Prepend the downstream-AI note and placeholder legend
176
+ For: scrub
174
177
  -m, --map <path> Use a specific map file
175
- --json Machine-readable output (scan, map)
178
+ For: scrub, restore, map, maps pull, maps push, maps
179
+ update
180
+ --json Machine-readable output
181
+ For: scan, map
176
182
  --strict scan: also fail on advisory findings. restore: write
177
183
  nothing and exit 1 if a placeholder would be left
178
- --keep-docs restore: keep JSDoc blocks the model wrote
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
179
189
  -f, --force Allow a map write that would drop existing entries
180
- --days <n> vault unlock, team unlock: keep the key for n days
181
- (1 to 30; 7 by default)
182
- --allow-drop maps update: allow dropping entries the Cloud map has
183
- and the local map does not
184
- --device login: sign in through a browser instead of typing a
185
- password here. Required for an SSO-bound account, and
186
- used automatically when the instance asks for a CAPTCHA
190
+ For: scrub, maps pull
187
191
  --team scrub: number new placeholders out of the team's
188
192
  shared allocation, for a map you intend to publish.
189
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
190
200
  -q, --quiet Suppress the all-clear summary (findings always show)
191
- --instance <url> login: the Veilio instance to sign in to. Defaults to
192
- the public Cloud; https required (localhost excepted)
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
193
209
  -h, --help Show this help
194
210
  -v, --version Show the version
195
211
  ```
196
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
+
197
221
  `restore --strict` is for pipelines that write the restored text somewhere: if a
198
222
  placeholder would be left in it — one the AI invented, one whose shape it changed
199
223
  (`__fn__1`), one the team's maps disagree on, or one the team's maps could not be
@@ -254,6 +278,10 @@ git diff --cached | veilio scan || {
254
278
 
255
279
  Redacted credentials are **not** in the map. `restore` cannot bring them back, by construction.
256
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
+
257
285
  ## In CI
258
286
 
259
287
  ### GitHub Action
@@ -285,17 +313,11 @@ contain the credential it is reporting.
285
313
 
286
314
  ### Pre-commit
287
315
 
288
- Via the [pre-commit framework](https://pre-commit.com):
289
-
290
- ```yaml
291
- repos:
292
- - repo: https://github.com/veilio-inc/veilio
293
- rev: v0.1.0
294
- hooks:
295
- - id: veilio-scan
296
- ```
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.
297
319
 
298
- Or a plain git hook:
320
+ Use a plain git hook:
299
321
 
300
322
  ```bash
301
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
- export type Command = 'scrub' | 'restore' | 'scan' | 'map' | 'login' | 'logout' | 'whoami' | 'maps' | 'team' | 'vault' | 'projects' | 'rules' | 'help' | 'version';
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: 'list' | 'pull' | 'push' | 'update' | 'rm' | null;
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: 'unlock' | 'lock' | null;
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: 'unlock' | 'lock' | null;
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: 'list' | 'use' | null;
81
+ projectsAction: ActionOf<'projects'> | null;
79
82
  /** `rules pull`. */
80
- rulesAction: 'pull' | null;
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. Named here so the split is one list
94
- * rather than a condition repeated at each call site — and so that adding a
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
@@ -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;AAEtD,MAAM,MAAM,OAAO,GACf,OAAO,GACP,SAAS,GACT,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,UAAU,GACV,OAAO,GACP,MAAM,GACN,SAAS,CAAA;AAEb,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,O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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
- 'scrub',
9
- 'restore',
10
- 'scan',
11
- 'map',
12
- 'login',
13
- 'logout',
14
- 'whoami',
15
- 'maps',
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. Named here so the split is one list
25
- * rather than a condition repeated at each call site — and so that adding a
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
- 'login',
31
- 'logout',
32
- 'whoami',
33
- 'maps',
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
- let i = 0;
75
- const first = argv[0];
76
- if (!first.startsWith('-')) {
77
- if (!COMMANDS.has(first)) {
78
- throw new UsageError(`unknown command "${first}"`);
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
- parsed.command = first;
81
- i = 1;
82
- // `maps` takes a verb. Read here rather than as a positional later, so that
83
- // `veilio maps pull abc` does not treat `pull` as a file to anonymize.
84
- if (parsed.command === 'maps') {
85
- const verb = argv[1];
86
- if (verb !== undefined && !verb.startsWith('-')) {
87
- if (verb !== 'list' &&
88
- verb !== 'pull' &&
89
- verb !== 'push' &&
90
- verb !== 'update' &&
91
- verb !== 'rm') {
92
- throw new UsageError(`unknown maps action "${verb}" — expected list, pull, push, update or rm`);
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
- if (parsed.command === 'team') {
99
- const verb = argv[1];
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 !== 'unlock' && verb !== 'lock') {
102
- throw new UsageError(`unknown team action "${verb}" — expected unlock or lock`);
121
+ if (!actions.includes(verb)) {
122
+ throw new UsageError(`unknown ${word} action "${verb}" — expected ${actionList(word)}`);
103
123
  }
104
- parsed.teamAction = verb;
105
- i = 2;
124
+ const field = ACTION_FIELD[word];
125
+ parsed[field] = verb;
126
+ taken.add(commandAt + 1);
127
+ key = `${word} ${verb}`;
106
128
  }
107
- }
108
- if (parsed.command === 'vault') {
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
- if (parsed.command === 'projects') {
119
- const verb = argv[1];
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
- if (parsed.command === 'rules') {
129
- const verb = argv[1];
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
- for (; i < argv.length; i++) {
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':
@@ -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;AAChF,2EAA2E;AAC3E,8DAA8D;AAE9D,OAAO,EAAE,SAAS,EAAsC,MAAM,oBAAoB,CAAA;AA4GlF,MAAM,OAAO,UAAW,SAAQ,KAAK;CAAG;AAExC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAU;IAChC,OAAO;IACP,SAAS;IACT,MAAM;IACN,KAAK;IACL,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,UAAU;IACV,OAAO;IACP,MAAM;IACN,SAAS;CACV,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAU;IAC7C,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,UAAU;IACV,OAAO;CACR,CAAC,CAAA;AACF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AACxE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAS,CAAC,GAAG,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AK,CAAC,CAAA;gBACtB,CAAC;gBAAC,MAAM,CAAC;oBACP,MAAM,IAAI,UAAU,CAAC,kCAAkC,KAAK,IAAI,CAAC,CAAA;gBACnE,CAAC;gBACD,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;oBAC9D,MAAM,IAAI,UAAU,CAClB,kCAAkC,KAAK,2CAA2C;wBAChF,wFAAwF,CAC3F,CAAA;gBACH,CAAC;gBACD,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAA;gBACvB,MAAK;YACP,CAAC;YACD;gBACE,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;oBACvC,MAAM,IAAI,UAAU,CAAC,iBAAiB,GAAG,GAAG,CAAC,CAAA;gBAC/C,CAAC;gBACD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,UAAU,CAAC,GAAG,WAAW,kBAAkB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;IACzE,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -73,5 +73,5 @@ export declare function runRestore(args: ParsedArgs, io: Io, teamLayer?: TeamLay
73
73
  /** Detect-only pass for pre-commit hooks and CI. Never rewrites anything. */
74
74
  export declare function runScan(args: ParsedArgs, io: Io): Promise<number>;
75
75
  export declare function runMap(args: ParsedArgs, io: Io): Promise<number>;
76
- export declare const HELP = "veilio \u2014 anonymize code before it reaches an LLM, restore it after.\n\nUSAGE\n veilio <command> [files...] [options]\n\nCOMMANDS\n scrub --team Number new placeholders from the team's allocation.\n scrub [files...] Mask identifiers and redact credentials. Reads stdin when\n no file is given. Writes the symbol map to .veilio/map.json.\n restore [files...] Swap placeholders back and strip AI-generated noise.\n scan [files...] Detect credentials only; never rewrites. Exits 1 when it\n finds something \u2014 use it in a pre-commit hook or CI.\n map Show the current symbol map (--clear to wipe it).\n\n Everything above works offline, with no account. The commands below connect a\n Veilio Cloud subscription and are the only ones that touch the network.\n\n login Sign in to Veilio Cloud (--instance for self-hosted).\n logout Revoke the session and forget the credential.\n whoami Show the signed-in account. Answers from disk; makes no\n request, so it works with the instance down.\n maps list List the maps this account holds in Cloud.\n maps pull <id> Fetch one into the local store. A personal map is\n decrypted here \u2014 the passphrase never leaves the machine.\n A team map opens with the key from `team unlock`.\n maps push [name] Encrypt the local map and upload it as a new map.\n maps push --team Publish it as the TEAM's shared map instead.\n maps update <id> Replace a Cloud map's entries with the local map's, in\n place: same id, name and project. Refuses to drop\n entries unless --allow-drop is given.\n maps rm <id> Remove a map from Cloud.\n team unlock Open this account's team keys with the vault passphrase\n and keep them on this machine (7 days), so team maps -\n and the MCP server's shared namespace - work unattended.\n team lock Remove the unlocked team keys from this machine.\n vault unlock Unlock the personal-maps key with the vault passphrase\n and keep only that key here (7 days), so personal maps -\n and the MCP server's map tools - work without a\n passphrase. Re-seals older personal maps under it.\n vault lock Remove the personal-maps key from this machine.\n projects List the projects your team works in; * marks the one\n in use. A team map belongs to exactly one project.\n projects use <name> Work in that project: team maps, pushes, updates and\n scrub --team use it only. Kept with the sign-in, so the\n MCP server uses it too. VEILIO_PROJECT=<name|id>\n overrides it for one shell, CI job or MCP server.\n rules pull Fetch this account's custom rules (personal and team).\n `scrub` then applies them offline, as the web app does.\n\nOPTIONS\n -l, --language <lang> auto (default), typescript, python, go, java, csharp,\n rust, ruby, php, c, sql\n -s, --secrets <policy> redact (default) | warn | off\n -p, --preamble Prepend the downstream-AI note and placeholder legend\n -m, --map <path> Use a specific map file\n --json Machine-readable output (scan, map)\n --strict scan: also fail on advisory findings. restore: write\n nothing and exit 1 if a placeholder would be left\n --keep-docs restore: keep JSDoc blocks the model wrote\n -f, --force Allow a map write that would drop existing entries\n --days <n> vault unlock, team unlock: keep the key n days (1-30)\n --allow-drop maps update: allow dropping entries the Cloud map has\n -q, --quiet Suppress the all-clear summary (findings always show)\n --instance <url> login: the Veilio instance to sign in to. Defaults to\n the public Cloud; https required (localhost excepted)\n -h, --help Show this help\n -v, --version Show the version\n\nEXIT CODES\n 0 clean 1 findings that should stop the pipeline 2 usage or IO error\n\nEXAMPLES\n veilio scrub src/billing.ts | pbcopy\n pbpaste | veilio restore\n git diff --cached | veilio scan # pre-commit gate\n veilio scan 'src/**/*.ts' --json > findings.json\n\nTransformed code goes to stdout; everything else goes to stderr, so the CLI\ncomposes in a pipe.\n";
76
+ export declare const HELP: string;
77
77
  //# sourceMappingURL=commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAUA,OAAO,EAiBL,KAAK,SAAS,EAEf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAI3C,OAAO,EAAgD,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGhG,MAAM,WAAW,EAAE;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qEAAqE;IACrE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC7C;;;OAGG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE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8 @@
7
7
  // corrupting that pipe.
8
8
  import { readFileSync } from 'node:fs';
9
9
  import { resolve } from 'node:path';
10
- import { alteredNote, BIN_NAME, detectSecrets, keepRule, languageOfPath, disputedNote, hasBlockingSecrets, LANGUAGE_LABELS, locallyNumberedNote, restore, restoreLayers, STORE_DIR, STRIPPABLE_TYPES, summarizeSecrets, withAiPreamble, } from '@veilio-inc/engine';
10
+ import { alteredNote, BIN_NAME, detectSecrets, keepRule, languageOfPath, disputedNote, hasBlockingSecrets, LANGUAGE_LABELS, locallyNumberedNote, restore, restoreLayers, STRIPPABLE_TYPES, summarizeSecrets, withAiPreamble, fileKindOf, } from '@veilio-inc/engine';
11
+ import { allCommandsHelp, optionsHelp } from './flags.js';
11
12
  import { clearMap, loadMap, resolveMapPath, saveMap } from './store.js';
12
13
  import { readCredential } from './credential.js';
13
14
  import { describeAge, readRules } from './rules.js';
@@ -116,10 +117,14 @@ export async function runScrub(args, io, teamSource) {
116
117
  ...(cached?.rules ?? []),
117
118
  ...keepRule(own, 'veilio-scrub-third-party', 'veilio scrub: third-party names'),
118
119
  ];
120
+ // The file's kind, never its path (engine spec 013 R19): the
121
+ // environment-style credential rules apply, the test-file relaxation does not.
122
+ const fileKind = input.name ? fileKindOf(input.name) : undefined;
119
123
  const masked = await mask(input.text, toPersist, {
120
124
  language,
121
125
  secrets: args.secrets,
122
126
  rules: rules.length ? rules : undefined,
127
+ ...(fileKind ? { fileKind } : {}),
123
128
  });
124
129
  if (!masked)
125
130
  return EXIT_ERROR;
@@ -298,7 +303,8 @@ export async function runScan(args, io) {
298
303
  : [{ name: '<stdin>', text: await io.stdin() }];
299
304
  const all = [];
300
305
  for (const target of targets) {
301
- for (const finding of detectSecrets(target.text)) {
306
+ const fileKind = target.name === '<stdin>' ? undefined : fileKindOf(target.name);
307
+ for (const finding of detectSecrets(target.text, fileKind ? { fileKind } : {})) {
302
308
  all.push({ file: target.name, finding });
303
309
  }
304
310
  }
@@ -348,67 +354,10 @@ USAGE
348
354
  ${BIN_NAME} <command> [files...] [options]
349
355
 
350
356
  COMMANDS
351
- scrub --team Number new placeholders from the team's allocation.
352
- scrub [files...] Mask identifiers and redact credentials. Reads stdin when
353
- no file is given. Writes the symbol map to ${STORE_DIR}/map.json.
354
- restore [files...] Swap placeholders back and strip AI-generated noise.
355
- scan [files...] Detect credentials only; never rewrites. Exits 1 when it
356
- finds something — use it in a pre-commit hook or CI.
357
- map Show the current symbol map (--clear to wipe it).
358
-
359
- Everything above works offline, with no account. The commands below connect a
360
- Veilio Cloud subscription and are the only ones that touch the network.
361
-
362
- login Sign in to Veilio Cloud (--instance for self-hosted).
363
- logout Revoke the session and forget the credential.
364
- whoami Show the signed-in account. Answers from disk; makes no
365
- request, so it works with the instance down.
366
- maps list List the maps this account holds in Cloud.
367
- maps pull <id> Fetch one into the local store. A personal map is
368
- decrypted here — the passphrase never leaves the machine.
369
- A team map opens with the key from \`team unlock\`.
370
- maps push [name] Encrypt the local map and upload it as a new map.
371
- maps push --team Publish it as the TEAM's shared map instead.
372
- maps update <id> Replace a Cloud map's entries with the local map's, in
373
- place: same id, name and project. Refuses to drop
374
- entries unless --allow-drop is given.
375
- maps rm <id> Remove a map from Cloud.
376
- team unlock Open this account's team keys with the vault passphrase
377
- and keep them on this machine (7 days), so team maps -
378
- and the MCP server's shared namespace - work unattended.
379
- team lock Remove the unlocked team keys from this machine.
380
- vault unlock Unlock the personal-maps key with the vault passphrase
381
- and keep only that key here (7 days), so personal maps -
382
- and the MCP server's map tools - work without a
383
- passphrase. Re-seals older personal maps under it.
384
- vault lock Remove the personal-maps key from this machine.
385
- projects List the projects your team works in; * marks the one
386
- in use. A team map belongs to exactly one project.
387
- projects use <name> Work in that project: team maps, pushes, updates and
388
- scrub --team use it only. Kept with the sign-in, so the
389
- MCP server uses it too. VEILIO_PROJECT=<name|id>
390
- overrides it for one shell, CI job or MCP server.
391
- rules pull Fetch this account's custom rules (personal and team).
392
- \`scrub\` then applies them offline, as the web app does.
357
+ ${allCommandsHelp()}
393
358
 
394
359
  OPTIONS
395
- -l, --language <lang> auto (default), typescript, python, go, java, csharp,
396
- rust, ruby, php, c, sql
397
- -s, --secrets <policy> redact (default) | warn | off
398
- -p, --preamble Prepend the downstream-AI note and placeholder legend
399
- -m, --map <path> Use a specific map file
400
- --json Machine-readable output (scan, map)
401
- --strict scan: also fail on advisory findings. restore: write
402
- nothing and exit 1 if a placeholder would be left
403
- --keep-docs restore: keep JSDoc blocks the model wrote
404
- -f, --force Allow a map write that would drop existing entries
405
- --days <n> vault unlock, team unlock: keep the key n days (1-30)
406
- --allow-drop maps update: allow dropping entries the Cloud map has
407
- -q, --quiet Suppress the all-clear summary (findings always show)
408
- --instance <url> login: the Veilio instance to sign in to. Defaults to
409
- the public Cloud; https required (localhost excepted)
410
- -h, --help Show this help
411
- -v, --version Show the version
360
+ ${optionsHelp()}
412
361
 
413
362
  EXIT CODES
414
363
  0 clean 1 findings that should stop the pipeline 2 usage or IO error