create-codemodekit 0.3.0 → 0.4.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.
@@ -1,44 +0,0 @@
1
- ---
2
- name: build-codemodekit-plugin
3
- description: Scaffold, retrofit, or maintain CodeModeKit servers and portable Agent Plugins with companion runtime skills. Use when creating a Code Mode MCP wrapper from an MCP command, adding Agent Plugins 1.0 packaging, refreshing generated tool TypeScript, configuring tool policy, installing a plugin into Cursor, or diagnosing a generated CodeModeKit project.
4
- ---
5
-
6
- # Build a CodeModeKit Plugin
7
-
8
- Prefer CodeModeKit's generator and lifecycle commands over hand-writing manifests, bundles, or generated tool declarations.
9
-
10
- ## Create a new project
11
-
12
- 1. Identify a short source name and a shell-free MCP executable plus arguments.
13
- 2. Run:
14
-
15
- ```sh
16
- npm create codemodekit@latest <directory> -- \
17
- --mcp-name <source-name> \
18
- --mcp-command '<executable> [args...]' \
19
- --agent-plugin
20
- ```
21
-
22
- 3. Inspect `src/server.mjs`, `plugin.json`, `mcp.json`, and the generated runtime skill before changing defaults.
23
- 4. Keep credentials outside committed files. Pass an env-file argument to the upstream executable when it supports one; do not embed secrets in `mcp.json`.
24
- 5. Run `npm run plugin:sync` after credentials and the upstream MCP are available.
25
- 6. Run `npm run plugin:build` to recreate the self-contained `dist/plugin` package.
26
- 7. Test `npm start` through an MCP client and confirm both `run_typescript` and `search_tools` are advertised.
27
-
28
- Read [references/generator.md](references/generator.md) for flags and lifecycle commands.
29
-
30
- ## Update an existing project
31
-
32
- Preserve the one-file server unless the integration genuinely needs more structure. Use `scaffoldAgentPlugin` for portable manifests and the companion skill, and use `syncAgentPluginSkill` with the project's `CodeMode` instance to refresh catalog-derived references. Never hand-edit `tools.d.ts`; it is generated output.
33
-
34
- Read [references/programmatic-api.md](references/programmatic-api.md) for the builder contracts and [references/plugin-layout.md](references/plugin-layout.md) for generated-file ownership.
35
-
36
- ## Validate
37
-
38
- - Treat a failed dependency install or plugin build as a generator failure; do not report the project as ready.
39
- - Treat a failed catalog sync as recoverable when the upstream MCP merely needs credentials or connectivity. Keep the pending references and report the exact `npm run plugin:sync` follow-up.
40
- - Reject partial snapshots when any source is unavailable.
41
- - Keep `SKILL.md` procedural and compact. Put generated schemas, TypeScript declarations, result semantics, and examples in `references/`.
42
- - Tell runtime agents to search large declaration references for focused matches instead of loading an entire catalog into context.
43
- - Preserve `search_tools` as a live fallback for pending, stale, or dynamic catalogs.
44
- - Reinstall the Cursor copy after changing source, policy, metadata, or generated references.
@@ -1,4 +0,0 @@
1
- interface:
2
- display_name: "Build CodeModeKit Plugin"
3
- short_description: "Scaffold and maintain CodeModeKit Agent Plugins"
4
- default_prompt: "Build or update a portable CodeModeKit Agent Plugin with a companion runtime skill."
@@ -1,42 +0,0 @@
1
- # Generator reference
2
-
3
- ## Minimal server
4
-
5
- ```sh
6
- npm create codemodekit@latest my-code-mode -- \
7
- --mcp-name upstream \
8
- --mcp-command 'uvx upstream-mcp'
9
- ```
10
-
11
- Dependency installation is automatic. Use `--no-install` only when installation must happen later. The generator also installs this development-time skill at `.agents/skills/build-codemodekit-plugin`; use `--no-authoring-skill` to omit it.
12
-
13
- ## Agent Plugin
14
-
15
- Add `--agent-plugin` to generate the portable manifests, companion Agent Skill, catalog references, and self-contained `dist/plugin` artifact. After installation, the generator attempts a live catalog sync. Use `--no-sync` to leave the references pending intentionally.
16
-
17
- The generated package includes:
18
-
19
- ```json
20
- {
21
- "scripts": {
22
- "start": "node src/server.mjs",
23
- "plugin:sync": "node src/server.mjs --sync-plugin",
24
- "plugin:build": "codemodekit-plugin build",
25
- "plugin:install:cursor": "codemodekit-plugin install cursor",
26
- "plugin:status:cursor": "codemodekit-plugin status cursor",
27
- "plugin:uninstall:cursor": "codemodekit-plugin uninstall cursor"
28
- }
29
- }
30
- ```
31
-
32
- `plugin:install:cursor` rebuilds the artifact, copies it into Cursor's local plugin directory, and resolves concrete Node and server paths for Cursor. Reload Cursor after install. Re-run the command after source or catalog changes.
33
-
34
- ## Tool policy
35
-
36
- `--policy allow-all` is the runnable default. It allows every tool advertised by configured sources, subject to restrictions enforced by the upstream server itself.
37
-
38
- Use `--policy deny-all` when the generated server must begin closed. Replace the policy in `src/server.mjs` with an explicit application policy before expecting tool calls to succeed.
39
-
40
- ## Command parsing
41
-
42
- `--mcp-command` is parsed into one executable and an argument array without a shell. Quotes and backslash escaping are supported. Pipes, redirects, command substitution, and leading environment assignments are rejected.
@@ -1,38 +0,0 @@
1
- # Generated plugin layout
2
-
3
- ```text
4
- my-code-mode/
5
- ├── .agents/skills/build-codemodekit-plugin/
6
- ├── dist/plugin/
7
- │ ├── emscripten-module.wasm
8
- │ ├── mcp.json
9
- │ ├── plugin.json
10
- │ ├── server.mjs
11
- │ └── skills/
12
- ├── package.json
13
- ├── plugin.json
14
- ├── mcp.json
15
- ├── src/
16
- │ └── server.mjs
17
- └── skills/
18
- └── use-upstream-codemode/
19
- ├── SKILL.md
20
- └── references/
21
- ├── catalog-metadata.json
22
- ├── examples.md
23
- ├── result-contract.md
24
- ├── runtime.md
25
- └── tools.d.ts
26
- ```
27
-
28
- ## Ownership
29
-
30
- - The developer owns `src/server.mjs`, tool policy, provider configuration, and plugin metadata.
31
- - CodeModeKit owns generated `tools.d.ts`, `catalog-metadata.json`, and `dist/plugin`.
32
- - The generated runtime `SKILL.md` contains stable procedure and should stay small.
33
- - `runtime.md`, `result-contract.md`, and `examples.md` are scaffolded reference templates and may be tailored when an integration needs additional guidance.
34
- - `.agents/skills/build-codemodekit-plugin` is development-time authoring guidance and is intentionally excluded from the portable plugin artifact.
35
-
36
- `mcp.json` exposes the bundled Code Mode server to an Agent Plugins client. The upstream MCP remains configured inside `src/server.mjs`; it is not exposed as a second direct server that would bypass Code Mode policy and sandboxing.
37
-
38
- The portable `dist/plugin/mcp.json` uses `${PLUGIN_ROOT}` as required by Agent Plugins. Cursor installation produces a separate concrete copy because Cursor currently needs absolute executable and server paths for local plugins.
@@ -1,48 +0,0 @@
1
- # Programmatic API
2
-
3
- Import the builders from `create-codemodekit`.
4
-
5
- ## Scaffold the full project
6
-
7
- ```ts
8
- import { parseMcpCommand, scaffoldCodeModeMcp } from "create-codemodekit";
9
-
10
- const result = await scaffoldCodeModeMcp({
11
- targetDirectory: "my-code-mode",
12
- mcpName: "upstream",
13
- mcpCommand: parseMcpCommand("uvx upstream-mcp"),
14
- agentPlugin: true,
15
- });
16
- ```
17
-
18
- Installation and the project authoring skill default to enabled. Pass `install: false` or `authoringSkill: false` only when intentionally deferring those steps.
19
-
20
- `agentPlugin` also accepts configuration:
21
-
22
- ```ts
23
- agentPlugin: {
24
- pluginName: "my-code-mode",
25
- skillName: "use-my-code-mode",
26
- description: "Use the upstream service through Code Mode.",
27
- license: "Apache-2.0",
28
- sync: true,
29
- }
30
- ```
31
-
32
- ## Scaffold only plugin components
33
-
34
- Use `scaffoldAgentPlugin` when a project already owns its server entrypoint. It writes `plugin.json`, `mcp.json`, the companion `SKILL.md`, and pending references.
35
-
36
- Use `buildAgentPlugin` to create the dependency-free `dist/plugin` artifact. Use `installCursorPlugin`, `getCursorPluginStatus`, and `uninstallCursorPlugin` for Cursor's concrete local copy.
37
-
38
- Use `installProjectAuthoringSkill` to add the bundled development-time skill to an existing project at `.agents/skills/build-codemodekit-plugin`.
39
-
40
- ## Refresh references
41
-
42
- Call `syncAgentPluginSkill` with a started or startable CodeModeKit `CodeMode` instance. The function reads the revisioned TypeScript catalog, rejects degraded or unstable snapshots, and atomically replaces `references/tools.d.ts` and `references/catalog-metadata.json`.
43
-
44
- Close the Code Mode application in a `finally` block after syncing.
45
-
46
- ## Observe execution
47
-
48
- The high- and low-level constructors accept an `observer` callback. Use it for metrics, tracing, and audit correlation. Events contain IDs, source/tool names, byte counts, durations, outcomes, and stable error codes; they intentionally exclude authored code, arguments, results, logs, and diagnostic messages. Keep payload logging as a separate, explicit host decision.