@twobirds/microcomponents 0.6.0 → 0.7.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 +17 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +14 -1
- package/dist/mcp/api.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,6 +46,21 @@ An MCP (Model Context Protocol) server ships with the package so AI assistants c
|
|
|
46
46
|
microcomponents-mcp # stdio server, straight from the installed package
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
`mc create` writes an `opencode.jsonc` into every scaffolded project, so opencode picks the server up as soon as you open the project — no config edit needed. opencode reads the project config from the repo root, and the server is started through `npx`, which resolves the version the project installed:
|
|
50
|
+
|
|
51
|
+
```jsonc
|
|
52
|
+
{
|
|
53
|
+
"$schema": "https://opencode.ai/config.json",
|
|
54
|
+
"mcp": {
|
|
55
|
+
"microcomponents": {
|
|
56
|
+
"type": "local",
|
|
57
|
+
"command": ["npx", "-p", "@twobirds/microcomponents", "microcomponents-mcp"],
|
|
58
|
+
"enabled": true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
49
64
|
In a published package the server runs from `dist/mcp` and reads the prebuilt `api.json` and the concept essays that the build step emits next to it. During development it generates the index live from `src/` at startup, so it cannot drift away from the library it documents:
|
|
50
65
|
|
|
51
66
|
```bash
|
|
@@ -80,11 +95,12 @@ pnpm run cli -- new my-card --target-html --target-css --dry-run
|
|
|
80
95
|
# would create src/my/card.target.css
|
|
81
96
|
```
|
|
82
97
|
|
|
83
|
-
`mc create` scaffolds a complete dev environment for a namespace — a Vite dev server serving `src/` straight, a page shell that turns on `autoload(true)`,
|
|
98
|
+
`mc create` scaffolds a complete dev environment for a namespace — a Vite dev server serving `src/` straight, a page shell that turns on `autoload(true)`, a starter component with companion assets, and an `opencode.jsonc` that registers the MCP server:
|
|
84
99
|
|
|
85
100
|
```bash
|
|
86
101
|
pnpm run cli -- create --namespace mc --dir mc-app
|
|
87
102
|
# created mc-app/package.json
|
|
103
|
+
# created mc-app/opencode.jsonc
|
|
88
104
|
# created mc-app/src/index.html
|
|
89
105
|
# created mc-app/src/mc/app.ts
|
|
90
106
|
# created mc-app/src/mc/app.target.html
|
package/dist/cli/create.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;EAkBE;AAUF;;;;;;;;;;EAUE;AACF,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,yCAAyC;AACzC,MAAM,WAAW,aAAa;IAC7B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;EAYE;AACF,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;EAkBE;AAUF;;;;;;;;;;EAUE;AACF,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,yCAAyC;AACzC,MAAM,WAAW,aAAa;IAC7B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;EAYE;AACF,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAwBhE"}
|
package/dist/cli/create.js
CHANGED
|
@@ -62,6 +62,7 @@ export function scaffoldProject(namespace) {
|
|
|
62
62
|
files['tsconfig.vc.json'] = tsconfigVc();
|
|
63
63
|
files['vite.config.ts'] = viteConfig(namespace);
|
|
64
64
|
files['.gitignore'] = gitignore();
|
|
65
|
+
files['opencode.jsonc'] = opencodeConfig();
|
|
65
66
|
files['README.md'] = readme(namespace, tag);
|
|
66
67
|
files['src/index.html'] = shell(namespace, tag);
|
|
67
68
|
files[`src/${base}.ts`] = appSource(namespace, tag);
|
|
@@ -81,7 +82,7 @@ function packageJson(namespace) {
|
|
|
81
82
|
typecheck: 'tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.vc.json',
|
|
82
83
|
},
|
|
83
84
|
dependencies: {
|
|
84
|
-
'@twobirds/microcomponents': '^0.
|
|
85
|
+
'@twobirds/microcomponents': '^0.7.0',
|
|
85
86
|
},
|
|
86
87
|
devDependencies: {
|
|
87
88
|
vite: '^8.1.5',
|
|
@@ -126,6 +127,18 @@ function gitignore() {
|
|
|
126
127
|
dist/
|
|
127
128
|
`;
|
|
128
129
|
}
|
|
130
|
+
function opencodeConfig() {
|
|
131
|
+
return JSON.stringify({
|
|
132
|
+
$schema: 'https://opencode.ai/config.json',
|
|
133
|
+
mcp: {
|
|
134
|
+
microcomponents: {
|
|
135
|
+
type: 'local',
|
|
136
|
+
command: ['npx', '-p', '@twobirds/microcomponents', 'microcomponents-mcp'],
|
|
137
|
+
enabled: true,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
}, null, '\t');
|
|
141
|
+
}
|
|
129
142
|
function readme(namespace, tag) {
|
|
130
143
|
return `# ${namespace} App
|
|
131
144
|
|
package/dist/mcp/api.json
CHANGED