devflow-kit 2.3.0 → 2.4.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.
@@ -181,12 +181,71 @@ PROXY_BIN=$(json_field_file "$PROXY_STATE_FILE" "binPath" "")
181
181
  PROXY_CONFIG=$(json_field_file "$PROXY_STATE_FILE" "configPath" "")
182
182
  dbg "PROXY_BIN=$PROXY_BIN PROXY_CONFIG=$PROXY_CONFIG"
183
183
 
184
- # Validate prerequisites before spawning
184
+ # Validate prerequisites before spawning.
185
+ # D-FIX4: when the persisted binPath is missing or stale (e.g. npx cache GC, upgrade),
186
+ # attempt dependency-light re-resolution before warning. Two strategies:
187
+ # a) Walk up from `devflow` CLI to find devflow's node_modules/subswitch.
188
+ # b) `command -v subswitch` — globally installed CLI.
189
+ # Re-resolution is best-effort: on failure the existing warning is emitted and the
190
+ # hook exits 0 as before. The healed path is used for this session only; the next
191
+ # successful `devflow proxy --enable` persists it to proxy.json. (avoids PF-001,
192
+ # avoids PF-009: non-fatal on failure, always exits 0)
185
193
  if [ -z "$PROXY_BIN" ] || [ ! -f "$PROXY_BIN" ]; then
186
- log "prereq fail: binPath missing or not a file: $PROXY_BIN"
187
- CONTEXT="[Devflow proxy] Warning: relay binary not found. Run 'devflow proxy --enable' to restore external model routing."
188
- json_session_output "$CONTEXT"
189
- exit 0
194
+ log "prereq: binPath missing or not a file (${PROXY_BIN:-<empty>}) — attempting re-resolution"
195
+ _RESOLVED_BIN=""
196
+
197
+ # Resolve node for re-resolution strategies.
198
+ _NODE_FOR_RESOLVE=$(command -v node 2>/dev/null || true)
199
+
200
+ # Strategy a: locate devflow CLI → walk up to find node_modules/subswitch
201
+ if [ -n "$_NODE_FOR_RESOLVE" ]; then
202
+ _DF_CMD=$(command -v devflow 2>/dev/null || true)
203
+ if [ -n "$_DF_CMD" ]; then
204
+ _DF_REAL=$(realpath "$_DF_CMD" 2>/dev/null || readlink -f "$_DF_CMD" 2>/dev/null || echo "$_DF_CMD")
205
+ _WALK_DIR=$(dirname "$_DF_REAL")
206
+ _WALK_GUARD=0
207
+ while [ "$_WALK_GUARD" -lt 6 ] && [ -n "$_WALK_DIR" ] && [ "$_WALK_DIR" != "/" ]; do
208
+ _SW_PKG="$_WALK_DIR/node_modules/subswitch/package.json"
209
+ if [ -f "$_SW_PKG" ]; then
210
+ # Read bin field from package.json using node (already confirmed present).
211
+ # Env-var pass avoids shell-quoting issues with paths containing spaces.
212
+ _BIN_REL=$(SUBSWITCH_PKG_JSON="$_SW_PKG" \
213
+ "$_NODE_FOR_RESOLVE" -p \
214
+ "try{var p=JSON.parse(require('fs').readFileSync(process.env.SUBSWITCH_PKG_JSON,'utf-8'));var b=p.bin;typeof b==='string'?b:b&&b.subswitch?b.subswitch:''}catch(e){''}" \
215
+ 2>/dev/null) || _BIN_REL=""
216
+ if [ -n "$_BIN_REL" ] && [ "$_BIN_REL" != "undefined" ]; then
217
+ _CAND="$(dirname "$_SW_PKG")/$_BIN_REL"
218
+ if [ -f "$_CAND" ]; then
219
+ _RESOLVED_BIN="$_CAND"
220
+ log "re-resolved binPath via devflow walk: $_RESOLVED_BIN"
221
+ fi
222
+ fi
223
+ break # found subswitch dir — stop walking regardless of bin result
224
+ fi
225
+ _WALK_DIR=$(dirname "$_WALK_DIR")
226
+ _WALK_GUARD=$(( _WALK_GUARD + 1 ))
227
+ done
228
+ fi
229
+ fi
230
+
231
+ # Strategy b: subswitch globally installed as a CLI
232
+ if [ -z "$_RESOLVED_BIN" ]; then
233
+ _SW_GLOBAL=$(command -v subswitch 2>/dev/null || true)
234
+ if [ -n "$_SW_GLOBAL" ] && [ -f "$_SW_GLOBAL" ]; then
235
+ _RESOLVED_BIN="$_SW_GLOBAL"
236
+ log "re-resolved binPath via command -v subswitch: $_RESOLVED_BIN"
237
+ fi
238
+ fi
239
+
240
+ if [ -n "$_RESOLVED_BIN" ]; then
241
+ PROXY_BIN="$_RESOLVED_BIN"
242
+ log "binPath healed for this session: $PROXY_BIN"
243
+ else
244
+ log "re-resolution failed — binPath not found"
245
+ CONTEXT="[Devflow proxy] Warning: relay binary not found. Run 'devflow proxy --enable' to restore external model routing."
246
+ json_session_output "$CONTEXT"
247
+ exit 0
248
+ fi
190
249
  fi
