ctxr-cli 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +21 -201
  2. package/README.md +14 -9
  3. package/dist/commands/plugin-build.d.ts +21 -11
  4. package/dist/commands/plugin-build.d.ts.map +1 -1
  5. package/dist/commands/plugin-build.js +45 -24
  6. package/dist/commands/plugin-build.js.map +1 -1
  7. package/dist/core/command.d.ts +5 -3
  8. package/dist/core/command.d.ts.map +1 -1
  9. package/dist/core/mcp/surface.js +1 -1
  10. package/dist/core/mcp/surface.js.map +1 -1
  11. package/dist/core/mcp/sync.d.ts +4 -1
  12. package/dist/core/mcp/sync.d.ts.map +1 -1
  13. package/dist/core/mcp/sync.js +6 -5
  14. package/dist/core/mcp/sync.js.map +1 -1
  15. package/dist/core/mcp/tool-map.d.ts +13 -11
  16. package/dist/core/mcp/tool-map.d.ts.map +1 -1
  17. package/dist/core/mcp/tool-map.js +13 -11
  18. package/dist/core/mcp/tool-map.js.map +1 -1
  19. package/dist/core/mcp/tools/gather.d.ts.map +1 -1
  20. package/dist/core/mcp/tools/gather.js +5 -4
  21. package/dist/core/mcp/tools/gather.js.map +1 -1
  22. package/dist/core/mcp/tools/index.d.ts +9 -1
  23. package/dist/core/mcp/tools/index.d.ts.map +1 -1
  24. package/dist/core/mcp/tools/index.js +20 -3
  25. package/dist/core/mcp/tools/index.js.map +1 -1
  26. package/dist/core/plugin/build.d.ts +53 -26
  27. package/dist/core/plugin/build.d.ts.map +1 -1
  28. package/dist/core/plugin/build.js +153 -50
  29. package/dist/core/plugin/build.js.map +1 -1
  30. package/dist/core/plugin/commands.d.ts +11 -0
  31. package/dist/core/plugin/commands.d.ts.map +1 -0
  32. package/dist/core/plugin/commands.js +23 -0
  33. package/dist/core/plugin/commands.js.map +1 -0
  34. package/dist/core/plugin/routes.d.ts +11 -7
  35. package/dist/core/plugin/routes.d.ts.map +1 -1
  36. package/dist/core/plugin/routes.js +27 -24
  37. package/dist/core/plugin/routes.js.map +1 -1
  38. package/dist/core/session/submit.d.ts.map +1 -1
  39. package/dist/core/session/submit.js +6 -3
  40. package/dist/core/session/submit.js.map +1 -1
  41. package/dist/core/shared-stores.d.ts +5 -0
  42. package/dist/core/shared-stores.d.ts.map +1 -1
  43. package/dist/core/shared-stores.js +10 -0
  44. package/dist/core/shared-stores.js.map +1 -1
  45. package/dist/core/skill-placeholders.d.ts +51 -0
  46. package/dist/core/skill-placeholders.d.ts.map +1 -0
  47. package/dist/core/skill-placeholders.js +55 -0
  48. package/dist/core/skill-placeholders.js.map +1 -0
  49. package/dist/core/skills.d.ts +37 -12
  50. package/dist/core/skills.d.ts.map +1 -1
  51. package/dist/core/skills.js +78 -89
  52. package/dist/core/skills.js.map +1 -1
  53. package/dist/run.d.ts.map +1 -1
  54. package/dist/run.js +25 -6
  55. package/dist/run.js.map +1 -1
  56. package/dist/version.d.ts +1 -1
  57. package/dist/version.js +1 -1
  58. package/package.json +3 -2
  59. package/templates/mcp/server-instructions.md +16 -0
  60. package/templates/plugin/README.md +30 -8
  61. package/templates/plugin/chatgpt-README.md +16 -0
  62. package/templates/plugin/claude-plugin.json +9 -1
  63. package/templates/plugin/command.md +7 -0
  64. package/templates/plugin/page.html +19 -8
  65. package/templates/skills/_surfaces.md +30 -0
  66. package/templates/skills/ctxr-placement.md +1 -1
  67. package/templates/skills/ctxr-session-lifecycle.md +6 -5
  68. package/templates/skills/mcp/_layer-step.md +18 -0
  69. package/templates/skills/mcp/_relation-grouping-step.md +5 -0
  70. package/templates/plugin/claude-mcp.json +0 -8
  71. package/templates/skills/mcp/_preamble.md +0 -44
