fix(packaging): add missing main() for broken console-script entry points#87
Merged
Conversation
…ints
pyproject.toml [project.scripts] declares four console scripts, but three
pointed at a main() that did not exist:
cyclaw-server = gate:main -> gate.py had no main()
cyclaw-index = retrieval.indexer:main -> indexer had build_index(), no main()
cyclaw-metrics = metrics:main -> metrics had print_metrics(), no main()
After a pip install, invoking any of these raised AttributeError at startup.
(cyclaw-mcp = mcp_hybrid_server:main already worked and is unchanged.)
Adds thin main() wrappers:
- gate.main() serves the FastAPI app via uvicorn on the loopback host/port
from config.yaml.
- metrics.main() / indexer.main() delegate to the existing
print_metrics() / build_index() and the __main__ guards now call them,
so 'python -m' and the console script share one path.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0167bHerb53KwtsHWVNt9qkg
The DS162092 (localhost access) finding on gate.main()'s host fallback is a false positive: gate.py binds loopback-only by design (see module docstring), and the default mirrors config.yaml's api.host. Matches the existing inline DevSkim suppression convention already used for api.host and llm.base_url. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0167bHerb53KwtsHWVNt9qkg
5edc145 to
2abbf9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pyproject.tomldeclares four console scripts under[project.scripts], but three of them point at amain()symbol that doesn't exist:cyclaw-servergate:maingate.pyhad nomain()cyclaw-indexretrieval.indexer:mainbuild_index(), nomain()cyclaw-metricsmetrics:mainprint_metrics(), nomain()cyclaw-mcpmcp_hybrid_server:mainAfter a
pip install ., runningcyclaw-server,cyclaw-index, orcyclaw-metricsfails immediately withAttributeError: module has no attribute 'main'. Since the project is markedDevelopment Status :: 5 - Production/Stableand ships these scripts, this is a real packaging defect.Change
Adds thin
main()wrappers (no behavior change to existing logic):gate.main()— serves the FastAPIappviauvicornon the loopbackhost/portalready defined inconfig.yaml(api:block).metrics.main()/indexer.main()— delegate to the existingprint_metrics()/build_index(), and the__main__guards now callmain()sopython -m ...and the console script follow the same path.Verification
(
gateis AST-verified rather than imported because importing it triggers heavy module-level init — telemetry kill + graph build.)🤖 Generated with Claude Code
Generated by Claude Code