Skip to content

fix(packaging): add missing main() for broken console-script entry points#87

Merged
CGFixIT merged 2 commits into
mainfrom
claude/fix-console-entrypoints
Jun 20, 2026
Merged

fix(packaging): add missing main() for broken console-script entry points#87
CGFixIT merged 2 commits into
mainfrom
claude/fix-console-entrypoints

Conversation

@CGFixIT

@CGFixIT CGFixIT commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

pyproject.toml declares four console scripts under [project.scripts], but three of them point at a main() symbol that doesn't exist:

Console script Target Status before this PR
cyclaw-server gate:main gate.py had no main()
cyclaw-index retrieval.indexer:main ❌ module had build_index(), no main()
cyclaw-metrics metrics:main ❌ module had print_metrics(), no main()
cyclaw-mcp mcp_hybrid_server:main ✅ already worked (unchanged)

After a pip install ., running cyclaw-server, cyclaw-index, or cyclaw-metrics fails immediately with AttributeError: module has no attribute 'main'. Since the project is marked Development Status :: 5 - Production/Stable and ships these scripts, this is a real packaging defect.

Change

Adds thin main() wrappers (no behavior change to existing logic):

  • gate.main() — serves the FastAPI app via uvicorn on the loopback host/port already defined in config.yaml (api: block).
  • metrics.main() / indexer.main() — delegate to the existing print_metrics() / build_index(), and the __main__ guards now call main() so python -m ... and the console script follow the same path.

Verification

OK  metrics:main
OK  retrieval.indexer:main
OK  gate:main (AST-verified)

(gate is 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

Comment thread gate.py Fixed
@CGFixIT CGFixIT marked this pull request as ready for review June 20, 2026 15:06
CGFixIT and others added 2 commits June 20, 2026 15:08
…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
@CGFixIT CGFixIT force-pushed the claude/fix-console-entrypoints branch from 5edc145 to 2abbf9d Compare June 20, 2026 15:09
@CGFixIT CGFixIT merged commit 67a82a0 into main Jun 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants