You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
epic(cli): add --claude-plugin flag to cast for claude code plugin output
Add a new --claude-plugin flag to ailloy cast that packages a mold's rendered output as a Claude Code plugin and writes it to Claude's plugin discovery location. This opens a third distribution channel — alongside project install (cast) and author tooling (plugin generate) — aimed at end users who want to install a published Ailloy mold as a Claude Code plugin without authoring overhead.
Note: the flag was originally proposed as --as-plugin and renamed to --claude-plugin during implementation. Ailloy is tool-agnostic (Claude Code, Cursor, OpenCode, Codex, …), so the target tool needs to be explicit in the flag name. The renamed surface leaves room for future per-tool plugin formats (--cursor-plugin, --opencode-plugin, …) without flag-name churn. The override flags --plugin-name / --plugin-version stayed generic so they can apply to any future plugin format.
Why
Today there are two consumer paths for a mold:
ailloy cast — renders blanks with flux variables and installs them at their declared destinations. Project-install path.
ailloy plugin generate — bundles a mold into Claude Code plugin format using a custom Transformer. Does not render flux templates and does not handle skills, AGENTS.md, or workflows. Author-facing tool.
There is no path for a user who wants the simplicity of "install this mold as a Claude Code plugin" with full flux rendering and the same blank coverage cast already provides. --claude-plugin fills that gap.
Key Design Decisions
Layering: pure derivation in ailloy. Molds do not need to be plugin-aware. plugin.json is synthesized from mold.yaml.
Internals: cast delegates to a new pkg/plugin/Packager. The existing plugin generate command and its Transformer are untouched for now.
Flag surface: --claude-plugin, plus optional --plugin-name and --plugin-version overrides. The --plugin-* flags are generic so they can apply to future per-tool plugin formats.
Output location: .claude/plugins/<slug>/ by default, ~/.claude/plugins/<slug>/ with --global.
Interactions: --with-workflows is silently skipped (warn); --set / --values work normally; CLAUDE.md @AGENTS.md import prompt is skipped (AGENTS.md is bundled inside the plugin instead).
Overwrite: re-running cast replaces the contents of the target plugin directory only; sibling plugin directories are untouched.
Acceptance Criteria
--claude-plugin flag added to ailloy cast (boolean)
--plugin-name <name> and --plugin-version <ver> flags added, validated to require a plugin output flag
New pkg/plugin/packager.go with Packager, RenderedFile, ManifestInput types and Package(...) method
Path translation table implemented per spec (.claude/commands/ → commands/, .claude/skills/ → skills/, .claude/agents/ → agents/, .claude/hooks/ → hooks/, AGENTS.md and README.md to plugin root, workflows dropped, unrecognized paths dropped with debug log)
.claude-plugin/plugin.json synthesized from mold.yaml with flag overrides; missing version defaults to 0.1.0; missing author/description omitted (no empty strings)
Slugification of plugin name (lowercase, non-alphanumeric → -, trim, error on empty result)
--global routes to ~/.claude/plugins/<slug>/; project-local cast routes to .claude/plugins/<slug>/
Cast skips the CLAUDE.md @AGENTS.md import prompt when --claude-plugin is set; AGENTS.md is bundled inside the plugin
Re-running cast overwrites the target plugin directory's contents only, never sibling directories
Path collisions between two CastDest entries error and name both sources
Unit tests for Packager (path translation, manifest synthesis, wipe semantics, missing-field handling, target-is-file error)
Unit tests for new flag validation in cast (overrides without --claude-plugin error, slugification cases)
Integration tests covering: full layout assertion against a fixture mold, workflow-skip warning, flux-rendering propagation (--set), re-cast wipe behavior, --global routing via temp HOME
Test fixture mold (commands + skill + AGENTS.md + README + one flux-templated file)
Out of scope: deprecating ailloy plugin generate (deferred — may be revisited once --claude-plugin proves itself), plugin marketplace/signing/registry concerns, smart-merge on re-cast, workflow blanks inside plugins, mold-side plugin: metadata blocks.
Open question: exact Claude Code plugin discovery paths for project-local vs global plugins. The implementation assumes .claude/plugins/<slug>/ and ~/.claude/plugins/<slug>/.
Brainstormed via /superpowers:brainstorm 2026-05-01.
epic(cli): add --claude-plugin flag to cast for claude code plugin output
Add a new
--claude-pluginflag toailloy castthat packages a mold's rendered output as a Claude Code plugin and writes it to Claude's plugin discovery location. This opens a third distribution channel — alongside project install (cast) and author tooling (plugin generate) — aimed at end users who want to install a published Ailloy mold as a Claude Code plugin without authoring overhead.Why
Today there are two consumer paths for a mold:
ailloy cast— renders blanks with flux variables and installs them at their declared destinations. Project-install path.ailloy plugin generate— bundles a mold into Claude Code plugin format using a customTransformer. Does not render flux templates and does not handle skills, AGENTS.md, or workflows. Author-facing tool.There is no path for a user who wants the simplicity of "install this mold as a Claude Code plugin" with full flux rendering and the same blank coverage
castalready provides.--claude-pluginfills that gap.Key Design Decisions
plugin.jsonis synthesized frommold.yaml.pkg/plugin/Packager. The existingplugin generatecommand and itsTransformerare untouched for now.--claude-plugin, plus optional--plugin-nameand--plugin-versionoverrides. The--plugin-*flags are generic so they can apply to future per-tool plugin formats..claude/plugins/<slug>/by default,~/.claude/plugins/<slug>/with--global.--with-workflowsis silently skipped (warn);--set/--valueswork normally; CLAUDE.md@AGENTS.mdimport prompt is skipped (AGENTS.md is bundled inside the plugin instead).Acceptance Criteria
--claude-pluginflag added toailloy cast(boolean)--plugin-name <name>and--plugin-version <ver>flags added, validated to require a plugin output flagpkg/plugin/packager.gowithPackager,RenderedFile,ManifestInputtypes andPackage(...)method.claude/commands/→commands/,.claude/skills/→skills/,.claude/agents/→agents/,.claude/hooks/→hooks/,AGENTS.mdandREADME.mdto plugin root, workflows dropped, unrecognized paths dropped with debug log).claude-plugin/plugin.jsonsynthesized frommold.yamlwith flag overrides; missing version defaults to0.1.0; missing author/description omitted (no empty strings)-, trim, error on empty result)--globalroutes to~/.claude/plugins/<slug>/; project-local cast routes to.claude/plugins/<slug>/--with-workflows+--claude-plugin→ warn-and-skip workflows@AGENTS.mdimport prompt when--claude-pluginis set; AGENTS.md is bundled inside the pluginCastDestentries error and name both sourcesPackager(path translation, manifest synthesis, wipe semantics, missing-field handling, target-is-file error)--claude-pluginerror, slugification cases)--set), re-cast wipe behavior,--globalrouting via tempHOMEdocs/cast-claude-plugin.md)Notes
ailloy plugin generate(deferred — may be revisited once--claude-pluginproves itself), plugin marketplace/signing/registry concerns, smart-merge on re-cast, workflow blanks inside plugins, mold-sideplugin:metadata blocks..claude/plugins/<slug>/and~/.claude/plugins/<slug>/./superpowers:brainstorm2026-05-01.kriscoleman/cast-plugin-flag. PR: feat: add --claude-plugin flag to cast for claude code plugin output #136.