package/LICENSE CHANGED
@@ -1,201 +1,21 @@
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
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rui Xue
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -469,21 +469,26 @@ curl -i https://ctx.example.com/.well-known/oauth-authorization-server # 200,
469
469
  curl -i -X POST https://ctx.example.com/mcp # 401 with WWW-Authenticate: Bearer resource_metadata=…
470
470
  ```
471
471
 
472
- **Installing the plugin.** The plugin is what gives an app the store's skills as well as its tools, so an agent in Claude or ChatGPT follows the same session practice as a local one. `serve` offers it at `https://ctx.example.com/plugin/`, a page naming two downloads, one for each app: `contexture-<store>-claude.zip` and `contexture-<store>-chatgpt.zip`. The page and both downloads need the same verified identity as the approval page, and only people the `mcp` block admits get them, so keep `/plugin/` behind the access proxy, outside the Bypass list above. Each person installs it once:
472
+ **Installing the skills and the connector.** Two things connect an app to a store, and each person sets each up once:
473
473
 
474
- - **Claude:** Customize → Plugins → *Add* → *Upload plugin*, and pick the Claude download.
475
- - **ChatGPT:** a workspace admin uploads the ChatGPT download for the whole workspace; without an admin, turn on developer mode and upload it there.
474
+ - **contexture's plugin** gives the app the skills, so an agent in Claude follows the same session practice as a local one. It is the same plugin for every store and lives in this repository, at [`plugins/contexture/`](plugins/contexture/), listed by the `contexture` marketplace in [`.claude-plugin/marketplace.json`](.claude-plugin/marketplace.json). In Claude: Customize → Plugins → *Add* → *Add marketplace*, enter `ayxuerui/contexture`, turn on **Sync automatically**, and install `contexture` (`contexture@contexture`). It needs no GitHub account, and with Sync on Claude installs each release by itself: the plugin's version is the CLI's, so a new copy arrives when a release merges and not between releases. It also carries typed commands that open its entry-point skills: `/contexture:capture`, `/contexture:ingest`, `/contexture:research`, `/contexture:rollup`, `/contexture:mission`, `/contexture:session` and `/contexture:submit`. A plugin added on claude.ai also syncs into Claude Code, where it says what the store's own copies say.
475
+ - **The store's connector** reaches one store. In Claude: Customize → Connectors → *Add custom connector*, with the URL `https://ctx.example.com/mcp`. In ChatGPT, turn on developer mode and add a connector with the same URL and OAuth. Someone in two stores adds two connectors; the skills work with whichever is attached and ask which store is meant when it is unclear.
476
476
 
