@delegance/claude-autopilot 7.4.2 → 7.4.3

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  - v5.6 Phase 7 (docs reconciliation) — pending.
4
4
 
5
+ ## 7.4.3 (2026-05-11)
6
+
7
+ **v7.4.3 — FastAPI scaffold respects spec-derived package name.**
8
+ Patch release. Real-package end-to-end test on v7.4.2 surfaced
9
+ this regression: the v7.4.0 Python/FastAPI scaffolder always used
10
+ `basename(cwd)` for the package directory and ignored spec-listed
11
+ `src/<pkg>/main.py` paths. Result: scaffolding a spec that listed
12
+ `src/fastapi_test/main.py` from a directory called `v742-fastapi`
13
+ produced TWO competing trees:
14
+
15
+ * `src/v742_fastapi/` — auto-generated FastAPI app (correct
16
+ content, wrong location)
17
+ * `src/fastapi_test/main.py` — empty placeholder from the spec's
18
+ bullet (right location, no content)
19
+
20
+ `pyproject.toml`'s `[project.scripts]` pointed at the
21
+ auto-generated tree (`v742_fastapi.main:run`) — the spec's intent
22
+ was clearly the named package.
23
+
24
+ **Fix:** new `packageNameFromSpec(parsed)` extracts the package
25
+ name from the first `src/<pkg>/<*>.py` entry in the spec's
26
+ `## Files` section. Falls back to the cwd-derived default only
27
+ when the spec doesn't list any `src/<pkg>/` path.
28
+
29
+ 8 new tests in `tests/scaffold-python.test.ts` cover:
30
+ * extraction from `src/<pkg>/main.py` (the conventional case)
31
+ * extraction from `src/<pkg>/<other>.py`
32
+ * null when no `src/<pkg>/<*>.py` listed
33
+ * null for non-`src/` paths
34
+ * first-match-wins on multiple `src/<pkg>/` entries
35
+ * rejects invalid Python identifier characters in the path
36
+ * the exact regression case (`src/fastapi_test/main.py` from
37
+ cwd `v742-fastapi`)
38
+ * fallback to cwd basename when spec has no `src/<pkg>/`
39
+
40
+ Plus 2 end-to-end tests verifying:
41
+ * scaffold from `cwd=v742-real` + `src/intentional_pkg/main.py`
42
+ spec → SINGLE `src/intentional_pkg/` directory (no competing
43
+ tree); `pyproject.toml` consistent throughout
44
+ * scaffold from `cwd=myapp` + spec without `src/<pkg>/` → still
45
+ uses `src/myapp/` (preserves v7.4.0 default behavior)
46
+
47
+ 1597 → 1606 CLI tests (+9). tsc clean. build clean.
48
+
5
49
  ## 7.4.2 (2026-05-11)
6
50
 
7
51
  **v7.4.2 — risk-tiered codex pass policy in autopilot skill.**
@@ -1,4 +1,4 @@
1
- import type { ScaffoldResult, ScaffoldRunContext } from './types.ts';
1
+ import type { ParsedFiles, ScaffoldResult, ScaffoldRunContext } from './types.ts';
2
2
  /**
3
3
  * PEP 503 distribution-name normalization, restricted to what we need
4
4
  * here. Lowercase, runs of `[._-]+` collapse to a single `-`, leading +
@@ -65,6 +65,16 @@ export declare function buildFastapiTest(packageName: string): string;
65
65
  * not listed in `## Files` — without them the generated pyproject.toml
66
66
  * is invalid (missing package dir) or has dead config (no tests).
67
67
  */
68
+ /**
69
+ * Extract the Python package name from a spec's `## Files` paths if the
70
+ * spec lists a `src/<pkg>/<*>.py` entry. Returns null if no spec-derived
71
+ * package name is present — caller falls back to the cwd-derived default.
72
+ *
73
+ * v7.4.3 hotfix — the v7.4.0 scaffolder always used basename(cwd) and
74
+ * ignored spec-listed src/<pkg>/ paths, producing two competing trees
75
+ * (one auto-generated, one empty placeholder from the spec).
76
+ */
77
+ export declare function packageNameFromSpec(parsed: ParsedFiles): string | null;
68
78
  export declare function scaffoldPython(ctx: ScaffoldRunContext, opts: {
69
79
  isFastapi: boolean;
70
80
  }): Promise<ScaffoldResult>;
@@ -206,11 +206,30 @@ pytest
206
206
  * not listed in `## Files` — without them the generated pyproject.toml
207
207
  * is invalid (missing package dir) or has dead config (no tests).
208
208
  */
209
+ /**
210
+ * Extract the Python package name from a spec's `## Files` paths if the
211
+ * spec lists a `src/<pkg>/<*>.py` entry. Returns null if no spec-derived
212
+ * package name is present — caller falls back to the cwd-derived default.
213
+ *
214
+ * v7.4.3 hotfix — the v7.4.0 scaffolder always used basename(cwd) and
215
+ * ignored spec-listed src/<pkg>/ paths, producing two competing trees
216
+ * (one auto-generated, one empty placeholder from the spec).
217
+ */
218
+ export function packageNameFromSpec(parsed) {
219
+ for (const p of parsed.paths) {
220
+ const m = /^src\/([a-zA-Z_][a-zA-Z0-9_]*)\/[^/]+\.py$/.exec(p);
221
+ if (m && m[1])
222
+ return m[1];
223
+ }
224
+ return null;
225
+ }
209
226
  export async function scaffoldPython(ctx, opts) {
210
227
  const { cwd, parsed, dryRun } = ctx;
211
228
  const { isFastapi } = opts;
229
+ // v7.4.3: prefer spec-derived package name; fall back to cwd basename.
230
+ const specPackage = packageNameFromSpec(parsed);
212
231
  const distributionName = normalizeDistributionName(path.basename(cwd));
213
- const packageName = packageNameFromDistribution(distributionName);
232
+ const packageName = specPackage ?? packageNameFromDistribution(distributionName);
214
233
  const filesCreated = [];
215
234
  const filesSkippedExisting = [];
216
235
  const dirsCreated = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delegance/claude-autopilot",
3
- "version": "7.4.2",
3
+ "version": "7.4.3",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "tag": "next"