@paretools/shared 0.10.1 → 0.11.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/errors.d.ts +99 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +261 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/input-schemas.d.ts +27 -0
- package/dist/input-schemas.d.ts.map +1 -0
- package/dist/input-schemas.js +52 -0
- package/dist/input-schemas.js.map +1 -0
- package/package.json +4 -1
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { RunResult } from "./runner.js";
|
|
3
|
+
import type { ToolOutput } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Zod schema for the set of error categories a Pare tool can return.
|
|
6
|
+
*
|
|
7
|
+
* Each category maps to a class of failure an AI agent can programmatically
|
|
8
|
+
* match on, enabling automated recovery strategies without parsing free-text
|
|
9
|
+
* error messages.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PareErrorCategory: z.ZodEnum<{
|
|
12
|
+
"command-not-found": "command-not-found";
|
|
13
|
+
"permission-denied": "permission-denied";
|
|
14
|
+
timeout: "timeout";
|
|
15
|
+
"invalid-input": "invalid-input";
|
|
16
|
+
"not-found": "not-found";
|
|
17
|
+
"network-error": "network-error";
|
|
18
|
+
"authentication-error": "authentication-error";
|
|
19
|
+
conflict: "conflict";
|
|
20
|
+
"configuration-error": "configuration-error";
|
|
21
|
+
"already-exists": "already-exists";
|
|
22
|
+
"command-failed": "command-failed";
|
|
23
|
+
}>;
|
|
24
|
+
export type PareErrorCategoryType = z.infer<typeof PareErrorCategory>;
|
|
25
|
+
/** Zod schema for the structured error every Pare tool can return. */
|
|
26
|
+
export declare const PareErrorSchema: z.ZodObject<{
|
|
27
|
+
isError: z.ZodLiteral<true>;
|
|
28
|
+
category: z.ZodEnum<{
|
|
29
|
+
"command-not-found": "command-not-found";
|
|
30
|
+
"permission-denied": "permission-denied";
|
|
31
|
+
timeout: "timeout";
|
|
32
|
+
"invalid-input": "invalid-input";
|
|
33
|
+
"not-found": "not-found";
|
|
34
|
+
"network-error": "network-error";
|
|
35
|
+
"authentication-error": "authentication-error";
|
|
36
|
+
conflict: "conflict";
|
|
37
|
+
"configuration-error": "configuration-error";
|
|
38
|
+
"already-exists": "already-exists";
|
|
39
|
+
"command-failed": "command-failed";
|
|
40
|
+
}>;
|
|
41
|
+
message: z.ZodString;
|
|
42
|
+
command: z.ZodOptional<z.ZodString>;
|
|
43
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export type PareError = z.infer<typeof PareErrorSchema>;
|
|
47
|
+
/** Returns true when stderr / error text indicates the command was not found. */
|
|
48
|
+
export declare function isCommandNotFound(text: string): boolean;
|
|
49
|
+
/** Returns true when stderr indicates a permission / access error. */
|
|
50
|
+
export declare function isPermissionDenied(text: string): boolean;
|
|
51
|
+
/** Returns true when stderr indicates a timeout. */
|
|
52
|
+
export declare function isTimeout(text: string): boolean;
|
|
53
|
+
/** Returns true when stderr indicates a network connectivity problem. */
|
|
54
|
+
export declare function isNetworkError(text: string): boolean;
|
|
55
|
+
/** Returns true when stderr indicates an authentication / authorisation failure. */
|
|
56
|
+
export declare function isAuthError(text: string): boolean;
|
|
57
|
+
/** Returns true when stderr indicates a conflict (merge, lock, etc.). */
|
|
58
|
+
export declare function isConflict(text: string): boolean;
|
|
59
|
+
/** Returns true when stderr indicates a resource was not found. */
|
|
60
|
+
export declare function isNotFound(text: string): boolean;
|
|
61
|
+
/** Returns true when stderr indicates a resource already exists. */
|
|
62
|
+
export declare function isAlreadyExists(text: string): boolean;
|
|
63
|
+
/** Returns true when stderr indicates a configuration problem. */
|
|
64
|
+
export declare function isConfigurationError(text: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Classifies a failed {@link RunResult} into a structured {@link PareError}.
|
|
67
|
+
*
|
|
68
|
+
* The function inspects stderr (and stdout when stderr is empty), the exit
|
|
69
|
+
* code, and well-known patterns to determine the most specific category.
|
|
70
|
+
* When no pattern matches, the category falls back to `"command-failed"`.
|
|
71
|
+
*
|
|
72
|
+
* @param result - The {@link RunResult} returned by the command runner.
|
|
73
|
+
* @param command - A human-readable label for the command (e.g. `"git tag"`).
|
|
74
|
+
* @returns A fully populated {@link PareError}.
|
|
75
|
+
*/
|
|
76
|
+
export declare function classifyError(result: RunResult, command: string): PareError;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a dual-output error response that can be returned directly from a
|
|
79
|
+
* tool handler. The response carries both human-readable text (`content`) and
|
|
80
|
+
* structured JSON (`structuredContent`) with `isError: true` so the MCP
|
|
81
|
+
* client knows the call did not succeed.
|
|
82
|
+
*
|
|
83
|
+
* Usage:
|
|
84
|
+
* ```ts
|
|
85
|
+
* if (result.exitCode !== 0) {
|
|
86
|
+
* return errorOutput(classifyError(result, "git tag"));
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare function errorOutput(error: PareError): ToolOutput<PareError>;
|
|
91
|
+
/**
|
|
92
|
+
* Convenience: creates a {@link PareError} for input-validation failures and
|
|
93
|
+
* returns it as a dual-output response. Useful in `inputSchema` guards before
|
|
94
|
+
* the CLI command is even invoked.
|
|
95
|
+
*
|
|
96
|
+
* @param message - Description of what was wrong with the input.
|
|
97
|
+
*/
|
|
98
|
+
export declare function invalidInputError(message: string): ToolOutput<PareError>;
|
|
99
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC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;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAMnE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAOxE"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Error categories
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
/**
|
|
6
|
+
* Zod schema for the set of error categories a Pare tool can return.
|
|
7
|
+
*
|
|
8
|
+
* Each category maps to a class of failure an AI agent can programmatically
|
|
9
|
+
* match on, enabling automated recovery strategies without parsing free-text
|
|
10
|
+
* error messages.
|
|
11
|
+
*/
|
|
12
|
+
export const PareErrorCategory = z.enum([
|
|
13
|
+
"command-not-found", // CLI tool not installed or not in PATH
|
|
14
|
+
"permission-denied", // Insufficient OS/filesystem permissions
|
|
15
|
+
"timeout", // Command exceeded its time limit
|
|
16
|
+
"invalid-input", // Validation failure on user-supplied input
|
|
17
|
+
"not-found", // Requested resource does not exist
|
|
18
|
+
"network-error", // Network connectivity / DNS failure
|
|
19
|
+
"authentication-error", // Auth / credential failure
|
|
20
|
+
"conflict", // Merge conflict, lock contention, etc.
|
|
21
|
+
"configuration-error", // Missing or invalid config file
|
|
22
|
+
"already-exists", // Resource already exists
|
|
23
|
+
"command-failed", // Generic catch-all for unrecognised failures
|
|
24
|
+
]);
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Structured error object
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
/** Zod schema for the structured error every Pare tool can return. */
|
|
29
|
+
export const PareErrorSchema = z.object({
|
|
30
|
+
isError: z.literal(true),
|
|
31
|
+
category: PareErrorCategory,
|
|
32
|
+
message: z.string(),
|
|
33
|
+
command: z.string().optional(),
|
|
34
|
+
exitCode: z.number().optional(),
|
|
35
|
+
suggestion: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Pattern-matching helpers
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
/** Returns true when stderr / error text indicates the command was not found. */
|
|
41
|
+
export function isCommandNotFound(text) {
|
|
42
|
+
const lower = text.toLowerCase();
|
|
43
|
+
return (lower.includes("command not found") ||
|
|
44
|
+
lower.includes("not recognized") ||
|
|
45
|
+
lower.includes("enoent") ||
|
|
46
|
+
lower.includes("no such file or directory") ||
|
|
47
|
+
/is not recognized as an internal or external command/.test(lower));
|
|
48
|
+
}
|
|
49
|
+
/** Returns true when stderr indicates a permission / access error. */
|
|
50
|
+
export function isPermissionDenied(text) {
|
|
51
|
+
const lower = text.toLowerCase();
|
|
52
|
+
return (lower.includes("permission denied") ||
|
|
53
|
+
lower.includes("eacces") ||
|
|
54
|
+
lower.includes("eperm") ||
|
|
55
|
+
lower.includes("access denied") ||
|
|
56
|
+
lower.includes("operation not permitted"));
|
|
57
|
+
}
|
|
58
|
+
/** Returns true when stderr indicates a timeout. */
|
|
59
|
+
export function isTimeout(text) {
|
|
60
|
+
const lower = text.toLowerCase();
|
|
61
|
+
return lower.includes("timed out") || lower.includes("timeout");
|
|
62
|
+
}
|
|
63
|
+
/** Returns true when stderr indicates a network connectivity problem. */
|
|
64
|
+
export function isNetworkError(text) {
|
|
65
|
+
const lower = text.toLowerCase();
|
|
66
|
+
return (lower.includes("connection refused") ||
|
|
67
|
+
lower.includes("econnrefused") ||
|
|
68
|
+
lower.includes("etimedout") ||
|
|
69
|
+
lower.includes("econnreset") ||
|
|
70
|
+
lower.includes("enetunreach") ||
|
|
71
|
+
lower.includes("could not resolve host") ||
|
|
72
|
+
lower.includes("network is unreachable") ||
|
|
73
|
+
lower.includes("dns resolution failed"));
|
|
74
|
+
}
|
|
75
|
+
/** Returns true when stderr indicates an authentication / authorisation failure. */
|
|
76
|
+
export function isAuthError(text) {
|
|
77
|
+
const lower = text.toLowerCase();
|
|
78
|
+
return (lower.includes("authentication") ||
|
|
79
|
+
lower.includes("authenticated") ||
|
|
80
|
+
lower.includes("credential") ||
|
|
81
|
+
lower.includes("unauthorized") ||
|
|
82
|
+
/ 401[ :]/.test(lower) ||
|
|
83
|
+
/ 403[ :]/.test(lower) ||
|
|
84
|
+
lower.includes("permission denied (publickey") ||
|
|
85
|
+
lower.includes("invalid credentials") ||
|
|
86
|
+
lower.includes("bad credentials") ||
|
|
87
|
+
lower.includes("login required"));
|
|
88
|
+
}
|
|
89
|
+
/** Returns true when stderr indicates a conflict (merge, lock, etc.). */
|
|
90
|
+
export function isConflict(text) {
|
|
91
|
+
const lower = text.toLowerCase();
|
|
92
|
+
return (lower.includes("merge conflict") ||
|
|
93
|
+
lower.includes("conflict") ||
|
|
94
|
+
lower.includes("lock file") ||
|
|
95
|
+
lower.includes("locked") ||
|
|
96
|
+
lower.includes("already locked"));
|
|
97
|
+
}
|
|
98
|
+
/** Returns true when stderr indicates a resource was not found. */
|
|
99
|
+
export function isNotFound(text) {
|
|
100
|
+
const lower = text.toLowerCase();
|
|
101
|
+
return (lower.includes("not found") ||
|
|
102
|
+
lower.includes("does not exist") ||
|
|
103
|
+
lower.includes("no such") ||
|
|
104
|
+
/ 404[ :]/.test(lower) ||
|
|
105
|
+
lower.includes("unknown revision") ||
|
|
106
|
+
lower.includes("pathspec"));
|
|
107
|
+
}
|
|
108
|
+
/** Returns true when stderr indicates a resource already exists. */
|
|
109
|
+
export function isAlreadyExists(text) {
|
|
110
|
+
const lower = text.toLowerCase();
|
|
111
|
+
return lower.includes("already exists") || lower.includes("already exist");
|
|
112
|
+
}
|
|
113
|
+
/** Returns true when stderr indicates a configuration problem. */
|
|
114
|
+
export function isConfigurationError(text) {
|
|
115
|
+
const lower = text.toLowerCase();
|
|
116
|
+
return (lower.includes("missing config") ||
|
|
117
|
+
lower.includes("configuration error") ||
|
|
118
|
+
lower.includes("config file not found") ||
|
|
119
|
+
lower.includes("invalid configuration") ||
|
|
120
|
+
lower.includes("no configuration") ||
|
|
121
|
+
lower.includes(".eslintrc") ||
|
|
122
|
+
lower.includes("tsconfig") ||
|
|
123
|
+
lower.includes("could not read config"));
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Classifier
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
/**
|
|
129
|
+
* Classifies a failed {@link RunResult} into a structured {@link PareError}.
|
|
130
|
+
*
|
|
131
|
+
* The function inspects stderr (and stdout when stderr is empty), the exit
|
|
132
|
+
* code, and well-known patterns to determine the most specific category.
|
|
133
|
+
* When no pattern matches, the category falls back to `"command-failed"`.
|
|
134
|
+
*
|
|
135
|
+
* @param result - The {@link RunResult} returned by the command runner.
|
|
136
|
+
* @param command - A human-readable label for the command (e.g. `"git tag"`).
|
|
137
|
+
* @returns A fully populated {@link PareError}.
|
|
138
|
+
*/
|
|
139
|
+
export function classifyError(result, command) {
|
|
140
|
+
const text = result.stderr || result.stdout;
|
|
141
|
+
const category = classifyText(text, result.exitCode);
|
|
142
|
+
return {
|
|
143
|
+
isError: true,
|
|
144
|
+
category,
|
|
145
|
+
message: text.trim() || `${command} failed with exit code ${result.exitCode}`,
|
|
146
|
+
command,
|
|
147
|
+
exitCode: result.exitCode,
|
|
148
|
+
suggestion: suggestRecovery(category, command),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Determines the error category from combined error text and exit code.
|
|
153
|
+
*
|
|
154
|
+
* Order matters — more specific patterns are checked before generic ones.
|
|
155
|
+
* For example `"permission denied (publickey)"` should match
|
|
156
|
+
* `authentication-error` rather than `permission-denied`.
|
|
157
|
+
*/
|
|
158
|
+
function classifyText(text, exitCode) {
|
|
159
|
+
// Timeout (often signalled by exit code 124 from `timeout(1)`)
|
|
160
|
+
if (exitCode === 124 || isTimeout(text))
|
|
161
|
+
return "timeout";
|
|
162
|
+
// Command not found
|
|
163
|
+
if (isCommandNotFound(text))
|
|
164
|
+
return "command-not-found";
|
|
165
|
+
// Auth — checked before permission-denied because some auth errors
|
|
166
|
+
// contain the substring "permission denied"
|
|
167
|
+
if (isAuthError(text))
|
|
168
|
+
return "authentication-error";
|
|
169
|
+
// Permission
|
|
170
|
+
if (isPermissionDenied(text))
|
|
171
|
+
return "permission-denied";
|
|
172
|
+
// Network
|
|
173
|
+
if (isNetworkError(text))
|
|
174
|
+
return "network-error";
|
|
175
|
+
// Already exists
|
|
176
|
+
if (isAlreadyExists(text))
|
|
177
|
+
return "already-exists";
|
|
178
|
+
// Configuration
|
|
179
|
+
if (isConfigurationError(text))
|
|
180
|
+
return "configuration-error";
|
|
181
|
+
// Conflict — checked before not-found because conflict messages sometimes
|
|
182
|
+
// contain path references that include "not found"
|
|
183
|
+
if (isConflict(text))
|
|
184
|
+
return "conflict";
|
|
185
|
+
// Not found
|
|
186
|
+
if (isNotFound(text))
|
|
187
|
+
return "not-found";
|
|
188
|
+
// Catch-all
|
|
189
|
+
return "command-failed";
|
|
190
|
+
}
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
// Suggestions
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
const SUGGESTION_MAP = {
|
|
195
|
+
"command-not-found": (cmd) => `Ensure "${cmd}" is installed and available in your PATH.`,
|
|
196
|
+
"permission-denied": () => "Check file/directory permissions or run with elevated privileges.",
|
|
197
|
+
timeout: () => "The command took too long. Retry with a longer timeout or a smaller scope.",
|
|
198
|
+
"invalid-input": () => "Check the input parameters and try again.",
|
|
199
|
+
"not-found": () => "Verify the resource (file, branch, ref, etc.) exists.",
|
|
200
|
+
"network-error": () => "Check your network connection and try again.",
|
|
201
|
+
"authentication-error": () => "Verify your credentials or tokens are valid and not expired.",
|
|
202
|
+
conflict: () => "Resolve the conflict or release the lock and retry.",
|
|
203
|
+
"configuration-error": () => "Check that all required config files exist and are valid.",
|
|
204
|
+
"already-exists": () => "The resource already exists. Use a different name or remove it first.",
|
|
205
|
+
"command-failed": (cmd) => `Inspect the error message from "${cmd}" for more details.`,
|
|
206
|
+
};
|
|
207
|
+
function suggestRecovery(category, command) {
|
|
208
|
+
return SUGGESTION_MAP[category](command);
|
|
209
|
+
}
|
|
210
|
+
// ---------------------------------------------------------------------------
|
|
211
|
+
// Error output helper
|
|
212
|
+
// ---------------------------------------------------------------------------
|
|
213
|
+
/**
|
|
214
|
+
* Formats a {@link PareError} as human-readable text for the `content` field.
|
|
215
|
+
*/
|
|
216
|
+
function formatPareError(error) {
|
|
217
|
+
const lines = [`Error [${error.category}]: ${error.message}`];
|
|
218
|
+
if (error.command)
|
|
219
|
+
lines.push(`Command: ${error.command}`);
|
|
220
|
+
if (error.exitCode !== undefined)
|
|
221
|
+
lines.push(`Exit code: ${error.exitCode}`);
|
|
222
|
+
if (error.suggestion)
|
|
223
|
+
lines.push(`Suggestion: ${error.suggestion}`);
|
|
224
|
+
return lines.join("\n");
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Creates a dual-output error response that can be returned directly from a
|
|
228
|
+
* tool handler. The response carries both human-readable text (`content`) and
|
|
229
|
+
* structured JSON (`structuredContent`) with `isError: true` so the MCP
|
|
230
|
+
* client knows the call did not succeed.
|
|
231
|
+
*
|
|
232
|
+
* Usage:
|
|
233
|
+
* ```ts
|
|
234
|
+
* if (result.exitCode !== 0) {
|
|
235
|
+
* return errorOutput(classifyError(result, "git tag"));
|
|
236
|
+
* }
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
export function errorOutput(error) {
|
|
240
|
+
return {
|
|
241
|
+
content: [{ type: "text", text: formatPareError(error) }],
|
|
242
|
+
structuredContent: error,
|
|
243
|
+
isError: true,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Convenience: creates a {@link PareError} for input-validation failures and
|
|
248
|
+
* returns it as a dual-output response. Useful in `inputSchema` guards before
|
|
249
|
+
* the CLI command is even invoked.
|
|
250
|
+
*
|
|
251
|
+
* @param message - Description of what was wrong with the input.
|
|
252
|
+
*/
|
|
253
|
+
export function invalidInputError(message) {
|
|
254
|
+
return errorOutput({
|
|
255
|
+
isError: true,
|
|
256
|
+
category: "invalid-input",
|
|
257
|
+
message,
|
|
258
|
+
suggestion: "Check the input parameters and try again.",
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC;IACtC,mBAAmB,EAAE,wCAAwC;IAC7D,mBAAmB,EAAE,yCAAyC;IAC9D,SAAS,EAAE,kCAAkC;IAC7C,eAAe,EAAE,4CAA4C;IAC7D,WAAW,EAAE,oCAAoC;IACjD,eAAe,EAAE,qCAAqC;IACtD,sBAAsB,EAAE,4BAA4B;IACpD,UAAU,EAAE,wCAAwC;IACpD,qBAAqB,EAAE,iCAAiC;IACxD,gBAAgB,EAAE,0BAA0B;IAC5C,gBAAgB,EAAE,8CAA8C;CACjE,CAAC,CAAC;AAIH,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E,sEAAsE;AACtE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACxB,QAAQ,EAAE,iBAAiB;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,E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SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7E,IAAI,KAAK,CAAC,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB;IAC1C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,iBAAiB,EAAE,KAAK;QACxB,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,WAAW,CAAC;QACjB,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,eAAe;QACzB,OAAO;QACP,UAAU,EAAE,2CAA2C;KACxD,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,13 @@ export { run, escapeCmdArg, type RunResult, type RunOptions } from "./runner.js"
|
|
|
3
3
|
export { stripAnsi } from "./ansi.js";
|
|
4
4
|
export { assertNoFlagInjection, assertValidSortKey, assertValidLogOpts, assertAllowedCommand, } from "./validation.js";
|
|
5
5
|
export { INPUT_LIMITS } from "./limits.js";
|
|
6
|
+
export { compactInput, projectPathInput, repoPathInput, cwdPathInput, fixInput, pathInput, configInput, filePatternsInput, } from "./input-schemas.js";
|
|
6
7
|
export { sanitizeErrorOutput } from "./sanitize.js";
|
|
7
8
|
export { shouldRegisterTool, _resetProfileCache } from "./tool-filter.js";
|
|
8
9
|
export { PROFILES, resolveProfile } from "./profiles.js";
|
|
9
10
|
export type { ProfileName } from "./profiles.js";
|
|
10
11
|
export { assertAllowedByPolicy, assertAllowedRoot, assertNoPathQualifiedCommand, } from "./policy.js";
|
|
11
12
|
export type { ToolOutput } from "./types.js";
|
|
13
|
+
export { PareErrorCategory, PareErrorSchema, classifyError, errorOutput, invalidInputError, isCommandNotFound, isPermissionDenied, isTimeout, isNetworkError, isAuthError, isConflict, isNotFound, isAlreadyExists, isConfigurationError, } from "./errors.js";
|
|
14
|
+
export type { PareErrorCategoryType, PareError } from "./errors.js";
|
|
12
15
|
//# 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,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,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"}
|
|
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,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,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;AAC7C,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,WAAW,EACX,UAAU,EACV,UAAU,EACV,eAAe,EACf,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,10 @@ export { run, escapeCmdArg } from "./runner.js";
|
|
|
3
3
|
export { stripAnsi } from "./ansi.js";
|
|
4
4
|
export { assertNoFlagInjection, assertValidSortKey, assertValidLogOpts, assertAllowedCommand, } from "./validation.js";
|
|
5
5
|
export { INPUT_LIMITS } from "./limits.js";
|
|
6
|
+
export { compactInput, projectPathInput, repoPathInput, cwdPathInput, fixInput, pathInput, configInput, filePatternsInput, } from "./input-schemas.js";
|
|
6
7
|
export { sanitizeErrorOutput } from "./sanitize.js";
|
|
7
8
|
export { shouldRegisterTool, _resetProfileCache } from "./tool-filter.js";
|
|
8
9
|
export { PROFILES, resolveProfile } from "./profiles.js";
|
|
9
10
|
export { assertAllowedByPolicy, assertAllowedRoot, assertNoPathQualifiedCommand, } from "./policy.js";
|
|
11
|
+
export { PareErrorCategory, PareErrorSchema, classifyError, errorOutput, invalidInputError, isCommandNotFound, isPermissionDenied, isTimeout, isNetworkError, isAuthError, isConflict, isNotFound, isAlreadyExists, isConfigurationError, } from "./errors.js";
|
|
10
12
|
//# 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,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,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"}
|
|
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,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,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;AAErB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,WAAW,EACX,UAAU,EACV,UAAU,EACV,eAAe,EACf,oBAAoB,GACrB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Zod input schemas for common tool parameters.
|
|
3
|
+
*
|
|
4
|
+
* These schemas centralize definitions that were previously duplicated
|
|
5
|
+
* across every server package (e.g. `compact`, `path`, `fix`).
|
|
6
|
+
*
|
|
7
|
+
* - **Constants** are used when the schema is identical everywhere.
|
|
8
|
+
* - **Factories** are used when only the `.describe()` text varies.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
/** `compact: z.boolean().optional().default(true).describe("Prefer compact output")` */
|
|
12
|
+
export declare const compactInput: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
13
|
+
/** `path` for servers whose root concept is a project (go, lint, build, make, cargo, python, test, npm). */
|
|
14
|
+
export declare const projectPathInput: z.ZodOptional<z.ZodString>;
|
|
15
|
+
/** `path` for servers whose root concept is a repository (git, github, security). */
|
|
16
|
+
export declare const repoPathInput: z.ZodOptional<z.ZodString>;
|
|
17
|
+
/** `path` for servers whose root concept is a working directory (docker, http, process, search). */
|
|
18
|
+
export declare const cwdPathInput: z.ZodOptional<z.ZodString>;
|
|
19
|
+
/** `fix: z.boolean().optional().default(false).describe("Auto-fix problems")` */
|
|
20
|
+
export declare const fixInput: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
21
|
+
/** Generic optional path string — use when none of the constants above fit. */
|
|
22
|
+
export declare const pathInput: (desc: string) => z.ZodOptional<z.ZodString>;
|
|
23
|
+
/** Optional config-file path. */
|
|
24
|
+
export declare const configInput: (desc: string) => z.ZodOptional<z.ZodString>;
|
|
25
|
+
/** Optional array of file-path patterns with INPUT_LIMITS applied. */
|
|
26
|
+
export declare const filePatternsInput: (desc: string, defaultValue?: string[]) => z.ZodOptional<z.ZodArray<z.ZodString>> | z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
27
|
+
//# sourceMappingURL=input-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-schemas.d.ts","sourceRoot":"","sources":["../src/input-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,wFAAwF;AACxF,eAAO,MAAM,YAAY,2CAAyE,CAAC;AAEnG,4GAA4G;AAC5G,eAAO,MAAM,gBAAgB,4BAIG,CAAC;AAEjC,qFAAqF;AACrF,eAAO,MAAM,aAAa,4BAII,CAAC;AAE/B,oGAAoG;AACpG,eAAO,MAAM,YAAY,4BAIO,CAAC;AAEjC,iFAAiF;AACjF,eAAO,MAAM,QAAQ,2CAAsE,CAAC;AAM5F,+EAA+E;AAC/E,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,+BAC2B,CAAC;AAElE,iCAAiC;AACjC,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,+BACyB,CAAC;AAElE,sEAAsE;AACtE,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,eAAe,MAAM,EAAE,kGAMtE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Zod input schemas for common tool parameters.
|
|
3
|
+
*
|
|
4
|
+
* These schemas centralize definitions that were previously duplicated
|
|
5
|
+
* across every server package (e.g. `compact`, `path`, `fix`).
|
|
6
|
+
*
|
|
7
|
+
* - **Constants** are used when the schema is identical everywhere.
|
|
8
|
+
* - **Factories** are used when only the `.describe()` text varies.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { INPUT_LIMITS } from "./limits.js";
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Constants (zero variation across servers)
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/** `compact: z.boolean().optional().default(true).describe("Prefer compact output")` */
|
|
16
|
+
export const compactInput = z.boolean().optional().default(true).describe("Prefer compact output");
|
|
17
|
+
/** `path` for servers whose root concept is a project (go, lint, build, make, cargo, python, test, npm). */
|
|
18
|
+
export const projectPathInput = z
|
|
19
|
+
.string()
|
|
20
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Project root path");
|
|
23
|
+
/** `path` for servers whose root concept is a repository (git, github, security). */
|
|
24
|
+
export const repoPathInput = z
|
|
25
|
+
.string()
|
|
26
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("Repository path");
|
|
29
|
+
/** `path` for servers whose root concept is a working directory (docker, http, process, search). */
|
|
30
|
+
export const cwdPathInput = z
|
|
31
|
+
.string()
|
|
32
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("Working directory");
|
|
35
|
+
/** `fix: z.boolean().optional().default(false).describe("Auto-fix problems")` */
|
|
36
|
+
export const fixInput = z.boolean().optional().default(false).describe("Auto-fix problems");
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Factories (same shape, varied descriptions)
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
/** Generic optional path string — use when none of the constants above fit. */
|
|
41
|
+
export const pathInput = (desc) => z.string().max(INPUT_LIMITS.PATH_MAX).optional().describe(desc);
|
|
42
|
+
/** Optional config-file path. */
|
|
43
|
+
export const configInput = (desc) => z.string().max(INPUT_LIMITS.PATH_MAX).optional().describe(desc);
|
|
44
|
+
/** Optional array of file-path patterns with INPUT_LIMITS applied. */
|
|
45
|
+
export const filePatternsInput = (desc, defaultValue) => {
|
|
46
|
+
const base = z
|
|
47
|
+
.array(z.string().max(INPUT_LIMITS.PATH_MAX))
|
|
48
|
+
.max(INPUT_LIMITS.ARRAY_MAX)
|
|
49
|
+
.optional();
|
|
50
|
+
return defaultValue ? base.default(defaultValue).describe(desc) : base.describe(desc);
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=input-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-schemas.js","sourceRoot":"","sources":["../src/input-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE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E,EAAE,CAC1C,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAElE,sEAAsE;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,YAAuB,EAAE,EAAE;IACzE,MAAM,IAAI,GAAG,CAAC;SACX,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;SAC5C,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC;SAC3B,QAAQ,EAAE,CAAC;IACd,OAAO,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paretools/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Shared utilities for Pare MCP servers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -33,6 +33,9 @@
|
|
|
33
33
|
"url": "https://github.com/Dave-London/Pare.git",
|
|
34
34
|
"directory": "packages/shared"
|
|
35
35
|
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/Dave-London/Pare/issues"
|
|
38
|
+
},
|
|
36
39
|
"files": [
|
|
37
40
|
"dist"
|
|
38
41
|
],
|