@hybridlabor-api/aos 4.8.0 → 4.10.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 (186) hide show
  1. package/.agents/{agents.md → AGENTS.md} +3 -1
  2. package/.agents/nodes.json +3 -1
  3. package/.agents/vendor-manifest.json +23 -1
  4. package/.claude/agents/godmode-media-eventtech.md +1 -1
  5. package/.claude/hooks/conventional-commits.mjs +125 -0
  6. package/.claude/hooks/env-file-protection.mjs +105 -0
  7. package/.claude/hooks/go-gate.mjs +101 -81
  8. package/.claude/hooks/memb-inject.mjs +29 -1
  9. package/.claude/settings.json +13 -0
  10. package/.claude/workflows/startcycle-dispatch.mjs +23 -1
  11. package/.opencode/agents/godmode-media-eventtech.md +1 -1
  12. package/.opencode/plugins/bdb-aos.js +31 -4
  13. package/CLAUDE.md +0 -571
  14. package/README.de.md +1 -1
  15. package/README.md +1 -1
  16. package/README.pt.md +1 -1
  17. package/THIRD_PARTY_NOTICES.md +126 -0
  18. package/bin/aos-doctor.mjs +1 -1
  19. package/docs/skills_table.md +1 -1
  20. package/installer.js +187 -55
  21. package/package.json +7 -3
  22. package/packages/aos-cli/README.md +80 -0
  23. package/packages/aos-cli/bin/aos-cli.mjs +134 -0
  24. package/packages/aos-cli/core-skills.json +12 -0
  25. package/packages/aos-cli/extensions/aos.ts +321 -0
  26. package/packages/aos-cli/package-lock.json +1923 -0
  27. package/packages/aos-cli/package.json +29 -0
  28. package/packages/aos-cli/scripts/check-theme.mjs +63 -0
  29. package/packages/aos-cli/themes/aos.json +97 -0
  30. package/scripts/build-plugin-manifest.mjs +131 -0
  31. package/scripts/validate-skills.mjs +81 -6
  32. package/skills/basic/ao-orchestrator/SKILL.md +116 -0
  33. package/skills/basic/bdb-eventagency-skill/SKILL.md +252 -0
  34. package/skills/basic/bdb-shipping-skill/SKILL.md +161 -0
  35. package/skills/basic/godmode-eventtech/SKILL.md +4 -1
  36. package/skills/global_config/agenttrail/SKILL.md +6 -1
  37. package/skills/global_config/aos-project-init/SKILL.md +2 -0
  38. package/skills/global_config/aos-project-init/assets/AGENTS.template.md +1 -1
  39. package/skills/global_config/aos-project-init/scripts/aos-project-doctor.mjs +1 -1
  40. package/skills/global_config/aos-setup/SKILL.md +1 -1
  41. package/skills/global_config/aos-setup/scripts/aos-doctor.mjs +1 -1
  42. package/skills/global_config/ask-tim/SKILL.md +7 -7
  43. package/skills/global_config/bash-script-generator/SKILL.md +201 -0
  44. package/skills/global_config/bash-script-generator/assets/templates/standard-template.sh +96 -0
  45. package/skills/global_config/bash-script-generator/docs/bash-scripting-guide.md +729 -0
  46. package/skills/global_config/bash-script-generator/docs/generation-best-practices.md +193 -0
  47. package/skills/global_config/bash-script-generator/docs/script-patterns.md +566 -0
  48. package/skills/global_config/bash-script-generator/docs/text-processing-guide.md +437 -0
  49. package/skills/global_config/bash-script-generator/examples/log-analyzer.sh +92 -0
  50. package/skills/global_config/bash-script-generator/scripts/generate_script_template.sh +123 -0
  51. package/skills/global_config/bash-script-generator/scripts/run_ci_checks.sh +172 -0
  52. package/skills/global_config/bash-script-generator/scripts/test_generator.sh +413 -0
  53. package/skills/global_config/bash-script-validator/SKILL.md +249 -0
  54. package/skills/global_config/bash-script-validator/docs/awk-reference.md +449 -0
  55. package/skills/global_config/bash-script-validator/docs/bash-reference.md +468 -0
  56. package/skills/global_config/bash-script-validator/docs/common-mistakes.md +623 -0
  57. package/skills/global_config/bash-script-validator/docs/grep-reference.md +395 -0
  58. package/skills/global_config/bash-script-validator/docs/regex-reference.md +391 -0
  59. package/skills/global_config/bash-script-validator/docs/sed-reference.md +454 -0
  60. package/skills/global_config/bash-script-validator/docs/shell-reference.md +463 -0
  61. package/skills/global_config/bash-script-validator/docs/shellcheck-reference.md +399 -0
  62. package/skills/global_config/bash-script-validator/examples/bad-bash.sh +55 -0
  63. package/skills/global_config/bash-script-validator/examples/bad-shell.sh +54 -0
  64. package/skills/global_config/bash-script-validator/examples/good-bash.sh +71 -0
  65. package/skills/global_config/bash-script-validator/examples/good-shell.sh +69 -0
  66. package/skills/global_config/bash-script-validator/scripts/run_ci_checks.sh +23 -0
  67. package/skills/global_config/bash-script-validator/scripts/shellcheck_wrapper.sh +174 -0
  68. package/skills/global_config/bash-script-validator/scripts/test_validate.sh +446 -0
  69. package/skills/global_config/bash-script-validator/scripts/validate.sh +512 -0
  70. package/skills/global_config/ci-pipeline/SKILL.md +135 -0
  71. package/skills/global_config/deja-memory/SKILL.md +3 -1
  72. package/skills/global_config/dispatching-parallel-agents/SKILL.md +170 -0
  73. package/skills/global_config/dockerfile-generator/SKILL.md +1038 -0
  74. package/skills/global_config/dockerfile-generator/examples/example.dockerignore +95 -0
  75. package/skills/global_config/dockerfile-generator/examples/golang-distroless.Dockerfile +34 -0
  76. package/skills/global_config/dockerfile-generator/examples/java-springboot.Dockerfile +45 -0
  77. package/skills/global_config/dockerfile-generator/examples/nextjs-production.Dockerfile +49 -0
  78. package/skills/global_config/dockerfile-generator/examples/nodejs-multistage.Dockerfile +55 -0
  79. package/skills/global_config/dockerfile-generator/examples/python-fastapi.Dockerfile +48 -0
  80. package/skills/global_config/dockerfile-generator/references/language_specific_guides.md +510 -0
  81. package/skills/global_config/dockerfile-generator/references/multistage_builds.md +570 -0
  82. package/skills/global_config/dockerfile-generator/references/optimization_patterns.md +492 -0
  83. package/skills/global_config/dockerfile-generator/references/security_best_practices.md +375 -0
  84. package/skills/global_config/dockerfile-generator/scripts/generate_dockerignore.sh +199 -0
  85. package/skills/global_config/dockerfile-generator/scripts/generate_golang.sh +172 -0
  86. package/skills/global_config/dockerfile-generator/scripts/generate_java.sh +185 -0
  87. package/skills/global_config/dockerfile-generator/scripts/generate_nodejs.sh +279 -0
  88. package/skills/global_config/dockerfile-generator/scripts/generate_python.sh +218 -0
  89. package/skills/global_config/dockerfile-generator/scripts/test_generator.sh +210 -0
  90. package/skills/global_config/dockerfile-validator/SKILL.md +300 -0
  91. package/skills/global_config/dockerfile-validator/examples/.dockerignore.example +34 -0
  92. package/skills/global_config/dockerfile-validator/examples/bad-example.Dockerfile +37 -0
  93. package/skills/global_config/dockerfile-validator/examples/golang-distroless.Dockerfile +50 -0
  94. package/skills/global_config/dockerfile-validator/examples/good-example.Dockerfile +52 -0
  95. package/skills/global_config/dockerfile-validator/examples/python-optimized.Dockerfile +53 -0
  96. package/skills/global_config/dockerfile-validator/examples/security-issues.Dockerfile +42 -0
  97. package/skills/global_config/dockerfile-validator/references/docker_best_practices.md +348 -0
  98. package/skills/global_config/dockerfile-validator/references/optimization_guide.md +473 -0
  99. package/skills/global_config/dockerfile-validator/references/security_checklist.md +208 -0
  100. package/skills/global_config/dockerfile-validator/scripts/dockerfile-validate.sh +699 -0
  101. package/skills/global_config/dockerfile-validator/scripts/test_validate.sh +35 -0
  102. package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn-lock-read.Dockerfile +6 -0
  103. package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn.Dockerfile +6 -0
  104. package/skills/global_config/dockerfile-validator/tests/fixtures/from-platform-nonroot.Dockerfile +7 -0
  105. package/skills/global_config/dockerfile-validator/tests/test_regression.sh +164 -0
  106. package/skills/global_config/finishing-a-development-branch/SKILL.md +228 -0
  107. package/skills/global_config/github-actions-generator/SKILL.md +353 -0
  108. package/skills/global_config/github-actions-generator/assets/templates/action/composite/action.yml +82 -0
  109. package/skills/global_config/github-actions-generator/assets/templates/action/docker/Dockerfile +25 -0
  110. package/skills/global_config/github-actions-generator/assets/templates/action/docker/action.yml +42 -0
  111. package/skills/global_config/github-actions-generator/assets/templates/action/docker/entrypoint.sh +27 -0
  112. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/action.yml +33 -0
  113. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/index.js +50 -0
  114. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/package.json +27 -0
  115. package/skills/global_config/github-actions-generator/assets/templates/workflow/basic_workflow.yml +242 -0
  116. package/skills/global_config/github-actions-generator/assets/templates/workflow/reusable_workflow.yml +106 -0
  117. package/skills/global_config/github-actions-generator/examples/README.md +147 -0
  118. package/skills/global_config/github-actions-generator/examples/actions/setup-node-cached/action.yml +93 -0
  119. package/skills/global_config/github-actions-generator/examples/caching/docker-buildkit.yml +256 -0
  120. package/skills/global_config/github-actions-generator/examples/security/dependency-review.yml +62 -0
  121. package/skills/global_config/github-actions-generator/examples/security/sbom-attestation.yml +119 -0
  122. package/skills/global_config/github-actions-generator/examples/triggers/chatops-commands.yml +475 -0
  123. package/skills/global_config/github-actions-generator/examples/triggers/repository-dispatch.yml +418 -0
  124. package/skills/global_config/github-actions-generator/examples/triggers/workflow-orchestration.yml +404 -0
  125. package/skills/global_config/github-actions-generator/examples/workflows/docker-build-push.yml +68 -0
  126. package/skills/global_config/github-actions-generator/examples/workflows/go-ci.yml +161 -0
  127. package/skills/global_config/github-actions-generator/examples/workflows/monorepo-ci.yml +340 -0
  128. package/skills/global_config/github-actions-generator/examples/workflows/multi-environment-deploy.yml +406 -0
  129. package/skills/global_config/github-actions-generator/examples/workflows/nodejs-ci.yml +122 -0
  130. package/skills/global_config/github-actions-generator/examples/workflows/python-ci.yml +157 -0
  131. package/skills/global_config/github-actions-generator/examples/workflows/scheduled-tasks.yml +376 -0
  132. package/skills/global_config/github-actions-generator/references/advanced-triggers.md +917 -0
  133. package/skills/global_config/github-actions-generator/references/best-practices.md +755 -0
  134. package/skills/global_config/github-actions-generator/references/common-actions.md +715 -0
  135. package/skills/global_config/github-actions-generator/references/custom-actions.md +320 -0
  136. package/skills/global_config/github-actions-generator/references/expressions-and-contexts.md +688 -0
  137. package/skills/global_config/github-actions-generator/references/modern-features.md +421 -0
  138. package/skills/global_config/github-actions-generator/scripts/test_generator.sh +344 -0
  139. package/skills/global_config/github-actions-templates/SKILL.md +7 -0
  140. package/skills/global_config/github-actions-validator/SKILL.md +576 -0
  141. package/skills/global_config/github-actions-validator/examples/README.md +88 -0
  142. package/skills/global_config/github-actions-validator/examples/outdated-versions.yml +76 -0
  143. package/skills/global_config/github-actions-validator/examples/valid-ci.yml +79 -0
  144. package/skills/global_config/github-actions-validator/examples/with-errors.yml +47 -0
  145. package/skills/global_config/github-actions-validator/references/act_usage.md +233 -0
  146. package/skills/global_config/github-actions-validator/references/action_versions.md +122 -0
  147. package/skills/global_config/github-actions-validator/references/actionlint_usage.md +343 -0
  148. package/skills/global_config/github-actions-validator/references/common_errors.md +512 -0
  149. package/skills/global_config/github-actions-validator/references/modern_features.md +384 -0
  150. package/skills/global_config/github-actions-validator/references/runners.md +317 -0
  151. package/skills/global_config/github-actions-validator/scripts/install_tools.sh +113 -0
  152. package/skills/global_config/github-actions-validator/scripts/validate_workflow.sh +910 -0
  153. package/skills/global_config/github-actions-validator/tests/test_validate_workflow.sh +237 -0
  154. package/skills/global_config/makefile-generator/SKILL.md +614 -0
  155. package/skills/global_config/makefile-generator/assets/templates/.gitkeep +1 -0
  156. package/skills/global_config/makefile-generator/docs/makefile-structure.md +530 -0
  157. package/skills/global_config/makefile-generator/docs/optimization-guide.md +784 -0
  158. package/skills/global_config/makefile-generator/docs/patterns-guide.md +642 -0
  159. package/skills/global_config/makefile-generator/docs/security-guide.md +361 -0
  160. package/skills/global_config/makefile-generator/docs/targets-guide.md +642 -0
  161. package/skills/global_config/makefile-generator/docs/variables-guide.md +596 -0
  162. package/skills/global_config/makefile-generator/scripts/add_standard_targets.sh +539 -0
  163. package/skills/global_config/makefile-generator/scripts/generate_makefile_template.sh +690 -0
  164. package/skills/global_config/makefile-generator/test/test_helper_scripts.sh +190 -0
  165. package/skills/global_config/makefile-validator/SKILL.md +244 -0
  166. package/skills/global_config/makefile-validator/docs/bake-tool.md +1000 -0
  167. package/skills/global_config/makefile-validator/docs/best-practices.md +858 -0
  168. package/skills/global_config/makefile-validator/docs/common-mistakes.md +944 -0
  169. package/skills/global_config/makefile-validator/examples/bad-makefile.mk +77 -0
  170. package/skills/global_config/makefile-validator/examples/good-makefile.mk +103 -0
  171. package/skills/global_config/makefile-validator/scripts/test_validate.sh +382 -0
  172. package/skills/global_config/makefile-validator/scripts/validate_makefile.sh +712 -0
  173. package/skills/global_config/{MCP_Manage → mcp-manage}/SKILL.md +3 -3
  174. package/skills/global_config/plan-canvas/SKILL.md +9 -2
  175. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/ui.js +10 -2
  176. package/skills/global_config/plan-canvas/scripts/plan-canvas.js +1 -1
  177. package/skills/global_config/read-the-damn-docs/SKILL.md +175 -0
  178. package/skills/global_config/requesting-code-review/SKILL.md +98 -0
  179. package/skills/global_config/requesting-code-review/code-reviewer.md +198 -0
  180. package/skills/global_config/using-git-worktrees/SKILL.md +170 -0
  181. package/skills/global_config/verification-before-completion/SKILL.md +123 -0
  182. package/skills/global_config/writing-plans/SKILL.md +126 -46
  183. package/skills/global_config/writing-plans-legacy/SKILL.md +152 -0
  184. package/.claude/CLAUDE.md +0 -12
  185. package/mcps/RhinoMCP/docs/content/docs/getting-started/gemini.md +0 -61
  186. /package/{GEMINI.md → RULES.md} +0 -0
