sgm-index --help is an error, and sgm-ask embeds --help or a mistyped flag as the query
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python, sqlite
- Ambito
- cli, developer-experience
Direzione di ricerca
Inizia da main() in src/sqlite_graph_memory/brain_ask.py, src/sqlite_graph_memory/index_notes.py e src/sqlite_graph_memory/doctor.py; leggi i pattern esistenti dei parser e tests/test_version_flag.py. Aggiungi test per l’aiuto, i flag sconosciuti, il separatore -- e sgm-index --version, assicurandoti che l’aiuto non carichi un modello né tocchi file. Esegui i test mirati, poi python -m pytest -q; il lavoro è terminato quando tutti i comportamenti dei comandi elencati passano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
The two commands a new user runs first have no working --help, and sgm-ask accepts any unknown flag as part of the question.
On a clone of master (0.3.9, Windows 11, Python 3.12, [lite] backend, index built from bench/vault):
$ sgm-index --help
usage: sgm-index [--full] [notes_dir]
sgm-index: error: unrecognized arguments: --help
$ echo $?
2
$ sgm-index --version
usage: sgm-index [--full] [notes_dir]
sgm-index: error: unrecognized arguments: --version
$ sgm-ask --help
12 hits (scope=all) -> _brain_answer.txt
$ head -2 _brain_answer.txt
QUERY: --help
(scope=all; e5 60 files -> dense; 204 chunks)
$ sgm-ask --grahp "ouzel" # typo of --graph
12 hits (scope=all) -> _brain_answer.txt
$ head -1 _brain_answer.txt
QUERY: --grahp ouzel
Causes:
src/sqlite_graph_memory/index_notes.py:258builds the parser withargparse.ArgumentParser(add_help=False), so--helpis rejected. Runningsgm-indexwith no arguments does print the module docstring.src/sqlite_graph_memory/brain_ask.py:547-548keeps a fixed set of known flags and joins everything else into the query.--helploads the model, runs a recall for the text--help, overwrites_brain_answer.txtand exits 0. A mistyped flag silently turns the mode off and changes the query.
sgm-stats and sgm-turnstate-show already use a normal argparse parser, and #75 added --version to sgm-stats and sgm-ask. sgm-doctor --help ignores the flag and just runs the checks.
Why it matters
--help is the first thing people type. Today it is an error for one command and a slow, misleading recall for the other. The typo case is worse for evaluation work: sgm-ask --grahp ... looks like a successful graph run but is a vector run on a different query.
Suggested approach
sgm-index: dropadd_help=False, pass the module docstring as the description (withformatter_class=argparse.RawDescriptionHelpFormatter), add--versionin the same style as #75.sgm-ask: handle-h/--helpfirst by printing the module docstring and exiting 0. For any other argument that starts with--and is not a known flag, printunknown option: <arg>to stderr and exit 2. Support a literal--separator so a question that really starts with dashes can still be asked (todaysgm-ask -- "--help"runs a recall for the text-- --help).sgm-doctor: accept-h/--helpand print a short usage text.- Keep the manual parsing in
brain_ask.pyif a full argparse rewrite feels too large; the checks above are enough. Mind the--pooloption, which_parse_poolalready strips before the flag set is applied.
Done when
sgm-index --help,sgm-ask --helpandsgm-doctor --helpexit 0, print usage, do not load a model and do not write_brain_answer.txtor touch the index.sgm-ask --grahp "x"exits 2 with a message that names the unknown option.sgm-ask -- "--help"runs a recall for the text--help.sgm-index --versionprintssgm-index <version>.- New tests next to
tests/test_version_flag.pycover these cases without a model or an index, and fail on current master. python -m pytest -qshows no new failures.
Where to start
src/sqlite_graph_memory/brain_ask.py:main()from line 538,_parse_poolat line 495 for the existing style of manual flag parsingsrc/sqlite_graph_memory/index_notes.py:main()at line 257src/sqlite_graph_memory/doctor.py:main()at line 185tests/test_version_flag.pyas a template
New here? Comment that you are taking it and ask anything in this thread; small PRs are reviewed within a day.
- Lingua principale
- Python
- Stelle
- 9
- Fork
- 6
- Merge medio
- 13h 8m
- PR unite (30g)
- 40
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tonydzi/sqlite-graph-memory
-
bug documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
tonydzi/sqlite-graph-memory#131 ·
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
tonydzi/sqlite-graph-memory#132 ·
I maintainer di solito rispondono entro 1 giorno
-
sgm-index on a mistyped or empty folder overwrites the existing index with an empty one and exits 0Apertabug good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
tonydzi/sqlite-graph-memory#130 ·
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
tonydzi/sqlite-graph-memory#126 ·
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
tonydzi/sqlite-graph-memory#125 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di tonydzi/sqlite-graph-memory
Issue simili
-
review-panel severity:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kristovatlas/coin-accounting#576 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
anthropics/skills#2328 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
repo-harnesses: the entrypoint-guard check greps a message `#13692` reworded, so it fails on mainAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
daniel-ospina/tortoise#14947 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100