@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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The marketplace entry: a `PluginFiles` over a marketplace tree in, a
|
|
3
|
+
* `MarketplaceReadOutcome` out.
|
|
4
|
+
*
|
|
5
|
+
* The read is a fixed sequence, like the plugin read: locate the marketplace
|
|
6
|
+
* file (first present in the dialect precedence, and only that one is read;
|
|
7
|
+
* a tree that carries two dialects' files describes one catalogue twice);
|
|
8
|
+
* parse it under the marketplace cap; read the dialect's shape into the one
|
|
9
|
+
* normalised shape; validate names and sources; drop the entries the tree
|
|
10
|
+
* cannot install, each with its own warning. Findings are collected and the
|
|
11
|
+
* read continues, so the outcome names every problem at once, and the
|
|
12
|
+
* marketplace is returned only when nothing refused.
|
|
13
|
+
*
|
|
14
|
+
* A catalogue installs nothing by itself: a field a dialect uses to name
|
|
15
|
+
* entries a client installs unasked (Codex's `INSTALLED_BY_DEFAULT` policy,
|
|
16
|
+
* or a `defaults` list) is not read, so a file that still carries one reads
|
|
17
|
+
* the same as a file without it.
|
|
18
|
+
*
|
|
19
|
+
* Sources. Every dialect names a plugin's directory relative to the
|
|
20
|
+
* marketplace root (Claude and Codex with a `./` prefix, Cursor without,
|
|
21
|
+
* Claude optionally under `metadata.pluginRoot`); the reader accepts both
|
|
22
|
+
* spellings and refuses a path that escapes the root. A source that is not
|
|
23
|
+
* such a directory (Claude's `github`, `url`, `npm` and `git-subdir` objects,
|
|
24
|
+
* Codex's non-`local` sources, Cursor's remote URLs) is a form this reader
|
|
25
|
+
* does not fetch: the entry is dropped with `entry-source-unsupported`, and
|
|
26
|
+
* nothing is invented in its place.
|
|
27
|
+
*
|
|
28
|
+
* This reader does not open the plugins it lists. A consumer that wants an
|
|
29
|
+
* entry's own description or version reads that directory with
|
|
30
|
+
* `readPluginPackage`; a consumer that wants to install it hands the same
|
|
31
|
+
* directory to the walker it already uses. Keeping the two reads apart is
|
|
32
|
+
* what lets a catalogue of eighty entries be listed without eighty reads.
|
|
33
|
+
*
|
|
34
|
+
* `readMarketplaceFile` is the same read without the tree: what the file
|
|
35
|
+
* declares, for a client that holds the file alone and asks only "does this
|
|
36
|
+
* source offer a plugin called X" before it pays for the tree (the CLI's
|
|
37
|
+
* bare-name search across GitHub sources fetches one small file per source
|
|
38
|
+
* instead of a zipball each). Whether the tree holds an entry is still
|
|
39
|
+
* `readMarketplace`'s to say, on the tree, before anything is installed.
|
|
40
|
+
*/
|
|
41
|
+
import { type PluginFiles } from "../files.js";
|
|
42
|
+
import type { MarketplaceReadOutcome } from "./outcome.js";
|
|
43
|
+
/** True when the tree holds any of the four marketplace files; the CLI's routing test. */
|
|
44
|
+
export declare function hasMarketplaceFile(paths: Iterable<string>): boolean;
|
|
45
|
+
export declare function readMarketplace(files: PluginFiles): MarketplaceReadOutcome;
|
|
46
|
+
/**
|
|
47
|
+
* The marketplace file as declared, the tree unverified: every entry with a
|
|
48
|
+
* readable source is offered, whether or not `files` holds its directory.
|
|
49
|
+
* For a client that has fetched the file alone; never for an install.
|
|
50
|
+
*/
|
|
51
|
+
export declare function readMarketplaceFile(files: PluginFiles): MarketplaceReadOutcome;
|
|
52
|
+
//# sourceMappingURL=read-marketplace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-marketplace.d.ts","sourceRoot":"","sources":["../src/marketplace/read-marketplace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAIH,OAAO,EAAwE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAErH,OAAO,KAAK,EAAuE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAKhI,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAInE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,sBAAsB,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,sBAAsB,CAE9E"}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The marketplace entry: a `PluginFiles` over a marketplace tree in, a
|
|
3
|
+
* `MarketplaceReadOutcome` out.
|
|
4
|
+
*
|
|
5
|
+
* The read is a fixed sequence, like the plugin read: locate the marketplace
|
|
6
|
+
* file (first present in the dialect precedence, and only that one is read;
|
|
7
|
+
* a tree that carries two dialects' files describes one catalogue twice);
|
|
8
|
+
* parse it under the marketplace cap; read the dialect's shape into the one
|
|
9
|
+
* normalised shape; validate names and sources; drop the entries the tree
|
|
10
|
+
* cannot install, each with its own warning. Findings are collected and the
|
|
11
|
+
* read continues, so the outcome names every problem at once, and the
|
|
12
|
+
* marketplace is returned only when nothing refused.
|
|
13
|
+
*
|
|
14
|
+
* A catalogue installs nothing by itself: a field a dialect uses to name
|
|
15
|
+
* entries a client installs unasked (Codex's `INSTALLED_BY_DEFAULT` policy,
|
|
16
|
+
* or a `defaults` list) is not read, so a file that still carries one reads
|
|
17
|
+
* the same as a file without it.
|
|
18
|
+
*
|
|
19
|
+
* Sources. Every dialect names a plugin's directory relative to the
|
|
20
|
+
* marketplace root (Claude and Codex with a `./` prefix, Cursor without,
|
|
21
|
+
* Claude optionally under `metadata.pluginRoot`); the reader accepts both
|
|
22
|
+
* spellings and refuses a path that escapes the root. A source that is not
|
|
23
|
+
* such a directory (Claude's `github`, `url`, `npm` and `git-subdir` objects,
|
|
24
|
+
* Codex's non-`local` sources, Cursor's remote URLs) is a form this reader
|
|
25
|
+
* does not fetch: the entry is dropped with `entry-source-unsupported`, and
|
|
26
|
+
* nothing is invented in its place.
|
|
27
|
+
*
|
|
28
|
+
* This reader does not open the plugins it lists. A consumer that wants an
|
|
29
|
+
* entry's own description or version reads that directory with
|
|
30
|
+
* `readPluginPackage`; a consumer that wants to install it hands the same
|
|
31
|
+
* directory to the walker it already uses. Keeping the two reads apart is
|
|
32
|
+
* what lets a catalogue of eighty entries be listed without eighty reads.
|
|
33
|
+
*
|
|
34
|
+
* `readMarketplaceFile` is the same read without the tree: what the file
|
|
35
|
+
* declares, for a client that holds the file alone and asks only "does this
|
|
36
|
+
* source offer a plugin called X" before it pays for the tree (the CLI's
|
|
37
|
+
* bare-name search across GitHub sources fetches one small file per source
|
|
38
|
+
* instead of a zipball each). Whether the tree holds an entry is still
|
|
39
|
+
* `readMarketplace`'s to say, on the tree, before anything is installed.
|
|
40
|
+
*/
|
|
41
|
+
import { hasPluginManifest, isValidPluginName } from "../detect.js";
|
|
42
|
+
import { describeValue, isJsonObject } from "../documents.js";
|
|
43
|
+
import { decodeUtf8, isContainedPath, PLUGIN_DOCUMENT_LIMITS, PluginFileIndex } from "../files.js";
|
|
44
|
+
import { MARKETPLACE_LOCATIONS, MarketplaceFindings } from "./messages.js";
|
|
45
|
+
/** The precedence the reader applies when a tree carries more than one marketplace file. */
|
|
46
|
+
const DIALECT_PRECEDENCE = ["stigmer", "claude", "cursor", "codex"];
|
|
47
|
+
/** True when the tree holds any of the four marketplace files; the CLI's routing test. */
|
|
48
|
+
export function hasMarketplaceFile(paths) {
|
|
49
|
+
const locations = new Set(Object.values(MARKETPLACE_LOCATIONS));
|
|
50
|
+
for (const path of paths)
|
|
51
|
+
if (locations.has(path))
|
|
52
|
+
return true;
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
export function readMarketplace(files) {
|
|
56
|
+
return read(files, "tree");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The marketplace file as declared, the tree unverified: every entry with a
|
|
60
|
+
* readable source is offered, whether or not `files` holds its directory.
|
|
61
|
+
* For a client that has fetched the file alone; never for an install.
|
|
62
|
+
*/
|
|
63
|
+
export function readMarketplaceFile(files) {
|
|
64
|
+
return read(files, "file");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* `tree`: entries whose directory the tree lacks, or holds without a plugin
|
|
68
|
+
* manifest, are dropped with their warning. `file`: entries are taken as the
|
|
69
|
+
* file declares them, and the tree is not consulted.
|
|
70
|
+
*/
|
|
71
|
+
function read(files, verify) {
|
|
72
|
+
const findings = new MarketplaceFindings();
|
|
73
|
+
const index = new PluginFileIndex(files);
|
|
74
|
+
const located = locate(index);
|
|
75
|
+
if (located === undefined) {
|
|
76
|
+
findings.error("marketplace-not-found");
|
|
77
|
+
return refused(findings);
|
|
78
|
+
}
|
|
79
|
+
const { dialect, path } = located;
|
|
80
|
+
const object = readObject(index, path, findings);
|
|
81
|
+
if (object === undefined)
|
|
82
|
+
return refused(findings);
|
|
83
|
+
const name = readName(object, path, findings);
|
|
84
|
+
const raw = readEntries(object, dialect, path, findings);
|
|
85
|
+
const entries = verify === "tree" ? offeredEntries(raw, index, path, findings) : declaredEntries(raw);
|
|
86
|
+
if (findings.errors.length > 0 || name === undefined)
|
|
87
|
+
return refused(findings);
|
|
88
|
+
const description = readDescription(object, dialect);
|
|
89
|
+
const owner = readOwner(object);
|
|
90
|
+
const marketplace = {
|
|
91
|
+
name,
|
|
92
|
+
...(description !== undefined && { description }),
|
|
93
|
+
...(owner !== undefined && { owner }),
|
|
94
|
+
dialect,
|
|
95
|
+
path,
|
|
96
|
+
plugins: entries,
|
|
97
|
+
};
|
|
98
|
+
return { ok: true, marketplace, warnings: findings.warnings };
|
|
99
|
+
}
|
|
100
|
+
function refused(findings) {
|
|
101
|
+
return { ok: false, errors: findings.errors, warnings: findings.warnings };
|
|
102
|
+
}
|
|
103
|
+
function locate(index) {
|
|
104
|
+
for (const dialect of DIALECT_PRECEDENCE) {
|
|
105
|
+
const path = MARKETPLACE_LOCATIONS[dialect];
|
|
106
|
+
if (index.has(path))
|
|
107
|
+
return { dialect, path };
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
function readObject(index, path, findings) {
|
|
112
|
+
const limit = PLUGIN_DOCUMENT_LIMITS.marketplace;
|
|
113
|
+
const entry = index.entry(path);
|
|
114
|
+
if (entry === undefined) {
|
|
115
|
+
throw new Error(`marketplace file '${path}' is not listed`);
|
|
116
|
+
}
|
|
117
|
+
if (entry.size > limit) {
|
|
118
|
+
findings.error("marketplace-too-large", { path, subject: String(entry.size), detail: String(limit) });
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
const bytes = index.files.read(path);
|
|
122
|
+
if (bytes.length > limit) {
|
|
123
|
+
findings.error("marketplace-too-large", { path, subject: String(bytes.length), detail: String(limit) });
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
let value;
|
|
127
|
+
try {
|
|
128
|
+
value = JSON.parse(decodeUtf8(bytes));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
findings.error("marketplace-unreadable", { path, detail: error instanceof Error ? error.message : String(error) });
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
if (!isJsonObject(value)) {
|
|
135
|
+
findings.error("marketplace-unreadable", { path, detail: "the document is not a JSON object" });
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
/** The marketplace's own name, validated under the plugin name rule (the same characters an install ref can carry). */
|
|
141
|
+
function readName(object, path, findings) {
|
|
142
|
+
const value = object["name"];
|
|
143
|
+
if (value === undefined) {
|
|
144
|
+
findings.error("marketplace-name-missing", { path });
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
if (typeof value !== "string") {
|
|
148
|
+
findings.error("marketplace-field-type", { path, subject: "name", detail: "a string" });
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
if (!isValidPluginName(value)) {
|
|
152
|
+
findings.error("marketplace-name-invalid", { path, subject: value });
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
return value;
|
|
156
|
+
}
|
|
157
|
+
function readDescription(object, dialect) {
|
|
158
|
+
switch (dialect) {
|
|
159
|
+
case "stigmer":
|
|
160
|
+
return optionalStringOf(object, "description");
|
|
161
|
+
case "claude":
|
|
162
|
+
case "cursor": {
|
|
163
|
+
const metadata = object["metadata"];
|
|
164
|
+
return isJsonObject(metadata) ? optionalStringOf(metadata, "description") : undefined;
|
|
165
|
+
}
|
|
166
|
+
case "codex":
|
|
167
|
+
// Codex's `interface.displayName` is a label for a picker, not a description.
|
|
168
|
+
return undefined;
|
|
169
|
+
default: {
|
|
170
|
+
const exhaustive = dialect;
|
|
171
|
+
return exhaustive;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function readOwner(object) {
|
|
176
|
+
const value = object["owner"];
|
|
177
|
+
if (!isJsonObject(value))
|
|
178
|
+
return undefined;
|
|
179
|
+
const name = optionalStringOf(value, "name");
|
|
180
|
+
const email = optionalStringOf(value, "email");
|
|
181
|
+
const url = optionalStringOf(value, "url");
|
|
182
|
+
if (name === undefined && email === undefined && url === undefined)
|
|
183
|
+
return undefined;
|
|
184
|
+
return {
|
|
185
|
+
...(name !== undefined && { name }),
|
|
186
|
+
...(email !== undefined && { email }),
|
|
187
|
+
...(url !== undefined && { url }),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/** A string field or `undefined`; a field of another type is treated as absent (metadata never refuses a catalogue). */
|
|
191
|
+
function optionalStringOf(object, field) {
|
|
192
|
+
const value = object[field];
|
|
193
|
+
return typeof value === "string" ? value : undefined;
|
|
194
|
+
}
|
|
195
|
+
function readEntries(object, dialect, path, findings) {
|
|
196
|
+
const list = object["plugins"];
|
|
197
|
+
if (list === undefined) {
|
|
198
|
+
findings.error("marketplace-plugins-missing", { path });
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
if (!Array.isArray(list)) {
|
|
202
|
+
findings.error("marketplace-field-type", { path, subject: "plugins", detail: "an array" });
|
|
203
|
+
return [];
|
|
204
|
+
}
|
|
205
|
+
const pluginRoot = dialect === "claude" ? claudePluginRoot(object) : "";
|
|
206
|
+
const entries = [];
|
|
207
|
+
const seen = new Set();
|
|
208
|
+
list.forEach((item, position) => {
|
|
209
|
+
if (!isJsonObject(item)) {
|
|
210
|
+
findings.error("entry-shape", { path, subject: String(position) });
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const name = item["name"];
|
|
214
|
+
if (name === undefined) {
|
|
215
|
+
findings.error("entry-name-missing", { path, subject: String(position) });
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (typeof name !== "string" || !isValidPluginName(name)) {
|
|
219
|
+
findings.error("entry-name-invalid", { path, subject: describeValue(name) });
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (seen.has(name)) {
|
|
223
|
+
findings.error("entry-name-duplicate", { path, subject: name });
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
seen.add(name);
|
|
227
|
+
const description = optionalStringOf(item, "description");
|
|
228
|
+
entries.push({
|
|
229
|
+
name,
|
|
230
|
+
dir: resolveSource(item["source"], name, pluginRoot, path, findings),
|
|
231
|
+
...(description !== undefined && { description }),
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
return entries;
|
|
235
|
+
}
|
|
236
|
+
/** Claude's `metadata.pluginRoot`, prepended to every relative source; the empty string when absent or unusable. */
|
|
237
|
+
function claudePluginRoot(object) {
|
|
238
|
+
const metadata = object["metadata"];
|
|
239
|
+
if (!isJsonObject(metadata))
|
|
240
|
+
return "";
|
|
241
|
+
const root = optionalStringOf(metadata, "pluginRoot");
|
|
242
|
+
if (root === undefined)
|
|
243
|
+
return "";
|
|
244
|
+
const resolved = relativeDirectory(root);
|
|
245
|
+
return resolved.ok ? resolved.dir : "";
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* A source becomes a marketplace-relative directory or nothing. A string is
|
|
249
|
+
* a relative directory (with or without `./`) unless it is a URL; Codex's
|
|
250
|
+
* `{source: "local", path}` object is the same directory; every other
|
|
251
|
+
* object form is a remote this reader does not fetch.
|
|
252
|
+
*/
|
|
253
|
+
function resolveSource(source, entryName, pluginRoot, path, findings) {
|
|
254
|
+
if (source === undefined) {
|
|
255
|
+
findings.error("entry-source-missing", { path, subject: entryName });
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
let candidate;
|
|
259
|
+
if (typeof source === "string") {
|
|
260
|
+
if (isUrl(source)) {
|
|
261
|
+
findings.warn("entry-source-unsupported", { path, subject: entryName, detail: source });
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
candidate = source;
|
|
265
|
+
}
|
|
266
|
+
else if (isJsonObject(source) && source["source"] === "local" && typeof source["path"] === "string") {
|
|
267
|
+
candidate = source["path"];
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
findings.warn("entry-source-unsupported", { path, subject: entryName, detail: describeSource(source) });
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
const resolved = relativeDirectory(candidate);
|
|
274
|
+
if (!resolved.ok) {
|
|
275
|
+
findings.error("entry-source-escapes-root", { path, subject: entryName, detail: candidate });
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
return joinDirectories(pluginRoot, resolved.dir);
|
|
279
|
+
}
|
|
280
|
+
/** The `source` discriminator of a remote object, or the whole value, for the sentence. */
|
|
281
|
+
function describeSource(source) {
|
|
282
|
+
if (isJsonObject(source) && typeof source["source"] === "string")
|
|
283
|
+
return source["source"];
|
|
284
|
+
return describeValue(source);
|
|
285
|
+
}
|
|
286
|
+
function isUrl(value) {
|
|
287
|
+
return /^[a-z][a-z0-9+.-]*:\/\//i.test(value);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* `./thermos`, `thermos`, `third_party/github/`, `.` and `./` all name a
|
|
291
|
+
* directory inside the root (the root itself is the empty string); an
|
|
292
|
+
* absolute path, a backslash, or a `..` segment does not.
|
|
293
|
+
*/
|
|
294
|
+
function relativeDirectory(value) {
|
|
295
|
+
let trimmed = value;
|
|
296
|
+
if (trimmed === "." || trimmed === "./")
|
|
297
|
+
return { ok: true, dir: "" };
|
|
298
|
+
if (trimmed.startsWith("./"))
|
|
299
|
+
trimmed = trimmed.slice(2);
|
|
300
|
+
trimmed = trimmed.replace(/\/+$/, "");
|
|
301
|
+
if (trimmed === "")
|
|
302
|
+
return { ok: true, dir: "" };
|
|
303
|
+
return isContainedPath(trimmed) ? { ok: true, dir: trimmed } : { ok: false };
|
|
304
|
+
}
|
|
305
|
+
function joinDirectories(root, dir) {
|
|
306
|
+
if (root === "")
|
|
307
|
+
return dir;
|
|
308
|
+
return dir === "" ? root : `${root}/${dir}`;
|
|
309
|
+
}
|
|
310
|
+
/** The entries the tree can install: a directory that exists and holds a plugin manifest at its root. */
|
|
311
|
+
function offeredEntries(raw, index, path, findings) {
|
|
312
|
+
const offered = [];
|
|
313
|
+
for (const entry of raw) {
|
|
314
|
+
if (entry.dir === undefined)
|
|
315
|
+
continue;
|
|
316
|
+
if (!index.isDirectory(entry.dir)) {
|
|
317
|
+
findings.warn("entry-directory-missing", { path, subject: entry.name, detail: entry.dir === "" ? "." : entry.dir });
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (!hasPluginManifest(childFilesOf(index, entry.dir))) {
|
|
321
|
+
findings.warn("entry-not-a-plugin", { path, subject: entry.name, detail: entry.dir === "" ? "." : entry.dir });
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
offered.push({
|
|
325
|
+
name: entry.name,
|
|
326
|
+
dir: entry.dir,
|
|
327
|
+
...(entry.description !== undefined && { description: entry.description }),
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
return offered;
|
|
331
|
+
}
|
|
332
|
+
/** Every entry with a readable source, as the file declares it; the tree is not asked. */
|
|
333
|
+
function declaredEntries(raw) {
|
|
334
|
+
const declared = [];
|
|
335
|
+
for (const entry of raw) {
|
|
336
|
+
if (entry.dir === undefined)
|
|
337
|
+
continue;
|
|
338
|
+
declared.push({
|
|
339
|
+
name: entry.name,
|
|
340
|
+
dir: entry.dir,
|
|
341
|
+
...(entry.description !== undefined && { description: entry.description }),
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
return declared;
|
|
345
|
+
}
|
|
346
|
+
/** The files under `dir` as plugin-relative paths, so `hasPluginManifest` reads them as it reads a plugin's own listing. */
|
|
347
|
+
function childFilesOf(index, dir) {
|
|
348
|
+
const prefix = dir === "" ? "" : `${dir}/`;
|
|
349
|
+
return index.filesUnder(dir).map((file) => file.slice(prefix.length));
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=read-marketplace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-marketplace.js","sourceRoot":"","sources":["../src/marketplace/read-marketplace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAmB,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAoB,MAAM,aAAa,CAAC;AACrH,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG3E,4FAA4F;AAC5F,MAAM,kBAAkB,GAAkC,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAEnG,0FAA0F;AAC1F,MAAM,UAAU,kBAAkB,CAAC,KAAuB;IACxD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACxE,KAAK,M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AAC;IACxC,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACxB,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS;YAAE,SAAS;QACtC,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,GAAG,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;SAC3E,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,4HAA4H;AAC5H,SAAS,YAAY,CAAC,KAAsB,EAAE,GAAW;IACvD,MAAM,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;IAC3C,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
package/messages.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one sentence for every finding kind, and the collector that composes
|
|
3
|
+
* findings from a kind and its context.
|
|
4
|
+
*
|
|
5
|
+
* Copy lives here and nowhere else: the CLI and the server print these
|
|
6
|
+
* sentences verbatim, so a plugin refused offline is refused by the server
|
|
7
|
+
* with the same words, and a consumer never composes refusal copy of its
|
|
8
|
+
* own. Every sentence says what is wrong and, where the fix is not obvious,
|
|
9
|
+
* what Stigmer needs instead. Identifiers are single-quoted (the ts-server
|
|
10
|
+
* quoting rule for new copy). The `Record` types are exhaustive over the
|
|
11
|
+
* kind unions, so a kind without a sentence does not compile.
|
|
12
|
+
*/
|
|
13
|
+
import type { Finding, FindingContext, PluginErrorKind, PluginFindingKind, PluginWarningKind } from "./outcome.js";
|
|
14
|
+
/** The canonical `$schema` identifiers the open format pins per version. */
|
|
15
|
+
export declare const AGENT_PLUGINS_MANIFEST_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
16
|
+
export declare const AGENT_PLUGINS_MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
|
|
17
|
+
/** The four manifest locations, in the precedence the reader applies when there is no root manifest. */
|
|
18
|
+
export declare const MANIFEST_LOCATIONS: {
|
|
19
|
+
readonly "agent-plugins": "plugin.json";
|
|
20
|
+
readonly claude: ".claude-plugin/plugin.json";
|
|
21
|
+
readonly cursor: ".cursor-plugin/plugin.json";
|
|
22
|
+
readonly codex: ".codex-plugin/plugin.json";
|
|
23
|
+
};
|
|
24
|
+
/** Single-quote an identifier for a sentence (the ts-server quoting rule); shared with the marketplace vocabulary. */
|
|
25
|
+
export declare const q: (value: string | undefined) => string;
|
|
26
|
+
/** ` in '<path>'`, or nothing when the finding names no file. */
|
|
27
|
+
export declare const at: (path: string | undefined) => string;
|
|
28
|
+
export type Sentence = (ctx: FindingContext) => string;
|
|
29
|
+
export declare function errorMessage(kind: PluginErrorKind, ctx: FindingContext): string;
|
|
30
|
+
export declare function warningMessage(kind: PluginWarningKind, ctx: FindingContext): string;
|
|
31
|
+
/** True for the kinds that refuse a package. */
|
|
32
|
+
export declare function isErrorKind(kind: PluginFindingKind): kind is PluginErrorKind;
|
|
33
|
+
/** A sentence table over a closed kind vocabulary; `Record` so a kind without a sentence does not compile. */
|
|
34
|
+
export type SentenceTable<K extends string> = Readonly<Record<K, Sentence>>;
|
|
35
|
+
/**
|
|
36
|
+
* Collects findings while a read proceeds. A reader never throws on the
|
|
37
|
+
* content it reads: every problem becomes a finding here, and the read
|
|
38
|
+
* continues so the outcome carries them all. Generic over the two kind
|
|
39
|
+
* vocabularies so the plugin reader and the marketplace reader share one
|
|
40
|
+
* collector and one finding shape while each owns its sentences.
|
|
41
|
+
*/
|
|
42
|
+
export declare class FindingCollector<E extends string, W extends string> {
|
|
43
|
+
private readonly errorSentences;
|
|
44
|
+
private readonly warningSentences;
|
|
45
|
+
readonly errors: Finding<E>[];
|
|
46
|
+
readonly warnings: Finding<W>[];
|
|
47
|
+
constructor(errorSentences: SentenceTable<E>, warningSentences: SentenceTable<W>);
|
|
48
|
+
error(kind: E, ctx?: FindingContext): void;
|
|
49
|
+
warn(kind: W, ctx?: FindingContext): void;
|
|
50
|
+
}
|
|
51
|
+
/** The plugin reader's collector, bound to the plugin vocabulary. */
|
|
52
|
+
export declare class Findings extends FindingCollector<PluginErrorKind, PluginWarningKind> {
|
|
53
|
+
constructor();
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["src/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEnH,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,+DAA+D,CAAC;AAC1G,eAAO,MAAM,wBAAwB,4DAA4D,CAAC;AAElG,wGAAwG;AACxG,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAEX,sHAAsH;AACtH,eAAO,MAAM,CAAC,GAAI,OAAO,MAAM,GAAG,SAAS,KAAG,MAA4B,CAAC;AAC3E,iEAAiE;AACjE,eAAO,MAAM,EAAE,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAAsD,CAAC;AAErG,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC;AA6JvD,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,GAAG,MAAM,CAE/E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,EAAE,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