@@ -0,0 +1,190 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
+ ADD_TARGETS_SCRIPT="$SKILL_DIR/scripts/add_standard_targets.sh"
6
+ GENERATE_SCRIPT="$SKILL_DIR/scripts/generate_makefile_template.sh"
7
+
8
+ fail() {
9
+ echo "FAIL: $1" >&2
10
+ exit 1
11
+ }
12
+
13
+ require_line() {
14
+ local file="$1"
15
+ local pattern="$2"
16
+ grep -qE "$pattern" "$file" || fail "Expected pattern '$pattern' in $file"
17
+ }
18
+
19
+ require_literal_line() {
20
+ local file="$1"
21
+ local line="$2"
22
+ grep -Fxq "$line" "$file" || fail "Expected exact line '$line' in $file"
23
+ }
24
+
25
+ TMP_DIR="$(mktemp -d)"
26
+ trap 'rm -rf "$TMP_DIR"' EXIT
27
+
28
+ # ─── add_standard_targets.sh ──────────────────────────────────────────────────
29
+
30
+ # Case 1: dry-run mode should not modify the Makefile.
31
+ mkdir -p "$TMP_DIR/dry_run"
32
+ cat > "$TMP_DIR/dry_run/Makefile" <<'EOF'
33
+ TARGET := demo
34
+
35
+ all:
36
+ @echo "demo"
37
+ EOF
38
+
39
+ cp "$TMP_DIR/dry_run/Makefile" "$TMP_DIR/dry_run/Makefile.before"
40
+ dry_output="$(cd "$TMP_DIR/dry_run" && bash "$ADD_TARGETS_SCRIPT" -n Makefile clean test)"
41
+ [[ "$dry_output" == *"Would add"* ]] || fail "Dry run output did not report planned additions"
42
+ cmp -s "$TMP_DIR/dry_run/Makefile.before" "$TMP_DIR/dry_run/Makefile" \
43
+ || fail "Dry run modified Makefile contents"
44
+
45
+ # Case 2: explicit-target mode should use ./Makefile when no file path is passed.
46
+ mkdir -p "$TMP_DIR/explicit_targets"
47
+ cat > "$TMP_DIR/explicit_targets/Makefile" <<'EOF'
48
+ TARGET := demo
49
+
50
+ all:
51
+ @echo "demo"
52
+ EOF
53
+
54
+ (cd "$TMP_DIR/explicit_targets" && bash "$ADD_TARGETS_SCRIPT" clean test >/dev/null)
55
+ require_line "$TMP_DIR/explicit_targets/Makefile" '^clean:'
56
+ require_line "$TMP_DIR/explicit_targets/Makefile" '^test:'
57
+
58
+ # Case 3: positional parsing with explicit Makefile path should keep the first target.
59
+ mkdir -p "$TMP_DIR/explicit_path"
60
+ cat > "$TMP_DIR/explicit_path/custom.mk" <<'EOF'
61
+ TARGET := demo
62
+
63
+ all:
64
+ @echo "demo"
65
+ EOF
66
+
67
+ bash "$ADD_TARGETS_SCRIPT" "$TMP_DIR/explicit_path/custom.mk" clean test >/dev/null
68
+ require_line "$TMP_DIR/explicit_path/custom.mk" '^clean:'
69
+ require_line "$TMP_DIR/explicit_path/custom.mk" '^test:'
70
+
71
+ # Case 4: ambiguous positional input should fail closed when a colliding path exists.
72
+ mkdir -p "$TMP_DIR/ambiguous_positional"
73
+ cat > "$TMP_DIR/ambiguous_positional/Makefile" <<'EOF'
74
+ TARGET := demo
75
+
76
+ all:
77
+ @echo "demo"
78
+ EOF
79
+ touch "$TMP_DIR/ambiguous_positional/clean"
80
+ cp "$TMP_DIR/ambiguous_positional/Makefile" "$TMP_DIR/ambiguous_positional/Makefile.before"
81
+ if ambiguous_output="$(cd "$TMP_DIR/ambiguous_positional" && bash "$ADD_TARGETS_SCRIPT" clean test 2>&1)"; then
82
+ fail "Ambiguous positional input unexpectedly succeeded"
83
+ fi
84
+ [[ "$ambiguous_output" == *"Ambiguous input"* ]] || fail "Expected ambiguity error output"
85
+ cmp -s "$TMP_DIR/ambiguous_positional/Makefile.before" "$TMP_DIR/ambiguous_positional/Makefile" \
86
+ || fail "Ambiguous parsing path modified Makefile"
87
+
88
+ # Case 5: explicit --targets mode should bypass positional ambiguity.
89
+ (cd "$TMP_DIR/ambiguous_positional" && bash "$ADD_TARGETS_SCRIPT" --targets clean test >/dev/null)
90
+ require_line "$TMP_DIR/ambiguous_positional/Makefile" '^clean:'
91
+ require_line "$TMP_DIR/ambiguous_positional/Makefile" '^test:'
92
+
93
+ # Case 6: explicit --file + --targets mode should update the selected file.
94
+ mkdir -p "$TMP_DIR/explicit_flags"
95
+ cat > "$TMP_DIR/explicit_flags/custom.mk" <<'EOF'
96
+ TARGET := demo
97
+
98
+ all:
99
+ @echo "demo"
100
+ EOF
101
+ bash "$ADD_TARGETS_SCRIPT" --file "$TMP_DIR/explicit_flags/custom.mk" --targets clean test >/dev/null
102
+ require_line "$TMP_DIR/explicit_flags/custom.mk" '^clean:'
103
+ require_line "$TMP_DIR/explicit_flags/custom.mk" '^test:'
104
+
105
+ # Case 13: idempotency — targets that already exist must not be duplicated.
106
+ mkdir -p "$TMP_DIR/idempotent"
107
+ bash "$GENERATE_SCRIPT" go myservice "$TMP_DIR/idempotent/Makefile" >/dev/null 2>&1
108
+ bash "$ADD_TARGETS_SCRIPT" "$TMP_DIR/idempotent/Makefile" clean test >/dev/null
109
+ clean_count="$(grep -c '^clean:' "$TMP_DIR/idempotent/Makefile")"
110
+ test_count="$(grep -c '^test:' "$TMP_DIR/idempotent/Makefile")"
111
+ [[ "$clean_count" -eq 1 ]] || fail "clean target duplicated ($clean_count occurrences after add on existing Makefile)"
112
+ [[ "$test_count" -eq 1 ]] || fail "test target duplicated ($test_count occurrences after add on existing Makefile)"
113
+
114
+ # Case 14: add_missing_variables must inject required variables without duplicating the header.
115
+ mkdir -p "$TMP_DIR/add_vars"
116
+ cat > "$TMP_DIR/add_vars/Makefile" <<'EOF'
117
+ # My project header
118
+ # Author: test
119
+
120
+ CC := gcc
121
+ EOF
122
+ bash "$ADD_TARGETS_SCRIPT" "$TMP_DIR/add_vars/Makefile" install >/dev/null
123
+ require_line "$TMP_DIR/add_vars/Makefile" '^PROJECT :='
124
+ require_line "$TMP_DIR/add_vars/Makefile" '^PREFIX \?= /usr/local$'
125
+ require_line "$TMP_DIR/add_vars/Makefile" '^VERSION :='
126
+ require_line "$TMP_DIR/add_vars/Makefile" '^install:'
127
+ header_count="$(grep -c '^# My project header$' "$TMP_DIR/add_vars/Makefile")"
128
+ [[ "$header_count" -eq 1 ]] || fail "Header comment duplicated ($header_count occurrences) by add_missing_variables"
129
+
130
+ # ─── generate_makefile_template.sh ───────────────────────────────────────────
131
+
132
+ # Case 6: output-file argument mapping (TYPE NAME OUTPUT) should be deterministic.
133
+ mkdir -p "$TMP_DIR/template_output"
134
+ (cd "$TMP_DIR/template_output" && bash "$GENERATE_SCRIPT" generic myproject out.mk >/dev/null)
135
+ [[ -f "$TMP_DIR/template_output/out.mk" ]] || fail "Output file argument was not honored"
136
+ require_line "$TMP_DIR/template_output/out.mk" '^PROJECT := myproject$'
137
+
138
+ # Case 7: generated Go template should include hardened defaults.
139
+ (cd "$TMP_DIR/template_output" && bash "$GENERATE_SCRIPT" go service go.mk >/dev/null)
140
+ require_line "$TMP_DIR/template_output/go.mk" '^\.PHONY: all build install test clean fmt lint help$'
141
+ require_line "$TMP_DIR/template_output/go.mk" '^GO_MAIN \?= \./cmd/\$\(PROJECT\)$'
142
+ require_line "$TMP_DIR/template_output/go.mk" '^GO_SUM := \$\(wildcard go\.sum\)$'
143
+ require_line "$TMP_DIR/template_output/go.mk" '^\$\(TARGET\): \$\(SOURCES\) go\.mod \$\(GO_SUM\)$'
144
+
145
+ # Case 8: C template should use gcc, enable dependency tracking, and include modern header.
146
+ bash "$GENERATE_SCRIPT" c myapp "$TMP_DIR/template_output/c.mk" >/dev/null 2>&1
147
+ require_line "$TMP_DIR/template_output/c.mk" '^CC \?= gcc$'
148
+ require_line "$TMP_DIR/template_output/c.mk" '^\.DELETE_ON_ERROR:$'
149
+ require_line "$TMP_DIR/template_output/c.mk" '^-include \$\(DEPENDS\)$'
150
+ require_line "$TMP_DIR/template_output/c.mk" '^\$\(OBJDIR\)/%.o: \$\(SRCDIR\)/%.c$'
151
+
152
+ # Case 9: C library template should declare both static and shared library targets.
153
+ bash "$GENERATE_SCRIPT" c-lib mylib "$TMP_DIR/template_output/c-lib.mk" >/dev/null 2>&1
154
+ require_line "$TMP_DIR/template_output/c-lib.mk" '^AR \?= ar$'
155
+ require_line "$TMP_DIR/template_output/c-lib.mk" '^STATIC_LIB :='
156
+ require_line "$TMP_DIR/template_output/c-lib.mk" '^SHARED_LIB :='
157
+ require_line "$TMP_DIR/template_output/c-lib.mk" '^\.PHONY: all static shared clean install help$'
158
+
159
+ # Case 10: C++ template must not corrupt project names that contain "gcc".
160
+ bash "$GENERATE_SCRIPT" cpp gcc-wrapper "$TMP_DIR/template_output/cpp.mk" >/dev/null 2>&1
161
+ require_line "$TMP_DIR/template_output/cpp.mk" '^PROJECT := gcc-wrapper$'
162
+ require_line "$TMP_DIR/template_output/cpp.mk" '^CXX \?= g\+\+$'
163
+ require_line "$TMP_DIR/template_output/cpp.mk" '\$\(SRCDIR\)/%.cpp'
164
+
165
+ # Case 11: Python template should use python3 and include a develop (editable-install) target.
166
+ bash "$GENERATE_SCRIPT" python mypkg "$TMP_DIR/template_output/python.mk" >/dev/null 2>&1
167
+ require_line "$TMP_DIR/template_output/python.mk" '^PYTHON \?= python3$'
168
+ require_line "$TMP_DIR/template_output/python.mk" '^develop:'
169
+ require_line "$TMP_DIR/template_output/python.mk" '\$\(PYTHON\) -m build'
170
+
171
+ # Case 12: Java template should include JAR creation, correct toolchain variables, and distclean.
172
+ bash "$GENERATE_SCRIPT" java myapp "$TMP_DIR/template_output/java.mk" >/dev/null 2>&1
173
+ require_line "$TMP_DIR/template_output/java.mk" '^JAVAC \?= javac$'
174
+ require_line "$TMP_DIR/template_output/java.mk" '^MAIN_CLASS := Main$'
175
+ require_line "$TMP_DIR/template_output/java.mk" '^jar:'
176
+ require_line "$TMP_DIR/template_output/java.mk" '^distclean: clean$'
177
+
178
+ # Case 15: slash in project names should render literally in template output.
179
+ bash "$GENERATE_SCRIPT" generic 'svc/api' "$TMP_DIR/template_output/special-slash.mk" >/dev/null 2>&1
180
+ require_literal_line "$TMP_DIR/template_output/special-slash.mk" 'PROJECT := svc/api'
181
+
182
+ # Case 16: ampersand in project names should render literally in template output.
183
+ bash "$GENERATE_SCRIPT" generic 'x&y' "$TMP_DIR/template_output/special-amp.mk" >/dev/null 2>&1
184
+ require_literal_line "$TMP_DIR/template_output/special-amp.mk" 'PROJECT := x&y'
185
+
186
+ # Case 17: backslash in project names should render literally in template output.
187
+ bash "$GENERATE_SCRIPT" generic 'a\b' "$TMP_DIR/template_output/special-backslash.mk" >/dev/null 2>&1
188
+ require_literal_line "$TMP_DIR/template_output/special-backslash.mk" 'PROJECT := a\b'
189
+
190
+ echo "PASS: makefile-generator helper script regression tests"
@@ -0,0 +1,244 @@
1
+ ---
2
+ name: makefile-validator
3
+ description: Validate, lint, audit, or check Makefiles and .mk files for errors.
4
+ category: engineering-method
5
+ source: cc-devops-skills
6
+ date_added: "2026-09-25"
7
+ ---
8
+
9
+ # Makefile Validator
10
+
11
+ ## Overview
12
+
13
+ Use this skill to validate Makefiles with a local-first, deterministic flow.
14
+
15
+ Default validator entrypoint:
16
+
17
+ ```bash
18
+ bash scripts/validate_makefile.sh <makefile-path>
19
+ ```
20
+
21
+ Validation layers:
22
+
23
+ 1. Dependency preflight (`python3`, `pip3`, `make`)
24
+ 2. GNU make syntax check (`make -n --dry-run`) when `make` is available
25
+ 3. `mbake validate`
26
+ 4. `mbake format --check`
27
+ 5. Custom security, best-practice, and optimization checks
28
+ 6. Optional `checkmake` and `unmake` checks when installed
29
+
30
+ ## Trigger Guidance
31
+
32
+ Use this skill when the request includes Makefile quality, linting, validation, hardening, or troubleshooting.
33
+
34
+ ### Trigger Phrases
35
+
36
+ - "Validate this Makefile"
37
+ - "Lint my `.mk` file"
38
+ - "Find issues in this build Makefile"
39
+ - "Check Makefile security problems"
40
+ - "Review this Makefile before CI"
41
+
42
+ ### Non-Trigger Examples
43
+
44
+ - Creating a brand new Makefile from scratch (use `makefile-generator`)
45
+ - Running build targets as part of delivery
46
+ - General shell scripting work unrelated to Makefiles
47
+
48
+ ## Deterministic Execution Model
49
+
50
+ Run from this skill directory for shortest commands:
51
+
52
+ ```bash
53
+ cd devops-skills-plugin/skills/makefile-validator
54
+ ```
55
+
56
+ ### Step 1: Preflight
57
+
58
+ 1. Confirm target file exists and is readable.
59
+ 2. Confirm whether file edits are allowed (`writable`) or only suggestions can be returned (`read-only`).
60
+ 3. Prefer the default validator path first; use fallbacks only when blocked by environment constraints.
61
+
62
+ ### Step 2: Baseline Validation (Default Path)
63
+
64
+ ```bash
65
+ # From skill directory
66
+ bash scripts/validate_makefile.sh <makefile-path>
67
+
68
+ # From repository root
69
+ bash devops-skills-plugin/skills/makefile-validator/scripts/validate_makefile.sh <makefile-path>
70
+ ```
71
+
72
+ Always record:
73
+
74
+ - command executed
75
+ - exit code
76
+ - summary counts (`Errors`, `Warnings`, `Info`)
77
+ - issue locations reported by tools
78
+
79
+ ### Step 3: Interpret Output and Exit Code
80
+
81
+ | Exit code | Meaning | Expected summary line | Action |
82
+ | --- | --- | --- | --- |
83
+ | `0` | no blocking findings | `Validation PASSED` | optional improvements only |
84
+ | `1` | warning-only result | `Validation PASSED with warnings` | fix recommended; merge policy dependent |
85
+ | `2` | error result | `Validation FAILED - errors must be fixed` | fix required, then rerun |
86
+
87
+ ### Step 4: Progressive Reference Loading
88
+
89
+ Open only the docs required by the current findings.
90
+
91
+ | Finding type | Reference doc |
92
+ | --- | --- |
93
+ | `.PHONY`, `.DELETE_ON_ERROR`, `.ONESHELL`, variable usage, performance structure | `docs/best-practices.md` |
94
+ | tabs vs spaces, dependency mistakes, credential patterns, anti-patterns | `docs/common-mistakes.md` |
95
+ | `mbake` behavior, formatter flags, known `mbake` caveats | `docs/bake-tool.md` |
96
+
97
+ ### Step 5: Fix + Rerun Loop
98
+
99
+ After applying fixes, rerun:
100
+
101
+ ```bash
102
+ bash scripts/validate_makefile.sh <makefile-path>
103
+ ```
104
+
105
+ Loop rules:
106
+
107
+ 1. Stop only when no new errors are introduced.
108
+ 2. If warnings remain intentionally, document why they are accepted.
109
+ 3. Always report the latest rerun exit code.
110
+
111
+ ## How to Open Docs
112
+
113
+ Use explicit file-open commands so paths are unambiguous.
114
+
115
+ From repository root:
116
+
117
+ ```bash
118
+ sed -n '1,220p' devops-skills-plugin/skills/makefile-validator/docs/best-practices.md
119
+ sed -n '1,220p' devops-skills-plugin/skills/makefile-validator/docs/common-mistakes.md
120
+ sed -n '1,220p' devops-skills-plugin/skills/makefile-validator/docs/bake-tool.md
121
+ rg -n "PHONY|DELETE_ON_ERROR|ONESHELL|tab|credential|mbake" devops-skills-plugin/skills/makefile-validator/docs/*.md
122
+ ```
123
+
124
+ From `devops-skills-plugin/skills/makefile-validator`:
125
+
126
+ ```bash
127
+ sed -n '1,220p' docs/best-practices.md
128
+ sed -n '1,220p' docs/common-mistakes.md
129
+ sed -n '1,220p' docs/bake-tool.md
130
+ rg -n "PHONY|DELETE_ON_ERROR|ONESHELL|tab|credential|mbake" docs/*.md
131
+ ```
132
+
133
+ If shell commands are unavailable, use the environment's file-open/read actions on the same paths.
134
+
135
+ ## Fallback Behavior
136
+
137
+ Use these only when the default validator path cannot run fully.
138
+
139
+ | Constraint | Fallback action | Reporting requirement |
140
+ | --- | --- | --- |
141
+ | `python3` or `pip3` unavailable | Run limited checks (`make -f <file> -n --dry-run` if `make` exists, plus focused `grep` checks) | State that `mbake` stages were skipped and coverage is reduced |
142
+ | `pip3 install mbake` fails (offline/proxy/index issue) | Keep syntax/custom checks that still work; defer formatter/linter stages | Report install failure and request rerun in a network-enabled environment |
143
+ | `make` unavailable | Continue with non-syntax stages; script already downgrades syntax stage | Explicitly note syntax coverage was skipped |
144
+ | `checkmake` or `unmake` unavailable | Continue; these are optional stages | Note optional lint/portability coverage not executed |
145
+ | target file is read-only | Provide patch suggestions only | Mark response as advisory only |
146
+ | command execution unavailable | Provide static review from file contents and docs | Mark result as non-executed analysis |
147
+
148
+ Minimal fallback commands:
149
+
150
+ ```bash
151
+ # Syntax only (when make exists)
152
+ make -f <makefile-path> -n --dry-run
153
+
154
+ # Focused quick checks
155
+ grep -n "^\\.DELETE_ON_ERROR:" <makefile-path>
156
+ grep -n "^\\.PHONY:" <makefile-path>
157
+ grep -nE "^( | | )[a-zA-Z@\\$\\(]" <makefile-path>
158
+ ```
159
+
160
+ ## Example Outcomes Mapped to Exit Codes
161
+
162
+ ### Clean Result (`exit 0`)
163
+
164
+ ```text
165
+ Errors: 0
166
+ Warnings: 0
167
+ Info: 2
168
+ ✓ Validation PASSED
169
+ ```
170
+
171
+ ### Warning-Only Result (`exit 1`)
172
+
173
+ ```text
174
+ Errors: 0
175
+ Warnings: 3
176
+ Info: 1
177
+ ⚠ Validation PASSED with warnings
178
+ ```
179
+
180
+ ### Error Result (`exit 2`)
181
+
182
+ ```text
183
+ Errors: 2
184
+ Warnings: 1
185
+ Info: 0
186
+ ⚠ Validation FAILED - errors must be fixed
187
+ ```
188
+
189
+ ## Troubleshooting Quick Start
190
+
191
+ 1. Verify required tools:
192
+
193
+ ```bash
194
+ command -v python3 pip3 make
195
+ ```
196
+
197
+ 2. Isolate GNU make syntax failures:
198
+
199
+ ```bash
200
+ make -f <makefile-path> -n --dry-run
201
+ ```
202
+
203
+ 3. Check likely tab-indentation violations:
204
+
205
+ ```bash
206
+ grep -nE "^( | | )[a-zA-Z@\\$\\(]" <makefile-path>
207
+ ```
208
+
209
+ 4. Rerun validator with plain output and capture log:
210
+
211
+ ```bash
212
+ NO_COLOR=1 bash scripts/validate_makefile.sh <makefile-path> > /tmp/makefile-validator.log 2>&1
213
+ echo "exit=$? log=/tmp/makefile-validator.log"
214
+ ```
215
+
216
+ 5. If mbake install keeps failing, validate in a network-enabled shell or with an internal PyPI mirror, then rerun the full validator.
217
+
218
+ ## Skill Paths
219
+
220
+ ```text
221
+ makefile-validator/
222
+ ├── SKILL.md
223
+ ├── scripts/
224
+ │ └── validate_makefile.sh
225
+ ├── docs/
226
+ │ ├── best-practices.md
227
+ │ ├── common-mistakes.md
228
+ │ └── bake-tool.md
229
+ └── examples/
230
+ ├── good-makefile.mk
231
+ └── bad-makefile.mk
232
+ ```
233
+
234
+ ## Done Criteria
235
+
236
+ This skill update is complete when all are true:
237
+
238
+ 1. Trigger guidance is explicit and easy to identify.
239
+ 2. Execution flow is deterministic (preflight -> run -> interpret -> docs -> rerun).
240
+ 3. "How to open docs" instructions include exact commands and paths.
241
+ 4. Example outcomes are explicitly tied to exit codes (`0`, `1`, `2`).
242
+ 5. Fallback behavior is documented for missing tools and constrained environments.
243
+ 6. Troubleshooting quick-start is concise and runnable.
244
+ 7. Frontmatter `name` and `description` remain unchanged.