477
- Each plugin carries the store's skills, rendered from the same templates as the skill copies in the store under a preamble that maps every `ctxr`, `git` and `gh` step onto the server's tools, and one server entry naming `serve.base_url` and `/mcp`. It carries no credential: the app signs in through the store's own login. Its version is the CLI's version plus the commit it was built from, so download it again after upgrading `ctxr` or changing the skills. To hand the plugin out yourself, for instance to a Claude organization's or ChatGPT workspace's admin, build it from a checkout:
477
+ The plugin carries no connector, because one plugin serves every store. Its skills name each store setting by a placeholder such as `<inbox path>` or `<default branch>`, and the connector's instructions answer them: the instructions `serve` returns when an app connects end with a *This store* section giving the store's value for each placeholder, its layers with their descriptions, the relation vocabulary and the server's ctxr version. Each shared skill is one text on both surfaces, the same as the store's own copy apart from those values. It opens with one short section, in the store's copies too: which store the person means, whether to work in a shell (a checkout of that store) or through its connector, and how a `ctxr` step, a path and a commit are done through the server. The few shell-only steps say at the step what to do through the server instead. A store's server can run an older ctxr than the plugin; when a skill names a tool the connector does not offer, the agent says so and skips that step rather than improvising a write.
478
+
479
+ **The connect page.** `serve` answers `https://ctx.example.com/plugin/` with a page giving a member both steps: the marketplace and plugin for Claude, and this store's connector address with how to add it in each app. It also links the store's ChatGPT plugin, `contexture-<store>-chatgpt.zip`: ChatGPT has no marketplace on personal plans, so its plugin stays the store's own download, bundling the same skills and the store's connector. A workspace admin uploads it for the whole workspace; without an admin, turn on developer mode and upload it there. ChatGPT does not update an uploaded plugin, so download it again after a release. The page and the download need the same verified identity as the approval page, and only people the `mcp` block admits get them, so keep `/plugin/` behind the access proxy, outside the Bypass list above. Someone who uploaded an earlier `contexture-<store>` plugin to Claude removes it once they install `contexture`, and keeps their connector.
480
+
481
+ To build the plugins yourself:
478
482
 
479
483
  ```sh
480
- ctxr plugin build # both plugins, as directories and zips, under .contexture/cache/plugin/
481
- ctxr plugin build --out dist/ # somewhere else
484
+ ctxr plugin build # outside a store: contexture's Claude plugin, under ./contexture-plugin/
485
+ ctxr plugin build # inside a store with mcp: also its ChatGPT plugin, under .contexture/cache/plugin/
486
+ ctxr plugin build --out dist/ # somewhere else
482
487
  ```
483
488
 
484
- It refuses with exit `2`, writing nothing, on a store without an `mcp` block.
489
+ Each plugin is written as a directory (`contexture/`, `chatgpt/`) and a zip beside it. A store without an `mcp` block gets the Claude plugin alone, with a notice. If the marketplace ever has to be withdrawn, members can upload `contexture-claude.zip` from a build instead, and keep their store connector; an uploaded plugin does not update itself. In this repository, `npm run plugin` regenerates `plugins/contexture/`, and a test fails any change whose committed plugin differs from a fresh build.
485
490
 
486
- **Connecting without the plugin.** In Claude: Settings → Connectors → *Add custom connector*, with the URL `https://ctx.example.com/mcp`. In ChatGPT, turn on developer mode and add a connector with the same URL and OAuth. Reads come from a checkout `serve` keeps for itself under `.contexture/cache/mcp/view`, brought up to date from `origin` at most once a minute. It never touches the checkout your agents work in. Each MCP request writes one line to `serve`'s stderr, naming the person, the method and the tool, but never the arguments or the results.
491
+ **Where reads come from.** Reads come from a checkout `serve` keeps for itself under `.contexture/cache/mcp/view`, brought up to date from `origin` at most once a minute. It never touches the checkout your agents work in. Each MCP request writes one line to `serve`'s stderr, naming the person, the method and the tool, but never the arguments or the results.
487
492
 
488
493
  ## Keeping a store current
489
494
 
@@ -548,7 +553,7 @@ To pin a value against a future default change, declare it. Nothing rewrites wha
548
553
  | `shared-stores sync \| status` | Clone and fast-forward the stores this store mounts under `shared/`, or report their state |
549
554
  | `adapters generate` | Regenerate harness outputs (`ctxr update` does this too) |
550
555
  | `serve` | Read the store in a browser |
551
- | `plugin build [--out <dir>]` | Build the Claude and ChatGPT plugins: the store's skills and its MCP server |
556
+ | `plugin build [--out <dir>]` | Build contexture's Claude plugin (no store needed) and, in a store with `mcp`, its ChatGPT plugin with its connector |
552
557
  | `update` | Bring contexture-owned files up to the installed version |
553
558
  | `version [--check]` | Report the installed version; `--check` compares it against the latest published release |
554
559
  | `verify [--portable]` | Exercise core store operations end to end |
