@veilio-inc/cli 0.11.1 → 0.12.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 +15 -2
- package/dist/args.d.ts +2 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +4 -0
- package/dist/args.js.map +1 -1
- package/dist/client/blocks.d.ts.map +1 -1
- package/dist/client/blocks.js +5 -2
- package/dist/client/blocks.js.map +1 -1
- package/dist/client/rules-skipped.d.ts +3 -0
- package/dist/client/rules-skipped.d.ts.map +1 -1
- package/dist/client/rules-skipped.js +4 -1
- package/dist/client/rules-skipped.js.map +1 -1
- package/dist/cloud-commands.d.ts.map +1 -1
- package/dist/cloud-commands.js +8 -15
- package/dist/cloud-commands.js.map +1 -1
- package/dist/cloud.d.ts +0 -9
- package/dist/cloud.d.ts.map +1 -1
- package/dist/cloud.js.map +1 -1
- package/dist/commands.d.ts +10 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +51 -4
- package/dist/commands.js.map +1 -1
- package/dist/flags.d.ts +7 -0
- package/dist/flags.d.ts.map +1 -1
- package/dist/flags.js +26 -1
- package/dist/flags.js.map +1 -1
- package/dist/git-index.d.ts +9 -2
- package/dist/git-index.d.ts.map +1 -1
- package/dist/git-index.js +45 -16
- package/dist/git-index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/reservations.d.ts.map +1 -1
- package/dist/reservations.js +15 -4
- package/dist/reservations.js.map +1 -1
- package/dist/rules-open.d.ts.map +1 -1
- package/dist/rules-open.js +17 -4
- package/dist/rules-open.js.map +1 -1
- package/dist/rules.d.ts +12 -0
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +45 -4
- package/dist/rules.js.map +1 -1
- package/dist/store.d.ts +27 -5
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +191 -33
- package/dist/store.js.map +1 -1
- package/dist/team-namespace.d.ts +11 -14
- package/dist/team-namespace.d.ts.map +1 -1
- package/dist/team-namespace.js +10 -28
- package/dist/team-namespace.js.map +1 -1
- package/dist/third-party.d.ts +17 -6
- package/dist/third-party.d.ts.map +1 -1
- package/dist/third-party.js +42 -50
- package/dist/third-party.js.map +1 -1
- package/package.json +2 -2
package/dist/third-party.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// server's `anonymize_file`, so the two give the same placeholders for the same
|
|
4
4
|
// file (spec 030 FR-005, as amended by spec 050 T033-T036).
|
|
5
5
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
6
|
-
import { join } from 'node:path';
|
|
7
|
-
import { externalNames, languageOfPath, parseDeclarations, parseShellDeclarations, } from '@veilio-inc/engine';
|
|
6
|
+
import { join, sep } from 'node:path';
|
|
7
|
+
import { externalNames, languageOfPath, parseDeclarations, parseShellDeclarations, projectShapeFrom, } from '@veilio-inc/engine';
|
|
8
8
|
/** The names each input takes from a public package, to leave as written
|
|
9
9
|
* (spec 050 FR-006, FR-007). Declarations are read from every input first, so
|
|
10
10
|
* a word one input imports and another declares stays masked; and nothing is
|
|
@@ -46,6 +46,10 @@ known, cwd) {
|
|
|
46
46
|
for (const name of parseShellDeclarations(i.text))
|
|
47
47
|
declared.add(name);
|
|
48
48
|
const shape = projectShape(cwd, inputs);
|
|
49
|
+
if (!shape) {
|
|
50
|
+
out.tooLarge = true;
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
49
53
|
for (const i of code) {
|
|
50
54
|
const names = externalNames(i.text, languageFor(i.name), shape);
|
|
51
55
|
// Nor a name the map already holds as code (a variable, function or class):
|
|
@@ -58,63 +62,51 @@ known, cwd) {
|
|
|
58
62
|
}
|
|
59
63
|
return out;
|
|
60
64
|
}
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
/** Files the CLI lists at most to read the project's shape. Past it the
|
|
66
|
+
* shape is unknown, and nothing is exempted (security review of R2-23). */
|
|
67
|
+
const MAX_SHAPE_FILES = 20_000;
|
|
68
|
+
/** Said once when the project was too large to read its shape. */
|
|
69
|
+
export const PROJECT_TOO_LARGE_NOTE = 'veilio: this project has more files than veilio reads to learn its shape, so it cannot tell its own packages from public ones; every imported name was masked.';
|
|
70
|
+
/**
|
|
71
|
+
* The project's shape as the guard reads it (spec 085 R2-23): the files under
|
|
72
|
+
* `cwd` (no `node_modules`, no dot folders), breadth-first so the root's own
|
|
73
|
+
* manifests come first, through the engine's one reader. `inputs` add their
|
|
74
|
+
* own Python module names, as they always did. Null when the project has more
|
|
75
|
+
* files than are read: a manifest not reached would make the project's own
|
|
76
|
+
* package read as public, so the caller exempts nothing.
|
|
77
|
+
*/
|
|
65
78
|
export function projectShape(cwd, inputs) {
|
|
66
|
-
const
|
|
79
|
+
const files = [];
|
|
80
|
+
const queue = [[cwd, '']];
|
|
81
|
+
for (let q = 0; q < queue.length; q++) {
|
|
82
|
+
const [dir, rel] = queue[q];
|
|
83
|
+
let entries;
|
|
67
84
|
try {
|
|
68
|
-
|
|
69
|
-
.filter((d) => d.isDirectory() && !d.name.startsWith('.') && d.name !== 'node_modules')
|
|
70
|
-
.map((d) => d.name);
|
|
85
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
71
86
|
}
|
|
72
87
|
catch {
|
|
73
|
-
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
for (const d of entries) {
|
|
91
|
+
if (d.name.startsWith('.') || d.name === 'node_modules')
|
|
92
|
+
continue;
|
|
93
|
+
const path = rel ? `${rel}/${d.name}` : d.name;
|
|
94
|
+
if (d.isDirectory())
|
|
95
|
+
queue.push([join(dir, d.name), path]);
|
|
96
|
+
else if (d.isFile() && files.push(path) > MAX_SHAPE_FILES)
|
|
97
|
+
return null;
|
|
74
98
|
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
99
|
+
}
|
|
100
|
+
for (const i of inputs)
|
|
101
|
+
if (i.name?.endsWith('.py'))
|
|
102
|
+
files.push(i.name.split(sep).join('/'));
|
|
103
|
+
return projectShapeFrom(files, (rel) => {
|
|
79
104
|
try {
|
|
80
|
-
|
|
81
|
-
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
82
|
-
.replace(/^\s*\/\/.*$/gm, '')
|
|
83
|
-
.replace(/,(\s*[}\]])/g, '$1'));
|
|
84
|
-
return value && typeof value === 'object' ? value : undefined;
|
|
105
|
+
return readFileSync(join(cwd, rel), 'utf8');
|
|
85
106
|
}
|
|
86
107
|
catch {
|
|
87
108
|
return undefined;
|
|
88
109
|
}
|
|
89
|
-
};
|
|
90
|
-
const top = dirs(cwd);
|
|
91
|
-
const workspaces = [];
|
|
92
|
-
for (const dir of [
|
|
93
|
-
'',
|
|
94
|
-
...top,
|
|
95
|
-
...top.flatMap((t) => dirs(join(cwd, t)).map((d) => `${t}/${d}`)),
|
|
96
|
-
]) {
|
|
97
|
-
const name = json(join(cwd, dir, 'package.json'))?.name;
|
|
98
|
-
if (typeof name === 'string')
|
|
99
|
-
workspaces.push(name);
|
|
100
|
-
}
|
|
101
|
-
const options = json(join(cwd, 'tsconfig.json'))?.compilerOptions;
|
|
102
|
-
const tsconfig = options && typeof options === 'object'
|
|
103
|
-
? options
|
|
104
|
-
: undefined;
|
|
105
|
-
const baseDirs = new Set(top);
|
|
106
|
-
if (typeof tsconfig?.baseUrl === 'string')
|
|
107
|
-
for (const d of dirs(join(cwd, tsconfig.baseUrl)))
|
|
108
|
-
baseDirs.add(d);
|
|
109
|
-
const paths = tsconfig?.paths;
|
|
110
|
-
const pathAliases = Object.keys(paths && typeof paths === 'object' ? paths : {})
|
|
111
|
-
.map((k) => k.replace(/\*.*$/, ''))
|
|
112
|
-
.filter(Boolean);
|
|
113
|
-
const pythonModules = new Set(top);
|
|
114
|
-
for (const i of inputs)
|
|
115
|
-
if (i.name?.endsWith('.py'))
|
|
116
|
-
for (const part of i.name.replace(/\.py$/, '').split('/'))
|
|
117
|
-
pythonModules.add(part);
|
|
118
|
-
return { baseDirs: [...baseDirs], workspaces, pathAliases, pythonModules: [...pythonModules] };
|
|
110
|
+
});
|
|
119
111
|
}
|
|
120
112
|
//# sourceMappingURL=third-party.js.map
|
package/dist/third-party.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"third-party.js","sourceRoot":"","sources":["../src/third-party.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,gFAAgF;AAChF,4DAA4D;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"third-party.js","sourceRoot":"","sources":["../src/third-party.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,gFAAgF;AAChF,4DAA4D;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EACL,aAAa,EAGb,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EAEtB,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAM3B;;;;;;;;gEAQgE;AAChE,MAAM,UAAU,eAAe,CAC7B,MAA+C;AAC/C;0EAC0E;AAC1E,KAA+B,EAC/B,GAAW;IAEX,MAAM,GAAG,GAAe,IAAI,GAAG,EAAuB,CAAA;IACtD,6EAA6E;IAC7E,2EAA2E;IAC3E,MAAM,WAAW,GAAG,CAAC,IAAmB,EAAkB,EAAE,CAC1D,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,MAAM,CAAA;IAChD,oEAAoE;IACpE,uEAAuE;IACvE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAA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AAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IAC5F,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;QACrC,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veilio-inc/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Anonymize identifiers and redact credentials in source code before it reaches an LLM \u2014 from the terminal, a pipe, or a pre-commit hook.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "SEE LICENSE IN LICENSE",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@veilio-inc/engine": "^1.
|
|
31
|
+
"@veilio-inc/engine": "^1.18.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsc",
|