merge-help-csv.py: fallback HEADER uses after/before, all module-help.csv files use preceded-by/followed-by

Aperta Adatta ai principianti
#102 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Esamina le cinque copie di merge-help-csv.py elencate nell’issue e confronta il loro fallback HEADER con le intestazioni corrispondenti di module-help.csv. Esegui la riproduzione blank-first-line fornita, quindi verifica che l’intestazione generata usi preceded-by e followed-by nelle posizioni 9–10 in tutte le copie.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

merge-help-csv.py declares its fallback HEADER with after / before in positions 9–10, but every module-help.csv in this repo uses preceded-by / followed-by. When the fallback is used, the written CSV has two misnamed columns, and any consumer reading preceded-by / followed-by finds nothing.

It's a clean internal inconsistency — verified against main @ e6935f2, all five copies of the script disagree with all five CSV assets:

merge-help-csv.py (all say after / before) module-help.csv (all say preceded-by / followed-by)
skills/bmad-module-builder/assets/standalone-module-template/ skills/module-help.csv
skills/bmad-module-builder/assets/setup-skill-template/scripts/ skills/bmad-module-builder/assets/setup-skill-template/assets/
skills/bmad-bmb-setup/scripts/ skills/bmad-bmb-setup/assets/
samples/sample-module-setup/scripts/ samples/sample-module-setup/assets/
samples/bmad-agent-dream-weaver/scripts/ samples/bmad-agent-dream-weaver/assets/

Because the two template copies are what scaffolded modules vendor, downstream modules inherit it — that's how it was found.

Steps to reproduce

The fallback is:

header = target_header if target_header else (source_header if source_header else HEADER)

Reaching it is harder than it looks, which is why this is latent rather than user-visible. read_csv_rows returns rows[0] unconditionally, so a falsy source_header normally implies an empty or missing source — which trips the sys.exit(1) just above. The one path through is a source whose first line is blank (csv.reader yields [], falsy) plus a non-existent target:

printf '\nabm,skill-a,A,1,desc,x,y,z,,,,,\n' > /tmp/src.csv
python3 merge-help-csv.py --target /tmp/fresh.csv --source /tmp/src.csv
head -1 /tmp/fresh.csv
# module,skill,display-name,menu-code,description,action,args,phase,after,before,required,output-location,outputs
#                                                                   ^^^^^ ^^^^^^

A normal merge never hits it, since either file supplies a header. So the practical cost isn't a broken install today — it's a wrong schema constant sitting in five files, which the next person to reach for HEADER (to add column validation, say) inherits.

Expected behavior

HEADER matches the schema the rest of the toolchain emits — preceded-by / followed-by in positions 9–10.

Environment

PR

Happy to open a one-line-per-file PR if that's welcome.

Additional context

Credit to @hugheba, who found this while vendoring a scaffolded module downstream and reported it at stefanoginella/auto-bmad#8 — verified by reading installed files, not static analysis. A copy of the same script in bmad-code-org/bmad-loop carries it too.

Lingua principale
Python
Stelle
220
Fork
54
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bmad-code-org/bmad-builder

Tutte le issue di bmad-code-org/bmad-builder

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.