@stigmer/plugin-package 0.1.0-dev.20261017020314.g644422724c27
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/LICENSE +194 -0
- package/README.md +72 -0
- package/client/archive.d.ts +27 -0
- package/client/archive.d.ts.map +1 -0
- package/client/archive.js +38 -0
- package/client/archive.js.map +1 -0
- package/client/builtin.d.ts +37 -0
- package/client/builtin.d.ts.map +1 -0
- package/client/builtin.js +49 -0
- package/client/builtin.js.map +1 -0
- package/client/ignore/defaults.d.ts +2 -0
- package/client/ignore/defaults.d.ts.map +1 -0
- package/client/ignore/defaults.js +140 -0
- package/client/ignore/defaults.js.map +1 -0
- package/client/ignore/match.d.ts +3 -0
- package/client/ignore/match.d.ts.map +1 -0
- package/client/ignore/match.js +166 -0
- package/client/ignore/match.js.map +1 -0
- package/client/ignore/matcher.d.ts +50 -0
- package/client/ignore/matcher.d.ts.map +1 -0
- package/client/ignore/matcher.js +116 -0
- package/client/ignore/matcher.js.map +1 -0
- package/client/ignore/pattern.d.ts +13 -0
- package/client/ignore/pattern.d.ts.map +1 -0
- package/client/ignore/pattern.js +119 -0
- package/client/ignore/pattern.js.map +1 -0
- package/client/prepare-eval.d.ts +62 -0
- package/client/prepare-eval.d.ts.map +1 -0
- package/client/prepare-eval.js +60 -0
- package/client/prepare-eval.js.map +1 -0
- package/client/prepare.d.ts +99 -0
- package/client/prepare.d.ts.map +1 -0
- package/client/prepare.js +89 -0
- package/client/prepare.js.map +1 -0
- package/client/presentation.d.ts +19 -0
- package/client/presentation.d.ts.map +1 -0
- package/client/presentation.js +44 -0
- package/client/presentation.js.map +1 -0
- package/client/refs.d.ts +76 -0
- package/client/refs.d.ts.map +1 -0
- package/client/refs.js +123 -0
- package/client/refs.js.map +1 -0
- package/client/release.d.ts +20 -0
- package/client/release.d.ts.map +1 -0
- package/client/release.js +28 -0
- package/client/release.js.map +1 -0
- package/client/reroot.d.ts +21 -0
- package/client/reroot.d.ts.map +1 -0
- package/client/reroot.js +37 -0
- package/client/reroot.js.map +1 -0
- package/client/select.d.ts +74 -0
- package/client/select.d.ts.map +1 -0
- package/client/select.js +121 -0
- package/client/select.js.map +1 -0
- package/client/vocabulary.d.ts +13 -0
- package/client/vocabulary.d.ts.map +1 -0
- package/client/vocabulary.js +17 -0
- package/client/vocabulary.js.map +1 -0
- package/client.d.ts +51 -0
- package/client.d.ts.map +1 -0
- package/client.js +51 -0
- package/client.js.map +1 -0
- package/detect.d.ts +83 -0
- package/detect.d.ts.map +1 -0
- package/detect.js +210 -0
- package/detect.js.map +1 -0
- package/dialects/claude.d.ts +34 -0
- package/dialects/claude.d.ts.map +1 -0
- package/dialects/claude.js +84 -0
- package/dialects/claude.js.map +1 -0
- package/dialects/codex.d.ts +20 -0
- package/dialects/codex.d.ts.map +1 -0
- package/dialects/codex.js +21 -0
- package/dialects/codex.js.map +1 -0
- package/dialects/cursor.d.ts +25 -0
- package/dialects/cursor.d.ts.map +1 -0
- package/dialects/cursor.js +66 -0
- package/dialects/cursor.js.map +1 -0
- package/dialects/manifest.d.ts +164 -0
- package/dialects/manifest.d.ts.map +1 -0
- package/dialects/manifest.js +256 -0
- package/dialects/manifest.js.map +1 -0
- package/dialects/open.d.ts +19 -0
- package/dialects/open.d.ts.map +1 -0
- package/dialects/open.js +49 -0
- package/dialects/open.js.map +1 -0
- package/documents.d.ts +58 -0
- package/documents.d.ts.map +1 -0
- package/documents.js +121 -0
- package/documents.js.map +1 -0
- package/evals/eval-dir.d.ts +59 -0
- package/evals/eval-dir.d.ts.map +1 -0
- package/evals/eval-dir.js +84 -0
- package/evals/eval-dir.js.map +1 -0
- package/evals/fields.d.ts +78 -0
- package/evals/fields.d.ts.map +1 -0
- package/evals/fields.js +156 -0
- package/evals/fields.js.map +1 -0
- package/evals/glob.d.ts +40 -0
- package/evals/glob.d.ts.map +1 -0
- package/evals/glob.js +146 -0
- package/evals/glob.js.map +1 -0
- package/evals/graders.d.ts +52 -0
- package/evals/graders.d.ts.map +1 -0
- package/evals/graders.js +279 -0
- package/evals/graders.js.map +1 -0
- package/evals/markdown.d.ts +24 -0
- package/evals/markdown.d.ts.map +1 -0
- package/evals/markdown.js +48 -0
- package/evals/markdown.js.map +1 -0
- package/evals/mocks.d.ts +50 -0
- package/evals/mocks.d.ts.map +1 -0
- package/evals/mocks.js +182 -0
- package/evals/mocks.js.map +1 -0
- package/evals/read-eval-suite.d.ts +110 -0
- package/evals/read-eval-suite.d.ts.map +1 -0
- package/evals/read-eval-suite.js +603 -0
- package/evals/read-eval-suite.js.map +1 -0
- package/evals/summary.d.ts +61 -0
- package/evals/summary.d.ts.map +1 -0
- package/evals/summary.js +69 -0
- package/evals/summary.js.map +1 -0
- package/evals/types.d.ts +203 -0
- package/evals/types.d.ts.map +1 -0
- package/evals/types.js +21 -0
- package/evals/types.js.map +1 -0
- package/files.d.ts +135 -0
- package/files.d.ts.map +1 -0
- package/files.js +209 -0
- package/files.js.map +1 -0
- package/frontmatter.d.ts +51 -0
- package/frontmatter.d.ts.map +1 -0
- package/frontmatter.js +61 -0
- package/frontmatter.js.map +1 -0
- package/index.d.ts +37 -0
- package/index.d.ts.map +1 -0
- package/index.js +33 -0
- package/index.js.map +1 -0
- package/marketplace/messages.d.ts +20 -0
- package/marketplace/messages.d.ts.map +1 -0
- package/marketplace/messages.js +49 -0
- package/marketplace/messages.js.map +1 -0
- package/marketplace/outcome.d.ts +70 -0
- package/marketplace/outcome.d.ts.map +1 -0
- package/marketplace/outcome.js +29 -0
- package/marketplace/outcome.js.map +1 -0
- package/marketplace/read-marketplace.d.ts +52 -0
- package/marketplace/read-marketplace.d.ts.map +1 -0
- package/marketplace/read-marketplace.js +351 -0
- package/marketplace/read-marketplace.js.map +1 -0
- package/messages.d.ts +55 -0
- package/messages.d.ts.map +1 -0
- package/messages.js +167 -0
- package/messages.js.map +1 -0
- package/normalise/hooks.d.ts +91 -0
- package/normalise/hooks.d.ts.map +1 -0
- package/normalise/hooks.js +437 -0
- package/normalise/hooks.js.map +1 -0
- package/normalise/ignored.d.ts +34 -0
- package/normalise/ignored.d.ts.map +1 -0
- package/normalise/ignored.js +78 -0
- package/normalise/ignored.js.map +1 -0
- package/normalise/mcp-servers.d.ts +50 -0
- package/normalise/mcp-servers.d.ts.map +1 -0
- package/normalise/mcp-servers.js +398 -0
- package/normalise/mcp-servers.js.map +1 -0
- package/normalise/settings.d.ts +32 -0
- package/normalise/settings.d.ts.map +1 -0
- package/normalise/settings.js +72 -0
- package/normalise/settings.js.map +1 -0
- package/normalise/skills.d.ts +39 -0
- package/normalise/skills.d.ts.map +1 -0
- package/normalise/skills.js +135 -0
- package/normalise/skills.js.map +1 -0
- package/normalise/stigmer-folder.d.ts +17 -0
- package/normalise/stigmer-folder.d.ts.map +1 -0
- package/normalise/stigmer-folder.js +19 -0
- package/normalise/stigmer-folder.js.map +1 -0
- package/normalise/sub-agents.d.ts +54 -0
- package/normalise/sub-agents.d.ts.map +1 -0
- package/normalise/sub-agents.js +219 -0
- package/normalise/sub-agents.js.map +1 -0
- package/normalise/variables.d.ts +31 -0
- package/normalise/variables.d.ts.map +1 -0
- package/normalise/variables.js +170 -0
- package/normalise/variables.js.map +1 -0
- package/outcome.d.ts +59 -0
- package/outcome.d.ts.map +1 -0
- package/outcome.js +32 -0
- package/outcome.js.map +1 -0
- package/package.json +47 -0
- package/placeholders.d.ts +65 -0
- package/placeholders.d.ts.map +1 -0
- package/placeholders.js +99 -0
- package/placeholders.js.map +1 -0
- package/presentation.d.ts +53 -0
- package/presentation.d.ts.map +1 -0
- package/presentation.js +156 -0
- package/presentation.js.map +1 -0
- package/read-plugin-package.d.ts +20 -0
- package/read-plugin-package.d.ts.map +1 -0
- package/read-plugin-package.js +73 -0
- package/read-plugin-package.js.map +1 -0
- package/src/client/archive.ts +44 -0
- package/src/client/builtin.ts +60 -0
- package/src/client/ignore/defaults.ts +155 -0
- package/src/client/ignore/match.ts +158 -0
- package/src/client/ignore/matcher.ts +156 -0
- package/src/client/ignore/pattern.ts +132 -0
- package/src/client/prepare-eval.ts +92 -0
- package/src/client/prepare.ts +160 -0
- package/src/client/presentation.ts +47 -0
- package/src/client/refs.ts +170 -0
- package/src/client/release.ts +29 -0
- package/src/client/reroot.ts +35 -0
- package/src/client/select.ts +161 -0
- package/src/client/vocabulary.ts +19 -0
- package/src/client.ts +102 -0
- package/src/detect.ts +245 -0
- package/src/dialects/claude.ts +102 -0
- package/src/dialects/codex.ts +26 -0
- package/src/dialects/cursor.ts +77 -0
- package/src/dialects/manifest.ts +316 -0
- package/src/dialects/open.ts +50 -0
- package/src/documents.ts +158 -0
- package/src/evals/eval-dir.ts +101 -0
- package/src/evals/fields.ts +184 -0
- package/src/evals/glob.ts +141 -0
- package/src/evals/graders.ts +293 -0
- package/src/evals/markdown.ts +56 -0
- package/src/evals/mocks.ts +202 -0
- package/src/evals/read-eval-suite.ts +713 -0
- package/src/evals/summary.ts +100 -0
- package/src/evals/types.ts +217 -0
- package/src/files.ts +235 -0
- package/src/frontmatter.ts +70 -0
- package/src/index.ts +129 -0
- package/src/marketplace/messages.ts +61 -0
- package/src/marketplace/outcome.ts +91 -0
- package/src/marketplace/read-marketplace.ts +388 -0
- package/src/messages.ts +248 -0
- package/src/normalise/hooks.ts +469 -0
- package/src/normalise/ignored.ts +79 -0
- package/src/normalise/mcp-servers.ts +423 -0
- package/src/normalise/settings.ts +81 -0
- package/src/normalise/skills.ts +145 -0
- package/src/normalise/stigmer-folder.ts +23 -0
- package/src/normalise/sub-agents.ts +231 -0
- package/src/normalise/variables.ts +181 -0
- package/src/outcome.ts +158 -0
- package/src/placeholders.ts +110 -0
- package/src/presentation.ts +170 -0
- package/src/read-plugin-package.ts +80 -0
- package/src/testing.ts +347 -0
- package/src/tool-names.ts +30 -0
- package/src/trim.ts +10 -0
- package/src/types.ts +214 -0
- package/testing.d.ts +127 -0
- package/testing.d.ts.map +1 -0
- package/testing.js +266 -0
- package/testing.js.map +1 -0
- package/tool-names.d.ts +21 -0
- package/tool-names.d.ts.map +1 -0
- package/tool-names.js +28 -0
- package/tool-names.js.map +1 -0
- package/trim.d.ts +7 -0
- package/trim.d.ts.map +1 -0
- package/trim.js +12 -0
- package/trim.js.map +1 -0
- package/types.d.ts +179 -0
- package/types.d.ts.map +1 -0
- package/types.js +19 -0
- package/types.js.map +1 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The normalised description of a plugin: what Stigmer would install from a
|
|
3
|
+
* package, whatever dialect the package was written in.
|
|
4
|
+
*
|
|
5
|
+
* These are the library's own plain types, deliberately not the protos. The
|
|
6
|
+
* library describes the plugin FORMAT; the server maps this description onto
|
|
7
|
+
* the plugin's status when it installs, and the CLI validates offline
|
|
8
|
+
* without pulling the resource schemas in for a parse. Field names still
|
|
9
|
+
* mirror the protos (`PluginAgent.name/description/instructions`,
|
|
10
|
+
* `EnvVarDeclaration.is_secret/description/optional`, the
|
|
11
|
+
* `McpServerEntry` `stdio`/`http` variants) so the server's mapping is one
|
|
12
|
+
* function per part and a proto rename is a visible edit here.
|
|
13
|
+
*
|
|
14
|
+
* Every path in this description is plugin-relative, POSIX, with no leading
|
|
15
|
+
* `./`: one path vocabulary for the whole package, whichever reader produced
|
|
16
|
+
* the files.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** The manifest that gave the plugin its identity. */
|
|
20
|
+
export type PluginDialect = "agent-plugins" | "claude" | "cursor" | "codex";
|
|
21
|
+
|
|
22
|
+
export interface PluginAuthor {
|
|
23
|
+
readonly name?: string;
|
|
24
|
+
readonly email?: string;
|
|
25
|
+
readonly url?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* One skill: a directory holding `SKILL.md`. `files` lists every file under
|
|
30
|
+
* `dir` (plugin-relative), so a reader can find the skill's files
|
|
31
|
+
* without walking the package again; `SKILL.md` is among them. For a plugin
|
|
32
|
+
* that IS a single skill (a root `SKILL.md`, the Claude Code layout) `dir` is
|
|
33
|
+
* the empty string and `files` is the whole package.
|
|
34
|
+
*/
|
|
35
|
+
export interface PluginSkill {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly description?: string;
|
|
38
|
+
readonly dir: string;
|
|
39
|
+
readonly files: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* One MCP server in the shape `McpServerEntry` takes. `env` is the list of
|
|
44
|
+
* variable NAMES the server references (in headers, arguments or its stdio
|
|
45
|
+
* environment), which is what `McpServerEntry.env` names; values never
|
|
46
|
+
* appear anywhere in this library.
|
|
47
|
+
*/
|
|
48
|
+
export type PluginMcpServer =
|
|
49
|
+
| {
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly transport: "http";
|
|
52
|
+
readonly url: string;
|
|
53
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
54
|
+
readonly env: readonly string[];
|
|
55
|
+
}
|
|
56
|
+
| {
|
|
57
|
+
readonly name: string;
|
|
58
|
+
readonly transport: "stdio";
|
|
59
|
+
readonly command: string;
|
|
60
|
+
readonly args: readonly string[];
|
|
61
|
+
readonly env: readonly string[];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A dialect's `model` value, kept as written (`raw`) and classified into an
|
|
66
|
+
* alias. The library never names a Stigmer model id: whether `raw` is a
|
|
67
|
+
* model the conversation's engine lists is the turn's question, so the
|
|
68
|
+
* server stores `raw` as written and the alias decides only the warnings.
|
|
69
|
+
* `inherit` and an absent `model` both mean "no override"; `unknown`
|
|
70
|
+
* carries the raw text for the library's warning.
|
|
71
|
+
*/
|
|
72
|
+
export type ModelAlias = "fast" | "sonnet" | "opus" | "haiku" | "inherit" | "unknown";
|
|
73
|
+
|
|
74
|
+
export interface ModelHint {
|
|
75
|
+
readonly raw: string;
|
|
76
|
+
readonly alias: ModelAlias;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** One agent file (`agents/*.md`) in the shape `PluginAgent` takes. */
|
|
80
|
+
export interface PluginSubAgent {
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly description?: string;
|
|
83
|
+
readonly instructions: string;
|
|
84
|
+
/** Plugin skill names this agent asked for (Claude `skills:`), checked against the plugin's skills by the installer. */
|
|
85
|
+
readonly skillNames: readonly string[];
|
|
86
|
+
readonly modelHint?: ModelHint;
|
|
87
|
+
/**
|
|
88
|
+
* Claude's "only these tools" list (`tools:`), entries as written. Absent
|
|
89
|
+
* means no list; an empty list is kept apart from absence so the installer
|
|
90
|
+
* can tell "no list" from a list it emptied.
|
|
91
|
+
*/
|
|
92
|
+
readonly tools?: readonly string[];
|
|
93
|
+
/** Claude's "never these tools" list (`disallowedTools:`), entries as written. */
|
|
94
|
+
readonly disallowedTools?: readonly string[];
|
|
95
|
+
/** The agent file, for messages that point at it. */
|
|
96
|
+
readonly path: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The hook format a plugin's hooks are written in, which decides the JSON a
|
|
101
|
+
* hook reads and how its answer is parsed (`HookFormat`). Codex plugin hooks
|
|
102
|
+
* are written in Claude Code's format.
|
|
103
|
+
*/
|
|
104
|
+
export type HookFormat = "claude-code" | "cursor";
|
|
105
|
+
|
|
106
|
+
/** One command a hook runs, in the shape `HookHandler` takes. */
|
|
107
|
+
export interface PluginHookHandler {
|
|
108
|
+
/** As written; placeholders such as `${CLAUDE_PLUGIN_ROOT}` are kept verbatim. */
|
|
109
|
+
readonly command: string;
|
|
110
|
+
/** Claude's exec form; when non-empty the command runs without a shell. */
|
|
111
|
+
readonly args: readonly string[];
|
|
112
|
+
/** Seconds, rounded up; absent means the format's default. */
|
|
113
|
+
readonly timeoutSeconds?: number;
|
|
114
|
+
/** Claude's `if`, a permission rule such as `Bash(git push *)`. */
|
|
115
|
+
readonly condition?: string;
|
|
116
|
+
/** Cursor's `failClosed`. */
|
|
117
|
+
readonly failClosed: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** One event, its matcher as written, and the handlers that run, in the shape `HookGroup` takes. */
|
|
121
|
+
export interface PluginHookGroup {
|
|
122
|
+
/** Spelled as the format spells it (`PreToolUse`, `beforeShellExecution`). */
|
|
123
|
+
readonly event: string;
|
|
124
|
+
/** As written; empty or `*` matches every call. */
|
|
125
|
+
readonly matcher: string;
|
|
126
|
+
readonly handlers: readonly PluginHookHandler[];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The plugin's tool-call hooks Stigmer reads, in the shape `HookConfig` takes.
|
|
131
|
+
* Only events and handlers Stigmer runs are here; everything else the
|
|
132
|
+
* plugin's hooks files carry is named in the read's warnings.
|
|
133
|
+
*/
|
|
134
|
+
export interface PluginHooks {
|
|
135
|
+
readonly format: HookFormat;
|
|
136
|
+
readonly groups: readonly PluginHookGroup[];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* One variable in the shape `EnvVarDeclaration` takes. `declaredBy` says
|
|
141
|
+
* where the declaration came from: a Cursor `variables` schema, a Claude
|
|
142
|
+
* `userConfig` entry, inference from an undeclared `${VAR}` reference,
|
|
143
|
+
* which the library declares as a required secret because the runner hands a
|
|
144
|
+
* server only the variables its spec declares, or the platform, for a name
|
|
145
|
+
* the runner fills itself (`PLATFORM_VARIABLES`).
|
|
146
|
+
*/
|
|
147
|
+
export interface PluginVariable {
|
|
148
|
+
readonly name: string;
|
|
149
|
+
readonly description?: string;
|
|
150
|
+
readonly isSecret: boolean;
|
|
151
|
+
readonly optional: boolean;
|
|
152
|
+
readonly declaredBy: "cursor" | "claude" | "inferred" | "platform";
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The component kinds Stigmer reads past without carrying. Recorded once per
|
|
157
|
+
* component (a directory, a file or a manifest field), never per file, so
|
|
158
|
+
* an author sees "hooks/ is not installed" once.
|
|
159
|
+
*/
|
|
160
|
+
export type IgnoredComponentKind =
|
|
161
|
+
| "agents"
|
|
162
|
+
| "apps"
|
|
163
|
+
| "assets"
|
|
164
|
+
| "bin"
|
|
165
|
+
| "canvases"
|
|
166
|
+
| "channels"
|
|
167
|
+
| "commands"
|
|
168
|
+
| "default-enabled"
|
|
169
|
+
| "dependencies"
|
|
170
|
+
| "extension"
|
|
171
|
+
| "logo"
|
|
172
|
+
| "lsp-servers"
|
|
173
|
+
| "min-client-versions"
|
|
174
|
+
| "monitors"
|
|
175
|
+
| "output-styles"
|
|
176
|
+
| "rules"
|
|
177
|
+
| "settings"
|
|
178
|
+
| "themes"
|
|
179
|
+
| "workflows";
|
|
180
|
+
|
|
181
|
+
export interface IgnoredComponent {
|
|
182
|
+
readonly kind: IgnoredComponentKind;
|
|
183
|
+
/** The directory, file, or `<manifest path>#<field>` the component came from. */
|
|
184
|
+
readonly path: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** What Stigmer would install from the package. */
|
|
188
|
+
export interface PluginPackage {
|
|
189
|
+
readonly name: string;
|
|
190
|
+
/** As written; Semantic Versioning is recommended by the format, not enforced. */
|
|
191
|
+
readonly version?: string;
|
|
192
|
+
readonly description?: string;
|
|
193
|
+
readonly author?: PluginAuthor;
|
|
194
|
+
readonly homepage?: string;
|
|
195
|
+
readonly repository?: string;
|
|
196
|
+
readonly license?: string;
|
|
197
|
+
readonly keywords: readonly string[];
|
|
198
|
+
readonly dialect: PluginDialect;
|
|
199
|
+
/** Every manifest the reader consulted, identity first. */
|
|
200
|
+
readonly manifestsFound: readonly string[];
|
|
201
|
+
readonly skills: readonly PluginSkill[];
|
|
202
|
+
readonly mcpServers: readonly PluginMcpServer[];
|
|
203
|
+
readonly subAgents: readonly PluginSubAgent[];
|
|
204
|
+
readonly variables: readonly PluginVariable[];
|
|
205
|
+
/** The tool-call hooks Stigmer reads; absent when the plugin carries none. */
|
|
206
|
+
readonly hooks?: PluginHooks;
|
|
207
|
+
/**
|
|
208
|
+
* The sub-agent a Claude plugin's settings (`settings.json` or the
|
|
209
|
+
* manifest's `settings`) name as the session's main agent, by its name in
|
|
210
|
+
* `subAgents`; absent when none is named.
|
|
211
|
+
*/
|
|
212
|
+
readonly mainAgent?: string;
|
|
213
|
+
readonly ignored: readonly IgnoredComponent[];
|
|
214
|
+
}
|
package/testing.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory plugin builders for tests (exported as
|
|
3
|
+
* `@stigmer/plugin-package/testing`).
|
|
4
|
+
*
|
|
5
|
+
* One builder per dialect, each writing the exact file layout that
|
|
6
|
+
* dialect's tools produce: `openPlugin` a root `plugin.json` with the
|
|
7
|
+
* canonical `$schema` and an `mcp.json` beside it; `claudePlugin` a
|
|
8
|
+
* `.claude-plugin/plugin.json` with `.mcp.json`, `hooks/hooks.json` and
|
|
9
|
+
* `settings.json`; `cursorPlugin` a `.cursor-plugin/plugin.json` declaring
|
|
10
|
+
* `./skills/`, `./agents/`, `./mcp.json` and `./hooks/hooks.json` the way
|
|
11
|
+
* every published Cursor plugin does; `codexPlugin` the legacy
|
|
12
|
+
* `.codex-plugin/plugin.json` compatibility layout. A `hooks` option is the
|
|
13
|
+
* event map; each builder wraps it in its format's file shape. The
|
|
14
|
+
* adversarial suite starts from a valid plugin and breaks exactly one
|
|
15
|
+
* thing with the mutators (`withFile`, `withoutFile`,
|
|
16
|
+
* `withManifestField`), so each test reads as "this plugin, minus this",
|
|
17
|
+
* and the consumers' tests (the CLI's, the server's) craft their fixtures
|
|
18
|
+
* from the same source so the shapes never drift apart.
|
|
19
|
+
*
|
|
20
|
+
* Builders return a path -> content map; `inMemoryPluginFiles` turns one
|
|
21
|
+
* into the `PluginFiles` the reader takes. Zipping a fixture for an
|
|
22
|
+
* archive-based consumer is `@stigmer/zip-structure/testing`'s job.
|
|
23
|
+
*
|
|
24
|
+
* `GLOB_VALIDITY_TABLE` is the one table of eval globs, well formed or not
|
|
25
|
+
* with the sentence `globError` answers, that this library's test and the
|
|
26
|
+
* server's matcher test both read, so the two readers of the grammar
|
|
27
|
+
* cannot drift apart.
|
|
28
|
+
*/
|
|
29
|
+
import { inMemoryPluginFiles } from "./files.js";
|
|
30
|
+
export { inMemoryPluginFiles };
|
|
31
|
+
/** A plugin as files: plugin-relative path -> content. */
|
|
32
|
+
export type PluginFixture = Map<string, string | Uint8Array>;
|
|
33
|
+
export interface SkillFixture {
|
|
34
|
+
/** The frontmatter `name`; also the directory name unless `dir` says otherwise. */
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly description?: string;
|
|
37
|
+
/** Directory under `skills/` (or the declared skills root); defaults to `name`. */
|
|
38
|
+
readonly dir?: string;
|
|
39
|
+
/** Extra frontmatter fields, or `null` for a `SKILL.md` with no frontmatter at all. */
|
|
40
|
+
readonly frontmatter?: Readonly<Record<string, unknown>> | null;
|
|
41
|
+
readonly body?: string;
|
|
42
|
+
/** Extra files inside the skill directory, relative to it. */
|
|
43
|
+
readonly files?: Readonly<Record<string, string>>;
|
|
44
|
+
}
|
|
45
|
+
export interface AgentFixture {
|
|
46
|
+
/** File name under `agents/`, without `.md`. */
|
|
47
|
+
readonly file: string;
|
|
48
|
+
/** Frontmatter fields, or `null` for a bare prompt with no frontmatter. */
|
|
49
|
+
readonly frontmatter?: Readonly<Record<string, unknown>> | null;
|
|
50
|
+
readonly body?: string;
|
|
51
|
+
}
|
|
52
|
+
interface CommonFixture {
|
|
53
|
+
readonly name?: string;
|
|
54
|
+
readonly version?: string;
|
|
55
|
+
readonly description?: string;
|
|
56
|
+
/** Extra or overriding manifest fields, merged last. */
|
|
57
|
+
readonly manifest?: Readonly<Record<string, unknown>>;
|
|
58
|
+
readonly skills?: readonly SkillFixture[];
|
|
59
|
+
/** Extra files anywhere in the plugin. */
|
|
60
|
+
readonly files?: Readonly<Record<string, string | Uint8Array>>;
|
|
61
|
+
}
|
|
62
|
+
export interface OpenPluginFixture extends CommonFixture {
|
|
63
|
+
/** The manifest `$schema`; `null` omits it. Defaults to the canonical 1.0.0 identifier. */
|
|
64
|
+
readonly schema?: string | null;
|
|
65
|
+
/** The `mcpServers` map for `mcp.json`; absent means no `mcp.json`. */
|
|
66
|
+
readonly mcpServers?: Readonly<Record<string, unknown>>;
|
|
67
|
+
/** The `mcp.json` `$schema`; `null` omits it. */
|
|
68
|
+
readonly mcpSchema?: string | null;
|
|
69
|
+
/** Extra top-level `mcp.json` fields. */
|
|
70
|
+
readonly mcpConfig?: Readonly<Record<string, unknown>>;
|
|
71
|
+
}
|
|
72
|
+
export interface ClaudePluginFixture extends CommonFixture {
|
|
73
|
+
readonly agents?: readonly AgentFixture[];
|
|
74
|
+
/** The `mcpServers` map for `.mcp.json`; absent means no `.mcp.json`. */
|
|
75
|
+
readonly mcpServers?: Readonly<Record<string, unknown>>;
|
|
76
|
+
readonly userConfig?: Readonly<Record<string, unknown>>;
|
|
77
|
+
/** The event map for `hooks/hooks.json`, written as `{"hooks": <map>}`; absent means no file. */
|
|
78
|
+
readonly hooks?: Readonly<Record<string, unknown>>;
|
|
79
|
+
/** The `settings.json` object; absent means no file. */
|
|
80
|
+
readonly settings?: Readonly<Record<string, unknown>>;
|
|
81
|
+
}
|
|
82
|
+
export interface CursorPluginFixture extends CommonFixture {
|
|
83
|
+
readonly agents?: readonly AgentFixture[];
|
|
84
|
+
/** The `mcpServers` map for `mcp.json`, declared as `"mcpServers": "./mcp.json"`. */
|
|
85
|
+
readonly mcpServers?: Readonly<Record<string, unknown>>;
|
|
86
|
+
/** The `variables` JSON Schema: property name -> `{ type, title, description }`. */
|
|
87
|
+
readonly variables?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
88
|
+
readonly required?: readonly string[];
|
|
89
|
+
/** The event map for `hooks/hooks.json`, written as `{"version": 1, "hooks": <map>}` and declared. */
|
|
90
|
+
readonly hooks?: Readonly<Record<string, unknown>>;
|
|
91
|
+
}
|
|
92
|
+
export interface CodexPluginFixture extends CommonFixture {
|
|
93
|
+
/** The `mcpServers` map for `.mcp.json`, declared as `"mcpServers": "./.mcp.json"`. */
|
|
94
|
+
readonly mcpServers?: Readonly<Record<string, unknown>>;
|
|
95
|
+
/** The `apps` map for `.app.json`. */
|
|
96
|
+
readonly apps?: Readonly<Record<string, unknown>>;
|
|
97
|
+
/** The event map for `hooks/hooks.json`, written as `{"hooks": <map>}`; absent means no file. */
|
|
98
|
+
readonly hooks?: Readonly<Record<string, unknown>>;
|
|
99
|
+
}
|
|
100
|
+
/** An Agent Plugins 1.0.0 package. */
|
|
101
|
+
export declare function openPlugin(fixture?: OpenPluginFixture): PluginFixture;
|
|
102
|
+
/** A Claude Code plugin. */
|
|
103
|
+
export declare function claudePlugin(fixture?: ClaudePluginFixture): PluginFixture;
|
|
104
|
+
/** A Cursor plugin, declaring its components the way the published catalogue does. */
|
|
105
|
+
export declare function cursorPlugin(fixture?: CursorPluginFixture): PluginFixture;
|
|
106
|
+
/** The legacy Codex compatibility layout (`.codex-plugin/plugin.json`, `.mcp.json`, `.app.json`). */
|
|
107
|
+
export declare function codexPlugin(fixture?: CodexPluginFixture): PluginFixture;
|
|
108
|
+
/** A copy of `files` with `path` set to `content`. */
|
|
109
|
+
export declare function withFile(files: PluginFixture, path: string, content: string | Uint8Array): PluginFixture;
|
|
110
|
+
/** A copy of `files` without `path`. */
|
|
111
|
+
export declare function withoutFile(files: PluginFixture, path: string): PluginFixture;
|
|
112
|
+
/**
|
|
113
|
+
* A copy of `files` with one top-level field of the JSON document at
|
|
114
|
+
* `manifestPath` set (or removed, when `value` is `undefined`).
|
|
115
|
+
*/
|
|
116
|
+
export declare function withManifestField(files: PluginFixture, manifestPath: string, field: string, value: unknown): PluginFixture;
|
|
117
|
+
/** A `SKILL.md` document from a fixture description. */
|
|
118
|
+
export declare function skillMarkdown(skill: SkillFixture): string;
|
|
119
|
+
/** A sub-agent document from a fixture description. */
|
|
120
|
+
export declare function agentMarkdown(agent: AgentFixture): string;
|
|
121
|
+
/**
|
|
122
|
+
* Eval globs and what `globError` answers for each: `undefined` for a
|
|
123
|
+
* well-formed glob, else its sentence. Shared with the server's matcher
|
|
124
|
+
* test (the module header).
|
|
125
|
+
*/
|
|
126
|
+
export declare const GLOB_VALIDITY_TABLE: ReadonlyArray<readonly [glob: string, error: string | undefined]>;
|
|
127
|
+
//# sourceMappingURL=testing.d.ts.map
|
package/testing.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,uFAAuF;IACvF,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAChE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC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wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,aAAa,CAuBzE;AAED,4BAA4B;AAC5B,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,aAAa,CAiB7E;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,aAAa,CA0B7E;AAED,qGAAqG;AACrG,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,aAAa,CAkB3E;AAED,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,CAIxG;AAED,wCAAwC;AACxC,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAI7E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAQ1H;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CASzD;AAED,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAKzD;AAsBD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,CA8DjG,CAAC"}
|
package/testing.js
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory plugin builders for tests (exported as
|
|
3
|
+
* `@stigmer/plugin-package/testing`).
|
|
4
|
+
*
|
|
5
|
+
* One builder per dialect, each writing the exact file layout that
|
|
6
|
+
* dialect's tools produce: `openPlugin` a root `plugin.json` with the
|
|
7
|
+
* canonical `$schema` and an `mcp.json` beside it; `claudePlugin` a
|
|
8
|
+
* `.claude-plugin/plugin.json` with `.mcp.json`, `hooks/hooks.json` and
|
|
9
|
+
* `settings.json`; `cursorPlugin` a `.cursor-plugin/plugin.json` declaring
|
|
10
|
+
* `./skills/`, `./agents/`, `./mcp.json` and `./hooks/hooks.json` the way
|
|
11
|
+
* every published Cursor plugin does; `codexPlugin` the legacy
|
|
12
|
+
* `.codex-plugin/plugin.json` compatibility layout. A `hooks` option is the
|
|
13
|
+
* event map; each builder wraps it in its format's file shape. The
|
|
14
|
+
* adversarial suite starts from a valid plugin and breaks exactly one
|
|
15
|
+
* thing with the mutators (`withFile`, `withoutFile`,
|
|
16
|
+
* `withManifestField`), so each test reads as "this plugin, minus this",
|
|
17
|
+
* and the consumers' tests (the CLI's, the server's) craft their fixtures
|
|
18
|
+
* from the same source so the shapes never drift apart.
|
|
19
|
+
*
|
|
20
|
+
* Builders return a path -> content map; `inMemoryPluginFiles` turns one
|
|
21
|
+
* into the `PluginFiles` the reader takes. Zipping a fixture for an
|
|
22
|
+
* archive-based consumer is `@stigmer/zip-structure/testing`'s job.
|
|
23
|
+
*
|
|
24
|
+
* `GLOB_VALIDITY_TABLE` is the one table of eval globs, well formed or not
|
|
25
|
+
* with the sentence `globError` answers, that this library's test and the
|
|
26
|
+
* server's matcher test both read, so the two readers of the grammar
|
|
27
|
+
* cannot drift apart.
|
|
28
|
+
*/
|
|
29
|
+
import { stringify as stringifyYaml } from "yaml";
|
|
30
|
+
import { inMemoryPluginFiles } from "./files.js";
|
|
31
|
+
import { AGENT_PLUGINS_MANIFEST_SCHEMA, AGENT_PLUGINS_MCP_SCHEMA, MANIFEST_LOCATIONS } from "./messages.js";
|
|
32
|
+
export { inMemoryPluginFiles };
|
|
33
|
+
const DEFAULT_NAME = "example";
|
|
34
|
+
/** An Agent Plugins 1.0.0 package. */
|
|
35
|
+
export function openPlugin(fixture = {}) {
|
|
36
|
+
const files = new Map();
|
|
37
|
+
const manifest = {
|
|
38
|
+
...(fixture.schema !== null && { $schema: fixture.schema ?? AGENT_PLUGINS_MANIFEST_SCHEMA }),
|
|
39
|
+
name: fixture.name ?? DEFAULT_NAME,
|
|
40
|
+
...(fixture.version !== undefined && { version: fixture.version }),
|
|
41
|
+
...(fixture.description !== undefined && { description: fixture.description }),
|
|
42
|
+
...fixture.manifest,
|
|
43
|
+
};
|
|
44
|
+
files.set(MANIFEST_LOCATIONS["agent-plugins"], json(manifest));
|
|
45
|
+
if (fixture.mcpServers !== undefined) {
|
|
46
|
+
files.set("mcp.json", json({
|
|
47
|
+
...(fixture.mcpSchema !== null && { $schema: fixture.mcpSchema ?? AGENT_PLUGINS_MCP_SCHEMA }),
|
|
48
|
+
mcpServers: fixture.mcpServers,
|
|
49
|
+
...fixture.mcpConfig,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
writeSkills(files, "skills", fixture.skills);
|
|
53
|
+
writeExtra(files, fixture.files);
|
|
54
|
+
return files;
|
|
55
|
+
}
|
|
56
|
+
/** A Claude Code plugin. */
|
|
57
|
+
export function claudePlugin(fixture = {}) {
|
|
58
|
+
const files = new Map();
|
|
59
|
+
const manifest = {
|
|
60
|
+
name: fixture.name ?? DEFAULT_NAME,
|
|
61
|
+
...(fixture.version !== undefined && { version: fixture.version }),
|
|
62
|
+
...(fixture.description !== undefined && { description: fixture.description }),
|
|
63
|
+
...(fixture.userConfig !== undefined && { userConfig: fixture.userConfig }),
|
|
64
|
+
...fixture.manifest,
|
|
65
|
+
};
|
|
66
|
+
files.set(MANIFEST_LOCATIONS.claude, json(manifest));
|
|
67
|
+
if (fixture.mcpServers !== undefined)
|
|
68
|
+
files.set(".mcp.json", json({ mcpServers: fixture.mcpServers }));
|
|
69
|
+
if (fixture.hooks !== undefined)
|
|
70
|
+
files.set("hooks/hooks.json", json({ hooks: fixture.hooks }));
|
|
71
|
+
if (fixture.settings !== undefined)
|
|
72
|
+
files.set("settings.json", json(fixture.settings));
|
|
73
|
+
writeSkills(files, "skills", fixture.skills);
|
|
74
|
+
writeAgents(files, "agents", fixture.agents);
|
|
75
|
+
writeExtra(files, fixture.files);
|
|
76
|
+
return files;
|
|
77
|
+
}
|
|
78
|
+
/** A Cursor plugin, declaring its components the way the published catalogue does. */
|
|
79
|
+
export function cursorPlugin(fixture = {}) {
|
|
80
|
+
const files = new Map();
|
|
81
|
+
const manifest = {
|
|
82
|
+
name: fixture.name ?? DEFAULT_NAME,
|
|
83
|
+
...(fixture.version !== undefined && { version: fixture.version }),
|
|
84
|
+
...(fixture.description !== undefined && { description: fixture.description }),
|
|
85
|
+
...(fixture.skills !== undefined && { skills: "./skills/" }),
|
|
86
|
+
...(fixture.agents !== undefined && { agents: "./agents/" }),
|
|
87
|
+
...(fixture.variables !== undefined && {
|
|
88
|
+
variables: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: fixture.variables,
|
|
91
|
+
...(fixture.required !== undefined && { required: fixture.required }),
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
...(fixture.mcpServers !== undefined && { mcpServers: "./mcp.json" }),
|
|
95
|
+
...(fixture.hooks !== undefined && { hooks: "./hooks/hooks.json" }),
|
|
96
|
+
...fixture.manifest,
|
|
97
|
+
};
|
|
98
|
+
files.set(MANIFEST_LOCATIONS.cursor, json(manifest));
|
|
99
|
+
if (fixture.mcpServers !== undefined)
|
|
100
|
+
files.set("mcp.json", json({ mcpServers: fixture.mcpServers }));
|
|
101
|
+
if (fixture.hooks !== undefined)
|
|
102
|
+
files.set("hooks/hooks.json", json({ version: 1, hooks: fixture.hooks }));
|
|
103
|
+
writeSkills(files, "skills", fixture.skills);
|
|
104
|
+
writeAgents(files, "agents", fixture.agents);
|
|
105
|
+
writeExtra(files, fixture.files);
|
|
106
|
+
return files;
|
|
107
|
+
}
|
|
108
|
+
/** The legacy Codex compatibility layout (`.codex-plugin/plugin.json`, `.mcp.json`, `.app.json`). */
|
|
109
|
+
export function codexPlugin(fixture = {}) {
|
|
110
|
+
const files = new Map();
|
|
111
|
+
const manifest = {
|
|
112
|
+
name: fixture.name ?? DEFAULT_NAME,
|
|
113
|
+
...(fixture.version !== undefined && { version: fixture.version }),
|
|
114
|
+
...(fixture.description !== undefined && { description: fixture.description }),
|
|
115
|
+
...(fixture.skills !== undefined && { skills: "./skills/" }),
|
|
116
|
+
...(fixture.mcpServers !== undefined && { mcpServers: "./.mcp.json" }),
|
|
117
|
+
...(fixture.apps !== undefined && { apps: "./.app.json" }),
|
|
118
|
+
...fixture.manifest,
|
|
119
|
+
};
|
|
120
|
+
files.set(MANIFEST_LOCATIONS.codex, json(manifest));
|
|
121
|
+
if (fixture.mcpServers !== undefined)
|
|
122
|
+
files.set(".mcp.json", json({ mcpServers: fixture.mcpServers }));
|
|
123
|
+
if (fixture.apps !== undefined)
|
|
124
|
+
files.set(".app.json", json({ apps: fixture.apps }));
|
|
125
|
+
if (fixture.hooks !== undefined)
|
|
126
|
+
files.set("hooks/hooks.json", json({ hooks: fixture.hooks }));
|
|
127
|
+
writeSkills(files, "skills", fixture.skills);
|
|
128
|
+
writeExtra(files, fixture.files);
|
|
129
|
+
return files;
|
|
130
|
+
}
|
|
131
|
+
/** A copy of `files` with `path` set to `content`. */
|
|
132
|
+
export function withFile(files, path, content) {
|
|
133
|
+
const copy = new Map(files);
|
|
134
|
+
copy.set(path, content);
|
|
135
|
+
return copy;
|
|
136
|
+
}
|
|
137
|
+
/** A copy of `files` without `path`. */
|
|
138
|
+
export function withoutFile(files, path) {
|
|
139
|
+
const copy = new Map(files);
|
|
140
|
+
copy.delete(path);
|
|
141
|
+
return copy;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A copy of `files` with one top-level field of the JSON document at
|
|
145
|
+
* `manifestPath` set (or removed, when `value` is `undefined`).
|
|
146
|
+
*/
|
|
147
|
+
export function withManifestField(files, manifestPath, field, value) {
|
|
148
|
+
const current = files.get(manifestPath);
|
|
149
|
+
if (current === undefined)
|
|
150
|
+
throw new Error(`fixture has no document at '${manifestPath}'`);
|
|
151
|
+
const text = typeof current === "string" ? current : new TextDecoder().decode(current);
|
|
152
|
+
const document = JSON.parse(text);
|
|
153
|
+
if (value === undefined)
|
|
154
|
+
delete document[field];
|
|
155
|
+
else
|
|
156
|
+
document[field] = value;
|
|
157
|
+
return withFile(files, manifestPath, json(document));
|
|
158
|
+
}
|
|
159
|
+
/** A `SKILL.md` document from a fixture description. */
|
|
160
|
+
export function skillMarkdown(skill) {
|
|
161
|
+
const body = skill.body ?? `# ${skill.name}\n\nInstructions for the ${skill.name} skill.\n`;
|
|
162
|
+
if (skill.frontmatter === null)
|
|
163
|
+
return body;
|
|
164
|
+
const frontmatter = {
|
|
165
|
+
name: skill.name,
|
|
166
|
+
...(skill.description !== undefined && { description: skill.description }),
|
|
167
|
+
...skill.frontmatter,
|
|
168
|
+
};
|
|
169
|
+
return `---\n${stringifyYaml(frontmatter)}---\n${body}`;
|
|
170
|
+
}
|
|
171
|
+
/** A sub-agent document from a fixture description. */
|
|
172
|
+
export function agentMarkdown(agent) {
|
|
173
|
+
const body = agent.body ?? `You are the ${agent.file} subagent. Do the task thoroughly and report back.\n`;
|
|
174
|
+
if (agent.frontmatter === null)
|
|
175
|
+
return body;
|
|
176
|
+
const frontmatter = { name: agent.file, ...agent.frontmatter };
|
|
177
|
+
return `---\n${stringifyYaml(frontmatter)}---\n${body}`;
|
|
178
|
+
}
|
|
179
|
+
function writeSkills(files, root, skills) {
|
|
180
|
+
for (const skill of skills ?? []) {
|
|
181
|
+
const dir = `${root}/${skill.dir ?? skill.name}`;
|
|
182
|
+
files.set(`${dir}/SKILL.md`, skillMarkdown(skill));
|
|
183
|
+
for (const [path, content] of Object.entries(skill.files ?? {}))
|
|
184
|
+
files.set(`${dir}/${path}`, content);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function writeAgents(files, root, agents) {
|
|
188
|
+
for (const agent of agents ?? [])
|
|
189
|
+
files.set(`${root}/${agent.file}.md`, agentMarkdown(agent));
|
|
190
|
+
}
|
|
191
|
+
function writeExtra(files, extra) {
|
|
192
|
+
for (const [path, content] of Object.entries(extra ?? {}))
|
|
193
|
+
files.set(path, content);
|
|
194
|
+
}
|
|
195
|
+
function json(value) {
|
|
196
|
+
return `${JSON.stringify(value, null, 2)}\n`;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Eval globs and what `globError` answers for each: `undefined` for a
|
|
200
|
+
* well-formed glob, else its sentence. Shared with the server's matcher
|
|
201
|
+
* test (the module header).
|
|
202
|
+
*/
|
|
203
|
+
export const GLOB_VALIDITY_TABLE = [
|
|
204
|
+
["", undefined],
|
|
205
|
+
["review-*", undefined],
|
|
206
|
+
["src/**/x.ts", undefined],
|
|
207
|
+
["src/**", undefined],
|
|
208
|
+
["case-?", undefined],
|
|
209
|
+
["case-[0-9]", undefined],
|
|
210
|
+
["case-[!0-9]", undefined],
|
|
211
|
+
["case-[^a-c]", undefined],
|
|
212
|
+
["[]]x", undefined],
|
|
213
|
+
["[!]]x", undefined],
|
|
214
|
+
["[a-]", undefined],
|
|
215
|
+
["[-z]", undefined],
|
|
216
|
+
["{alpha,beta}-*", undefined],
|
|
217
|
+
["{a,{b,c}}", undefined],
|
|
218
|
+
["{,a}", undefined],
|
|
219
|
+
["{}", undefined],
|
|
220
|
+
["[{]", undefined],
|
|
221
|
+
["fix}", undefined],
|
|
222
|
+
["a,b", undefined],
|
|
223
|
+
["(x).+|^$\\", undefined],
|
|
224
|
+
["{a,b}{a,b}{a,b}{a,b}{a,b}{a,b}", undefined],
|
|
225
|
+
["{a,b}{a,b}{a,b}{a,b}{a,b}{a,b}{a,b}", "it expands to more than 64 alternatives"],
|
|
226
|
+
["{a,b,c,d,e,f,g,h}{a,b,c,d,e,f,g,h}{a,b}", "it expands to more than 64 alternatives"],
|
|
227
|
+
["[z-a].txt", "range 'z-a' is reversed"],
|
|
228
|
+
["x[9-0]", "range '9-0' is reversed"],
|
|
229
|
+
["case-[", "'[' at 5 is never closed"],
|
|
230
|
+
["case-[1", "'[' at 5 is never closed"],
|
|
231
|
+
["[]", "'[' at 0 is never closed"],
|
|
232
|
+
["{a,b", "'{' at 0 is never closed"],
|
|
233
|
+
["x{a,{b}", "'{' at 1 is never closed"],
|
|
234
|
+
["{[}]", "'{' at 0 is never closed"],
|
|
235
|
+
["{".repeat(17) + "}".repeat(17), "braces are nested more than 16 deep"],
|
|
236
|
+
["{".repeat(16) + "}".repeat(16), undefined],
|
|
237
|
+
["{a,b}[z-a]", "range 'z-a' is reversed"],
|
|
238
|
+
["a".repeat(1024), undefined],
|
|
239
|
+
["a".repeat(1025), "it is longer than 1024 characters"],
|
|
240
|
+
["é".repeat(1024), undefined],
|
|
241
|
+
["😀".repeat(1024), undefined],
|
|
242
|
+
["😀".repeat(1025), "it is longer than 1024 characters"],
|
|
243
|
+
["[z-a]" + "a".repeat(1020), "it is longer than 1024 characters"],
|
|
244
|
+
["{a,b}".repeat(6) + "a".repeat(58), undefined],
|
|
245
|
+
["{a,b}".repeat(6) + "a".repeat(59), "it expands to more than 4096 tokens"],
|
|
246
|
+
["{a,b}".repeat(6) + "**/".repeat(29), undefined],
|
|
247
|
+
["{a,b}".repeat(6) + "**/".repeat(30), "it expands to more than 4096 tokens"],
|
|
248
|
+
["{a,b}".repeat(6) + "*".repeat(900), undefined],
|
|
249
|
+
["{a,b}".repeat(6) + "[a-z]".repeat(58), undefined],
|
|
250
|
+
["{a,b}".repeat(6) + "[a-z]".repeat(59), "it expands to more than 4096 tokens"],
|
|
251
|
+
["{" + "a".repeat(400) + "," + "b".repeat(400) + "}{x,y,z,w,v}", undefined],
|
|
252
|
+
["{" + "a".repeat(500) + "," + "b".repeat(500) + "}{x,y,z,w,v}", "it expands to more than 4096 tokens"],
|
|
253
|
+
["{a,b}".repeat(7) + "a".repeat(100), "it expands to more than 64 alternatives"],
|
|
254
|
+
["{a,b}".repeat(6) + "a".repeat(59) + "[", "'[' at 89 is never closed"],
|
|
255
|
+
// A class costs its ranges per character, so its size is capped and
|
|
256
|
+
// counted: 64 alternatives around an 829-character class is refused.
|
|
257
|
+
["{" + Array(64).fill("**").join(",") + "}[" + "a-z".repeat(275) + "ab]", "'[' at 193 holds more than 32 ranges or characters"],
|
|
258
|
+
["[" + "a-c".repeat(32) + "]", undefined],
|
|
259
|
+
["[" + "a-c".repeat(33) + "]", "'[' at 0 holds more than 32 ranges or characters"],
|
|
260
|
+
["x[!" + "a".repeat(32) + "]", undefined],
|
|
261
|
+
["x[!" + "a".repeat(33) + "]", "'[' at 1 holds more than 32 ranges or characters"],
|
|
262
|
+
["[" + "a".repeat(33), "'[' at 0 holds more than 32 ranges or characters"],
|
|
263
|
+
["{a,b}".repeat(6) + "[" + "a-z".repeat(32) + "]" + "a".repeat(26), undefined],
|
|
264
|
+
["{a,b}".repeat(6) + "[" + "a-z".repeat(32) + "]" + "a".repeat(27), "it expands to more than 4096 tokens"],
|
|
265
|
+
];
|
|
266
|
+
//# sourceMappingURL=testing.js.map
|
package/testing.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE5G,OAAO,EAAE,mBAAmB,EAAE,CAAC;AA+E/B,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,sCAAsC;AACtC,MAAM,UAAU,UAAU,CAAC,UAA6B,EAAE;IACxD,MAAM,KAAK,GAAkB,IAAI,GAAG,EAAE,CAAC;IACvC,MAAM,QAAQ,GAA4B;QACxC,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,IAAI,EAAE,OAAO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AE,CAAC,GAAG,GAAG,EAAE,kDAAkD,CAAC;IAClF,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,kDAAkD,CAAC;IAC1E,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC;IAC9E,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,qCAAqC,CAAC;CAC3G,CAAC"}
|
package/tool-names.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The name a plugin's MCP server gives its tools, as Claude Code builds it:
|
|
3
|
+
* `mcp__plugin_<plugin>_<server>__<tool>`, with every character outside
|
|
4
|
+
* `A-Za-z0-9_-` in either name written as `_`. The server segment is built
|
|
5
|
+
* from the two names, never parsed back, because either name may hold `_`.
|
|
6
|
+
* The installer refuses a plugin whose segment would hold `__` or end in
|
|
7
|
+
* `_`, and the runner names each plugin server by this segment (its own
|
|
8
|
+
* copy, `shared/plugin-servers.ts`, held equal by a runner test), so an
|
|
9
|
+
* agent's tool list written for Claude Code scopes the same tools here.
|
|
10
|
+
*/
|
|
11
|
+
/** `plugin_<plugin>_<server>`: the server part of a plugin tool's name. */
|
|
12
|
+
export declare function toolServerSegment(pluginName: string, serverName: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether `name` can stand as a server segment of a tool name as it is:
|
|
15
|
+
* only `A-Za-z0-9_-`, with no `__` (the separator between a tool name's
|
|
16
|
+
* parts) and no trailing `_` (which would run into it). A pushed eval's
|
|
17
|
+
* mock directory names an agent's MCP server this way, so a name that
|
|
18
|
+
* fails could never match one.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isToolNameSegment(name: string): boolean;
|
|
21
|
+
//# sourceMappingURL=tool-names.d.ts.map
|