@crewhaus/target-claude-plugin 0.2.3 → 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.
Files changed (2) hide show
  1. package/dist/index.js +25 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -145,10 +145,32 @@ function renderMcpJson(ir) {
145
145
  const v = ir;
146
146
  if (v.mcp_servers === undefined)
147
147
  return undefined;
148
- const keys = Object.keys(v.mcp_servers);
149
- if (keys.length === 0)
148
+ const entries = Object.entries(v.mcp_servers);
149
+ if (entries.length === 0)
150
150
  return undefined;
151
- return `${JSON.stringify(v.mcp_servers, null, 2)}\n`;
151
+ // 0.3.0 env/header values are IrSecretRef objects. Claude Code's
152
+ // .mcp.json expands `${VAR}` from the environment at load time, so an
153
+ // env ref renders as `${VAR}` (the secret stays out of the artifact and
154
+ // Claude Code resolves it on the user's machine); literals render as
155
+ // their plain string.
156
+ const rendered = {};
157
+ for (const [name, cfg] of entries) {
158
+ rendered[name] =
159
+ cfg.transport === "stdio"
160
+ ? { ...cfg, ...(cfg.env !== undefined ? { env: renderSecretMap(cfg.env) } : {}) }
161
+ : {
162
+ ...cfg,
163
+ ...(cfg.headers !== undefined ? { headers: renderSecretMap(cfg.headers) } : {}),
164
+ };
165
+ }
166
+ return `${JSON.stringify(rendered, null, 2)}\n`;
167
+ }
168
+ function renderSecretMap(map) {
169
+ const out = {};
170
+ for (const [key, ref] of Object.entries(map)) {
171
+ out[key] = ref.kind === "env" ? `\${${ref.name}}` : ref.value;
172
+ }
173
+ return out;
152
174
  }
153
175
  /**
154
176
  * Render a SKILL.md frontmatter block. Anthropic's minimal schema:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/target-claude-plugin",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Track H / §59 — emits an Anthropic-compatible Claude Code plugin directory from any CrewHaus IR variant. Source: claude-plugins-official (Anthropic).",
6
6
  "main": "dist/index.js",
@@ -15,8 +15,8 @@
15
15
  "test": "bun test src"
16
16
  },
17
17
  "dependencies": {
18
- "@crewhaus/errors": "0.2.3",
19
- "@crewhaus/ir": "0.2.3"
18
+ "@crewhaus/errors": "0.3.0",
19
+ "@crewhaus/ir": "0.3.0"
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "author": {