docs: regen inventory blocks - #159
Conversation
bb04bb5 to
58edd41
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
66d4884 to
3e19a04
Compare
3e19a04 to
92f02cf
Compare
92f02cf to
4a9e4d1
Compare
265e70b to
c81f6cf
Compare
c81f6cf to
71bff4b
Compare
bbeb0b7 to
0bc3998
Compare
074b41e to
fc40e6a
Compare
fc40e6a to
bb8494d
Compare
d397204 to
ee62dfc
Compare
| </details> | ||
|
|
||
| <details><summary>Database functions (96)</summary> | ||
| <details><summary>Database functions (104)</summary> |
There was a problem hiding this comment.
🟡 Auto-generated function list silently drops sg_expected_strokes due to regex not handling union-typed overloads
The function sg_expected_strokes exists in src/lib/types/database.ts:11651 but is missing from the auto-generated function list in memory/glossary.md. The regen script (scripts/regen-docs.mjs:98) uses the regex /^ ([a-z_][a-z0-9_]*):\s*[\{\(]/gm which requires { or ( immediately after the colon. However, sg_expected_strokes has a union-type definition (| { Args: ... } | { Args: ... }) that starts with | instead of {, so the regex silently skips it. The documented count says 104 functions when the actual count is 105. This function is heavily used in the codebase for strokes-gained calculations, so its omission from the glossary could mislead developers consulting the inventory.
Prompt for agents
The root cause is in scripts/regen-docs.mjs line 98. The regex /^ ([a-z_][a-z0-9_]*):\s*[\{\(]/gm only matches function keys whose type definition starts with { or ( on the same or next line. When database.ts has a function with overloaded signatures using TypeScript union syntax (e.g. sg_expected_strokes: | { ... } | { ... }), the | character doesn't match [{(] so the function is silently dropped.
Fix the regex in extractTopLevelKeys() to also match the union pattern. For example, change [\{\(] to [\{\(|] (add pipe), or use a broader approach like /^ ([a-z_][a-z0-9_]*):/gm and filter out false positives (like nested Args/Returns keys) by checking indentation level. The broader regex already produces the correct count of 105 when tested. After fixing the script, re-run npm run docs:regen to update the glossary.
Was this helpful? React with 👍 or 👎 to provide feedback.
ee62dfc to
99dbfd4
Compare
There was a problem hiding this comment.
🚩 Enum inventory also suffers from the same multi-line union type regex limitation
The extractEnums regex in scripts/regen-docs.mjs:120 has the same class of limitation as the functions regex. Enums like baseball_pipeline_stage, coach_status, crm_event_type, email_status, golf_expense_category, golf_expense_paid_by, notification_type, program_type, and team_member_status all use multi-line union syntax in src/lib/types/database.ts:11739-11797 and are not captured. The glossary lists only 7 enums but database.ts contains 16. This is a pre-existing issue (unchanged by this PR) but worth noting since the same fix applied to the functions regex should also be applied to the enums regex.
Was this helpful? React with 👍 or 👎 to provide feedback.
99dbfd4 to
d1f1d12
Compare
d1f1d12 to
608fcfc
Compare
| </details> | ||
|
|
||
| <details><summary>Database functions (96)</summary> | ||
| <details><summary>Database functions (104)</summary> |
There was a problem hiding this comment.
sg_expected_strokes() silently dropped despite still existing in database.ts
sg_expected_strokes still appears in src/lib/types/database.ts (line 11215) and is actively called by src/lib/golf/strokes-gained.ts and src/lib/coachhelm/v2/shot-analysis/shot-level-sg.ts — both files carry a comment saying it "MUST stay in lockstep with the DB function". It was removed from the inventory because regen-docs.mjs's extractTopLevelKeys regex (/^ ([a-z_][a-z0-9_]*):\s*[\{\(]/gm) requires the value to start with { or ( on the same logical line, but sg_expected_strokes now uses a union overload type (| { ... } | { ... }) so the first non-whitespace character after the : is |, not {. Any AI review or developer lookup against this inventory will incorrectly conclude the function no longer exists. The fix belongs in scripts/regen-docs.mjs — expand the regex (or the block-extraction logic) to also match :\s*\| union-type entries before this PR lands.
608fcfc to
5eaf38f
Compare
5eaf38f to
23e5300
Compare
23e5300 to
87c52a5
Compare
87c52a5 to
c864450
Compare
| - `/baseball/reset-password` | ||
| - `/baseball/signup` | ||
| - `/baseball/team/[id]` | ||
| - `/fairway-preview` |
There was a problem hiding this comment.
🚩 New routes include a top-level /fairway-preview outside the golf namespace
Among the 3 new routes, /fairway-preview (src/app/fairway-preview/page.tsx) sits at the top level outside both /golf/ and /baseball/ namespaces. This is unusual given the project's convention of namespacing all product routes under their sport prefix. It may be intentional (e.g., a public preview/marketing page), but worth confirming it doesn't need auth protection or sport-prefixed routing per the project conventions in CLAUDE.md.
Was this helpful? React with 👍 or 👎 to provide feedback.
c864450 to
957b15f
Compare
There was a problem hiding this comment.
🚩 The sg_expected_strokes format change was caused by supabase gen types adding a function overload
At commit 49694b2 (when the script was first run), sg_expected_strokes in database.ts used a simple object format (sg_expected_strokes: { Args: ...; Returns: ... }) that the script's regex matched. A subsequent supabase gen types regeneration added a second overload signature, changing the format to a TypeScript union type (sg_expected_strokes: | { ... } | { ... }). This is the first time the regen script has been run since that schema change, exposing the regex limitation. Any future function that gains overloads will also be silently dropped.
Was this helpful? React with 👍 or 👎 to provide feedback.
957b15f to
89095a5
Compare
89095a5 to
5695f6b
Compare
Auto-generated by .github/workflows/docs-regen.yml. Sources: src/lib/types/database.ts, src/app/**/page.tsx, src/app/**/actions/**/*.ts, src/hooks/**/*.ts.
|
Folded into #304 (feat/coachhelm-stats-roundup) — merged clean, combined gates green. Branch intact + reopenable. |
Auto-generated inventory update
Triggered by a push to
mainthat touched a source of truthfor the inventory blocks in
memory/glossary.mdandmemory/projects/golfhelm.md.What changed: the auto-regenerated sections between
<!-- AUTOGEN:* -->markers. Hand-curated narrative outsidethose markers is preserved.
What to do: review the diff. If it looks sane, squash-merge.
If something looks wrong, the script lives at
scripts/regen-docs.mjs.See
.github/workflows/docs-regen.ymland the"Auto-regen inventory docs" section of
CLAUDE.md.🤖 Generated by GitHub Actions
Greptile Summary
This PR contains auto-regenerated inventory blocks in
memory/glossary.mdandmemory/projects/golfhelm.md, triggered by source-of-truth changes onmain. All count deltas are arithmetically consistent with the items added in the diff.memory/glossary.md: table count bumped 180 → 181;golf_recruit_documentsadded to the alphabetical table list.memory/projects/golfhelm.md: route count 144 → 145 (/golf/dashboard/coursesadded); action-file count 112 → 115 (course-library.ts,recruit-documents-categories.ts,recruit-documents.tsadded); hook count 51 → 52 (use-distance-units.tsadded).Confidence Score: 5/5
Purely additive documentation update; no logic, schema, or runtime code is touched.
All four inventory sections (tables, routes, actions, hooks) show consistent arithmetic between the declared count and the number of lines actually added. The new entries are inserted at correct alphabetical positions. No hand-curated narrative is altered.
No files require special attention.
Important Files Changed
golf_recruit_documentsinserted in correct alphabetical position.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Push to main touches source files] --> B[docs-regen.yml workflow triggered] B --> C[scripts/regen-docs.mjs runs] C --> D1[Scans src/lib/types/database.ts for tables/views/functions] C --> D2[Scans src/app/**/page.tsx for routes] C --> D3[Scans src/app/**/actions/**/*.ts for server-action files] C --> D4[Scans src/hooks/**/*.ts for custom hooks] D1 --> E1[Rewrites AUTOGEN:tables block in memory/glossary.md] D2 --> E2[Rewrites AUTOGEN:routes block] D3 --> E3[Rewrites AUTOGEN:actions block] D4 --> E4[Rewrites AUTOGEN:hooks block] E1 & E2 & E3 & E4 --> F[Bot opens PR #159 for human review]Reviews (46): Last reviewed commit: "docs: regen inventory blocks" | Re-trigger Greptile