@crewhaus/target-claude-plugin 0.1.8 → 0.2.1

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/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@
33
33
  * See Track H of the §55–§59 batch in factory/CHANGELOG.md.
34
34
  */
35
35
  import { CrewhausError } from "@crewhaus/errors";
36
- import type { IrNode } from "@crewhaus/ir";
36
+ import { type IrNode } from "@crewhaus/ir";
37
37
  export declare class TargetClaudePluginError extends CrewhausError {
38
38
  readonly name = "TargetClaudePluginError";
39
39
  constructor(message: string, cause?: unknown);
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@
33
33
  * See Track H of the §55–§59 batch in factory/CHANGELOG.md.
34
34
  */
35
35
  import { CrewhausError } from "@crewhaus/errors";
36
+ import { renderBundleReadme, } from "@crewhaus/ir";
36
37
  export class TargetClaudePluginError extends CrewhausError {
37
38
  name = "TargetClaudePluginError";
38
39
  constructor(message, cause) {
@@ -46,10 +47,7 @@ export class TargetClaudePluginError extends CrewhausError {
46
47
  export function emitClaudePlugin(ir, opts) {
47
48
  const description = opts.description ?? defaultDescription(ir);
48
49
  const pluginJson = renderPluginJson(ir.name, description, opts.author);
49
- const files = [
50
- { path: ".claude-plugin/plugin.json", content: pluginJson },
51
- { path: "README.md", content: renderReadme(ir, description) },
52
- ];
50
+ const files = [{ path: ".claude-plugin/plugin.json", content: pluginJson }];
53
51
  // MCP servers — only emitted for variants that carry them in IR.
54
52
  const mcp = renderMcpJson(ir);
55
53
  if (mcp !== undefined) {
@@ -94,6 +92,11 @@ export function emitClaudePlugin(ir, opts) {
94
92
  default:
95
93
  throw new TargetClaudePluginError(`unsupported IR target for claude-plugin emission: ${ir.target}`);
96
94
  }
95
+ // Rendered after the switch so an unsupported target fails with the
96
+ // typed TargetClaudePluginError above, not a renderer error over a
97
+ // malformed variant; inserted at index 1 to keep the historical
98
+ // plugin.json → README.md → … file order.
99
+ files.splice(1, 0, { path: "README.md", content: renderReadme(ir, description) });
97
100
  return { files };
98
101
  }
99
102
  function defaultDescription(ir) {
@@ -110,22 +113,32 @@ function renderPluginJson(name, description, author) {
110
113
  };
111
114
  return `${JSON.stringify(obj, null, 2)}\n`;
112
115
  }
116
+ /**
117
+ * Item 42 — the plugin README is now rendered by the shared
118
+ * `renderBundleReadme` in `@crewhaus/ir` (tool table, MCP servers, env
119
+ * vars, literal-secret redaction), with the plugin-specific Origin +
120
+ * Install sections layered on via options. The `.crewhaus/` workspace
121
+ * note is suppressed — a Claude Code plugin has no CrewHaus runtime
122
+ * workspace.
123
+ */
113
124
  function renderReadme(ir, description) {
114
- return [
115
- `# ${ir.name}`,
116
- "",
125
+ return renderBundleReadme(ir, {
117
126
  description,
118
- "",
119
- "## Origin",
120
- "",
121
- `Generated by CrewHaus \`target-claude-plugin\` from a \`target: ${ir.target}\` spec.`,
122
- "Format reference: [claude-plugins-official](https://github.com/anthropics/claude-code-plugins).",
123
- "",
124
- "## Install",
125
- "",
126
- "Drop this directory under `~/.claude/plugins/` or your project's `.claude/plugins/`.",
127
- "",
128
- ].join("\n");
127
+ usage: {
128
+ heading: "Install",
129
+ body: "Drop this directory under `~/.claude/plugins/` or your project's `.claude/plugins/`.",
130
+ },
131
+ includeWorkspaceNote: false,
132
+ extraSections: [
133
+ {
134
+ heading: "Origin",
135
+ body: [
136
+ `Generated by CrewHaus \`target-claude-plugin\` from a \`target: ${ir.target}\` spec.`,
137
+ "Format reference: [claude-plugins-official](https://github.com/anthropics/claude-code-plugins).",
138
+ ].join("\n"),
139
+ },
140
+ ],
141
+ });
129
142
  }
130
143
  function renderMcpJson(ir) {
131
144
  // Only emit when the IR variant has mcp_servers and it's non-empty.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/target-claude-plugin",
3
- "version": "0.1.8",
3
+ "version": "0.2.1",
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.1.8",
19
- "@crewhaus/ir": "0.1.8"
18
+ "@crewhaus/errors": "0.2.1",
19
+ "@crewhaus/ir": "0.2.1"
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "author": {