You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/scan-flow.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,16 @@ This document outlines how repository scans are transformed into AI instruction
6
6
7
7
1.**Scan the repository** (`app/api/scan-repo/route.ts`)
8
8
- Detect languages, frameworks, tooling, structure hints, and enriched metadata.
9
+
- Use stack conventions (`collectConventionValues`) to cross-check detection lists (e.g., testing tools) so any signal we add in `conventions/<stack>.json` becomes discoverable with minimal code changes.
10
+
- Reuse convention values to expand stack-specific heuristics (e.g., Python’s Behave directories, Next.js routing shapes), so each conventions file remains the source of truth for new detections.
9
11
- Infer the primary stack using `inferStackFromScan`.
10
12
- Load stack conventions (`loadStackConventions`) to determine which structure hints matter and whether stack-specific rules exist.
11
13
- Attach `summary.conventions` so the UI knows which directories to highlight and whether a conventions file was found.
- Apply convention defaults from `conventions/<stack>.json` + `default.json`.
16
-
- Layer in detections from the scan (tooling, testing, naming signals, etc.).
18
+
- Layer in detections from the scan (tooling, testing, naming signals, etc.), matching scan values against convention-provided options so stack JSON remains the single source of truth.
17
19
- Run convention rules to tweak values based on detected tooling/testing.
18
20
- Pull default answers directly from the stack’s question set (`buildStepsForStack`) and fill any remaining empty responses. We track which questions were auto-defaulted (`defaultedQuestionIds`) so the summary can explain why.
19
21
@@ -32,13 +34,14 @@ This document outlines how repository scans are transformed into AI instruction
32
34
| Location | Purpose |
33
35
| --- | --- |
34
36
|`conventions/default.json` & `/conventions/<stack>.json`| Declarative defaults + rules for each stack (tooling choices, structure hints, apply-to glob, etc.). |
37
+
|`lib/convention-values.ts`| Helpers that normalize and aggregate convention values (e.g., testingUT/testingE2E) for both the scanner and the wizard. |
35
38
|`data/stacks.json`| List of stacks exposed to the wizard; each should have a matching conventions file. |
36
39
|`data/questions/<stack>.json`| Stack-specific questions with default answers and metadata. These defaults are now honored automatically when scan data is missing. |
37
40
38
41
## Extending the Flow
39
42
40
43
-**Add a new stack**: create `conventions/<stack>.json`, add questions under `data/questions/<stack>.json`, and register the stack in `data/stacks.json`. The pipeline will pick it up automatically.
41
-
-**Add scan heuristics**: update `app/api/scan-repo/route.ts` (e.g., detect tooling) so conventions rules have richer signals to work with.
44
+
-**Add scan heuristics**: update `app/api/scan-repo/route.ts` (e.g., detect tooling/testing) so conventions rules have richer signals to work with. Shared helpers mean you can usually expand detection by tweaking the convention file plus a small matcher (see `detectPythonTestingSignals` for the current pattern).
42
45
-**Adjust defaults**: edit the stack’s question JSON to set a new `isDefault` answer; the scan pipeline will adopt it whenever the repo lacks an explicit signal.
43
46
-**Customize templates**: templates consume the final `WizardResponses`, so any new fields surfaced via conventions should be represented there before referencing them in markdown/JSON output.
0 commit comments