@paretools/shared 0.9.0 → 0.10.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/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/profiles.d.ts +29 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +352 -0
- package/dist/profiles.js.map +1 -0
- package/dist/runner.d.ts +2 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +15 -2
- package/dist/runner.js.map +1 -1
- package/dist/tool-filter.d.ts +10 -3
- package/dist/tool-filter.d.ts.map +1 -1
- package/dist/tool-filter.js +18 -3
- package/dist/tool-filter.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export { stripAnsi } from "./ansi.js";
|
|
|
4
4
|
export { assertNoFlagInjection, assertAllowedCommand } from "./validation.js";
|
|
5
5
|
export { INPUT_LIMITS } from "./limits.js";
|
|
6
6
|
export { sanitizeErrorOutput } from "./sanitize.js";
|
|
7
|
-
export { shouldRegisterTool } from "./tool-filter.js";
|
|
7
|
+
export { shouldRegisterTool, _resetProfileCache } from "./tool-filter.js";
|
|
8
|
+
export { PROFILES, resolveProfile } from "./profiles.js";
|
|
9
|
+
export type { ProfileName } from "./profiles.js";
|
|
8
10
|
export { assertAllowedByPolicy, assertAllowedRoot, assertNoPathQualifiedCommand, } from "./policy.js";
|
|
9
11
|
export type { ToolOutput } from "./types.js";
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { stripAnsi } from "./ansi.js";
|
|
|
4
4
|
export { assertNoFlagInjection, assertAllowedCommand } from "./validation.js";
|
|
5
5
|
export { INPUT_LIMITS } from "./limits.js";
|
|
6
6
|
export { sanitizeErrorOutput } from "./sanitize.js";
|
|
7
|
-
export { shouldRegisterTool } from "./tool-filter.js";
|
|
7
|
+
export { shouldRegisterTool, _resetProfileCache } from "./tool-filter.js";
|
|
8
|
+
export { PROFILES, resolveProfile } from "./profiles.js";
|
|
8
9
|
export { assertAllowedByPolicy, assertAllowedRoot, assertNoPathQualifiedCommand, } from "./policy.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,YAAY,EAAmC,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,YAAY,EAAmC,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset tool profiles — allows users to activate a curated set of tools
|
|
3
|
+
* via the `PARE_PROFILE` environment variable.
|
|
4
|
+
*
|
|
5
|
+
* Profiles provide a convenient shorthand for `PARE_TOOLS` lists tuned to
|
|
6
|
+
* common workflows (web dev, Python, DevOps, Rust, Go, or a minimal core set).
|
|
7
|
+
*
|
|
8
|
+
* Setting `PARE_PROFILE=full` (or leaving it unset) enables all tools.
|
|
9
|
+
*/
|
|
10
|
+
/** Valid profile names. */
|
|
11
|
+
export type ProfileName = "minimal" | "web" | "python" | "devops" | "rust" | "go" | "full";
|
|
12
|
+
/**
|
|
13
|
+
* Maps each profile name to an array of `server:tool` strings, or `null`
|
|
14
|
+
* for the "full" profile (no filtering).
|
|
15
|
+
*/
|
|
16
|
+
export declare const PROFILES: Record<ProfileName, readonly string[] | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Reads `PARE_PROFILE` and returns a `Set<string>` of allowed `server:tool`
|
|
19
|
+
* entries, or `null` if all tools should be enabled.
|
|
20
|
+
*
|
|
21
|
+
* Results are cached at the module level since the env var is read once at
|
|
22
|
+
* startup and does not change.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveProfile(): Set<string> | null;
|
|
25
|
+
/**
|
|
26
|
+
* Resets the module-level profile cache. Intended for test cleanup only.
|
|
27
|
+
*/
|
|
28
|
+
export declare function _resetProfileCache(): void;
|
|
29
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,2BAA2B;AAC3B,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;AAE3F;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAgTlE,CAAC;AAKF;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CA6BnD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
|
package/dist/profiles.js
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset tool profiles — allows users to activate a curated set of tools
|
|
3
|
+
* via the `PARE_PROFILE` environment variable.
|
|
4
|
+
*
|
|
5
|
+
* Profiles provide a convenient shorthand for `PARE_TOOLS` lists tuned to
|
|
6
|
+
* common workflows (web dev, Python, DevOps, Rust, Go, or a minimal core set).
|
|
7
|
+
*
|
|
8
|
+
* Setting `PARE_PROFILE=full` (or leaving it unset) enables all tools.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Maps each profile name to an array of `server:tool` strings, or `null`
|
|
12
|
+
* for the "full" profile (no filtering).
|
|
13
|
+
*/
|
|
14
|
+
export const PROFILES = {
|
|
15
|
+
minimal: [
|
|
16
|
+
"git:status",
|
|
17
|
+
"git:log",
|
|
18
|
+
"git:diff",
|
|
19
|
+
"git:add",
|
|
20
|
+
"git:commit",
|
|
21
|
+
"git:push",
|
|
22
|
+
"git:pull",
|
|
23
|
+
"git:checkout",
|
|
24
|
+
"git:branch",
|
|
25
|
+
"test:run",
|
|
26
|
+
"build:build",
|
|
27
|
+
"build:tsc",
|
|
28
|
+
"search:search",
|
|
29
|
+
"search:find",
|
|
30
|
+
"github:pr-view",
|
|
31
|
+
"github:pr-list",
|
|
32
|
+
"github:pr-create",
|
|
33
|
+
"process:run",
|
|
34
|
+
],
|
|
35
|
+
web: [
|
|
36
|
+
"git:status",
|
|
37
|
+
"git:log",
|
|
38
|
+
"git:log-graph",
|
|
39
|
+
"git:diff",
|
|
40
|
+
"git:branch",
|
|
41
|
+
"git:show",
|
|
42
|
+
"git:add",
|
|
43
|
+
"git:commit",
|
|
44
|
+
"git:push",
|
|
45
|
+
"git:pull",
|
|
46
|
+
"git:checkout",
|
|
47
|
+
"git:merge",
|
|
48
|
+
"git:rebase",
|
|
49
|
+
"git:stash",
|
|
50
|
+
"git:stash-list",
|
|
51
|
+
"git:reset",
|
|
52
|
+
"git:restore",
|
|
53
|
+
"github:pr-view",
|
|
54
|
+
"github:pr-list",
|
|
55
|
+
"github:pr-create",
|
|
56
|
+
"github:pr-merge",
|
|
57
|
+
"github:pr-comment",
|
|
58
|
+
"github:pr-review",
|
|
59
|
+
"github:pr-update",
|
|
60
|
+
"github:pr-checks",
|
|
61
|
+
"github:pr-diff",
|
|
62
|
+
"github:issue-view",
|
|
63
|
+
"github:issue-list",
|
|
64
|
+
"github:issue-create",
|
|
65
|
+
"github:issue-close",
|
|
66
|
+
"github:issue-comment",
|
|
67
|
+
"github:run-view",
|
|
68
|
+
"github:run-list",
|
|
69
|
+
"npm:install",
|
|
70
|
+
"npm:audit",
|
|
71
|
+
"npm:outdated",
|
|
72
|
+
"npm:list",
|
|
73
|
+
"npm:run",
|
|
74
|
+
"npm:test",
|
|
75
|
+
"npm:info",
|
|
76
|
+
"npm:search",
|
|
77
|
+
"npm:nvm",
|
|
78
|
+
"build:tsc",
|
|
79
|
+
"build:build",
|
|
80
|
+
"build:esbuild",
|
|
81
|
+
"build:vite-build",
|
|
82
|
+
"build:webpack",
|
|
83
|
+
"build:turbo",
|
|
84
|
+
"build:nx",
|
|
85
|
+
"test:run",
|
|
86
|
+
"test:coverage",
|
|
87
|
+
"test:playwright",
|
|
88
|
+
"lint:lint",
|
|
89
|
+
"lint:format-check",
|
|
90
|
+
"lint:prettier-format",
|
|
91
|
+
"lint:biome-check",
|
|
92
|
+
"lint:biome-format",
|
|
93
|
+
"lint:oxlint",
|
|
94
|
+
"lint:stylelint",
|
|
95
|
+
"search:search",
|
|
96
|
+
"search:find",
|
|
97
|
+
"search:count",
|
|
98
|
+
"search:jq",
|
|
99
|
+
"http:get",
|
|
100
|
+
"http:post",
|
|
101
|
+
"http:request",
|
|
102
|
+
"http:head",
|
|
103
|
+
"process:run",
|
|
104
|
+
],
|
|
105
|
+
python: [
|
|
106
|
+
"git:status",
|
|
107
|
+
"git:log",
|
|
108
|
+
"git:log-graph",
|
|
109
|
+
"git:diff",
|
|
110
|
+
"git:branch",
|
|
111
|
+
"git:show",
|
|
112
|
+
"git:add",
|
|
113
|
+
"git:commit",
|
|
114
|
+
"git:push",
|
|
115
|
+
"git:pull",
|
|
116
|
+
"git:checkout",
|
|
117
|
+
"git:merge",
|
|
118
|
+
"git:rebase",
|
|
119
|
+
"git:stash",
|
|
120
|
+
"git:stash-list",
|
|
121
|
+
"git:reset",
|
|
122
|
+
"git:restore",
|
|
123
|
+
"github:pr-view",
|
|
124
|
+
"github:pr-list",
|
|
125
|
+
"github:pr-create",
|
|
126
|
+
"github:pr-merge",
|
|
127
|
+
"github:pr-checks",
|
|
128
|
+
"github:issue-view",
|
|
129
|
+
"github:issue-list",
|
|
130
|
+
"github:issue-create",
|
|
131
|
+
"github:run-view",
|
|
132
|
+
"github:run-list",
|
|
133
|
+
"python:pip-install",
|
|
134
|
+
"python:pip-list",
|
|
135
|
+
"python:pip-show",
|
|
136
|
+
"python:mypy",
|
|
137
|
+
"python:ruff-check",
|
|
138
|
+
"python:ruff-format",
|
|
139
|
+
"python:pip-audit",
|
|
140
|
+
"python:pytest",
|
|
141
|
+
"python:uv-install",
|
|
142
|
+
"python:uv-run",
|
|
143
|
+
"python:black",
|
|
144
|
+
"python:poetry",
|
|
145
|
+
"python:pyenv",
|
|
146
|
+
"python:conda",
|
|
147
|
+
"test:run",
|
|
148
|
+
"test:coverage",
|
|
149
|
+
"search:search",
|
|
150
|
+
"search:find",
|
|
151
|
+
"search:count",
|
|
152
|
+
"make:run",
|
|
153
|
+
"make:list",
|
|
154
|
+
"process:run",
|
|
155
|
+
],
|
|
156
|
+
devops: [
|
|
157
|
+
"git:status",
|
|
158
|
+
"git:log",
|
|
159
|
+
"git:diff",
|
|
160
|
+
"git:branch",
|
|
161
|
+
"git:show",
|
|
162
|
+
"git:add",
|
|
163
|
+
"git:commit",
|
|
164
|
+
"git:push",
|
|
165
|
+
"git:pull",
|
|
166
|
+
"git:checkout",
|
|
167
|
+
"git:tag",
|
|
168
|
+
"git:remote",
|
|
169
|
+
"git:merge",
|
|
170
|
+
"github:pr-view",
|
|
171
|
+
"github:pr-list",
|
|
172
|
+
"github:pr-create",
|
|
173
|
+
"github:pr-merge",
|
|
174
|
+
"github:pr-checks",
|
|
175
|
+
"github:issue-view",
|
|
176
|
+
"github:issue-list",
|
|
177
|
+
"github:run-view",
|
|
178
|
+
"github:run-list",
|
|
179
|
+
"github:run-rerun",
|
|
180
|
+
"github:release-create",
|
|
181
|
+
"github:release-list",
|
|
182
|
+
"docker:ps",
|
|
183
|
+
"docker:build",
|
|
184
|
+
"docker:logs",
|
|
185
|
+
"docker:images",
|
|
186
|
+
"docker:run",
|
|
187
|
+
"docker:exec",
|
|
188
|
+
"docker:compose-up",
|
|
189
|
+
"docker:compose-down",
|
|
190
|
+
"docker:pull",
|
|
191
|
+
"docker:inspect",
|
|
192
|
+
"docker:network-ls",
|
|
193
|
+
"docker:volume-ls",
|
|
194
|
+
"docker:compose-ps",
|
|
195
|
+
"docker:compose-logs",
|
|
196
|
+
"docker:compose-build",
|
|
197
|
+
"docker:stats",
|
|
198
|
+
"k8s:get",
|
|
199
|
+
"k8s:describe",
|
|
200
|
+
"k8s:logs",
|
|
201
|
+
"k8s:apply",
|
|
202
|
+
"k8s:helm",
|
|
203
|
+
"security:trivy",
|
|
204
|
+
"security:semgrep",
|
|
205
|
+
"security:gitleaks",
|
|
206
|
+
"make:run",
|
|
207
|
+
"make:list",
|
|
208
|
+
"lint:shellcheck",
|
|
209
|
+
"lint:hadolint",
|
|
210
|
+
"http:get",
|
|
211
|
+
"http:post",
|
|
212
|
+
"http:request",
|
|
213
|
+
"http:head",
|
|
214
|
+
"search:search",
|
|
215
|
+
"search:find",
|
|
216
|
+
"process:run",
|
|
217
|
+
],
|
|
218
|
+
rust: [
|
|
219
|
+
"git:status",
|
|
220
|
+
"git:log",
|
|
221
|
+
"git:log-graph",
|
|
222
|
+
"git:diff",
|
|
223
|
+
"git:branch",
|
|
224
|
+
"git:show",
|
|
225
|
+
"git:add",
|
|
226
|
+
"git:commit",
|
|
227
|
+
"git:push",
|
|
228
|
+
"git:pull",
|
|
229
|
+
"git:checkout",
|
|
230
|
+
"git:merge",
|
|
231
|
+
"git:rebase",
|
|
232
|
+
"git:stash",
|
|
233
|
+
"git:stash-list",
|
|
234
|
+
"git:reset",
|
|
235
|
+
"git:restore",
|
|
236
|
+
"github:pr-view",
|
|
237
|
+
"github:pr-list",
|
|
238
|
+
"github:pr-create",
|
|
239
|
+
"github:pr-merge",
|
|
240
|
+
"github:pr-checks",
|
|
241
|
+
"github:issue-view",
|
|
242
|
+
"github:issue-list",
|
|
243
|
+
"github:issue-create",
|
|
244
|
+
"github:run-view",
|
|
245
|
+
"github:run-list",
|
|
246
|
+
"cargo:build",
|
|
247
|
+
"cargo:test",
|
|
248
|
+
"cargo:clippy",
|
|
249
|
+
"cargo:run",
|
|
250
|
+
"cargo:add",
|
|
251
|
+
"cargo:remove",
|
|
252
|
+
"cargo:fmt",
|
|
253
|
+
"cargo:doc",
|
|
254
|
+
"cargo:check",
|
|
255
|
+
"cargo:update",
|
|
256
|
+
"cargo:tree",
|
|
257
|
+
"cargo:audit",
|
|
258
|
+
"test:run",
|
|
259
|
+
"test:coverage",
|
|
260
|
+
"search:search",
|
|
261
|
+
"search:find",
|
|
262
|
+
"search:count",
|
|
263
|
+
"process:run",
|
|
264
|
+
],
|
|
265
|
+
go: [
|
|
266
|
+
"git:status",
|
|
267
|
+
"git:log",
|
|
268
|
+
"git:log-graph",
|
|
269
|
+
"git:diff",
|
|
270
|
+
"git:branch",
|
|
271
|
+
"git:show",
|
|
272
|
+
"git:add",
|
|
273
|
+
"git:commit",
|
|
274
|
+
"git:push",
|
|
275
|
+
"git:pull",
|
|
276
|
+
"git:checkout",
|
|
277
|
+
"git:merge",
|
|
278
|
+
"git:rebase",
|
|
279
|
+
"git:stash",
|
|
280
|
+
"git:stash-list",
|
|
281
|
+
"git:reset",
|
|
282
|
+
"git:restore",
|
|
283
|
+
"github:pr-view",
|
|
284
|
+
"github:pr-list",
|
|
285
|
+
"github:pr-create",
|
|
286
|
+
"github:pr-merge",
|
|
287
|
+
"github:pr-checks",
|
|
288
|
+
"github:issue-view",
|
|
289
|
+
"github:issue-list",
|
|
290
|
+
"github:issue-create",
|
|
291
|
+
"github:run-view",
|
|
292
|
+
"github:run-list",
|
|
293
|
+
"go:build",
|
|
294
|
+
"go:test",
|
|
295
|
+
"go:vet",
|
|
296
|
+
"go:run",
|
|
297
|
+
"go:mod-tidy",
|
|
298
|
+
"go:fmt",
|
|
299
|
+
"go:generate",
|
|
300
|
+
"go:env",
|
|
301
|
+
"go:list",
|
|
302
|
+
"go:get",
|
|
303
|
+
"go:golangci-lint",
|
|
304
|
+
"test:run",
|
|
305
|
+
"test:coverage",
|
|
306
|
+
"search:search",
|
|
307
|
+
"search:find",
|
|
308
|
+
"search:count",
|
|
309
|
+
"process:run",
|
|
310
|
+
],
|
|
311
|
+
full: null,
|
|
312
|
+
};
|
|
313
|
+
/** Module-level cache for the resolved profile Set. */
|
|
314
|
+
let profileCache;
|
|
315
|
+
/**
|
|
316
|
+
* Reads `PARE_PROFILE` and returns a `Set<string>` of allowed `server:tool`
|
|
317
|
+
* entries, or `null` if all tools should be enabled.
|
|
318
|
+
*
|
|
319
|
+
* Results are cached at the module level since the env var is read once at
|
|
320
|
+
* startup and does not change.
|
|
321
|
+
*/
|
|
322
|
+
export function resolveProfile() {
|
|
323
|
+
if (profileCache !== undefined)
|
|
324
|
+
return profileCache;
|
|
325
|
+
const raw = process.env.PARE_PROFILE;
|
|
326
|
+
if (raw === undefined || raw.trim() === "") {
|
|
327
|
+
profileCache = null;
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
const name = raw.trim().toLowerCase();
|
|
331
|
+
const tools = PROFILES[name];
|
|
332
|
+
if (tools === undefined) {
|
|
333
|
+
// Unknown profile — warn and fall back to no filtering.
|
|
334
|
+
console.warn(`[pare] Unknown profile "${raw.trim()}". Valid profiles: ${Object.keys(PROFILES).join(", ")}. Ignoring.`);
|
|
335
|
+
profileCache = null;
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
if (tools === null) {
|
|
339
|
+
// "full" profile — no filtering.
|
|
340
|
+
profileCache = null;
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
profileCache = new Set(tools);
|
|
344
|
+
return profileCache;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Resets the module-level profile cache. Intended for test cleanup only.
|
|
348
|
+
*/
|
|
349
|
+
export function _resetProfileCache() {
|
|
350
|
+
profileCache = undefined;
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAkD;IACrE,OAAO,EAAE;QACP,YAAY;QACZ,SAAS;QACT,UAAU;QACV,SAAS;QACT,YAAY;QACZ,UAAU;QACV,UAAU;QACV,cAAc;QACd,YAAY;QACZ,UAAU;QACV,aAAa;QACb,WAAW;QACX,eAAe;QACf,aAAa;QACb,gBAAgB;QAChB,gB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AC;QAC3C,YAAY,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAiB,CAAC;IACrD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,wDAAwD;QACxD,OAAO,CAAC,IAAI,CACV,2BAA2B,GAAG,CAAC,IAAI,EAAE,sBAAsB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CACzG,CAAC;QACF,YAAY,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,iCAAiC;QACjC,YAAY,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,YAAY,GAAG,SAAS,CAAC;AAC3B,CAAC"}
|
package/dist/runner.d.ts
CHANGED
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAIA,uGAAuG;AACvG,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B;;mFAE+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;qFAEiF;IACjF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;0FACsF;IACtF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAIA,uGAAuG;AACvG,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B;;mFAE+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;qFAEiF;IACjF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;0FACsF;IACtF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAgCD,+FAA+F;AAC/F,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAqChD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CA4JtF"}
|
package/dist/runner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spawn,
|
|
1
|
+
import { spawn, execFileSync } from "node:child_process";
|
|
2
2
|
import { stripAnsi } from "./ansi.js";
|
|
3
3
|
import { sanitizeErrorOutput } from "./sanitize.js";
|
|
4
4
|
/**
|
|
@@ -15,7 +15,10 @@ import { sanitizeErrorOutput } from "./sanitize.js";
|
|
|
15
15
|
function killProcessGroup(pid) {
|
|
16
16
|
if (process.platform === "win32") {
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
execFileSync("taskkill", ["/pid", String(pid), "/T", "/F"], {
|
|
19
|
+
stdio: "ignore",
|
|
20
|
+
timeout: 5_000,
|
|
21
|
+
});
|
|
19
22
|
}
|
|
20
23
|
catch {
|
|
21
24
|
/* best-effort */
|
|
@@ -180,6 +183,14 @@ export function run(cmd, args, opts) {
|
|
|
180
183
|
if (settled)
|
|
181
184
|
return;
|
|
182
185
|
settled = true;
|
|
186
|
+
let userCpuTimeMicros;
|
|
187
|
+
let systemCpuTimeMicros;
|
|
188
|
+
const childWithUsage = child;
|
|
189
|
+
if (typeof childWithUsage.resourceUsage === "function") {
|
|
190
|
+
const usage = childWithUsage.resourceUsage();
|
|
191
|
+
userCpuTimeMicros = usage.userCPUTime;
|
|
192
|
+
systemCpuTimeMicros = usage.systemCPUTime;
|
|
193
|
+
}
|
|
183
194
|
const stdout = stripAnsi(Buffer.concat(stdoutChunks).toString("utf-8"));
|
|
184
195
|
const stderr = sanitizeErrorOutput(stripAnsi(Buffer.concat(stderrChunks).toString("utf-8")));
|
|
185
196
|
// Timeout: we killed the process group after the configured timeout.
|
|
@@ -201,6 +212,8 @@ export function run(cmd, args, opts) {
|
|
|
201
212
|
exitCode: code ?? 1,
|
|
202
213
|
stdout,
|
|
203
214
|
stderr,
|
|
215
|
+
...(userCpuTimeMicros !== undefined ? { userCpuTimeMicros } : {}),
|
|
216
|
+
...(systemCpuTimeMicros !== undefined ? { systemCpuTimeMicros } : {}),
|
|
204
217
|
});
|
|
205
218
|
});
|
|
206
219
|
// Pipe stdin data if provided, then close the stream so the child
|
package/dist/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,
|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AS,yBAAyB,CAClF,CACF,CAAC;gBACF,OAAO;YACT,CAAC;YAED,4DAA4D;YAC5D,IAAI,IAAI,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBACvD,MAAM,CACJ,IAAI,KAAK,CACP,uBAAuB,GAAG,uDAAuD,CAClF,CACF,CAAC;gBACF,OAAO;YACT,CAAC;YAED,OAAO,CAAC;gBACN,QAAQ,EAAE,IAAI,IAAI,CAAC;gBACnB,MAAM;gBACN,MAAM;gBACN,GAAG,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjE,GAAG,CAAC,mBAAmB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACtE,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,kEAAkE;QAClE,iEAAiE;QACjE,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;YACxB,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/B,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/tool-filter.d.ts
CHANGED
|
@@ -7,14 +7,21 @@
|
|
|
7
7
|
* Format: comma-separated `server:tool` pairs.
|
|
8
8
|
* Example: `PARE_TOOLS=git:status,git:log,npm:install`
|
|
9
9
|
*
|
|
10
|
-
* 2. `
|
|
10
|
+
* 2. `PARE_PROFILE` — preset tool profile.
|
|
11
|
+
* Format: profile name (minimal, web, python, devops, rust, go, full).
|
|
12
|
+
* Example: `PARE_PROFILE=python`
|
|
13
|
+
*
|
|
14
|
+
* 3. `PARE_{SERVER}_TOOLS` — per-server filter.
|
|
11
15
|
* Format: comma-separated tool names.
|
|
12
16
|
* Example: `PARE_GIT_TOOLS=status,log`
|
|
13
17
|
*
|
|
14
|
-
*
|
|
18
|
+
* 4. No env vars → all tools enabled (default).
|
|
15
19
|
*
|
|
16
|
-
* Universal (`PARE_TOOLS`) takes precedence over
|
|
20
|
+
* Universal (`PARE_TOOLS`) takes precedence over profiles,
|
|
21
|
+
* which take precedence over per-server env vars.
|
|
17
22
|
*/
|
|
23
|
+
import { _resetProfileCache } from "./profiles.js";
|
|
24
|
+
export { _resetProfileCache };
|
|
18
25
|
/**
|
|
19
26
|
* Determines whether a tool should be registered based on environment variables.
|
|
20
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-filter.d.ts","sourceRoot":"","sources":["../src/tool-filter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-filter.d.ts","sourceRoot":"","sources":["../src/tool-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAkB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CA0BhF"}
|
package/dist/tool-filter.js
CHANGED
|
@@ -7,14 +7,21 @@
|
|
|
7
7
|
* Format: comma-separated `server:tool` pairs.
|
|
8
8
|
* Example: `PARE_TOOLS=git:status,git:log,npm:install`
|
|
9
9
|
*
|
|
10
|
-
* 2. `
|
|
10
|
+
* 2. `PARE_PROFILE` — preset tool profile.
|
|
11
|
+
* Format: profile name (minimal, web, python, devops, rust, go, full).
|
|
12
|
+
* Example: `PARE_PROFILE=python`
|
|
13
|
+
*
|
|
14
|
+
* 3. `PARE_{SERVER}_TOOLS` — per-server filter.
|
|
11
15
|
* Format: comma-separated tool names.
|
|
12
16
|
* Example: `PARE_GIT_TOOLS=status,log`
|
|
13
17
|
*
|
|
14
|
-
*
|
|
18
|
+
* 4. No env vars → all tools enabled (default).
|
|
15
19
|
*
|
|
16
|
-
* Universal (`PARE_TOOLS`) takes precedence over
|
|
20
|
+
* Universal (`PARE_TOOLS`) takes precedence over profiles,
|
|
21
|
+
* which take precedence over per-server env vars.
|
|
17
22
|
*/
|
|
23
|
+
import { resolveProfile, _resetProfileCache } from "./profiles.js";
|
|
24
|
+
export { _resetProfileCache };
|
|
18
25
|
/**
|
|
19
26
|
* Determines whether a tool should be registered based on environment variables.
|
|
20
27
|
*
|
|
@@ -23,6 +30,7 @@
|
|
|
23
30
|
* @returns `true` if the tool should be registered, `false` if filtered out.
|
|
24
31
|
*/
|
|
25
32
|
export function shouldRegisterTool(serverName, toolName) {
|
|
33
|
+
// 1. PARE_TOOLS — highest priority universal filter.
|
|
26
34
|
const universal = process.env.PARE_TOOLS;
|
|
27
35
|
if (universal !== undefined) {
|
|
28
36
|
if (universal.trim() === "")
|
|
@@ -30,6 +38,12 @@ export function shouldRegisterTool(serverName, toolName) {
|
|
|
30
38
|
const allowed = universal.split(",").map((s) => s.trim());
|
|
31
39
|
return allowed.includes(`${serverName}:${toolName}`);
|
|
32
40
|
}
|
|
41
|
+
// 2. PARE_PROFILE — preset profile filter.
|
|
42
|
+
const profileSet = resolveProfile();
|
|
43
|
+
if (profileSet !== null) {
|
|
44
|
+
return profileSet.has(`${serverName}:${toolName}`);
|
|
45
|
+
}
|
|
46
|
+
// 3. PARE_{SERVER}_TOOLS — per-server filter.
|
|
33
47
|
const envKey = `PARE_${serverName.toUpperCase().replace(/-/g, "_")}_TOOLS`;
|
|
34
48
|
const perServer = process.env[envKey];
|
|
35
49
|
if (perServer !== undefined) {
|
|
@@ -38,6 +52,7 @@ export function shouldRegisterTool(serverName, toolName) {
|
|
|
38
52
|
const allowed = perServer.split(",").map((s) => s.trim());
|
|
39
53
|
return allowed.includes(toolName);
|
|
40
54
|
}
|
|
55
|
+
// 4. Default: all enabled.
|
|
41
56
|
return true;
|
|
42
57
|
}
|
|
43
58
|
//# sourceMappingURL=tool-filter.js.map
|
package/dist/tool-filter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-filter.js","sourceRoot":"","sources":["../src/tool-filter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-filter.js","sourceRoot":"","sources":["../src/tool-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAkB,EAAE,QAAgB;IACrE,qDAAqD;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IACzC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,IAAI,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;QAC1C,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,2CAA2C;IAC3C,MAAM,UAAU,GAAG,cAAc,EAAE,CAAC;IACpC,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC,GAAG,CAAC,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,8CAA8C;IAC9C,MAAM,MAAM,GAAG,QAAQ,UAAU,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC;IAC3E,MAAM,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