@hybridlabor-api/aos 4.8.0 → 4.9.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 (166) hide show
  1. package/.agents/agents.md +1 -1
  2. package/.agents/nodes.json +1 -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/settings.json +13 -0
  9. package/.opencode/agents/godmode-media-eventtech.md +1 -1
  10. package/.opencode/plugins/bdb-aos.js +31 -4
  11. package/README.de.md +1 -1
  12. package/README.md +1 -1
  13. package/README.pt.md +1 -1
  14. package/THIRD_PARTY_NOTICES.md +88 -0
  15. package/docs/skills_table.md +1 -1
  16. package/installer.js +174 -46
  17. package/package.json +6 -2
  18. package/packages/aos-cli/README.md +80 -0
  19. package/packages/aos-cli/bin/aos-cli.mjs +134 -0
  20. package/packages/aos-cli/core-skills.json +12 -0
  21. package/packages/aos-cli/extensions/aos.ts +321 -0
  22. package/packages/aos-cli/package-lock.json +1923 -0
  23. package/packages/aos-cli/package.json +29 -0
  24. package/packages/aos-cli/scripts/check-theme.mjs +63 -0
  25. package/packages/aos-cli/themes/aos.json +97 -0
  26. package/scripts/build-plugin-manifest.mjs +131 -0
  27. package/scripts/validate-skills.mjs +81 -6
  28. package/skills/basic/ao-orchestrator/SKILL.md +116 -0
  29. package/skills/global_config/agenttrail/SKILL.md +6 -1
  30. package/skills/global_config/ask-tim/SKILL.md +4 -4
  31. package/skills/global_config/bash-script-generator/SKILL.md +201 -0
  32. package/skills/global_config/bash-script-generator/assets/templates/standard-template.sh +96 -0
  33. package/skills/global_config/bash-script-generator/docs/bash-scripting-guide.md +729 -0
  34. package/skills/global_config/bash-script-generator/docs/generation-best-practices.md +193 -0
  35. package/skills/global_config/bash-script-generator/docs/script-patterns.md +566 -0
  36. package/skills/global_config/bash-script-generator/docs/text-processing-guide.md +437 -0
  37. package/skills/global_config/bash-script-generator/examples/log-analyzer.sh +92 -0
  38. package/skills/global_config/bash-script-generator/scripts/generate_script_template.sh +123 -0
  39. package/skills/global_config/bash-script-generator/scripts/run_ci_checks.sh +172 -0
  40. package/skills/global_config/bash-script-generator/scripts/test_generator.sh +413 -0
  41. package/skills/global_config/bash-script-validator/SKILL.md +249 -0
  42. package/skills/global_config/bash-script-validator/docs/awk-reference.md +449 -0
  43. package/skills/global_config/bash-script-validator/docs/bash-reference.md +468 -0
  44. package/skills/global_config/bash-script-validator/docs/common-mistakes.md +623 -0
  45. package/skills/global_config/bash-script-validator/docs/grep-reference.md +395 -0
  46. package/skills/global_config/bash-script-validator/docs/regex-reference.md +391 -0
  47. package/skills/global_config/bash-script-validator/docs/sed-reference.md +454 -0
  48. package/skills/global_config/bash-script-validator/docs/shell-reference.md +463 -0
  49. package/skills/global_config/bash-script-validator/docs/shellcheck-reference.md +399 -0
  50. package/skills/global_config/bash-script-validator/examples/bad-bash.sh +55 -0
  51. package/skills/global_config/bash-script-validator/examples/bad-shell.sh +54 -0
  52. package/skills/global_config/bash-script-validator/examples/good-bash.sh +71 -0
  53. package/skills/global_config/bash-script-validator/examples/good-shell.sh +69 -0
  54. package/skills/global_config/bash-script-validator/scripts/run_ci_checks.sh +23 -0
  55. package/skills/global_config/bash-script-validator/scripts/shellcheck_wrapper.sh +174 -0
  56. package/skills/global_config/bash-script-validator/scripts/test_validate.sh +446 -0
  57. package/skills/global_config/bash-script-validator/scripts/validate.sh +512 -0
  58. package/skills/global_config/ci-pipeline/SKILL.md +135 -0
  59. package/skills/global_config/dispatching-parallel-agents/SKILL.md +170 -0
  60. package/skills/global_config/dockerfile-generator/SKILL.md +1038 -0
  61. package/skills/global_config/dockerfile-generator/examples/example.dockerignore +95 -0
  62. package/skills/global_config/dockerfile-generator/examples/golang-distroless.Dockerfile +34 -0
  63. package/skills/global_config/dockerfile-generator/examples/java-springboot.Dockerfile +45 -0
  64. package/skills/global_config/dockerfile-generator/examples/nextjs-production.Dockerfile +49 -0
  65. package/skills/global_config/dockerfile-generator/examples/nodejs-multistage.Dockerfile +55 -0
  66. package/skills/global_config/dockerfile-generator/examples/python-fastapi.Dockerfile +48 -0
  67. package/skills/global_config/dockerfile-generator/references/language_specific_guides.md +510 -0
  68. package/skills/global_config/dockerfile-generator/references/multistage_builds.md +570 -0
  69. package/skills/global_config/dockerfile-generator/references/optimization_patterns.md +492 -0
  70. package/skills/global_config/dockerfile-generator/references/security_best_practices.md +375 -0
  71. package/skills/global_config/dockerfile-generator/scripts/generate_dockerignore.sh +199 -0
  72. package/skills/global_config/dockerfile-generator/scripts/generate_golang.sh +172 -0
  73. package/skills/global_config/dockerfile-generator/scripts/generate_java.sh +185 -0
  74. package/skills/global_config/dockerfile-generator/scripts/generate_nodejs.sh +279 -0
  75. package/skills/global_config/dockerfile-generator/scripts/generate_python.sh +218 -0
  76. package/skills/global_config/dockerfile-generator/scripts/test_generator.sh +210 -0
  77. package/skills/global_config/dockerfile-validator/SKILL.md +300 -0
  78. package/skills/global_config/dockerfile-validator/examples/.dockerignore.example +34 -0
  79. package/skills/global_config/dockerfile-validator/examples/bad-example.Dockerfile +37 -0
  80. package/skills/global_config/dockerfile-validator/examples/golang-distroless.Dockerfile +50 -0
  81. package/skills/global_config/dockerfile-validator/examples/good-example.Dockerfile +52 -0
  82. package/skills/global_config/dockerfile-validator/examples/python-optimized.Dockerfile +53 -0
  83. package/skills/global_config/dockerfile-validator/examples/security-issues.Dockerfile +42 -0
  84. package/skills/global_config/dockerfile-validator/references/docker_best_practices.md +348 -0
  85. package/skills/global_config/dockerfile-validator/references/optimization_guide.md +473 -0
  86. package/skills/global_config/dockerfile-validator/references/security_checklist.md +208 -0
  87. package/skills/global_config/dockerfile-validator/scripts/dockerfile-validate.sh +699 -0
  88. package/skills/global_config/dockerfile-validator/scripts/test_validate.sh +35 -0
  89. package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn-lock-read.Dockerfile +6 -0
  90. package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn.Dockerfile +6 -0
  91. package/skills/global_config/dockerfile-validator/tests/fixtures/from-platform-nonroot.Dockerfile +7 -0
  92. package/skills/global_config/dockerfile-validator/tests/test_regression.sh +164 -0
  93. package/skills/global_config/finishing-a-development-branch/SKILL.md +228 -0
  94. package/skills/global_config/github-actions-generator/SKILL.md +353 -0
  95. package/skills/global_config/github-actions-generator/assets/templates/action/composite/action.yml +82 -0
  96. package/skills/global_config/github-actions-generator/assets/templates/action/docker/Dockerfile +25 -0
  97. package/skills/global_config/github-actions-generator/assets/templates/action/docker/action.yml +42 -0
  98. package/skills/global_config/github-actions-generator/assets/templates/action/docker/entrypoint.sh +27 -0
  99. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/action.yml +33 -0
  100. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/index.js +50 -0
  101. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/package.json +27 -0
  102. package/skills/global_config/github-actions-generator/assets/templates/workflow/basic_workflow.yml +242 -0
  103. package/skills/global_config/github-actions-generator/assets/templates/workflow/reusable_workflow.yml +106 -0
  104. package/skills/global_config/github-actions-generator/examples/README.md +147 -0
  105. package/skills/global_config/github-actions-generator/examples/actions/setup-node-cached/action.yml +93 -0
  106. package/skills/global_config/github-actions-generator/examples/caching/docker-buildkit.yml +256 -0
  107. package/skills/global_config/github-actions-generator/examples/security/dependency-review.yml +62 -0
  108. package/skills/global_config/github-actions-generator/examples/security/sbom-attestation.yml +119 -0
  109. package/skills/global_config/github-actions-generator/examples/triggers/chatops-commands.yml +475 -0
  110. package/skills/global_config/github-actions-generator/examples/triggers/repository-dispatch.yml +418 -0
  111. package/skills/global_config/github-actions-generator/examples/triggers/workflow-orchestration.yml +404 -0
  112. package/skills/global_config/github-actions-generator/examples/workflows/docker-build-push.yml +68 -0
  113. package/skills/global_config/github-actions-generator/examples/workflows/go-ci.yml +161 -0
  114. package/skills/global_config/github-actions-generator/examples/workflows/monorepo-ci.yml +340 -0
  115. package/skills/global_config/github-actions-generator/examples/workflows/multi-environment-deploy.yml +406 -0
  116. package/skills/global_config/github-actions-generator/examples/workflows/nodejs-ci.yml +122 -0
  117. package/skills/global_config/github-actions-generator/examples/workflows/python-ci.yml +157 -0
  118. package/skills/global_config/github-actions-generator/examples/workflows/scheduled-tasks.yml +376 -0
  119. package/skills/global_config/github-actions-generator/references/advanced-triggers.md +917 -0
  120. package/skills/global_config/github-actions-generator/references/best-practices.md +755 -0
  121. package/skills/global_config/github-actions-generator/references/common-actions.md +715 -0
  122. package/skills/global_config/github-actions-generator/references/custom-actions.md +320 -0
  123. package/skills/global_config/github-actions-generator/references/expressions-and-contexts.md +688 -0
  124. package/skills/global_config/github-actions-generator/references/modern-features.md +421 -0
  125. package/skills/global_config/github-actions-generator/scripts/test_generator.sh +344 -0
  126. package/skills/global_config/github-actions-templates/SKILL.md +7 -0
  127. package/skills/global_config/github-actions-validator/SKILL.md +576 -0
  128. package/skills/global_config/github-actions-validator/examples/README.md +88 -0
  129. package/skills/global_config/github-actions-validator/examples/outdated-versions.yml +76 -0
  130. package/skills/global_config/github-actions-validator/examples/valid-ci.yml +79 -0
  131. package/skills/global_config/github-actions-validator/examples/with-errors.yml +47 -0
  132. package/skills/global_config/github-actions-validator/references/act_usage.md +233 -0
  133. package/skills/global_config/github-actions-validator/references/action_versions.md +122 -0
  134. package/skills/global_config/github-actions-validator/references/actionlint_usage.md +343 -0
  135. package/skills/global_config/github-actions-validator/references/common_errors.md +512 -0
  136. package/skills/global_config/github-actions-validator/references/modern_features.md +384 -0
  137. package/skills/global_config/github-actions-validator/references/runners.md +317 -0
  138. package/skills/global_config/github-actions-validator/scripts/install_tools.sh +113 -0
  139. package/skills/global_config/github-actions-validator/scripts/validate_workflow.sh +910 -0
  140. package/skills/global_config/github-actions-validator/tests/test_validate_workflow.sh +237 -0
  141. package/skills/global_config/makefile-generator/SKILL.md +614 -0
  142. package/skills/global_config/makefile-generator/assets/templates/.gitkeep +1 -0
  143. package/skills/global_config/makefile-generator/docs/makefile-structure.md +530 -0
  144. package/skills/global_config/makefile-generator/docs/optimization-guide.md +784 -0
  145. package/skills/global_config/makefile-generator/docs/patterns-guide.md +642 -0
  146. package/skills/global_config/makefile-generator/docs/security-guide.md +361 -0
  147. package/skills/global_config/makefile-generator/docs/targets-guide.md +642 -0
  148. package/skills/global_config/makefile-generator/docs/variables-guide.md +596 -0
  149. package/skills/global_config/makefile-generator/scripts/add_standard_targets.sh +539 -0
  150. package/skills/global_config/makefile-generator/scripts/generate_makefile_template.sh +690 -0
  151. package/skills/global_config/makefile-generator/test/test_helper_scripts.sh +190 -0
  152. package/skills/global_config/makefile-validator/SKILL.md +244 -0
  153. package/skills/global_config/makefile-validator/docs/bake-tool.md +1000 -0
  154. package/skills/global_config/makefile-validator/docs/best-practices.md +858 -0
  155. package/skills/global_config/makefile-validator/docs/common-mistakes.md +944 -0
  156. package/skills/global_config/makefile-validator/examples/bad-makefile.mk +77 -0
  157. package/skills/global_config/makefile-validator/examples/good-makefile.mk +103 -0
  158. package/skills/global_config/makefile-validator/scripts/test_validate.sh +382 -0
  159. package/skills/global_config/makefile-validator/scripts/validate_makefile.sh +712 -0
  160. package/skills/global_config/{MCP_Manage → mcp-manage}/SKILL.md +3 -3
  161. package/skills/global_config/requesting-code-review/SKILL.md +98 -0
  162. package/skills/global_config/requesting-code-review/code-reviewer.md +198 -0
  163. package/skills/global_config/using-git-worktrees/SKILL.md +170 -0
  164. package/skills/global_config/verification-before-completion/SKILL.md +123 -0
  165. package/skills/global_config/writing-plans/SKILL.md +126 -46
  166. package/skills/global_config/writing-plans-legacy/SKILL.md +139 -0
