make-runner-mcp 2.1.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.
@@ -0,0 +1,169 @@
1
+ ---
2
+ description: Find every Makefile in the current project, check which ones make-runner-mcp can actually discover (via a real `include`/`-include` directive, the `%:` catch-all forwarding idiom, or a `## make-runner: also-read <path>` marker), and add the missing link automatically for any that are orphaned — instead of just reporting the gap. Only run when explicitly invoked as /fix-makefile-links.
3
+ argument-hint: [optional: path to a local make-runner-mcp checkout, to run --diagnose for live verification]
4
+ disable-model-invocation: true
5
+ allowed-tools: Read Glob Grep Bash Edit AskUserQuestion
6
+ ---
7
+
8
+ # Fix make-runner-mcp Makefile linking
9
+
10
+ Input: $ARGUMENTS (optional path to a make-runner-mcp checkout — see Step 5)
11
+
12
+ Goal: make sure every Makefile in this project that defines real targets is
13
+ actually reachable from `<project root>/Makefile` — the only file
14
+ make-runner-mcp reads — and fix it automatically where it isn't, rather
15
+ than just telling the user their Makefile isn't being picked up.
16
+
17
+ This handles **linking/discovery only**. It does not touch recipe bodies,
18
+ convert `$(MAKECMDGOALS)`-style argument passing, or fix denylist false
19
+ positives — those are separate, higher-judgment concerns covered by
20
+ make-runner-mcp's own `MAKEFILE-GUIDE.md`; mention it in your final report
21
+ if you notice any of those along the way, but don't act on them here.
22
+
23
+ ## Step 0: Preconditions
24
+
25
+ - Confirm a root `Makefile` exists at the project root (where this was
26
+ invoked, or a directory the user named in $ARGUMENTS/the conversation).
27
+ If not, stop and say so — make-runner-mcp requires
28
+ `<project root>/Makefile` to exist; there's nothing to link yet.
29
+ - `git status --porcelain` (if this is a git repo). If dirty, proceed
30
+ anyway — the only edit this skill makes is appending comment lines to
31
+ the root Makefile — but mention in the final report that the edit will
32
+ land alongside whatever else is already uncommitted.
33
+
34
+ ## Step 1: Inventory every Makefile in the project
35
+
36
+ ```bash
37
+ find . -name Makefile \
38
+ -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/vendor/*' \
39
+ -not -path '*/.venv/*' -not -path '*/venv/*'
40
+ ```
41
+
42
+ Read every file this finds. Set aside the root one; everything else is a
43
+ **candidate secondary Makefile**.
44
+
45
+ If this returns only the root Makefile, stop here and report: "Only one
46
+ Makefile in this project — nothing to link." Don't invent work.
47
+
48
+ ## Step 2: Resolve what the root Makefile already reaches
49
+
50
+ Read the root Makefile (and recurse into anything it reaches, same as
51
+ below) and classify every line into one of three link mechanisms —
52
+ this mirrors exactly what make-runner-mcp's own parser does, so a file
53
+ found here is one make-runner-mcp already discovers today:
54
+
55
+ 1. **Real include**: a line matching `^\s*(-|s)?include\s+(.+)$`. Each
56
+ whitespace-separated path on the line, resolved relative to the
57
+ *including* file's own directory. A path containing `$(` can't be
58
+ resolved by make-runner-mcp either — note it as **unresolvable
59
+ include** (see Step 4) rather than treating it as reachable.
60
+ 2. **Catch-all forwarding**: a rule whose target is bare `%:` (not
61
+ `%.o:` or `docker-%:` — those are ordinary pattern rules, not this
62
+ idiom), whose recipe (the tab-indented lines immediately after it)
63
+ contains `$(MAKE) ... -C <dir>`. Reaches `<dir>/Makefile`. A `-C`
64
+ value containing `$(` similarly can't be resolved — note it the same
65
+ way as an unresolvable include.
66
+ 3. **The marker this skill itself manages**: a comment line matching
67
+ `^\s*#{1,2}\s*make-runner:\s*also-read\s+(.+)$`. Each
68
+ whitespace-separated path, resolved the same way as `include`.
69
+
70
+ For every file reached via (1) or (3), recurse into it too — apply the
71
+ same three checks to its contents, since an included/linked file can
72
+ itself `include` or mark further files. (Forwarding targets, (2), are a
73
+ Makefile invoked by a live `$(MAKE)` at build time in a fresh directory
74
+ context, not textually processed further here — don't recurse into them
75
+ for more forwarding/include chains; treat the forwarded file itself as
76
+ reached and stop there, matching what make-runner-mcp's own parser does.)
77
+
78
+ Build the **reached set**: the realpath of every file resolved this way,
79
+ starting from the root Makefile itself.
80
+
81
+ ## Step 3: Compute the gap
82
+
83
+ Any candidate secondary Makefile from Step 1 whose realpath is **not** in
84
+ the reached set from Step 2 is **orphaned** — make-runner-mcp cannot see
85
+ its targets right now, regardless of why (never referenced at all, or
86
+ referenced only via an unresolvable `$(VAR)` path).
87
+
88
+ If the gap is empty: report "All Makefiles are already correctly linked —
89
+ nothing to fix" and stop.
90
+
91
+ ## Step 4: Fix each orphaned file
92
+
93
+ For each orphaned Makefile, the default and safest fix is to append this
94
+ line to the root Makefile (near any existing `include`/`also-read` lines
95
+ if present, otherwise near the top, after any leading variable
96
+ assignments):
97
+
98
+ ```makefile
99
+ ## make-runner: also-read <path, relative to the root Makefile's directory>
100
+ ```
101
+
102
+ This is a plain comment — it changes nothing about what a human running
103
+ `make` by hand experiences, and it works regardless of *why* the file was
104
+ orphaned. Prefer it over adding a real `include` here: a real `include`
105
+ would need you to verify the whole orphaned file is safe to textually pull
106
+ into the root Makefile's namespace (no colliding variable/target names,
107
+ no assumption about running from a different `cwd`), which is exactly the
108
+ kind of judgment call this skill should not make silently.
109
+
110
+ **Exception — flag instead of auto-fixing:** before applying the marker to
111
+ a given orphaned file, grep its recipes for `$(UPPERCASE_VAR)`-style
112
+ tokens and check whether each one is assigned *only* in the root Makefile
113
+ and not in the orphaned file itself (excluding standard built-ins like
114
+ `$(MAKE)`, `$(CC)`, `$(SHELL)`). If you find one, the `also-read` marker
115
+ would run this file without that variable defined — likely breaking or
116
+ silently changing its recipe. For that file only: don't edit anything,
117
+ add it to a **NEEDS HUMAN DECISION** list in your final report with the
118
+ variable name and where it's defined, and suggest either (a) defining that
119
+ variable directly in the orphaned file too, or (b) using a real `include`
120
+ once a human has verified there's no namespace collision. This is a
121
+ heuristic, not exhaustive — say so.
122
+
123
+ Apply the marker fix for every other orphaned file in one edit to the root
124
+ Makefile (one line per file), then move on.
125
+
126
+ ## Step 5: Verify
127
+
128
+ Re-run Step 2's classification by hand against the now-edited root
129
+ Makefile and confirm every previously-orphaned file (other than ones left
130
+ for human decision) now appears in the reached set.
131
+
132
+ If $ARGUMENTS names a local make-runner-mcp checkout (a directory
133
+ containing `server.js`), or `command -v make-runner-mcp` resolves to
134
+ something, run the real thing for a live check instead of trusting your
135
+ own by-hand classification alone:
136
+
137
+ ```bash
138
+ PROJECT_DIR="$(pwd)" node <path-to-that-checkout>/server.js --diagnose
139
+ ```
140
+
141
+ Check its `EXPOSED TARGETS` section lists targets from the newly-linked
142
+ file(s), and its `UNRESOLVED ... PATHS` / `FILES REJECTED` sections are
143
+ empty for the files you just fixed. If no checkout is available, say so in
144
+ the report and note that the by-hand verification above stands in for it.
145
+
146
+ Do **not** invoke any actual `make <target>` to test — that executes real
147
+ recipes, which is outside what this skill is for.
148
+
149
+ ## Step 6: Report
150
+
151
+ State plainly, in this shape:
152
+
153
+ ```
154
+ MAKEFILES FOUND:
155
+ - <path>: <root | already linked via include/forwarding/also-read | orphaned>
156
+
157
+ FIXED (also-read marker added to root Makefile):
158
+ - <path>
159
+
160
+ NEEDS HUMAN DECISION:
161
+ - <path>: <reason — e.g. "recipe uses $(FOO), only defined in root Makefile">
162
+
163
+ VERIFIED: <"live --diagnose output matches" | "by-hand classification only — no make-runner-mcp checkout available to confirm">
164
+ ```
165
+
166
+ Also mention, once, that the `also-read` marker only works with a
167
+ make-runner-mcp version that supports it — if this project's MCP client
168
+ config pins an older release tag, the fix won't take effect until that
169
+ tag is bumped.