mirror of
https://github.com/codeflash-ai/codeflash-agent.git
synced 2026-05-04 18:25:19 +00:00
57 lines
2 KiB
Makefile
57 lines
2 KiB
Makefile
DIST := dist
|
|
LANG := python
|
|
|
|
.PHONY: build-plugin clean
|
|
|
|
build-plugin: clean
|
|
@echo "Assembling plugin → $(DIST)/"
|
|
|
|
# 1. Base plugin
|
|
cp -R plugin/ $(DIST)/
|
|
|
|
# 2. Language overlay (agents, references, skills merge into same dirs)
|
|
cp -R languages/$(LANG)/plugin/agents/ $(DIST)/agents/
|
|
cp -R languages/$(LANG)/plugin/references/ $(DIST)/references/
|
|
cp -R languages/$(LANG)/plugin/skills/ $(DIST)/skills/
|
|
|
|
# 3. Vendored codex (now inside dist as sibling)
|
|
mkdir -p $(DIST)/vendor
|
|
cp -R vendor/codex/ $(DIST)/vendor/codex/
|
|
|
|
# 4. Language config
|
|
cp languages/$(LANG)/lang.toml $(DIST)/lang.toml
|
|
|
|
# 5. Templates — shared templates get a shared- prefix to avoid collisions
|
|
mkdir -p $(DIST)/templates
|
|
cp languages/$(LANG)/*.j2 $(DIST)/templates/
|
|
@for f in languages/shared/*.j2; do \
|
|
cp "$$f" "$(DIST)/templates/shared-$$(basename $$f)"; \
|
|
done
|
|
@# Update extends directives to match renamed shared templates
|
|
sed -i '' 's|"shared/|"shared-|g' $(DIST)/templates/*.j2
|
|
|
|
# 6. Rewrite paths — vendor is now co-located instead of ../
|
|
# Do CLAUDE_PLUGIN_ROOT paths first (more specific), then generic ../vendor
|
|
find $(DIST) -type f \( -name '*.json' -o -name '*.md' \) -exec \
|
|
sed -i '' \
|
|
's|$${CLAUDE_PLUGIN_ROOT}/../vendor/codex|$${CLAUDE_PLUGIN_ROOT}/vendor/codex|g' {} +
|
|
find $(DIST) -type f \( -name '*.json' -o -name '*.md' \) -exec \
|
|
sed -i '' 's|\.\./vendor/codex|./vendor/codex|g' {} +
|
|
|
|
# 7. Rewrite language-relative paths — everything is now co-located
|
|
find $(DIST) -type f -name '*.md' -exec \
|
|
sed -i '' 's|languages/$(LANG)/plugin/references/|references/|g' {} +
|
|
find $(DIST) -type f -name '*.md' -exec \
|
|
sed -i '' 's|languages/$(LANG)/plugin/agents/|agents/|g' {} +
|
|
find $(DIST) -type f -name '*.md' -exec \
|
|
sed -i '' 's|languages/$(LANG)/plugin/skills/|skills/|g' {} +
|
|
find $(DIST) -type f -name '*.md' -exec \
|
|
sed -i '' 's|languages/$(LANG)/plugin/|./|g' {} +
|
|
|
|
# 8. Remove .DS_Store artifacts
|
|
find $(DIST) -name '.DS_Store' -delete
|
|
|
|
@echo "Done. Plugin assembled in $(DIST)/"
|
|
|
|
clean:
|
|
rm -rf $(DIST)
|