@@ -0,0 +1,1000 @@
1
+ # mbake Tool Reference
2
+
3
+ Comprehensive guide to using mbake (Makefile formatter and linter) for Makefile validation and formatting.
4
+
5
+ ## Overview
6
+
7
+ **mbake** is a modern Python-based tool designed to format and validate Makefiles with intelligent features. It's the first comprehensive Makefile formatter and linter, filling a 50-year gap in build tooling.
8
+
9
+ **Current Version**: See [PyPI](https://pypi.org/project/mbake/) for latest
10
+
11
+ ### Known Limitations
12
+
13
+ While mbake is excellent for GNU Make formatting, be aware of these limitations:
14
+
15
+ - **POSIX Make**: mbake is designed for GNU Make; it may not recognize all POSIX make syntax
16
+ - **.SUFFIXES**: mbake doesn't understand `.SUFFIXES` special target
17
+ - **Format vs Check**: Some users report `mbake format --check` warns about different things than `mbake format` fixes
18
+
19
+ For additional linting coverage, consider using [checkmake](https://github.com/checkmake/checkmake) alongside mbake.
20
+
21
+ ## Table of Contents
22
+
23
+ 1. [Installation](#installation)
24
+ 2. [Quick Start](#quick-start)
25
+ 3. [Commands](#commands)
26
+ 4. [Configuration](#configuration)
27
+ 5. [Features](#features)
28
+ 6. [CI/CD Integration](#cicd-integration)
29
+ 7. [Editor Integration](#editor-integration)
30
+ 8. [Advanced Usage](#advanced-usage)
31
+ 9. [Troubleshooting](#troubleshooting)
32
+
33
+ ## Installation
34
+
35
+ ### PyPI Installation (Recommended)
36
+
37
+ ```bash
38
+ # Install mbake
39
+ pip install mbake
40
+
41
+ # Upgrade to latest version
42
+ pip install --upgrade mbake
43
+
44
+ # Verify installation
45
+ mbake --version
46
+ ```
47
+
48
+ ### System Requirements
49
+
50
+ - **Python**: 3.9 or higher
51
+ - **GNU Make**: Required for validation (syntax checking)
52
+ - **pip**: For package management
53
+
54
+ ### Virtual Environment (Isolated Installation)
55
+
56
+ ```bash
57
+ # Create venv
58
+ python3 -m venv mbake-env
59
+
60
+ # Activate venv
61
+ source mbake-env/bin/activate # Linux/macOS
62
+ # or
63
+ mbake-env\Scripts\activate # Windows
64
+
65
+ # Install mbake
66
+ pip install mbake
67
+
68
+ # Use mbake
69
+ mbake format Makefile
70
+
71
+ # Deactivate when done
72
+ deactivate
73
+ ```
74
+
75
+ **Note**: The makefile-validator skill automatically handles venv creation and cleanup.
76
+
77
+ ### VS Code Extension
78
+
79
+ Install the "mbake Makefile Formatter" extension from the VS Code marketplace:
80
+
81
+ 1. Open VS Code
82
+ 2. Go to Extensions (Ctrl+Shift+X)
83
+ 3. Search for "mbake Makefile Formatter"
84
+ 4. Click Install
85
+
86
+ ## Quick Start
87
+
88
+ ### Basic Workflow
89
+
90
+ ```bash
91
+ # 1. Check current formatting status
92
+ mbake format --check Makefile
93
+
94
+ # 2. Preview changes before applying
95
+ mbake format --diff Makefile
96
+
97
+ # 3. Apply formatting
98
+ mbake format Makefile
99
+
100
+ # 4. Validate syntax
101
+ mbake validate Makefile
102
+ ```
103
+
104
+ ### First-Time Usage
105
+
106
+ ```bash
107
+ # Initialize configuration file
108
+ mbake init
109
+
110
+ # This creates ~/.bake.toml with default settings
111
+ # Edit the file to customize mbake behavior
112
+
113
+ # View current configuration
114
+ mbake config
115
+
116
+ # Format with current settings
117
+ mbake format Makefile
118
+ ```
119
+
120
+ ## Commands
121
+
122
+ ### `mbake format`
123
+
124
+ Format and standardize Makefile structure.
125
+
126
+ ```bash
127
+ # Basic formatting
128
+ mbake format Makefile
129
+
130
+ # Check formatting without modifying (CI/CD)
131
+ mbake format --check Makefile
132
+ # Exit code: 0 (properly formatted), 1 (needs formatting)
133
+
134
+ # Show diff of changes
135
+ mbake format --diff Makefile
136
+
137
+ # Backup before formatting
138
+ mbake format --backup Makefile
139
+ # Creates Makefile.bak
140
+
141
+ # Validate after formatting
142
+ mbake format --validate Makefile
143
+
144
+ # Specify custom config file
145
+ mbake format --config /path/to/.bake.toml Makefile
146
+
147
+ # Format multiple files
148
+ mbake format Makefile tests/*.mk build/*.mk
149
+ ```
150
+
151
+ **Options:**
152
+ - `--check`: Check formatting without modifying (exit 0 if formatted, 1 if not)
153
+ - `--diff`: Display potential changes without applying
154
+ - `--backup`: Create .bak backup before modifying
155
+ - `--validate`: Run syntax validation after formatting
156
+ - `--config PATH`: Use custom configuration file
157
+
158
+ ### `mbake validate`
159
+
160
+ Validate Makefile syntax using GNU Make.
161
+
162
+ ```bash
163
+ # Validate syntax
164
+ mbake validate Makefile
165
+
166
+ # Validates with: make -f Makefile --dry-run
167
+ # Exit code: 0 (valid), 1 (invalid)
168
+
169
+ # Validate multiple files
170
+ mbake validate Makefile src/*.mk
171
+ ```
172
+
173
+ **What it checks:**
174
+ - Syntax errors (missing colons, invalid characters)
175
+ - Target definition correctness
176
+ - Variable expansion syntax
177
+ - Recipe format
178
+ - Dependency chain validity
179
+
180
+ ### `mbake init`
181
+
182
+ Create initial configuration file.
183
+
184
+ ```bash
185
+ # Create ~/.bake.toml with defaults
186
+ mbake init
187
+
188
+ # The configuration file includes all formatting options
189
+ # Edit it to customize mbake behavior
190
+ ```
191
+
192
+ ### `mbake config`
193
+
194
+ Display current configuration settings.
195
+
196
+ ```bash
197
+ # Show active configuration
198
+ mbake config
199
+
200
+ # Output includes:
201
+ # - Configuration file location
202
+ # - All active settings
203
+ # - Default values for unset options
204
+ ```
205
+
206
+ ### `mbake update`
207
+
208
+ Update mbake to the latest version.
209
+
210
+ ```bash
211
+ # Update via pip
212
+ mbake update
213
+
214
+ # Equivalent to: pip install --upgrade mbake
215
+ ```
216
+
217
+ ## Configuration
218
+
219
+ ### Configuration File: `~/.bake.toml`
220
+
221
+ Create and edit `~/.bake.toml` to customize mbake behavior:
222
+
223
+ ```toml
224
+ # ~/.bake.toml - mbake configuration
225
+
226
+ # Add spaces around = in variable assignments
227
+ # Example: VAR = value (instead of VAR=value)
228
+ space_around_assignment = true
229
+
230
+ # Add space after : in target definitions
231
+ # Example: target : prerequisites (instead of target: prerequisites)
232
+ space_after_colon = true
233
+
234
+ # Normalize line continuation characters (backslashes)
235
+ # Removes trailing spaces before \ and ensures proper continuation
236
+ normalize_line_continuations = true
237
+
238
+ # Remove trailing whitespace from all lines
239
+ remove_trailing_whitespace = true
240
+
241
+ # Fix missing tabs in recipes (convert spaces to tabs)
242
+ # This is critical - Makefiles MUST use tabs for recipes
243
+ fix_missing_recipe_tabs = true
244
+
245
+ # Automatically detect and insert .PHONY declarations
246
+ # Analyzes recipes to identify phony targets (clean, test, etc.)
247
+ auto_insert_phony_declarations = true
248
+
249
+ # Group multiple .PHONY declarations into single declaration
250
+ # .PHONY: clean test (instead of two separate lines)
251
+ group_phony_declarations = true
252
+
253
+ # Place .PHONY declarations at the top of the file
254
+ # If false, keeps them near their target definitions
255
+ phony_at_top = false
256
+ ```
257
+
258
+ ### Per-Project Configuration
259
+
260
+ Create `.bake.toml` in your project root:
261
+
262
+ ```toml
263
+ # Project-specific mbake settings
264
+ # These override ~/.bake.toml for this project
265
+
266
+ space_around_assignment = false # Compact style for this project
267
+ auto_insert_phony_declarations = true
268
+ phony_at_top = true
269
+ ```
270
+
271
+ **Priority:**
272
+ 1. `.bake.toml` in current directory (highest)
273
+ 2. `~/.bake.toml` in home directory
274
+ 3. Built-in defaults (lowest)
275
+
276
+ ### Configuration Options Reference
277
+
278
+ | Option | Type | Default | Description |
279
+ |--------|------|---------|-------------|
280
+ | `space_around_assignment` | bool | `true` | Add spaces around `=` |
281
+ | `space_after_colon` | bool | `true` | Add space after `:` |
282
+ | `normalize_line_continuations` | bool | `true` | Clean backslash continuations |
283
+ | `remove_trailing_whitespace` | bool | `true` | Remove end-of-line spaces |
284
+ | `fix_missing_recipe_tabs` | bool | `true` | Convert spaces to tabs in recipes |
285
+ | `auto_insert_phony_declarations` | bool | `true` | Auto-detect and add .PHONY |
286
+ | `group_phony_declarations` | bool | `true` | Combine .PHONY lines |
287
+ | `phony_at_top` | bool | `false` | Place .PHONY at file start |
288
+
289
+ ## Features
290
+
291
+ ### 1. Tab Indentation Enforcement
292
+
293
+ Automatically converts spaces to tabs in recipe sections.
294
+
295
+ ```makefile
296
+ # Before (spaces - invalid!)
297
+ build:
298
+ echo "Building..."
299
+ go build -o app
300
+
301
+ # After (tabs - correct!)
302
+ build:
303
+ echo "Building..."
304
+ go build -o app
305
+ ```
306
+
307
+ ### 2. Variable Assignment Formatting
308
+
309
+ Consistent spacing around assignments.
310
+
311
+ ```makefile
312
+ # Before (inconsistent)
313
+ VAR1=value
314
+ VAR2 =value
315
+ VAR3= value
316
+ VAR4 = value
317
+
318
+ # After (consistent)
319
+ VAR1 = value
320
+ VAR2 = value
321
+ VAR3 = value
322
+ VAR4 = value
323
+ ```
324
+
325
+ ### 3. Target Colon Spacing
326
+
327
+ Standardizes spacing after target colons.
328
+
329
+ ```makefile
330
+ # Before
331
+ target1:prerequisites
332
+ target2 :prerequisites
333
+ target3: prerequisites
334
+
335
+ # After
336
+ target1: prerequisites
337
+ target2: prerequisites
338
+ target3: prerequisites
339
+ ```
340
+
341
+ ### 4. Intelligent .PHONY Detection
342
+
343
+ Automatically identifies phony targets by analyzing recipes.
344
+
345
+ ```makefile
346
+ # Before
347
+ clean:
348
+ rm -rf build
349
+
350
+ test:
351
+ go test ./...
352
+
353
+ install:
354
+ cp app /usr/local/bin/
355
+
356
+ # After
357
+ .PHONY: clean test install
358
+
359
+ clean:
360
+ rm -rf build
361
+
362
+ test:
363
+ go test ./...
364
+
365
+ install:
366
+ cp app /usr/local/bin/
367
+ ```
368
+
369
+ **Detection Logic:**
370
+ - Targets with `rm`, `mkdir`, `echo` commands → Phony
371
+ - Targets with `npm`, `go test`, `docker` commands → Phony
372
+ - Targets with `curl`, `ssh`, `scp` commands → Phony
373
+ - Targets producing actual files (*.o, *.a, binaries) → Not phony
374
+
375
+ ### 5. Line Continuation Normalization
376
+
377
+ Cleans up line continuation characters.
378
+
379
+ ```makefile
380
+ # Before (trailing space after \, inconsistent)
381
+ SOURCES = main.c \
382
+ utils.c\
383
+ config.c \
384
+
385
+ # After (consistent, no trailing spaces)
386
+ SOURCES = main.c \
387
+ utils.c \
388
+ config.c
389
+ ```
390
+
391
+ ### 6. Trailing Whitespace Removal
392
+
393
+ Removes all trailing spaces and tabs.
394
+
395
+ ```makefile
396
+ # Before (invisible trailing spaces marked with ·)
397
+ VAR = value···
398
+ build:···
399
+ echo "test"··
400
+
401
+ # After (clean)
402
+ VAR = value
403
+ build:
404
+ echo "test"
405
+ ```
406
+
407
+ ### 7. Syntax Validation
408
+
409
+ Validates Makefile syntax before and after formatting.
410
+
411
+ ```bash
412
+ mbake format --validate Makefile
413
+ ```
414
+
415
+ **Validation Process:**
416
+ 1. Validates original file with `make --dry-run`
417
+ 2. Applies formatting changes
418
+ 3. Validates formatted file
419
+ 4. Only saves if both validations pass
420
+
421
+ ### 8. Format Disable Comments
422
+
423
+ Selectively disable formatting for specific sections.
424
+
425
+ ```makefile
426
+ # Standard formatting applies here
427
+ VAR1=value
428
+ target1:prerequisites
429
+
430
+ # bake-format off
431
+ # Preserve legacy formatting in this section
432
+ VAR2 = value
433
+ target2 : prerequisites
434
+ echo "custom spacing"
435
+ # bake-format on
436
+
437
+ # Standard formatting resumes
438
+ VAR3=value
439
+ target3:prerequisites
440
+ ```
441
+
442
+ **Use cases:**
443
+ - Legacy Makefiles with specific formatting
444
+ - Auto-generated sections
445
+ - Intentional custom spacing
446
+ - Compatibility with other tools
447
+
448
+ ## CI/CD Integration
449
+
450
+ ### GitHub Actions
451
+
452
+ ```yaml
453
+ name: Validate Makefiles
454
+
455
+ on: [push, pull_request]
456
+
457
+ jobs:
458
+ validate:
459
+ runs-on: ubuntu-latest
460
+
461
+ steps:
462
+ - name: Checkout code
463
+ uses: actions/checkout@v3
464
+
465
+ - name: Set up Python
466
+ uses: actions/setup-python@v4
467
+ with:
468
+ python-version: '3.11'
469
+
470
+ - name: Install mbake
471
+ run: pip install mbake
472
+
473
+ - name: Check Makefile formatting
474
+ run: mbake format --check Makefile
475
+
476
+ - name: Validate Makefile syntax
477
+ run: mbake validate Makefile
478
+
479
+ - name: Check all .mk files
480
+ run: |
481
+ for file in $(find . -name "*.mk" -o -name "Makefile"); do
482
+ echo "Checking $file..."
483
+ mbake format --check "$file"
484
+ mbake validate "$file"
485
+ done
486
+ ```
487
+
488
+ ### GitLab CI
489
+
490
+ ```yaml
491
+ # .gitlab-ci.yml
492
+ validate-makefiles:
493
+ image: python:3.11
494
+ stage: test
495
+
496
+ before_script:
497
+ - pip install mbake
498
+
499
+ script:
500
+ - find . -name "Makefile" -o -name "*.mk" | while read file; do
501
+ echo "Validating $file";
502
+ mbake format --check "$file";
503
+ mbake validate "$file";
504
+ done
505
+
506
+ only:
507
+ - merge_requests
508
+ - main
509
+ ```
510
+
511
+ ### Pre-commit Hook
512
+
513
+ Install as a pre-commit hook:
514
+
515
+ ```yaml
516
+ # .pre-commit-config.yaml
517
+ repos:
518
+ - repo: local
519
+ hooks:
520
+ - id: mbake-format
521
+ name: mbake format
522
+ entry: mbake format --check
523
+ language: system
524
+ files: (Makefile|.*\.mk)$
525
+
526
+ - id: mbake-validate
527
+ name: mbake validate
528
+ entry: mbake validate
529
+ language: system
530
+ files: (Makefile|.*\.mk)$
531
+ ```
532
+
533
+ Install and use:
534
+
535
+ ```bash
536
+ # Install pre-commit
537
+ pip install pre-commit
538
+
539
+ # Install hooks
540
+ pre-commit install
541
+
542
+ # Run manually
543
+ pre-commit run --all-files
544
+ ```
545
+
546
+ ### Make Target for Self-Validation
547
+
548
+ Add to your Makefile:
549
+
550
+ ```makefile
551
+ # Self-validation targets
552
+ .PHONY: format-check format-fix validate-makefile
553
+
554
+ format-check:
555
+ @echo "Checking Makefile formatting..."
556
+ @mbake format --check $(MAKEFILE_LIST)
557
+
558
+ format-fix:
559
+ @echo "Applying formatting to Makefile..."
560
+ @mbake format $(MAKEFILE_LIST)
561
+
562
+ validate-makefile:
563
+ @echo "Validating Makefile syntax..."
564
+ @mbake validate $(MAKEFILE_LIST)
565
+
566
+ # Run all checks
567
+ .PHONY: check
568
+ check: format-check validate-makefile
569
+ @echo "All checks passed!"
570
+ ```
571
+
572
+ Usage:
573
+
574
+ ```bash
575
+ # Check formatting and syntax
576
+ make check
577
+
578
+ # Auto-fix formatting
579
+ make format-fix
580
+
581
+ # Validate only
582
+ make validate-makefile
583
+ ```
584
+
585
+ ## Editor Integration
586
+
587
+ ### VS Code
588
+
589
+ #### Extension
590
+
591
+ Install "mbake Makefile Formatter" from marketplace.
592
+
593
+ **Features:**
594
+ - Format on save
595
+ - Format on demand (Shift+Alt+F)
596
+ - Real-time validation
597
+ - Error highlighting
598
+
599
+ #### Manual Setup
600
+
601
+ Add to `.vscode/settings.json`:
602
+
603
+ ```json
604
+ {
605
+ "[makefile]": {
606
+ "editor.formatOnSave": true,
607
+ "editor.defaultFormatter": "mbake.mbake-formatter",
608
+ "editor.insertSpaces": false,
609
+ "editor.detectIndentation": false,
610
+ "editor.tabSize": 8
611
+ },
612
+ "mbake.validateOnSave": true,
613
+ "mbake.autoFixOnSave": false
614
+ }
615
+ ```
616
+
617
+ #### Tasks
618
+
619
+ Add to `.vscode/tasks.json`:
620
+
621
+ ```json
622
+ {
623
+ "version": "2.0.0",
624
+ "tasks": [
625
+ {
626
+ "label": "mbake: Format Makefile",
627
+ "type": "shell",
628
+ "command": "mbake",
629
+ "args": ["format", "${file}"],
630
+ "problemMatcher": []
631
+ },
632
+ {
633
+ "label": "mbake: Validate Makefile",
634
+ "type": "shell",
635
+ "command": "mbake",
636
+ "args": ["validate", "${file}"],
637
+ "problemMatcher": []
638
+ },
639
+ {
640
+ "label": "mbake: Check Format",
641
+ "type": "shell",
642
+ "command": "mbake",
643
+ "args": ["format", "--check", "${file}"],
644
+ "problemMatcher": []
645
+ }
646
+ ]
647
+ }
648
+ ```
649
+
650
+ ### Vim/Neovim
651
+
652
+ Add to `.vimrc` or `init.vim`:
653
+
654
+ ```vim
655
+ " Format Makefile with mbake
656
+ autocmd FileType make nnoremap <buffer> <leader>f :!mbake format %<CR>:e<CR>
657
+
658
+ " Validate Makefile
659
+ autocmd FileType make nnoremap <buffer> <leader>v :!mbake validate %<CR>
660
+
661
+ " Check format
662
+ autocmd FileType make nnoremap <buffer> <leader>c :!mbake format --check %<CR>
663
+
664
+ " Ensure tabs in Makefiles
665
+ autocmd FileType make setlocal noexpandtab tabstop=8 shiftwidth=8
666
+ ```
667
+
668
+ ### Emacs
669
+
670
+ Add to `.emacs` or `init.el`:
671
+
672
+ ```elisp
673
+ ;; mbake formatting for Makefiles
674
+ (defun mbake-format-buffer ()
675
+ "Format current Makefile with mbake."
676
+ (interactive)
677
+ (shell-command (format "mbake format %s" (buffer-file-name)))
678
+ (revert-buffer t t t))
679
+
680
+ (defun mbake-validate-buffer ()
681
+ "Validate current Makefile with mbake."
682
+ (interactive)
683
+ (compile (format "mbake validate %s" (buffer-file-name))))
684
+
685
+ ;; Key bindings
686
+ (add-hook 'makefile-mode-hook
687
+ (lambda ()
688
+ (local-set-key (kbd "C-c f") 'mbake-format-buffer)
689
+ (local-set-key (kbd "C-c v") 'mbake-validate-buffer)))
690
+ ```
691
+
692
+ ## Advanced Usage
693
+
694
+ ### Batch Processing
695
+
696
+ ```bash
697
+ # Format all Makefiles in project
698
+ find . -name "Makefile" -o -name "*.mk" | xargs mbake format
699
+
700
+ # Check all files without modifying
701
+ find . -name "Makefile" -o -name "*.mk" | xargs mbake format --check
702
+
703
+ # Create backups of all files
704
+ find . -name "Makefile" -o -name "*.mk" | while read file; do
705
+ mbake format --backup "$file"
706
+ done
707
+ ```
708
+
709
+ ### Selective Formatting
710
+
711
+ ```bash
712
+ # Format only specific files
713
+ mbake format Makefile build.mk test.mk
714
+
715
+ # Format with pattern
716
+ mbake format **/*.mk
717
+
718
+ # Exclude certain files
719
+ find . -name "*.mk" ! -name "legacy.mk" | xargs mbake format
720
+ ```
721
+
722
+ ### Diff Review Workflow
723
+
724
+ ```bash
725
+ # 1. Review changes before applying
726
+ mbake format --diff Makefile > changes.diff
727
+
728
+ # 2. Review the diff
729
+ less changes.diff
730
+
731
+ # 3. If satisfied, apply
732
+ mbake format Makefile
733
+
734
+ # 4. Validate result
735
+ mbake validate Makefile
736
+ ```
737
+
738
+ ### Integration with Git
739
+
740
+ ```bash
741
+ # Check if formatting is needed before commit
742
+ git diff --cached --name-only | grep -E '(Makefile|.*\.mk)$' | while read file; do
743
+ if ! mbake format --check "$file"; then
744
+ echo "Error: $file needs formatting"
745
+ echo "Run: mbake format $file"
746
+ exit 1
747
+ fi
748
+ done
749
+ ```
750
+
751
+ ### Automated Refactoring
752
+
753
+ ```bash
754
+ # Refactor entire codebase
755
+ #!/bin/bash
756
+
757
+ echo "Refactoring all Makefiles..."
758
+
759
+ find . -type f \( -name "Makefile" -o -name "*.mk" \) | while read file; do
760
+ echo "Processing: $file"
761
+
762
+ # Backup
763
+ cp "$file" "$file.backup"
764
+
765
+ # Format
766
+ if mbake format "$file"; then
767
+ echo " ✓ Formatted"
768
+ else
769
+ echo " ✗ Format failed"
770
+ mv "$file.backup" "$file"
771
+ continue
772
+ fi
773
+
774
+ # Validate
775
+ if mbake validate "$file"; then
776
+ echo " ✓ Validated"
777
+ rm "$file.backup"
778
+ else
779
+ echo " ✗ Validation failed - reverting"
780
+ mv "$file.backup" "$file"
781
+ fi
782
+ done
783
+
784
+ echo "Refactoring complete!"
785
+ ```
786
+
787
+ ## Troubleshooting
788
+
789
+ ### Common Issues
790
+
791
+ #### 1. mbake Command Not Found
792
+
793
+ ```bash
794
+ # Problem: mbake not in PATH
795
+ $ mbake format Makefile
796
+ bash: mbake: command not found
797
+
798
+ # Solution: Ensure pip install directory is in PATH
799
+ export PATH="$HOME/.local/bin:$PATH"
800
+
801
+ # Or use python -m
802
+ python3 -m mbake format Makefile
803
+ ```
804
+
805
+ #### 2. Syntax Errors After Formatting
806
+
807
+ ```bash
808
+ # Problem: Validation fails after formatting
809
+ $ mbake format --validate Makefile
810
+ Error: Syntax validation failed
811
+
812
+ # Solution: Check format disable comments
813
+ # Look for unclosed # bake-format off sections
814
+ grep -n "bake-format" Makefile
815
+
816
+ # Or restore from backup
817
+ cp Makefile.bak Makefile
818
+ ```
819
+
820
+ #### 3. Configuration Not Applied
821
+
822
+ ```bash
823
+ # Problem: Settings in .bake.toml ignored
824
+ $ mbake format Makefile
825
+ # Formatting doesn't match config
826
+
827
+ # Solution: Verify config file location
828
+ mbake config
829
+
830
+ # Or specify config explicitly
831
+ mbake format --config .bake.toml Makefile
832
+ ```
833
+
834
+ #### 4. Permission Denied
835
+
836
+ ```bash
837
+ # Problem: Cannot write to file
838
+ $ mbake format Makefile
839
+ Error: Permission denied
840
+
841
+ # Solution: Check file permissions
842
+ ls -l Makefile
843
+ chmod u+w Makefile
844
+ ```
845
+
846
+ #### 5. Python Version Incompatibility
847
+
848
+ ```bash
849
+ # Problem: Wrong Python version
850
+ $ pip install mbake
851
+ ERROR: mbake requires Python '>=3.9'
852
+
853
+ # Solution: Use correct Python version
854
+ python3.11 -m pip install mbake
855
+
856
+ # Or use pyenv
857
+ pyenv install 3.11
858
+ pyenv local 3.11
859
+ pip install mbake
860
+ ```
861
+
862
+ ### Debug Mode
863
+
864
+ ```bash
865
+ # Enable verbose output (if supported in future versions)
866
+ MBAKE_DEBUG=1 mbake format Makefile
867
+
868
+ # Check Python environment
869
+ python3 -c "import mbake; print(mbake.__version__)"
870
+
871
+ # Validate manually
872
+ make -f Makefile --dry-run
873
+ ```
874
+
875
+ ## Exit Codes
876
+
877
+ mbake uses standard exit codes:
878
+
879
+ | Code | Meaning | Commands |
880
+ |------|---------|----------|
881
+ | 0 | Success / No changes needed | All commands |
882
+ | 1 | Formatting needed / Validation failed | `format --check`, `validate` |
883
+ | 2 | Error occurred | All commands |
884
+
885
+ **Usage in Scripts:**
886
+
887
+ ```bash
888
+ # Check formatting
889
+ if mbake format --check Makefile; then
890
+ echo "Formatting OK"
891
+ else
892
+ echo "Needs formatting"
893
+ exit 1
894
+ fi
895
+
896
+ # Validate
897
+ mbake validate Makefile || {
898
+ echo "Validation failed!"
899
+ exit 1
900
+ }
901
+ ```
902
+
903
+ ## Best Practices
904
+
905
+ 1. **Always use --check in CI/CD** to prevent automatic modifications
906
+ 2. **Review diffs** with `--diff` before applying formatting
907
+ 3. **Create backups** with `--backup` for important files
908
+ 4. **Use configuration files** for consistent team formatting
909
+ 5. **Combine with validation** using `--validate` flag
910
+ 6. **Document exceptions** with `# bake-format off` comments
911
+ 7. **Run in pre-commit hooks** to catch issues early
912
+ 8. **Format incrementally** during refactoring, not all at once
913
+ 9. **Test after formatting** to ensure builds still work
914
+ 10. **Version control config** by committing `.bake.toml`
915
+
916
+ ## Alternative Tool: checkmake
917
+
918
+ [checkmake](https://github.com/checkmake/checkmake) is a complementary linter that can be used alongside mbake for additional coverage.
919
+
920
+ ### Installation
921
+
922
+ ```bash
923
+ # With Go (1.16+)
924
+ go install github.com/checkmake/checkmake/cmd/checkmake@latest
925
+
926
+ # Docker
927
+ docker run --rm -v $(pwd):/data checkmake/checkmake Makefile
928
+ ```
929
+
930
+ ### Usage
931
+
932
+ ```bash
933
+ # Basic linting
934
+ checkmake Makefile
935
+
936
+ # List available rules
937
+ checkmake list-rules
938
+
939
+ # JSON output
940
+ checkmake --output json Makefile
941
+
942
+ # With config file
943
+ checkmake --config checkmake.ini Makefile
944
+ ```
945
+
946
+ ### What checkmake Checks
947
+
948
+ - Missing required phony targets (all, test)
949
+ - Targets that should be declared PHONY
950
+ - Other configurable rules
951
+
952
+ ### Using Both Tools Together
953
+
954
+ ```makefile
955
+ # Makefile validation target
956
+ .PHONY: lint
957
+ lint:
958
+ @echo "Running mbake..."
959
+ mbake format --check Makefile
960
+ mbake validate Makefile
961
+ @echo "Running checkmake..."
962
+ checkmake Makefile || true
963
+ @echo "Lint complete!"
964
+ ```
965
+
966
+ ### CI/CD with Both Tools
967
+
968
+ ```yaml
969
+ # GitHub Actions example
970
+ - name: Lint Makefile
971
+ run: |
972
+ pip install mbake
973
+ go install github.com/checkmake/checkmake/cmd/checkmake@latest
974
+ mbake format --check Makefile
975
+ mbake validate Makefile
976
+ checkmake Makefile
977
+ ```
978
+
979
+ ## Resources
980
+
981
+ - **mbake GitHub**: https://github.com/EbodShojaei/bake
982
+ - **mbake PyPI**: https://pypi.org/project/mbake/
983
+ - **mbake Issues**: https://github.com/EbodShojaei/bake/issues
984
+ - **mbake VS Code Extension**: Search "mbake" in Extensions marketplace
985
+ - **checkmake GitHub**: https://github.com/checkmake/checkmake
986
+
987
+ ## Version Compatibility
988
+
989
+ - **mbake**: Latest stable version recommended
990
+ - **Python**: 3.9+ required
991
+ - **GNU Make**: Any version with `--dry-run` support
992
+ - **OS**: Linux, macOS, Windows (with GNU Make installed)
993
+
994
+ ## License
995
+
996
+ mbake is released under the MIT License.
997
+
998
+ ---
999
+
1000
+ **Note**: This documentation covers mbake as used by the makefile-validator skill. For the latest features and updates, visit the official GitHub repository.