@stigmer/plugin-package 3.15.3-dev.20260916211208

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.
Files changed (173) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +66 -0
  3. package/detect.d.ts +50 -0
  4. package/detect.d.ts.map +1 -0
  5. package/detect.js +164 -0
  6. package/detect.js.map +1 -0
  7. package/dialects/claude.d.ts +30 -0
  8. package/dialects/claude.d.ts.map +1 -0
  9. package/dialects/claude.js +71 -0
  10. package/dialects/claude.js.map +1 -0
  11. package/dialects/codex.d.ts +18 -0
  12. package/dialects/codex.d.ts.map +1 -0
  13. package/dialects/codex.js +19 -0
  14. package/dialects/codex.js.map +1 -0
  15. package/dialects/cursor.d.ts +23 -0
  16. package/dialects/cursor.d.ts.map +1 -0
  17. package/dialects/cursor.js +63 -0
  18. package/dialects/cursor.js.map +1 -0
  19. package/dialects/manifest.d.ts +109 -0
  20. package/dialects/manifest.d.ts.map +1 -0
  21. package/dialects/manifest.js +194 -0
  22. package/dialects/manifest.js.map +1 -0
  23. package/dialects/open.d.ts +18 -0
  24. package/dialects/open.d.ts.map +1 -0
  25. package/dialects/open.js +47 -0
  26. package/dialects/open.js.map +1 -0
  27. package/documents.d.ts +43 -0
  28. package/documents.d.ts.map +1 -0
  29. package/documents.js +111 -0
  30. package/documents.js.map +1 -0
  31. package/files.d.ts +114 -0
  32. package/files.d.ts.map +1 -0
  33. package/files.js +187 -0
  34. package/files.js.map +1 -0
  35. package/frontmatter.d.ts +51 -0
  36. package/frontmatter.d.ts.map +1 -0
  37. package/frontmatter.js +61 -0
  38. package/frontmatter.js.map +1 -0
  39. package/index.d.ts +19 -0
  40. package/index.d.ts.map +1 -0
  41. package/index.js +17 -0
  42. package/index.js.map +1 -0
  43. package/messages.d.ts +39 -0
  44. package/messages.d.ts.map +1 -0
  45. package/messages.js +135 -0
  46. package/messages.js.map +1 -0
  47. package/normalise/ignored.d.ts +24 -0
  48. package/normalise/ignored.d.ts.map +1 -0
  49. package/normalise/ignored.js +68 -0
  50. package/normalise/ignored.js.map +1 -0
  51. package/normalise/mcp-servers.d.ts +47 -0
  52. package/normalise/mcp-servers.d.ts.map +1 -0
  53. package/normalise/mcp-servers.js +397 -0
  54. package/normalise/mcp-servers.js.map +1 -0
  55. package/normalise/overlay.d.ts +27 -0
  56. package/normalise/overlay.d.ts.map +1 -0
  57. package/normalise/overlay.js +67 -0
  58. package/normalise/overlay.js.map +1 -0
  59. package/normalise/skills.d.ts +31 -0
  60. package/normalise/skills.d.ts.map +1 -0
  61. package/normalise/skills.js +116 -0
  62. package/normalise/skills.js.map +1 -0
  63. package/normalise/sub-agents.d.ts +44 -0
  64. package/normalise/sub-agents.d.ts.map +1 -0
  65. package/normalise/sub-agents.js +168 -0
  66. package/normalise/sub-agents.js.map +1 -0
  67. package/normalise/variables.d.ts +27 -0
  68. package/normalise/variables.d.ts.map +1 -0
  69. package/normalise/variables.js +155 -0
  70. package/normalise/variables.js.map +1 -0
  71. package/outcome.d.ts +46 -0
  72. package/outcome.d.ts.map +1 -0
  73. package/outcome.js +21 -0
  74. package/outcome.js.map +1 -0
  75. package/package.json +40 -0
  76. package/placeholders.d.ts +41 -0
  77. package/placeholders.d.ts.map +1 -0
  78. package/placeholders.js +68 -0
  79. package/placeholders.js.map +1 -0
  80. package/read-plugin-package.d.ts +19 -0
  81. package/read-plugin-package.d.ts.map +1 -0
  82. package/read-plugin-package.js +67 -0
  83. package/read-plugin-package.js.map +1 -0
  84. package/src/__test-utils__/directory-files.ts +29 -0
  85. package/src/__test-utils__/read.ts +55 -0
  86. package/src/__tests__/adversarial.test.ts +434 -0
  87. package/src/__tests__/detect.test.ts +133 -0
  88. package/src/__tests__/files.test.ts +119 -0
  89. package/src/__tests__/fixtures/cursor-plugins/NOTICE +22 -0
  90. package/src/__tests__/fixtures/cursor-plugins/advisor/.cursor-plugin/plugin.json +33 -0
  91. package/src/__tests__/fixtures/cursor-plugins/advisor/CHANGELOG.md +8 -0
  92. package/src/__tests__/fixtures/cursor-plugins/advisor/LICENSE +21 -0
  93. package/src/__tests__/fixtures/cursor-plugins/advisor/README.md +87 -0
  94. package/src/__tests__/fixtures/cursor-plugins/advisor/agents/advisor-subagent.md +48 -0
  95. package/src/__tests__/fixtures/cursor-plugins/advisor/assets/avatar.png +0 -0
  96. package/src/__tests__/fixtures/cursor-plugins/advisor/hooks/capture-response.sh +20 -0
  97. package/src/__tests__/fixtures/cursor-plugins/advisor/hooks/hooks.json +27 -0
  98. package/src/__tests__/fixtures/cursor-plugins/advisor/hooks/lib.sh +61 -0
  99. package/src/__tests__/fixtures/cursor-plugins/advisor/hooks/mark-pending.sh +27 -0
  100. package/src/__tests__/fixtures/cursor-plugins/advisor/hooks/record-consult.sh +41 -0
  101. package/src/__tests__/fixtures/cursor-plugins/advisor/hooks/stop-hook.sh +48 -0
  102. package/src/__tests__/fixtures/cursor-plugins/advisor/skills/advisor/SKILL.md +123 -0
  103. package/src/__tests__/fixtures/cursor-plugins/advisor/skills/advisor/references/briefing-template.md +44 -0
  104. package/src/__tests__/fixtures/cursor-plugins/github/.cursor-plugin/plugin.json +45 -0
  105. package/src/__tests__/fixtures/cursor-plugins/github/CHANGELOG.md +9 -0
  106. package/src/__tests__/fixtures/cursor-plugins/github/LICENSE +21 -0
  107. package/src/__tests__/fixtures/cursor-plugins/github/README.md +64 -0
  108. package/src/__tests__/fixtures/cursor-plugins/github/assets/logo.svg +0 -0
  109. package/src/__tests__/fixtures/cursor-plugins/github/mcp.json +11 -0
  110. package/src/__tests__/fixtures/cursor-plugins/playwright/.cursor-plugin/plugin.json +35 -0
  111. package/src/__tests__/fixtures/cursor-plugins/playwright/CHANGELOG.md +8 -0
  112. package/src/__tests__/fixtures/cursor-plugins/playwright/LICENSE +21 -0
  113. package/src/__tests__/fixtures/cursor-plugins/playwright/README.md +46 -0
  114. package/src/__tests__/fixtures/cursor-plugins/playwright/assets/logo.svg +0 -0
  115. package/src/__tests__/fixtures/cursor-plugins/playwright/mcp.json +8 -0
  116. package/src/__tests__/fixtures/cursor-plugins/salesforce/.cursor-plugin/plugin.json +48 -0
  117. package/src/__tests__/fixtures/cursor-plugins/salesforce/CHANGELOG.md +10 -0
  118. package/src/__tests__/fixtures/cursor-plugins/salesforce/LICENSE +21 -0
  119. package/src/__tests__/fixtures/cursor-plugins/salesforce/README.md +95 -0
  120. package/src/__tests__/fixtures/cursor-plugins/salesforce/assets/logo.svg +0 -0
  121. package/src/__tests__/fixtures/cursor-plugins/salesforce/mcp.json +12 -0
  122. package/src/__tests__/fixtures/cursor-plugins/thermos/.cursor-plugin/plugin.json +32 -0
  123. package/src/__tests__/fixtures/cursor-plugins/thermos/CHANGELOG.md +8 -0
  124. package/src/__tests__/fixtures/cursor-plugins/thermos/LICENSE +21 -0
  125. package/src/__tests__/fixtures/cursor-plugins/thermos/README.md +70 -0
  126. package/src/__tests__/fixtures/cursor-plugins/thermos/agents/thermo-nuclear-code-quality-review-subagent.md +23 -0
  127. package/src/__tests__/fixtures/cursor-plugins/thermos/agents/thermo-nuclear-review-subagent.md +28 -0
  128. package/src/__tests__/fixtures/cursor-plugins/thermos/assets/logo.png +0 -0
  129. package/src/__tests__/fixtures/cursor-plugins/thermos/skills/thermo-nuclear-code-quality-review/SKILL.md +192 -0
  130. package/src/__tests__/fixtures/cursor-plugins/thermos/skills/thermo-nuclear-review/SKILL.md +51 -0
  131. package/src/__tests__/fixtures/cursor-plugins/thermos/skills/thermos/SKILL.md +21 -0
  132. package/src/__tests__/fixtures/cursor-plugins/xero/.cursor-plugin/plugin.json +53 -0
  133. package/src/__tests__/fixtures/cursor-plugins/xero/CHANGELOG.md +9 -0
  134. package/src/__tests__/fixtures/cursor-plugins/xero/LICENSE +21 -0
  135. package/src/__tests__/fixtures/cursor-plugins/xero/README.md +79 -0
  136. package/src/__tests__/fixtures/cursor-plugins/xero/assets/logo.png +0 -0
  137. package/src/__tests__/fixtures/cursor-plugins/xero/mcp.json +16 -0
  138. package/src/__tests__/fixtures.test.ts +198 -0
  139. package/src/__tests__/mcp-servers.test.ts +120 -0
  140. package/src/__tests__/overlay-and-ignored.test.ts +65 -0
  141. package/src/__tests__/skills.test.ts +89 -0
  142. package/src/__tests__/sub-agents.test.ts +111 -0
  143. package/src/__tests__/variables.test.ts +94 -0
  144. package/src/detect.ts +189 -0
  145. package/src/dialects/claude.ts +90 -0
  146. package/src/dialects/codex.ts +24 -0
  147. package/src/dialects/cursor.ts +73 -0
  148. package/src/dialects/manifest.ts +237 -0
  149. package/src/dialects/open.ts +48 -0
  150. package/src/documents.ts +145 -0
  151. package/src/files.ts +213 -0
  152. package/src/frontmatter.ts +70 -0
  153. package/src/index.ts +59 -0
  154. package/src/messages.ts +206 -0
  155. package/src/normalise/ignored.ts +70 -0
  156. package/src/normalise/mcp-servers.ts +427 -0
  157. package/src/normalise/overlay.ts +71 -0
  158. package/src/normalise/skills.ts +126 -0
  159. package/src/normalise/sub-agents.ts +184 -0
  160. package/src/normalise/variables.ts +161 -0
  161. package/src/outcome.ts +122 -0
  162. package/src/placeholders.ts +74 -0
  163. package/src/read-plugin-package.ts +74 -0
  164. package/src/testing.ts +258 -0
  165. package/src/types.ts +189 -0
  166. package/testing.d.ts +106 -0
  167. package/testing.d.ts.map +1 -0
  168. package/testing.js +182 -0
  169. package/testing.js.map +1 -0
  170. package/types.d.ts +152 -0
  171. package/types.d.ts.map +1 -0
  172. package/types.js +19 -0
  173. package/types.js.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Stigmer Contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @stigmer/plugin-package