@@ -2,32 +2,42 @@ import type { CommandOutcome, CommandRequires } from '../core/command.js';
2
2
  import type { RunEnv } from '../core/env.js';
3
3
  import { type PluginTarget } from '../core/plugin/build.js';
4
4
  import type { Store } from '../core/store.js';
5
+ /** publish-one-contexture-plugin D1: contexture's own plugin needs no store; inside one, the store's ChatGPT plugin is written too. */
5
6
  export declare const requires: CommandRequires;
6
- /** serve-the-session-lifecycle-to-chat-apps D7: under the derived cache, which no commit carries. */
7
+ /** serve-the-session-lifecycle-to-chat-apps D7: in a store, under the derived cache, which no commit carries. */
7
8
  export declare const DEFAULT_PLUGIN_OUT = ".contexture/cache/plugin";
9
+ /** publish-one-contexture-plugin D1: outside a store, a directory of its own under the working directory, never the directory itself. */
10
+ export declare const DEFAULT_GENERAL_PLUGIN_OUT = "contexture-plugin";
11
+ /**
12
+ * Where each plugin's directory goes under `--out`. The Claude plugin's is its
13
+ * name, so `--out plugins` in contexture's repository writes the marketplace's
14
+ * `plugins/contexture/` (publish-one-contexture-plugin revision 9).
15
+ */
16
+ export declare const PLUGIN_DIRECTORIES: Readonly<Record<PluginTarget, string>>;
8
17
  export interface PluginBuildFlags {
9
18
  out?: string;
10
19
  }
11
20
  export interface PluginBuildData {
12
- name: string;
13
- version: string;
14
- mcp_url: string;
15
21
  out: string;
16
22
  skills: string[];
23
+ /** The store's connector address, which only its ChatGPT plugin carries; null when no ChatGPT plugin was written. */
24
+ mcp_url: string | null;
17
25
  plugins: {
18
26
  target: PluginTarget;
27
+ name: string;
28
+ version: string;
19
29
  directory: string;
20
30
  archive: string;
21
31
  files: number;
22
32
  }[];
23
33
  }
24
34
  /**
25
- * harness-portability spec, *`ctxr plugin build` writes the store's chat-app
26
- * plugins*: the Claude and ChatGPT plugins, each as a directory and as an
27
- * archive. A store with no `mcp` block is refused before anything is written,
28
- * by the builder's own configuration error. Each run replaces the two plugin
29
- * directories whole, so a skill the plugin no longer carries leaves nothing
30
- * behind.
35
+ * harness-portability spec, *contexture publishes one plugin for every store*:
36
+ * contexture's Claude plugin, with no connector and the CLI's version, and,
37
+ * in a store that declares `mcp`, that store's ChatGPT plugin with its
38
+ * connector — each as a directory and an archive. A store without the block
39
+ * gets the Claude plugin and a notice. Each run replaces the plugin
40
+ * directories whole, so a skill the plugin no longer carries leaves nothing behind.
31
41
  */
32
- export declare function execute(env: RunEnv, store: Store, flags: PluginBuildFlags): Promise<CommandOutcome<PluginBuildData>>;
42
+ export declare function execute(env: RunEnv, store: Store | null, flags: PluginBuildFlags): Promise<CommandOutcome<PluginBuildData>>;
33
43
  //# sourceMappingURL=plugin-build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-build.d.ts","sourceRoot":"","sources":["../../src/commands/plugin-build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAA8C,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACxG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG9C,eAAO,MAAM,QAAQ,EAAE,eAAuC,CAAC;AAE/D,qGAAqG;AACrG,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MA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;IACjB,qHAAqH;IACrH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE;QAAE,MAAM,EAAE,YAAY,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvH;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CA8CjI"}
@@ -2,30 +2,49 @@ import { mkdir, rm } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { ExitCode } from '../core/exit-codes.js';
4
4
  import { writeFileAtomic } from '../core/fs/atomic.js';
