create-codemodekit 0.2.0 → 0.3.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.
- package/README.md +22 -3
- package/dist/agent-plugin.d.ts.map +1 -1
- package/dist/agent-plugin.js +1 -2
- package/dist/agent-plugin.js.map +1 -1
- package/dist/authoring-skill.d.ts +7 -0
- package/dist/authoring-skill.d.ts.map +1 -0
- package/dist/authoring-skill.js +42 -0
- package/dist/authoring-skill.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +60 -6
- package/dist/cli.js.map +1 -1
- package/dist/cursor-plugin.d.ts +25 -0
- package/dist/cursor-plugin.d.ts.map +1 -0
- package/dist/cursor-plugin.js +177 -0
- package/dist/cursor-plugin.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin-build.d.ts +19 -0
- package/dist/plugin-build.d.ts.map +1 -0
- package/dist/plugin-build.js +177 -0
- package/dist/plugin-build.js.map +1 -0
- package/dist/plugin-cli.d.ts +3 -0
- package/dist/plugin-cli.d.ts.map +1 -0
- package/dist/plugin-cli.js +102 -0
- package/dist/plugin-cli.js.map +1 -0
- package/dist/scaffold.d.ts +5 -0
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +87 -2
- package/dist/scaffold.js.map +1 -1
- package/package.json +21 -6
- package/skills/build-codemodekit-plugin/SKILL.md +44 -0
- package/skills/build-codemodekit-plugin/agents/openai.yaml +4 -0
- package/skills/build-codemodekit-plugin/references/generator.md +42 -0
- package/skills/build-codemodekit-plugin/references/plugin-layout.md +38 -0
- package/skills/build-codemodekit-plugin/references/programmatic-api.md +48 -0
|
@@ -0,0 +1,42 @@
|
|
|
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.
|
|
@@ -0,0 +1,38 @@
|
|
|
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.
|
|
@@ -0,0 +1,48 @@
|
|
|
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.
|