2
+
3
+ Reads an Agent Plugins package into one normalised description of what
4
+ Stigmer would install from it.
5
+
6
+ A plugin is a folder with a manifest, `skills/` and an MCP server
7
+ configuration. This library reads the open Agent Plugins 1.0.0 format and
8
+ the three vendor dialects that preceded it (Cursor `.cursor-plugin/`,
9
+ Claude Code `.claude-plugin/`, Codex `.codex-plugin/`) unchanged, and hands
10
+ back a `PluginPackage`: the skills, MCP servers, sub-agents and variables in
11
+ the shapes Stigmer's resources take, the `ai.stigmer/` overlay documents as
12
+ opaque bytes, and every component it ignored. What Stigmer cannot carry is
13
+ refused with one fixed sentence per problem, and the reader keeps scanning
14
+ past a refusal so one run reports every problem at once.
15
+
16
+ ## Why this is a library
17
+
18
+ The same code runs in two places: the CLI validates a plugin directory
19
+ offline (`stigmer validate -f <dir>`), and the server parses an uploaded
20
+ archive when it installs a plugin. One implementation means a plugin that
21
+ validates offline installs, and a plugin that is refused offline is refused
22
+ by the server with the same sentence. The library is pure over a
23
+ `PluginFiles` reader (a sorted list of sized entries plus `read`), so each
24
+ consumer supplies its own: a directory walker in the CLI, an archive reader
25
+ in the server. Nothing here touches the filesystem, the clock, the network
26
+ or the environment, and the main entry imports no `node:*` module, so a
27
+ browser can run it too.
28
+
29
+ ## Consumers
30
+
31
+ - `@stigmer/cli` (`client-apps/cli`): `stigmer validate -f <dir>` over a
32
+ plugin directory.
33
+ - `@stigmer/server`: the plugin install pipeline, when it lands.
34
+
35
+ ## Dependency policy
36
+
37
+ One runtime dependency, `yaml` (the CLI's and the SDK's YAML library), for
38
+ `SKILL.md` and sub-agent frontmatter. No dependency on `@stigmer/protos`:
39
+ the library describes the plugin format, and the CLI's offline validation
40
+ should not pull the resource schemas in for a parse. Field names in the
41
+ normalised types mirror the protos (`SubAgent`, `EnvVarDeclaration`,
42
+ `McpServerSpec`) so the server's mapping is one function per kind.
43
+
44
+ ## Design notes
45
+
46
+ - **Refuse, do not skip.** The open specification tells a client to skip a
47
+ broken component and keep loading. Stigmer refuses the plugin instead: an
48
+ installed agent that quietly lacks a server or a sub-agent is worse than a
49
+ refused install. The parser still scans past a fatal finding so an author
50
+ fixes everything in one pass.
51
+ - **Every sentence lives in `src/messages.ts`**, one per finding kind,
52
+ identifiers single-quoted. Consumers never compose refusal copy.
53
+ - **Caps are checked from declared sizes before a byte is read**
54
+ (`PLUGIN_DOCUMENT_LIMITS`), and again on the bytes returned, so no reader
55
+ can be talked into inflating a bomb through the library.
56
+ - **Variables are references the runner resolves.** A `${VAR}` in a server
57
+ configuration is a reference to the caller's Environment in every dialect;
58
+ an undeclared one is inferred as a required secret and warned, because the
59
+ runner hands a server only the variables its spec declares.
60
+ - **Two facts about the runner shape two refusals**: a `${VAR}` in a server
61
+ `url` is sent literally (refused), and a stdio `env` can only pass a
62
+ declared variable by its own name, so only `KEY: "${KEY}"` is
63
+ representable (anything else refused).
64
+ - **The `./testing` entry** builds in-memory plugins in each dialect's exact
65
+ layout, so consumers' tests and this library's own adversarial suite craft
66
+ fixtures from one source.
package/detect.d.ts ADDED
@@ -0,0 +1,50 @@
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. Sub-agent files (`agents/*.md`) are a vendor
24
+ * component: they are read when any vendor manifest is present and recorded
25
+ * as ignored otherwise, since the open format defines no such component.
26
+ */
27
+ import type { DialectManifest, McpConfigSource } from "./dialects/manifest.js";
28
+ import type { PluginFileIndex } from "./files.js";
29
+ import { type Findings } from "./messages.js";
30
+ import type { PluginDialect } from "./types.js";
31
+ /** The open format's `mcp.json`, a fixed location. */
32
+ export declare const OPEN_MCP_CONFIG = "mcp.json";
33
+ export interface ManifestSet {
34
+ /** The dialect that gave the plugin its identity. */
35
+ readonly dialect: PluginDialect;
36
+ /** Identity first, then the others in location order. */
37
+ readonly manifests: readonly DialectManifest[];
38
+ /** The validated plugin name; `undefined` after a name finding. */
39
+ readonly name: string | undefined;
40
+ /** True when a vendor manifest is present, so `agents/*.md` is a component. */
41
+ readonly readsAgents: boolean;
42
+ readonly mcpSources: readonly McpConfigSource[];
43
+ }
44
+ /** True when the directory holds any of the four manifests; the CLI's routing test. */
45
+ export declare function hasPluginManifest(paths: Iterable<string>): boolean;
46
+ /** Read every present manifest; `undefined` (after `no-manifest`) when there is none. */
47
+ export declare function detectManifests(index: PluginFileIndex, findings: Findings): ManifestSet | undefined;
48
+ /** The open format's name rule, applied in every dialect. */
49
+ export declare function isValidPluginName(name: string): boolean;
50
+ //# sourceMappingURL=detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,KAAK,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,sDAAsD;AACtD,eAAO,MAAM,eAAe,aAAa,CAAC;AAQ1C,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,CAAC;CACjD;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAIlE;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAmCnG;AAyDD,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD"}
package/detect.js ADDED
@@ -0,0 +1,164 @@
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. Sub-agent files (`agents/*.md`) are a vendor
24
+ * component: they are read when any vendor manifest is present and recorded
25
+ * as ignored otherwise, since the open format defines no such component.
26
+ */
27
+ import { readClaudeManifest, CLAUDE_DEFAULT_MCP_CONFIG } from "./dialects/claude.js";
28
+ import { readCodexManifest } from "./dialects/codex.js";
29
+ import { readCursorManifest } from "./dialects/cursor.js";
30
+ import { readOpenManifest } from "./dialects/open.js";
31
+ import { parseJsonObject, readText } from "./documents.js";
32
+ import { MANIFEST_LOCATIONS } from "./messages.js";
33
+ /** The open format's `mcp.json`, a fixed location. */
34
+ export const OPEN_MCP_CONFIG = "mcp.json";
35
+ /** The vendor precedence when no root manifest exists. */
36
+ const VENDOR_PRECEDENCE = ["claude", "cursor", "codex"];
37
+ const NAME_MAX_LENGTH = 64;
38
+ const NAME_PATTERN = /^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$/;
39
+ /** True when the directory holds any of the four manifests; the CLI's routing test. */
40
+ export function hasPluginManifest(paths) {
41
+ const locations = new Set(Object.values(MANIFEST_LOCATIONS));
42
+ for (const path of paths)
43
+ if (locations.has(path))
44
+ return true;
45
+ return false;
46
+ }
47
+ /** Read every present manifest; `undefined` (after `no-manifest`) when there is none. */
48
+ export function detectManifests(index, findings) {
49
+ const manifests = [];
50
+ const present = (dialect) => {
51
+ const path = MANIFEST_LOCATIONS[dialect];
52
+ if (!index.has(path))
53
+ return undefined;
54
+ const object = readManifestObject(index, path, findings);
55
+ // An unreadable manifest still counts as present: the finding already
56
+ // says why, and an empty contribution keeps the read going.
57
+ const manifest = object === undefined ? emptyManifest(dialect, path) : readDialect(dialect, object, path, findings);
58
+ manifests.push(manifest);
59
+ return manifest;
60
+ };
61
+ const root = present("agent-plugins");
62
+ const vendors = VENDOR_PRECEDENCE.map(present).filter((m) => m !== undefined);
63
+ if (manifests.length === 0) {
64
+ findings.error("no-manifest");
65
+ return undefined;
66
+ }
67
+ const identity = root ?? vendors[0];
68
+ if (identity === undefined) {
69
+ // Unreachable: manifests is non-empty, so root or vendors[0] exists.
70
+ throw new Error("manifest set without an identity manifest");
71
+ }
72
+ const ordered = [identity, ...manifests.filter((m) => m !== identity)];
73
+ const name = resolveName(identity, ordered, findings);
74
+ return {
75
+ dialect: identity.dialect,
76
+ manifests: ordered,
77
+ name,
78
+ readsAgents: vendors.length > 0,
79
+ mcpSources: resolveMcpSources(index, root, vendors),
80
+ };
81
+ }
82
+ function readManifestObject(index, path, findings) {
83
+ const text = readText(index, path, "manifest", findings);
84
+ return text === undefined ? undefined : parseJsonObject(text, path, "manifest-unreadable", findings);
85
+ }
86
+ function readDialect(dialect, object, path, findings) {
87
+ switch (dialect) {
88
+ case "agent-plugins":
89
+ return readOpenManifest(object, path, findings);
90
+ case "claude":
91
+ return readClaudeManifest(object, path, findings);
92
+ case "cursor":
93
+ return readCursorManifest(object, path, findings);
94
+ case "codex":
95
+ return readCodexManifest(object, path, findings);
96
+ default: {
97
+ const exhaustive = dialect;
98
+ throw new Error(`unknown dialect ${String(exhaustive)}`);
99
+ }
100
+ }
101
+ }
102
+ function emptyManifest(dialect, path) {
103
+ return { dialect, path, identity: {}, skillPaths: [], mcpConfigs: [], ignored: [] };
104
+ }
105
+ function resolveName(identity, all, findings) {
106
+ const name = identity.identity.name;
107
+ if (name === undefined) {
108
+ // An unreadable identity manifest already reported itself; a second
109
+ // finding about its missing name would blame the author twice.
110
+ if (findings.errors.some((f) => f.kind === "manifest-unreadable" && f.path === identity.path))
111
+ return undefined;
112
+ findings.error("manifest-name-missing", { path: identity.path });
113
+ return undefined;
114
+ }
115
+ let valid = true;
116
+ if (!isValidPluginName(name)) {
117
+ findings.error("manifest-name-invalid", { path: identity.path, subject: name });
118
+ valid = false;
119
+ }
120
+ for (const other of all) {
121
+ if (other === identity)
122
+ continue;
123
+ const otherName = other.identity.name;
124
+ if (otherName !== undefined && otherName !== name) {
125
+ findings.error("manifest-name-conflict", {
126
+ path: identity.path,
127
+ subject: name,
128
+ detail: `'${otherName}' in '${other.path}'`,
129
+ });
130
+ valid = false;
131
+ }
132
+ }
133
+ return valid ? name : undefined;
134
+ }
135
+ /** The open format's name rule, applied in every dialect. */
136
+ export function isValidPluginName(name) {
137
+ return name.length <= NAME_MAX_LENGTH && NAME_PATTERN.test(name) && !name.includes("--") && !name.includes("..");
138
+ }
139
+ function resolveMcpSources(index, root, vendors) {
140
+ const sources = [];
141
+ if (root !== undefined && index.has(OPEN_MCP_CONFIG)) {
142
+ sources.push({ kind: "file", path: OPEN_MCP_CONFIG, dialect: "agent-plugins", manifest: root.path });
143
+ }
144
+ for (const vendor of vendors) {
145
+ if (vendor.mcpConfigs.length > 0) {
146
+ sources.push(...vendor.mcpConfigs);
147
+ }
148
+ else if (vendor.dialect !== "cursor" && index.has(CLAUDE_DEFAULT_MCP_CONFIG)) {
149
+ sources.push({ kind: "file", path: CLAUDE_DEFAULT_MCP_CONFIG, dialect: vendor.dialect, manifest: vendor.path });
150
+ }
151
+ }
152
+ // Two manifests may name the same file (Claude and Codex both defaulting
153
+ // to `.mcp.json`); reading it twice would report every server twice.
154
+ const seen = new Set();
155
+ return sources.filter((source) => {
156
+ if (source.kind === "inline")
157
+ return true;
158
+ if (seen.has(source.path))
159
+ return false;
160
+ seen.add(source.path);
161
+ return true;
162
+ });
163
+ }
164
+ //# sourceMappingURL=detect.js.map
package/detect.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAmB,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE5E,OAAO,EAAiB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGlE,sDAAsD;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;AAE1C,0DAA0D;AAC1D,MAAM,iBAAiB,GAAuD,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAE5G,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,YAAY,G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Ae,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACvG,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;aAAM,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,CAAC;YAC/E,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAClH,CAAC;IACH,CAAC;IACD,yEAAyE;IACzE,qEAAqE;IACrE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;QAC/B,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QACxC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The Claude Code manifest (`.claude-plugin/plugin.json`), and the shape the
3
+ * Codex compatibility manifest shares with it.
4
+ *
5
+ * Claude's manifest is optional in its own tool (without one, the directory
6
+ * name is the plugin name) and `name` is its only required field. Path
7
+ * fields are a string or an array of strings, `./`-prefixed: `skills` ADDS
8
+ * to the default `skills/` scan and may name a directory that is itself a
9
+ * skill; `agents` REPLACES the default `agents/` and its entries are files
10
+ * or directories. `mcpServers` is a path, an inline object, or an array of
11
+ * either, defaulting to `.mcp.json` at the plugin root. `userConfig`
12
+ * declares the variables a user is prompted for. Hooks, LSP servers,
13
+ * channels, output styles, workflows and the experimental components are
14
+ * recorded as ignored.
15
+ *
16
+ * The reader is exported with its known-field set so the Codex dialect,
17
+ * whose legacy manifest is this shape plus `apps` and `interface`, reuses it
18
+ * rather than restating it.
19
+ */
20
+ import type { JsonObject } from "../documents.js";
21
+ import type { Findings } from "../messages.js";
22
+ import type { PluginDialect } from "../types.js";
23
+ import { type DialectManifest } from "./manifest.js";
24
+ export declare const CLAUDE_KNOWN_FIELDS: ReadonlySet<string>;
25
+ /** The default MCP configuration file when the manifest declares none. */
26
+ export declare const CLAUDE_DEFAULT_MCP_CONFIG = ".mcp.json";
27
+ export declare function readClaudeManifest(object: JsonObject, path: string, findings: Findings): DialectManifest;
28
+ /** The Claude shape under a given dialect and known-field set (Codex reuses it). */
29
+ export declare function readClaudeShapedManifest(object: JsonObject, path: string, dialect: PluginDialect, known: ReadonlySet<string>, findings: Findings): DialectManifest;
30
+ //# sourceMappingURL=claude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/dialects/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,KAAK,eAAe,EAMrB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAsBlD,CAAC;AAEH,0EAA0E;AAC1E,eAAO,MAAM,yBAAyB,cAAc,CAAC;AAErD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAExG;AAED,oFAAoF;AACpF,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,QAAQ,EAAE,QAAQ,GACjB,eAAe,CAmBjB"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The Claude Code manifest (`.claude-plugin/plugin.json`), and the shape the
3
+ * Codex compatibility manifest shares with it.
4
+ *
5
+ * Claude's manifest is optional in its own tool (without one, the directory
6
+ * name is the plugin name) and `name` is its only required field. Path
7
+ * fields are a string or an array of strings, `./`-prefixed: `skills` ADDS
8
+ * to the default `skills/` scan and may name a directory that is itself a
9
+ * skill; `agents` REPLACES the default `agents/` and its entries are files
10
+ * or directories. `mcpServers` is a path, an inline object, or an array of
11
+ * either, defaulting to `.mcp.json` at the plugin root. `userConfig`
12
+ * declares the variables a user is prompted for. Hooks, LSP servers,
13
+ * channels, output styles, workflows and the experimental components are
14
+ * recorded as ignored.
15
+ *
16
+ * The reader is exported with its known-field set so the Codex dialect,
17
+ * whose legacy manifest is this shape plus `apps` and `interface`, reuses it
18
+ * rather than restating it.
19
+ */
20
+ import { ignoredFieldComponents, readDeclaredPaths, readIdentity, readMcpSources, warnUnknownFields, } from "./manifest.js";
21
+ export const CLAUDE_KNOWN_FIELDS = new Set([
22
+ "name",
23
+ "version",
24
+ "description",
25
+ "author",
26
+ "homepage",
27
+ "repository",
28
+ "license",
29
+ "keywords",
30
+ "skills",
31
+ "commands",
32
+ "agents",
33
+ "workflows",
34
+ "hooks",
35
+ "mcpServers",
36
+ "outputStyles",
37
+ "lspServers",
38
+ "experimental",
39
+ "userConfig",
40
+ "channels",
41
+ "dependencies",
42
+ "defaultEnabled",
43
+ ]);
44
+ /** The default MCP configuration file when the manifest declares none. */
45
+ export const CLAUDE_DEFAULT_MCP_CONFIG = ".mcp.json";
46
+ export function readClaudeManifest(object, path, findings) {
47
+ return readClaudeShapedManifest(object, path, "claude", CLAUDE_KNOWN_FIELDS, findings);
48
+ }
49
+ /** The Claude shape under a given dialect and known-field set (Codex reuses it). */
50
+ export function readClaudeShapedManifest(object, path, dialect, known, findings) {
51
+ warnUnknownFields(object, known, path, findings);
52
+ const identity = readIdentity(object, path, findings);
53
+ const skillPaths = readDeclaredPaths(object, "skills", path, findings) ?? [];
54
+ const agentPaths = readDeclaredPaths(object, "agents", path, findings);
55
+ const declaredMcp = readMcpSources(object, "mcpServers", path, dialect, findings);
56
+ const manifest = {
57
+ dialect,
58
+ path,
59
+ identity,
60
+ skillPaths,
61
+ mcpConfigs: declaredMcp,
62
+ ignored: ignoredFieldComponents(object, path),
63
+ };
64
+ if (agentPaths !== undefined)
65
+ manifest.agentPaths = agentPaths;
66
+ if (object["userConfig"] !== undefined) {
67
+ manifest.variables = { dialect: "claude", value: object["userConfig"], manifest: path };
68
+ }
69
+ return manifest;
70
+ }
71
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/dialects/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAEL,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC;IAC9D,MAAM;IACN,SAAS;IACT,aAAa;IACb,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,SAAS;IACT,UAAU;IACV,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,WAAW;IACX,OAAO;IACP,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,UAAU;IACV,cAAc;IACd,gBAAgB;CACjB,CA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EAAE,IAAI,EAAE,CAAC;IAC1F,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The Codex compatibility manifest (`.codex-plugin/plugin.json`).
3
+ *
4
+ * New Codex packages are the open form: a root `plugin.json` with
5
+ * OpenAI-specific presentation, app mappings and hooks under
6
+ * `extensions["com.openai"]`, which the open reader records as an ignored
7
+ * extension. The legacy `.codex-plugin/plugin.json` that Codex still
8
+ * accepts is the Claude shape (`skills`, `mcpServers`, hooks) plus two
9
+ * fields of its own: `apps` (registered ChatGPT app mappings, `.app.json`)
10
+ * and `interface` (marketplace presentation). Nothing Codex-specific maps
11
+ * to a Stigmer resource, so the reader is the Claude reader under the
12
+ * `codex` dialect with the two extra fields known and `apps` ignored.
13
+ */
14
+ import type { JsonObject } from "../documents.js";
15
+ import type { Findings } from "../messages.js";
16
+ import type { DialectManifest } from "./manifest.js";
17
+ export declare function readCodexManifest(object: JsonObject, path: string, findings: Findings): DialectManifest;
18
+ //# sourceMappingURL=codex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/dialects/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIrD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAEvG"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The Codex compatibility manifest (`.codex-plugin/plugin.json`).
3
+ *
4
+ * New Codex packages are the open form: a root `plugin.json` with
5
+ * OpenAI-specific presentation, app mappings and hooks under
6
+ * `extensions["com.openai"]`, which the open reader records as an ignored
7
+ * extension. The legacy `.codex-plugin/plugin.json` that Codex still
8
+ * accepts is the Claude shape (`skills`, `mcpServers`, hooks) plus two
9
+ * fields of its own: `apps` (registered ChatGPT app mappings, `.app.json`)
10
+ * and `interface` (marketplace presentation). Nothing Codex-specific maps
11
+ * to a Stigmer resource, so the reader is the Claude reader under the
12
+ * `codex` dialect with the two extra fields known and `apps` ignored.
13
+ */
14
+ import { CLAUDE_KNOWN_FIELDS, readClaudeShapedManifest } from "./claude.js";
15
+ const KNOWN_FIELDS = new Set([...CLAUDE_KNOWN_FIELDS, "apps", "interface"]);
16
+ export function readCodexManifest(object, path, findings) {
17
+ return readClaudeShapedManifest(object, path, "codex", KNOWN_FIELDS, findings);
18
+ }
19
+ //# sourceMappingURL=codex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/dialects/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAG5E,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,GAAG,mBAAmB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAEjG,MAAM,UAAU,iBAAiB,CAAC,MAAkB,EAAE,IAAY,EAAE,QAAkB;IACpF,OAAO,wBAAwB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AACjF,CAAC"}