5
- import { buildPlugins, renderedCommit, storeNameFor } from '../core/plugin/build.js';
5
+ import { buildChatgptPlugin, buildClaudePlugin, CLAUDE_PLUGIN_NAME, renderedCommit, storeNameFor } from '../core/plugin/build.js';
6
6
  import { CLI_VERSION } from '../version.js';
7
- export const requires = { store: 'required' };
8
- /** serve-the-session-lifecycle-to-chat-apps D7: under the derived cache, which no commit carries. */
7
+ /** publish-one-contexture-plugin D1: contexture's own plugin needs no store; inside one, the store's ChatGPT plugin is written too. */
8
+ export const requires = { store: 'optional' };
9
+ /** serve-the-session-lifecycle-to-chat-apps D7: in a store, under the derived cache, which no commit carries. */
9
10
  export const DEFAULT_PLUGIN_OUT = '.contexture/cache/plugin';
11
+ /** publish-one-contexture-plugin D1: outside a store, a directory of its own under the working directory, never the directory itself. */
12
+ export const DEFAULT_GENERAL_PLUGIN_OUT = 'contexture-plugin';
10
13
  /**
11
- * harness-portability spec, *`ctxr plugin build` writes the store's chat-app
12
- * plugins*: the Claude and ChatGPT plugins, each as a directory and as an
13
- * archive. A store with no `mcp` block is refused before anything is written,
14
- * by the builder's own configuration error. Each run replaces the two plugin
15
- * directories whole, so a skill the plugin no longer carries leaves nothing
16
- * behind.
14
+ * Where each plugin's directory goes under `--out`. The Claude plugin's is its
15
+ * name, so `--out plugins` in contexture's repository writes the marketplace's
16
+ * `plugins/contexture/` (publish-one-contexture-plugin revision 9).
17
+ */
18
+ export const PLUGIN_DIRECTORIES = { claude: CLAUDE_PLUGIN_NAME, chatgpt: 'chatgpt' };
19
+ /**
20
+ * harness-portability spec, *contexture publishes one plugin for every store*:
21
+ * contexture's Claude plugin, with no connector and the CLI's version, and,
22
+ * in a store that declares `mcp`, that store's ChatGPT plugin with its
23
+ * connector — each as a directory and an archive. A store without the block
24
+ * gets the Claude plugin and a notice. Each run replaces the plugin
25
+ * directories whole, so a skill the plugin no longer carries leaves nothing behind.
17
26
  */