191
250
 
192
251
  NODE_BIN=$(command -v node 2>/dev/null || true)
@@ -97,8 +97,6 @@ See `references/patterns.md` for extended recovery and stash workflows.
97
97
  <optional body explaining what and why>
98
98
 
99
99
  <optional footer with references>
100
-
101
- Co-Authored-By: Claude <noreply@anthropic.com>
102
100
  ```
103
101
 
104
102
  ### Types
@@ -125,8 +123,6 @@ Implement token validation middleware with:
125
123
  - Expiration checking
126
124
 
127
125
  Closes #123
128
-
129
- Co-Authored-By: Claude <noreply@anthropic.com>
130
126
  EOF
131
127
  )"
132
128
  ```
@@ -205,7 +201,7 @@ sleep 1 # Between each API call
205
201
 
206
202
  - Only lines in the PR diff can receive inline comments
207
203
  - Deduplicate before posting (same file + line = keep one)
208
- - Always include suggested fix and Claude Code attribution footer
204
+ - Always include a suggested fix; every comment carries the `<!-- devflow:* -->` marker, and the visible devflow footer (*Posted by [devflow](https://github.com/dean0x/devflow)*) is appended only on summary comments (see src/assets/agents/git.md)
209
205
 
210
206
  ### Releases
211
207
 
@@ -177,8 +177,6 @@ Previous implementation assumed UTC, causing off-by-one errors
177
177
  for dates near midnight in non-UTC timezones.
178
178
 
179
179
  Fixes #456
180
-
181
- Co-Authored-By: Claude <noreply@anthropic.com>
182
180
  EOF
183
181
  )"
184
182
  ```
@@ -193,8 +191,6 @@ BREAKING CHANGE: API responses now follow JSON:API specification.
193
191
  All clients must update to handle new response structure.
194
192
 
195
193
  Migration guide: docs/migration/v2-response-format.md
196
-
197
- Co-Authored-By: Claude <noreply@anthropic.com>
198
194
  EOF
199
195
  )"
200
196
  ```
@@ -255,8 +251,6 @@ gh pr create \
255
251
  Implements JWT-based authentication...
256
252
 
257
253
  [Full description content]
258
-
259
- Generated with [Claude Code](https://claude.com/claude-code)
260
254
  EOF
261
255
  )"
262
256
  ```
@@ -78,9 +78,5 @@
78
78
  ]
79
79
  }
80
80
  ]
81
- },
82
- "attribution": {
83
- "commit": "",
84
- "pr": ""
85
81
  }
86
82
  }