@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,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which files of a tree a plugin push carries, and in what order.
|
|
3
|
+
*
|
|
4
|
+
* A client that installs a plugin holds a tree: the CLI a directory on disk,
|
|
5
|
+
* the console the file list a marketplace host returned. Both must choose
|
|
6
|
+
* the same files in the same order, because the archive's bytes are the
|
|
7
|
+
* plugin's identity on the server (`status.digest` is the SHA-256 of what
|
|
8
|
+
* it received) and the order of the archive's entries is part of those
|
|
9
|
+
* bytes. This module is that choice, made once.
|
|
10
|
+
*
|
|
11
|
+
* The rule is the CLI's original walk (`stigmer push plugin <dir>`): at each
|
|
12
|
+
* directory the names are sorted by code point, files and directories
|
|
13
|
+
* interleaved by name, and a directory the matcher ignores is skipped whole,
|
|
14
|
+
* so no negation inside it can pull a file back. Symlinks never appear (the
|
|
15
|
+
* CLI walker skips them; a hosted tree has none the client asks for).
|
|
16
|
+
* `compareWalkOrder` states that order for a flat list of paths so a client
|
|
17
|
+
* with no directory to walk arrives at the same sequence; it is NOT the plain
|
|
18
|
+
* code-point order of full paths (`b/x.txt` sorts before `b.txt` here,
|
|
19
|
+
* because the directory `b` sorts before the file `b.txt` at their level).
|
|
20
|
+
* The reader in `read-plugin-package.ts` indexes entries by path and is
|
|
21
|
+
* indifferent to their order; only the archive cares.
|
|
22
|
+
*
|
|
23
|
+
* `.gitignore` and `.stigmerignore` are read from the root of the tree being
|
|
24
|
+
* selected, as the CLI does, never from an ancestor: a marketplace entry is
|
|
25
|
+
* its own plugin root.
|
|
26
|
+
*/
|
|
27
|
+
import type { PluginFiles } from "../files.js";
|
|
28
|
+
import { type Matcher } from "./ignore/matcher.js";
|
|
29
|
+
/** The tree a client holds before selection: every file it could offer, with its size. */
|
|
30
|
+
export interface CandidateFile {
|
|
31
|
+
/** Root-relative POSIX path, no leading `./`. */
|
|
32
|
+
readonly path: string;
|
|
33
|
+
readonly size: number;
|
|
34
|
+
}
|
|
35
|
+
/** What the selection included and left out, for the summary line every client prints. */
|
|
36
|
+
export interface SelectionStats {
|
|
37
|
+
filesIncluded: number;
|
|
38
|
+
filesIgnored: number;
|
|
39
|
+
/** Ignored directories that held at least one candidate; a tree lists no empty directories. */
|
|
40
|
+
dirsSkipped: number;
|
|
41
|
+
totalSize: number;
|
|
42
|
+
}
|
|
43
|
+
export interface SelectPluginFilesOptions {
|
|
44
|
+
/** Whether the tree's own root `.gitignore` applies (every push says yes unless asked otherwise). */
|
|
45
|
+
readonly respectGitignore: boolean;
|
|
46
|
+
readonly extraIgnore?: readonly string[];
|
|
47
|
+
readonly extraInclude?: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
export interface PluginSelection {
|
|
50
|
+
readonly files: PluginFiles;
|
|
51
|
+
readonly stats: SelectionStats;
|
|
52
|
+
/** The matcher the selection ran, for diagnostics (`push --dry-run` lists its patterns). */
|
|
53
|
+
readonly matcher: Matcher;
|
|
54
|
+
}
|
|
55
|
+
/** The two files at a tree's root that shape its own selection. */
|
|
56
|
+
export declare const IGNORE_FILE_NAMES: {
|
|
57
|
+
readonly gitignore: ".gitignore";
|
|
58
|
+
readonly stigmerignore: ".stigmerignore";
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Select the files a push of `candidates` carries. `read` yields a listed
|
|
62
|
+
* candidate's bytes and is called here only for the two ignore files at the
|
|
63
|
+
* root, so a client may hand over a lazy reader and pay for the rest only
|
|
64
|
+
* when the archive is built.
|
|
65
|
+
*/
|
|
66
|
+
export declare function selectPluginFiles(candidates: readonly CandidateFile[], read: (path: string) => Uint8Array, options: SelectPluginFilesOptions): PluginSelection;
|
|
67
|
+
/**
|
|
68
|
+
* The order a sorted directory walk visits files: component by component,
|
|
69
|
+
* each compared by code point. Two paths never share a prefix that is a
|
|
70
|
+
* file in one and a directory in the other, so a shorter path is never a
|
|
71
|
+
* prefix of a longer one at the point they differ.
|
|
72
|
+
*/
|
|
73
|
+
export declare function compareWalkOrder(a: string, b: string): number;
|
|
74
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../src/client/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAsB,KAAK,OAAO,EAAwD,MAAM,qBAAqB,CAAC;AAE7H,0FAA0F;AAC1F,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,0FAA0F;AAC1F,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,+FAA+F;IAC/F,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,qGAAqG;IACrG,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,4FAA4F;IAC5F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,mEAAmE;AACnE,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,SAAS,aAAa,EAAE,EACpC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,EAClC,OAAO,EAAE,wBAAwB,GAChC,eAAe,CAwCjB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAU7D"}
|
package/client/select.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which files of a tree a plugin push carries, and in what order.
|
|
3
|
+
*
|
|
4
|
+
* A client that installs a plugin holds a tree: the CLI a directory on disk,
|
|
5
|
+
* the console the file list a marketplace host returned. Both must choose
|
|
6
|
+
* the same files in the same order, because the archive's bytes are the
|
|
7
|
+
* plugin's identity on the server (`status.digest` is the SHA-256 of what
|
|
8
|
+
* it received) and the order of the archive's entries is part of those
|
|
9
|
+
* bytes. This module is that choice, made once.
|
|
10
|
+
*
|
|
11
|
+
* The rule is the CLI's original walk (`stigmer push plugin <dir>`): at each
|
|
12
|
+
* directory the names are sorted by code point, files and directories
|
|
13
|
+
* interleaved by name, and a directory the matcher ignores is skipped whole,
|
|
14
|
+
* so no negation inside it can pull a file back. Symlinks never appear (the
|
|
15
|
+
* CLI walker skips them; a hosted tree has none the client asks for).
|
|
16
|
+
* `compareWalkOrder` states that order for a flat list of paths so a client
|
|
17
|
+
* with no directory to walk arrives at the same sequence; it is NOT the plain
|
|
18
|
+
* code-point order of full paths (`b/x.txt` sorts before `b.txt` here,
|
|
19
|
+
* because the directory `b` sorts before the file `b.txt` at their level).
|
|
20
|
+
* The reader in `read-plugin-package.ts` indexes entries by path and is
|
|
21
|
+
* indifferent to their order; only the archive cares.
|
|
22
|
+
*
|
|
23
|
+
* `.gitignore` and `.stigmerignore` are read from the root of the tree being
|
|
24
|
+
* selected, as the CLI does, never from an ancestor: a marketplace entry is
|
|
25
|
+
* its own plugin root.
|
|
26
|
+
*/
|
|
27
|
+
import { SOURCE_GITIGNORE, SOURCE_STIGMERIGNORE, buildMatcher } from "./ignore/matcher.js";
|
|
28
|
+
/** The two files at a tree's root that shape its own selection. */
|
|
29
|
+
export const IGNORE_FILE_NAMES = {
|
|
30
|
+
gitignore: SOURCE_GITIGNORE,
|
|
31
|
+
stigmerignore: SOURCE_STIGMERIGNORE,
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Select the files a push of `candidates` carries. `read` yields a listed
|
|
35
|
+
* candidate's bytes and is called here only for the two ignore files at the
|
|
36
|
+
* root, so a client may hand over a lazy reader and pay for the rest only
|
|
37
|
+
* when the archive is built.
|
|
38
|
+
*/
|
|
39
|
+
export function selectPluginFiles(candidates, read, options) {
|
|
40
|
+
const byPath = new Map(candidates.map((candidate) => [candidate.path, candidate]));
|
|
41
|
+
const sources = {
|
|
42
|
+
includeDefaults: true,
|
|
43
|
+
...(options.respectGitignore &&
|
|
44
|
+
byPath.has(IGNORE_FILE_NAMES.gitignore) && { gitignore: decode(read(IGNORE_FILE_NAMES.gitignore)) }),
|
|
45
|
+
...(byPath.has(IGNORE_FILE_NAMES.stigmerignore) && {
|
|
46
|
+
stigmerignore: decode(read(IGNORE_FILE_NAMES.stigmerignore)),
|
|
47
|
+
}),
|
|
48
|
+
...(options.extraIgnore !== undefined && { extraIgnore: options.extraIgnore }),
|
|
49
|
+
...(options.extraInclude !== undefined && { extraInclude: options.extraInclude }),
|
|
50
|
+
};
|
|
51
|
+
const matcher = buildMatcher(sources);
|
|
52
|
+
const stats = { filesIncluded: 0, filesIgnored: 0, dirsSkipped: 0, totalSize: 0 };
|
|
53
|
+
const skippedDirs = new Set();
|
|
54
|
+
const entries = [];
|
|
55
|
+
for (const candidate of [...candidates].sort((a, b) => compareWalkOrder(a.path, b.path))) {
|
|
56
|
+
if (underSkippedDir(candidate.path, matcher, skippedDirs, stats))
|
|
57
|
+
continue;
|
|
58
|
+
if (matcher.matchWithReason(candidate.path, false).ignored) {
|
|
59
|
+
stats.filesIgnored++;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
entries.push({ path: candidate.path, size: candidate.size });
|
|
63
|
+
stats.filesIncluded++;
|
|
64
|
+
stats.totalSize += candidate.size;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
files: {
|
|
68
|
+
entries,
|
|
69
|
+
read(path) {
|
|
70
|
+
if (!byPath.has(path))
|
|
71
|
+
throw new Error(`plugin file '${path}' is not listed`);
|
|
72
|
+
return read(path);
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
stats,
|
|
76
|
+
matcher,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The order a sorted directory walk visits files: component by component,
|
|
81
|
+
* each compared by code point. Two paths never share a prefix that is a
|
|
82
|
+
* file in one and a directory in the other, so a shorter path is never a
|
|
83
|
+
* prefix of a longer one at the point they differ.
|
|
84
|
+
*/
|
|
85
|
+
export function compareWalkOrder(a, b) {
|
|
86
|
+
const as = a.split("/");
|
|
87
|
+
const bs = b.split("/");
|
|
88
|
+
const depth = Math.min(as.length, bs.length);
|
|
89
|
+
for (let i = 0; i < depth; i++) {
|
|
90
|
+
const x = as[i] ?? "";
|
|
91
|
+
const y = bs[i] ?? "";
|
|
92
|
+
if (x !== y)
|
|
93
|
+
return x < y ? -1 : 1;
|
|
94
|
+
}
|
|
95
|
+
return as.length - bs.length;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* True when an ancestor directory of `path` is ignored as a directory. The
|
|
99
|
+
* walk checks a directory once and skips its subtree, so each ignored
|
|
100
|
+
* directory counts once whatever it holds.
|
|
101
|
+
*/
|
|
102
|
+
function underSkippedDir(path, matcher, skipped, stats) {
|
|
103
|
+
const parts = path.split("/");
|
|
104
|
+
let dir = "";
|
|
105
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
106
|
+
dir = dir === "" ? (parts[i] ?? "") : `${dir}/${parts[i] ?? ""}`;
|
|
107
|
+
if (skipped.has(dir))
|
|
108
|
+
return true;
|
|
109
|
+
if (matcher.matchWithReason(dir, true).ignored) {
|
|
110
|
+
skipped.add(dir);
|
|
111
|
+
stats.dirsSkipped++;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const decoder = new TextDecoder();
|
|
118
|
+
function decode(bytes) {
|
|
119
|
+
return decoder.decode(bytes);
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../src/client/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAoC,gBAAgB,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAgC7H,mEAAmE;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,gBAAgB;IAC3B,aAAa,EAAE,oBAAoB;CAC3B,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAoC,EACpC,IAAkC,EAClC,OAAiC;IAEjC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACnF,MAAM,OAAO,GAAkB;QAC7B,eAAe,EAAE,IAAI;QACrB,GAAG,CAAC,OAAO,CAAC,gBAAgB;YAC1B,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QACtG,GAAG,CAAC,MAAM,CA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IAC9B,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACjE,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAClC,IAAI,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,KAAK,CAAC,WAAW,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,SAAS,MAAM,CAAC,KAAiB;IAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words every client prints for the same thing.
|
|
3
|
+
*
|
|
4
|
+
* The CLI's `validate -f`, `push plugin --dry-run` and `install`, and the
|
|
5
|
+
* console's install preview, all describe a package to the user; a
|
|
6
|
+
* platform where the same fact is named differently on two surfaces has
|
|
7
|
+
* two vocabularies. The labels here are the docs' words
|
|
8
|
+
* (`docs/vocabulary.md`), kept once.
|
|
9
|
+
*/
|
|
10
|
+
import type { PluginDialect } from "../types.js";
|
|
11
|
+
/** Human labels for the four dialects, in the vocabulary the docs use. */
|
|
12
|
+
export declare const DIALECT_LABELS: Readonly<Record<PluginDialect, string>>;
|
|
13
|
+
//# sourceMappingURL=vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../src/client/vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,0EAA0E;AAC1E,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAKlE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words every client prints for the same thing.
|
|
3
|
+
*
|
|
4
|
+
* The CLI's `validate -f`, `push plugin --dry-run` and `install`, and the
|
|
5
|
+
* console's install preview, all describe a package to the user; a
|
|
6
|
+
* platform where the same fact is named differently on two surfaces has
|
|
7
|
+
* two vocabularies. The labels here are the docs' words
|
|
8
|
+
* (`docs/vocabulary.md`), kept once.
|
|
9
|
+
*/
|
|
10
|
+
/** Human labels for the four dialects, in the vocabulary the docs use. */
|
|
11
|
+
export const DIALECT_LABELS = {
|
|
12
|
+
"agent-plugins": "Agent Plugins 1.0",
|
|
13
|
+
claude: "Claude Code plugin",
|
|
14
|
+
cursor: "Cursor plugin",
|
|
15
|
+
codex: "Codex plugin",
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../src/client/vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAA4C;IACrE,eAAe,EAAE,mBAAmB;IACpC,MAAM,EAAE,oBAAoB;IAC5B,MAAM,EAAE,eAAe;IACvB,KAAK,EAAE,cAAc;CACtB,CAAC"}
|
package/client.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@stigmer/plugin-package/client`: what every client that installs a
|
|
3
|
+
* plugin does identically.
|
|
4
|
+
*
|
|
5
|
+
* The main entry reads a package; this entry is for the client that holds
|
|
6
|
+
* a tree and must turn it into the push the server expects. Two clients do
|
|
7
|
+
* that today, the CLI from a directory and the console from a marketplace
|
|
8
|
+
* host's file list, and a plugin installed from either must have one
|
|
9
|
+
* digest for one tree, be refused with one sentence for one mistake, and be
|
|
10
|
+
* described in one vocabulary. So the pieces live here, once:
|
|
11
|
+
*
|
|
12
|
+
* - the gitignore-compatible ignore engine and the security defaults
|
|
13
|
+
* (`ignore/`), pure over the text of the ignore files;
|
|
14
|
+
* - the selection rule (`select.ts`): which files a push carries, in the
|
|
15
|
+
* order the CLI's original walk produced them;
|
|
16
|
+
* - the archive and its digest (`archive.ts`): the deterministic zip and
|
|
17
|
+
* the SHA-256 the server records;
|
|
18
|
+
* - the preparation (`prepare.ts`): select, read, refuse, archive, digest,
|
|
19
|
+
* once, for a tree on disk, on a host, or in a browser's memory;
|
|
20
|
+
* - the eval preparation (`prepare-eval.ts`): an evals/ folder's push,
|
|
21
|
+
* its run output left out, read as the server reads it, archived;
|
|
22
|
+
* - the presentation (`presentation.ts`): a card's face from a listed
|
|
23
|
+
* tree, reading the entry's manifest and nothing else;
|
|
24
|
+
* - the grammars (`refs.ts`): an install ref and a GitHub marketplace
|
|
25
|
+
* source, with their refusal sentences;
|
|
26
|
+
* - the built-in sources (`builtin.ts`): the official catalogue and the
|
|
27
|
+
* three vendors', listed by every client without configuration;
|
|
28
|
+
* - the release predicate (`release.ts`): which server versions the
|
|
29
|
+
* catalogue is published for;
|
|
30
|
+
* - the re-rooting rule (`reroot.ts`): a zipped folder reads as the folder;
|
|
31
|
+
* - the vocabulary (`vocabulary.ts`): the labels both surfaces print.
|
|
32
|
+
*
|
|
33
|
+
* Nothing here touches the filesystem, the network or any `node:*` module.
|
|
34
|
+
* A client's edge (a directory walk, a fetch, a file pick) produces the
|
|
35
|
+
* candidates and the bytes; this entry decides what becomes of them.
|
|
36
|
+
*/
|
|
37
|
+
export { DEFAULT_PATTERNS } from "./client/ignore/defaults.js";
|
|
38
|
+
export { matchName } from "./client/ignore/match.js";
|
|
39
|
+
export { type IgnoreSources, type MatchReason, Matcher, Reason, REASON_TEXT, SOURCE_CLI, SOURCE_DEFAULTS, SOURCE_GITIGNORE, SOURCE_STIGMERIGNORE, buildMatcher, } from "./client/ignore/matcher.js";
|
|
40
|
+
export { MatchResult, type Pattern, parsePattern } from "./client/ignore/pattern.js";
|
|
41
|
+
export { type CandidateFile, type PluginSelection, type SelectPluginFilesOptions, type SelectionStats, IGNORE_FILE_NAMES, compareWalkOrder, selectPluginFiles, } from "./client/select.js";
|
|
42
|
+
export { DETERMINISTIC_ZIP_MTIME, archivePlugin, digestArchive } from "./client/archive.js";
|
|
43
|
+
export { type LazyCandidate, type PrepareArchiveOutcome, type PrepareFromTreeOptions, type PreparePluginOutcome, type PreparedPlugin, preparePluginArchive, preparePluginFromTree, } from "./client/prepare.js";
|
|
44
|
+
export { EVAL_RESULTS_DIR, type PrepareEvalOutcome, type PreparedEval, prepareEvalArchive, } from "./client/prepare-eval.js";
|
|
45
|
+
export { readPluginPresentationFromTree } from "./client/presentation.js";
|
|
46
|
+
export { type BuiltInMarketplace, BUILT_IN_MARKETPLACES, builtInSourceRefusal, isBuiltInMarketplaceName, } from "./client/builtin.js";
|
|
47
|
+
export { isReleaseVersion } from "./client/release.js";
|
|
48
|
+
export { rerootSingleDirectory, stripDirectoryPrefix } from "./client/reroot.js";
|
|
49
|
+
export { type GitHubMarketplaceSource, type GitHubSourceOutcome, type InstallRef, type InstallRefOutcome, GITHUB_SOURCE_SHAPE, INSTALL_REF_SHAPE, OFFICIAL_MARKETPLACE_NAME, describeGitHubSource, formatInstallRef, isOwnerRepo, looksLikePath, parseGitHubSource, parseInstallRef, } from "./client/refs.js";
|
|
50
|
+
export { DIALECT_LABELS } from "./client/vocabulary.js";
|
|
51
|
+
//# sourceMappingURL=client.d.ts.map
|
package/client.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,KAAK,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EACL,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
package/client.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@stigmer/plugin-package/client`: what every client that installs a
|
|
3
|
+
* plugin does identically.
|
|
4
|
+
*
|
|
5
|
+
* The main entry reads a package; this entry is for the client that holds
|
|
6
|
+
* a tree and must turn it into the push the server expects. Two clients do
|
|
7
|
+
* that today, the CLI from a directory and the console from a marketplace
|
|
8
|
+
* host's file list, and a plugin installed from either must have one
|
|
9
|
+
* digest for one tree, be refused with one sentence for one mistake, and be
|
|
10
|
+
* described in one vocabulary. So the pieces live here, once:
|
|
11
|
+
*
|
|
12
|
+
* - the gitignore-compatible ignore engine and the security defaults
|
|
13
|
+
* (`ignore/`), pure over the text of the ignore files;
|
|
14
|
+
* - the selection rule (`select.ts`): which files a push carries, in the
|
|
15
|
+
* order the CLI's original walk produced them;
|
|
16
|
+
* - the archive and its digest (`archive.ts`): the deterministic zip and
|
|
17
|
+
* the SHA-256 the server records;
|
|
18
|
+
* - the preparation (`prepare.ts`): select, read, refuse, archive, digest,
|
|
19
|
+
* once, for a tree on disk, on a host, or in a browser's memory;
|
|
20
|
+
* - the eval preparation (`prepare-eval.ts`): an evals/ folder's push,
|
|
21
|
+
* its run output left out, read as the server reads it, archived;
|
|
22
|
+
* - the presentation (`presentation.ts`): a card's face from a listed
|
|
23
|
+
* tree, reading the entry's manifest and nothing else;
|
|
24
|
+
* - the grammars (`refs.ts`): an install ref and a GitHub marketplace
|
|
25
|
+
* source, with their refusal sentences;
|
|
26
|
+
* - the built-in sources (`builtin.ts`): the official catalogue and the
|
|
27
|
+
* three vendors', listed by every client without configuration;
|
|
28
|
+
* - the release predicate (`release.ts`): which server versions the
|
|
29
|
+
* catalogue is published for;
|
|
30
|
+
* - the re-rooting rule (`reroot.ts`): a zipped folder reads as the folder;
|
|
31
|
+
* - the vocabulary (`vocabulary.ts`): the labels both surfaces print.
|
|
32
|
+
*
|
|
33
|
+
* Nothing here touches the filesystem, the network or any `node:*` module.
|
|
34
|
+
* A client's edge (a directory walk, a fetch, a file pick) produces the
|
|
35
|
+
* candidates and the bytes; this entry decides what becomes of them.
|
|
36
|
+
*/
|
|
37
|
+
export { DEFAULT_PATTERNS } from "./client/ignore/defaults.js";
|
|
38
|
+
export { matchName } from "./client/ignore/match.js";
|
|
39
|
+
export { Matcher, Reason, REASON_TEXT, SOURCE_CLI, SOURCE_DEFAULTS, SOURCE_GITIGNORE, SOURCE_STIGMERIGNORE, buildMatcher, } from "./client/ignore/matcher.js";
|
|
40
|
+
export { MatchResult, parsePattern } from "./client/ignore/pattern.js";
|
|
41
|
+
export { IGNORE_FILE_NAMES, compareWalkOrder, selectPluginFiles, } from "./client/select.js";
|
|
42
|
+
export { DETERMINISTIC_ZIP_MTIME, archivePlugin, digestArchive } from "./client/archive.js";
|
|
43
|
+
export { preparePluginArchive, preparePluginFromTree, } from "./client/prepare.js";
|
|
44
|
+
export { EVAL_RESULTS_DIR, prepareEvalArchive, } from "./client/prepare-eval.js";
|
|
45
|
+
export { readPluginPresentationFromTree } from "./client/presentation.js";
|
|
46
|
+
export { BUILT_IN_MARKETPLACES, builtInSourceRefusal, isBuiltInMarketplaceName, } from "./client/builtin.js";
|
|
47
|
+
export { isReleaseVersion } from "./client/release.js";
|
|
48
|
+
export { rerootSingleDirectory, stripDirectoryPrefix } from "./client/reroot.js";
|
|
49
|
+
export { GITHUB_SOURCE_SHAPE, INSTALL_REF_SHAPE, OFFICIAL_MARKETPLACE_NAME, describeGitHubSource, formatInstallRef, isOwnerRepo, looksLikePath, parseGitHubSource, parseInstallRef, } from "./client/refs.js";
|
|
50
|
+
export { DIALECT_LABELS } from "./client/vocabulary.js";
|
|
51
|
+
//# sourceMappingURL=client.js.map
|
package/client.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAGL,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAgB,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAKL,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAML,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAGhB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAEL,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAKL,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
package/detect.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which manifests a package carries, which one gives it its identity, and
|
|
3
|
+
* what they agree on.
|
|
4
|
+
*
|
|
5
|
+
* A root `plugin.json` (the open format) is the identity when present, and
|
|
6
|
+
* any vendor manifests beside it contribute only their dialect data
|
|
7
|
+
* (declared paths, variables, inline servers). Without a root manifest the
|
|
8
|
+
* precedence is Claude, Cursor, Codex: the first present names the plugin.
|
|
9
|
+
* Every present manifest is read, so a plugin that ships two dialects has
|
|
10
|
+
* both honoured; a `name` present in two manifests with different values is
|
|
11
|
+
* refused, because a plugin that is two plugins depending on who reads it
|
|
12
|
+
* is exactly the drift Stigmer will not carry.
|
|
13
|
+
*
|
|
14
|
+
* The plugin name obeys the open format's rule in every dialect (1 to 64
|
|
15
|
+
* characters of `a-z 0-9 - .`, alphanumeric at both ends, no `--` or `..`);
|
|
16
|
+
* Cursor's published pattern is the same rule minus the repetition clause.
|
|
17
|
+
* Slugging is the installer's, not the reader's.
|
|
18
|
+
*
|
|
19
|
+
* MCP configuration sources are resolved here too, because a default
|
|
20
|
+
* location is a cross-manifest fact: `mcp.json` is read under the open
|
|
21
|
+
* rules when a root manifest exists; a Claude or Codex manifest that
|
|
22
|
+
* declares no `mcpServers` reads `.mcp.json` when present; Cursor reads
|
|
23
|
+
* only what it declares. Hooks sources resolve the same way: every vendor
|
|
24
|
+
* manifest's declared sources, then `hooks/hooks.json` when it exists (the
|
|
25
|
+
* default Claude Code, Cursor and Codex all read, merged with what is
|
|
26
|
+
* declared), each file read once and tagged with the hook formats of the
|
|
27
|
+
* manifests that reach it. Sub-agent files (`agents/*.md`) are a vendor
|
|
28
|
+
* component: they are read when any vendor manifest is present and recorded
|
|
29
|
+
* as ignored otherwise, since the open format defines no such component.
|
|
30
|
+
*/
|
|
31
|
+
import type { DialectManifest, McpConfigSource } from "./dialects/manifest.js";
|
|
32
|
+
import { type JsonObject } from "./documents.js";
|
|
33
|
+
import type { PluginFileIndex } from "./files.js";
|
|
34
|
+
import { type Findings } from "./messages.js";
|
|
35
|
+
import type { HookFormat, PluginDialect } from "./types.js";
|
|
36
|
+
/** The open format's `mcp.json`, a fixed location. */
|
|
37
|
+
export declare const OPEN_MCP_CONFIG = "mcp.json";
|
|
38
|
+
/** The hooks file every vendor reads by default. */
|
|
39
|
+
export declare const DEFAULT_HOOKS_FILE = "hooks/hooks.json";
|
|
40
|
+
/**
|
|
41
|
+
* A hooks source after resolution. A file carries every format a manifest
|
|
42
|
+
* reaching it reads, so a file whose shape is none of them is refused; an
|
|
43
|
+
* inline object has the one format of the manifest that holds it.
|
|
44
|
+
*/
|
|
45
|
+
export type ResolvedHookSource = {
|
|
46
|
+
readonly kind: "file";
|
|
47
|
+
readonly path: string;
|
|
48
|
+
readonly formats: readonly HookFormat[];
|
|
49
|
+
readonly manifest: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "inline";
|
|
52
|
+
readonly manifest: string;
|
|
53
|
+
readonly value: JsonObject;
|
|
54
|
+
readonly format: HookFormat;
|
|
55
|
+
};
|
|
56
|
+
/** The hook format a vendor dialect reads; Codex reads Claude Code's. */
|
|
57
|
+
export declare function hookFormatOf(dialect: PluginDialect): HookFormat;
|
|
58
|
+
/**
|
|
59
|
+
* Every manifest location in the order that names a plugin: the root
|
|
60
|
+
* manifest, then the vendors. The one precedence the reader applies,
|
|
61
|
+
* exported so a partial read (`presentation.ts`) cannot rank the manifests
|
|
62
|
+
* differently from the full one.
|
|
63
|
+
*/
|
|
64
|
+
export declare const MANIFEST_PRECEDENCE: readonly PluginDialect[];
|
|
65
|
+
export interface ManifestSet {
|
|
66
|
+
/** The dialect that gave the plugin its identity. */
|
|
67
|
+
readonly dialect: PluginDialect;
|
|
68
|
+
/** Identity first, then the others in location order. */
|
|
69
|
+
readonly manifests: readonly DialectManifest[];
|
|
70
|
+
/** The validated plugin name; `undefined` after a name finding. */
|
|
71
|
+
readonly name: string | undefined;
|
|
72
|
+
/** True when a vendor manifest is present, so `agents/*.md` is a component. */
|
|
73
|
+
readonly readsAgents: boolean;
|
|
74
|
+
readonly mcpSources: readonly McpConfigSource[];
|
|
75
|
+
readonly hookSources: readonly ResolvedHookSource[];
|
|
76
|
+
}
|
|
77
|
+
/** True when the directory holds any of the four manifests; the CLI's routing test. */
|
|
78
|
+
export declare function hasPluginManifest(paths: Iterable<string>): boolean;
|
|
79
|
+
/** Read every present manifest; `undefined` (after `no-manifest`) when there is none. */
|
|
80
|
+
export declare function detectManifests(index: PluginFileIndex, findings: Findings): ManifestSet | undefined;
|
|
81
|
+
/** The open format's name rule, applied in every dialect. */
|
|
82
|
+
export declare function isValidPluginName(name: string): boolean;
|
|
83
|
+
//# sourceMappingURL=detect.d.ts.map
|
package/detect.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["src/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,KAAK,UAAU,EAA6B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,KAAK,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE5D,sDAAsD;AACtD,eAAO,MAAM,eAAe,aAAa,CAAC;AAE1C,oDAAoD;AACpD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