Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
112 lines (99 loc) · 3.61 KB
/
Copy pathMakefile
File metadata and controls
112 lines (99 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
.PHONY: clone-repos pull-repos remove-repos lint lint-fix help sync-skills lint-symlinks
SKILLSAW_IMAGE ?= ghcr.io/stbenjam/skillsaw:latest
CONTAINER_ENGINE ?= $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null || echo docker)
GIT_BASE_URL ?= git@github.com:
SKILLS_SRC_DIR ?= .claude/skills
SKILLS_DST_DIR ?= .agents/skills
# On Linux, append :Z for SELinux relabeling; on macOS/others, mount without it
VOLUME_FLAG := $(if $(filter Linux,$(shell uname -s)),:Z,)
REPOS = \
viaq/vector \
openshift/cluster-logging-operator \
grafana/loki \
openshift/eventrouter \
viaq/log-file-metric-exporter \
openshift/logging-view-plugin \
openshift/openshift-docs \
openshift-eng/openshift-logging-e2e-tests \
openshift/release \
openshift-eng/ocp-build-data
REPO_DIRS = $(foreach r,$(REPOS),$(notdir $(r)))
## clone-repos: Clone all workspace repos into this directory
clone-repos:
@for repo in $(REPOS); do \
name=$$(basename $$repo); \
if [ -d "$$name/.git" ]; then \
echo "=== $$name already cloned ==="; \
else \
flags=""; \
if [ "$$name" = "openshift-docs" ]; then flags="--single-branch --branch standalone-logging-docs-main"; fi; \
git clone $$flags $(GIT_BASE_URL)$$repo.git; \
fi; \
done
## pull-repos: Pull latest changes in all cloned repos
pull-repos:
@for d in $(REPO_DIRS); do \
if [ -d "$$d/.git" ]; then \
echo "=== $$d ==="; \
git -C "$$d" pull --ff-only; \
if [ -f "$$d/.gitmodules" ]; then git -C "$$d" submodule update --init --recursive; fi; \
fi; \
done
## remove-repos: Delete all cloned repos to start fresh
remove-repos:
@echo "This will delete all cloned repos. Press Ctrl+C to cancel, Enter to continue."
@read _confirm
@for d in $(REPO_DIRS); do \
if [ -d "$$d/.git" ]; then echo "Removing $$d..."; rm -rf "$$d"; fi; \
done
@echo "Done. Run 'make clone-repos' to re-clone."
## lint: Run skillsaw linter (Docker or Podman)
lint:
@$(CONTAINER_ENGINE) run --rm -v "$(CURDIR):/workspace$(VOLUME_FLAG)" $(SKILLSAW_IMAGE) lint --strict $(SKILLSAW_ARGS)
## lint-fix: Auto-fix fixable issues
lint-fix:
@$(CONTAINER_ENGINE) run --rm -v "$(CURDIR):/workspace$(VOLUME_FLAG)" $(SKILLSAW_IMAGE) fix
## lint-symlinks: Lint skills symlinks in target directory
lint-symlinks:
@errors=0; \
for skill in $(SKILLS_SRC_DIR)/*; do \
[ -e "$$skill" ] || continue; \
name="$$(basename "$$skill")"; \
target="$(SKILLS_DST_DIR)/$$name"; \
if [ ! -L "$$target" ]; then \
echo "Error: Missing symlink in $(SKILLS_DST_DIR) for '$$name'"; \
errors=$$((errors + 1)); \
elif [ ! -e "$$target" ]; then \
echo "Error: Broken symlink in $(SKILLS_DST_DIR) for '$$name'"; \
errors=$$((errors + 1)); \
fi; \
done; \
for link in $(SKILLS_DST_DIR)/*; do \
if [ -L "$$link" ] && [ ! -e "$$link" ]; then \
echo "Error: Dangling symlink found at '$$link'"; \
errors=$$((errors + 1)); \
fi; \
done; \
if [ $$errors -gt 0 ]; then \
echo "Found $$errors skill symlink issue(s)."; \
exit 1; \
fi; \
echo "All skill symlinks are present and valid."
## sync-skills: Sync skills from source to destination via symlinks
sync-skills:
@mkdir -p $(SKILLS_DST_DIR)
@for skill in $(SKILLS_SRC_DIR)/*; do \
[ -e "$$skill" ] || continue; \
name="$$(basename "$$skill")"; \
target="$(SKILLS_DST_DIR)/$$name"; \
if [ ! -e "$$target" ] && [ ! -L "$$target" ]; then \
ln -s "../../$$skill" "$$target"; \
echo "Linked: $$name"; \
else \
echo "Skipped: $$name (already exists)"; \
fi; \
done
## help: Show available targets and descriptions
help:
@echo "Available targets:"
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':' | sed 's/^/ /'