18
27
  export async function execute(env, store, flags) {
19
- const bundle = buildPlugins({
20
- config: store.config,
21
- storeName: await storeNameFor(env.git, store.root),
22
- cliVersion: CLI_VERSION,
23
- commit: await renderedCommit(env.git, store.root),
24
- });
25
- const out = flags.out === undefined ? path.join(store.root, DEFAULT_PLUGIN_OUT) : path.resolve(env.cwd, flags.out);
28
+ const built = [buildClaudePlugin(CLI_VERSION)];
29
+ let mcpUrl = null;
30
+ const notices = [];
31
+ if (store !== null && store.config.mcp !== undefined) {
32
+ const chatgpt = buildChatgptPlugin({
33
+ config: store.config,
34
+ storeName: await storeNameFor(env.git, store.root),
35
+ cliVersion: CLI_VERSION,
36
+ commit: await renderedCommit(env.git, store.root),
37
+ });
38
+ built.push(chatgpt);
39
+ mcpUrl = chatgpt.mcpUrl;
40
+ }
41
+ else if (store !== null) {
42
+ notices.push("plugin build: this store declares no mcp block, so no ChatGPT plugin was written; contexture's Claude plugin needs none.");
43
+ }
44
+ const out = flags.out !== undefined ? path.resolve(env.cwd, flags.out) : store !== null ? path.join(store.root, DEFAULT_PLUGIN_OUT) : path.resolve(env.cwd, DEFAULT_GENERAL_PLUGIN_OUT);
26
45
  const plugins = [];
27
- for (const plugin of bundle.plugins) {
28
- const directory = path.join(out, plugin.target);
46
+ for (const plugin of built) {
47
+ const directory = path.join(out, PLUGIN_DIRECTORIES[plugin.target]);
29
48
  await rm(directory, { recursive: true, force: true });
30
49
  for (const [file, content] of plugin.files) {
31
50
  const target = path.join(directory, ...file.split('/'));
@@ -34,18 +53,20 @@ export async function execute(env, store, flags) {
34
53
  }
35
54
  const archive = path.join(out, plugin.archiveName);
36
55
  await writeFileAtomic(archive, plugin.archive);
37
- plugins.push({ target: plugin.target, directory, archive, files: plugin.files.size });
56
+ plugins.push({ target: plugin.target, name: plugin.name, version: plugin.version, directory, archive, files: plugin.files.size });
38
57
  }
58
+ const skills = built[0].skills;
39
59
  return {
40
60
  exitCode: ExitCode.Ok,
41
- data: { name: bundle.name, version: bundle.version, mcp_url: bundle.mcpUrl, out, skills: bundle.skills, plugins },
61
+ data: { out, skills, mcp_url: mcpUrl, plugins },
42
62
  findings: [],
43
63
  humanSummary: [
44
- `built ${bundle.name} ${bundle.version} (${bundle.skills.length} skills, server ${bundle.mcpUrl})`,
45
- ...plugins.map((p) => ` ${p.target}: ${p.archive}`),
64
+ `built ${plugins.length === 1 ? 'one plugin' : `${plugins.length} plugins`} (${skills.length} skills)`,
65
+ ...plugins.map((p) => ` ${p.target}: ${p.name} ${p.version}, ${p.directory} and ${p.archive}${p.target === 'chatgpt' && mcpUrl !== null ? ` (server ${mcpUrl})` : ''}`),
46
66
  ].join('\n'),
47
- storeRoot: store.root,
48
- schemaVersion: store.config.schema_version,
67
+ notices,
68
+ storeRoot: store?.root ?? null,
69
+ schemaVersion: store?.config.schema_version ?? null,
49
70
  };
50
71
  }
51
72
  //# sourceMappingURL=plugin-build.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-build.js","sourceRoot":"","sources":["../../src/commands/plugin-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBA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AAE,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;SACzK,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,OAAO;QACP,SAAS,EAAE,KAAK,EAAE,IAAI,IAAI,IAAI;QAC9B,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,cAAc,IAAI,IAAI;KACpD,CAAC;AACJ,CAAC"}
@@ -2,14 +2,16 @@ import type { Finding } from './envelope.js';
2
2
  import type { ExitCode } from './exit-codes.js';
3
3
  /**
4
4
  * Declarative, per-command metadata read uniformly by run.ts's dispatcher —
5
- * `init` is the one command that declares `store: 'absent'`; every other
6
- * command requires an already-opened store. This is what keeps `init`'s
5
+ * `init` is the one command that declares `store: 'absent'`, and `plugin
6
+ * build` the one that declares `store: 'optional'` (contexture's own plugin
7
+ * needs no store, publish-one-contexture-plugin D1); every other command
8
+ * requires an already-opened store. This is what keeps `init`'s
7
9
  * exception to the usual git-check/schema-gate an enumerated, testable fact
8
10
  * rather than an `if (commandName === 'init')` special case in the
9
11
  * dispatcher.
10
12
  */
11
13
  export interface CommandRequires {
12
- store: 'required' | 'absent';
14
+ store: 'required' | 'absent' | 'optional';
13
15
  }
14
16
  export interface CommandOutcome<TData> {
15
17
  exitCode: ExitCode;
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/core/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc,CAAC,KAAK;IACnC,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/core/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC3C;AAED,MAAM,WAAW,cAAc,CAAC,KAAK;IACnC,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B"}
@@ -118,7 +118,7 @@ export class McpSurface {
118
118
  mutex: this.mutex,
119
119
  baseUrl: config.serve?.base_url,
120
120
  });
121
- const instructions = serverInstructions(storeName);
121
+ const instructions = serverInstructions(storeName, config);
122
122
  await handleMcpRequest({
123
123
  originAllowed: (origin) => origin === issuer,
124
124
  authenticate: (r) => oauth.auth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Z,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;oBACtB,IAAI,CAAE,SAAS,CAAC,MAA4B,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;wBAClE,MAAM,IAAI,WAAW,CAAC,wBAAwB,EAAE,YAAY,IAAI,CAAC,IAAI,gBAAgB,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC;oBAC7G,CAAC;gBACH,CAAC;gBACD,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,YAAY,eAAe,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;aAChJ,CAAC;SACH,EACD,GAAG,EACH,GAAG,EACH,QAAQ,CACT,CAAC;IACJ,CAAC;CACF"}
@@ -77,7 +77,10 @@ export declare class McpView {
77
77
  private syncOnce;
78
78
  /** Forced, detached, and cleaned of untracked files — the view is this surface's alone. Null on success. */
79
79
  private checkout;
80
- /** The configuration committed at the view's commit, and that commit's graph. */
80
+ /**
81
+ * The configuration committed at the view's commit, and that commit's graph — built over the read view, as
82
+ * `ctxr graph build` builds it, so doctor's staleness check in the view compares like with like (#233).
83
+ */
81
84
  private rebuild;
82
85
  /** Back to `commit` with its graph; null on success, else why not. */
83
86
  private restore;
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/core/mcp/sync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAA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C,oGAAoG;IACpG,OAAO,CAAC,UAAU,CAAqB;IAEvC,YAA6B,OAAO,EAAE,WAAW,EAEhD;IAED,OAAO,CAAC,GAAG;IAIX,IAAI,KAAK,IAAI,UAAU,CAEtB;IAED,yGAAyG;IACnG,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG;QAAE,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC,CASvH;IAED,4HAA4H;IACtH,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3C;YAEa,SAAS;YAUT,UAAU;IAaxB,0DAA0D;YAC5C,QAAQ;IAwDtB,4GAA4G;YAC9F,QAAQ;IAOtB;;;OAGG;YACW,OAAO;IASrB,sEAAsE;YACxD,OAAO;IAWrB;;;;OAIG;YACW,WAAW;CA2B1B"}
@@ -7,9 +7,8 @@ import { runRemoteGit } from '../forge/credentials.js';
7
7
  import { isUnderAnyPrefix } from '../fs/prefix.js';
8
8
  import { pruneWorktrees } from '../git/worktree.js';
9
9
  import { renderGraphDocument } from '../graph/document.js';
10
- import { buildGraphFromNotes, graphBuildOptions } from '../graph/model.js';
11
10
  import { readGraph, writeGraph, writeGraphDocument } from '../graph/persist.js';
12
- import { listNotes } from '../notes/list.js';
11
+ import { buildReadViewGraph } from '../shared-stores.js';
13
12
  import { ToolRefusal } from './jsonrpc.js';
14
13
  import { ReadWriteLock } from './rwlock.js';
15
14
  /**
@@ -154,12 +153,14 @@ export class McpView {
154
153
  await this.run(['clean', '-fdq'], viewRoot);
155
154
  return null;
156
155
  }
157
- /** The configuration committed at the view's commit, and that commit's graph. */
156
+ /**
157
+ * The configuration committed at the view's commit, and that commit's graph — built over the read view, as
158
+ * `ctxr graph build` builds it, so doctor's staleness check in the view compares like with like (#233).
159
+ */
158
160
  async rebuild(viewRoot) {
159
161
  const config = await readConfig(viewRoot, MIGRATION_STEPS);
160
162
  const store = { root: viewRoot, config };
161
- const notes = await listNotes(store.root, store.config);
162
- const graph = buildGraphFromNotes(notes, graphBuildOptions(store.config));
163
+ const { graph } = await buildReadViewGraph(store.root, store.config);
163
164
  await writeGraph(store, graph);
164
165
  await writeGraphDocument(store, renderGraphDocument(graph, store.config.retrieval.graph).text);
165
166
  return store;