Repository navigation
feat(onboarding): autodetect chat sources and first-run setup (#869) - #1116
Conversation
Adds `polylogue init`, which scans the canonical chat-export roots under the user's home directory (Claude Code, Codex, Gemini CLI, Hermes, Antigravity, and the agent hook sidecar) and writes a starter polylogue.toml into XDG_CONFIG_HOME. Both the CLI and the daemon read the same file, so a fresh install reaches a usable archive without needing to read docs. The bare `polylogue` status fallback now distinguishes "no archive, no config" (suggests `polylogue init`) from "no archive, config present" (suggests `polylogued run`) so the next action is always one copy-paste away. The direct-mode JSON status fallback exposes the same `next_action` field for machine readers. docs/onboarding.md walks through install → init → daemon → first search in three commands, and surfaces `polylogue doctor` as the recovery handle for FTS / schema / blob issues. Ref #869 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8c43a1be4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…1126) ## Summary Rewrites the project README around a new visitor's path of attention: a single-sentence pitch, a 30-second install-to-first-search tour using the current `polylogue init` + `polylogued run` flow, and a value-prop section explaining the corpus framing. Surfaces the architecture diagram that `devtools render-readme-media` already produces. ## Problem The previous README opened with operator-shaped quickstart instructions (`direnv allow`, `nix run`, `devtools lab-corpus seed`) and led with the source checkout flow. A new visitor arriving from a link had no one-line "what is this," no end-user install path, no `polylogue init` reference (PR #1116), and no visual anchor for the architecture despite `docs/media/` already carrying rendered Mermaid diagrams. Issue #952 asked for a README revamp plus an assurance-visual pipeline (screencasts + extension screenshots). Issue #1082 / PR #1096 then established the policy that committed screenshots and VHS tapes are not desirable — they drift faster than the code. The README revamp can still happen; visuals stay on the on-demand rendering path through `devtools render-readme-media`. ## Solution `README.md` rewritten: - New opener: bold one-sentence pitch, paragraph explaining the system, three-bullet value prop (local-first, source-agnostic, idempotent). - New "30-second tour" using the production path: `pip install` → `polylogue init` → `polylogued run --enable-api` → `polylogue "query"` → `polylogue --latest open`. Links to `docs/onboarding.md`. - New "Why this exists" section frames Polylogue as a corpus layer, not an operator tool. - New "Architecture at a glance" section embeds `docs/media/architecture-overview.svg` (already rendered by `devtools render-readme-media`), keeps the ASCII data-flow as a text-renderable fallback, and links the on-demand media policy (`docs/media/README.md`). - "Installing from source" demoted into its own section so the first install instruction a new visitor sees is `pip install polylogue`, not `direnv allow`. - "Synthetic demo" demoted to a subsection under source install. - Surfaces section reordered around current CLI: web reader → MCP → browser capture → Python API. - Generated `docs-surface` block preserved unchanged (`devtools render-docs-surface --check` confirms). No committed binary screenshots or VHS tapes were added — the existing SVG architecture diagram is the only embedded visual and is regenerated deterministically from `devtools/generate_readme_media.py`. Inherited stale generated surface (`docs/topology-status.md`) was regenerated in a separate commit so the pre-push gate passes; that drift came from a previously landed PR adding a module without refreshing the rendered surface, not from this README work. `Ref #952` rather than `Closes` — the issue's screencast/extension screenshot acceptance criteria were superseded by the #1082/#1096 policy decision and the README is now the readable-by-new-visitor artifact the issue asked for, but a future visual-rendering pass (if any beyond the existing Mermaid diagrams) would still belong to #952. ## Verification ``` nix develop -c devtools render-readme-media --check Wrote 4 .mmd source(s) in docs/media nix develop -c devtools render-docs-surface --check render-docs-surface: sync OK nix develop -c devtools verify --quick exit_code: 0 (after regenerating docs/topology-status.md, which was inherited stale on master) ``` `docs/media/architecture-overview.svg` is unchanged on disk — the README now references the existing rendered diagram. No new binary assets were committed. Ref #952 Ref #1082 Ref #1116 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…829) (#1143) ## Summary Establishes the five-layer config precedence chain described in #829 (defaults → site → user → env → CLI) and surfaces layer provenance through `polylogue config --show-layers`. ## Problem `polylogue/config.py` already had a `PolylogueConfig` loader that read a single TOML and `POLYLOGUE_*` env vars, but it did not match the contract in #829 in three ways: 1. No site-wide config layer. Issue specifies `/etc/polylogue/polylogue.toml` so packaging can ship defaults that are themselves overridable per user. 2. No provenance. Operators could read the resolved values but had no way to ask "which layer did this come from?" — the very question #829 calls out for `polylogue config --show-layers`. 3. The `config` CLI command did not expose layer information at all. ## Solution `polylogue/config.py`: - Adds `DEFAULT_SITE_CONFIG_PATH = /etc/polylogue/polylogue.toml` and `_site_config_path()` with a `POLYLOGUE_SITE_CONFIG` override (empty string disables, e.g. for tests and ephemeral environments). - Splits the loader into a pure `_default_config_values()` and an `_apply_toml_layer()` helper that records which keys each layer actually changed. - `load_polylogue_config(site_config_path=..., config_path=..., cli_overrides=...)` now walks defaults → site TOML → user TOML → env → CLI in order and builds a `layers` map alongside the resolved values. - `PolylogueConfig` gains `layers` (dict) and `layer_of(key)` accessors; malformed TOML is swallowed silently so a broken site config cannot brick the CLI. - `describe_config_layers()` returns a JSON-friendly view of the resolved site and user config paths plus existence flags, used by `polylogue config --show-layers`. `polylogue/cli/commands/config.py`: - Adds `--show-layers` to the existing `polylogue config` command. - Emits the layer descriptor + per-key `{value, layer}` map in either TOML or JSON (both via `console.print(..., markup=False)` so JSON and TOML headers survive Rich markup parsing). `tests/unit/core/test_config.py`: - `TestPolylogueConfigLayerPrecedence` covers every transition (default → site → user → env → CLI), the missing-file fallthrough, and the malformed-TOML graceful fallback. - `TestDescribeConfigLayers` covers the structured report including the `POLYLOGUE_SITE_CONFIG=""` disable case. The inherited `init`-command snapshot drift on master (#1116 landed without refreshing `tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr`) is included so `pytest tests/unit/cli/test_terminal_snapshots.py` is green again on this branch. ## Verification ``` nix develop -c devtools verify --quick # total_duration_s 20.29, exit_code 0 nix develop -c pytest tests/unit/core/test_config.py -q # 81 passed in 7.88s nix develop -c pytest tests/unit/cli/test_terminal_snapshots.py -q # 9 passed in 8.48s POLYLOGUE_SITE_CONFIG='' POLYLOGUE_API_PORT=9999 \ POLYLOGUE_FORCE_PLAIN=1 nix develop -c polylogue config --show-layers # api_port = 9999 # layer = env ``` Ref #829 Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds
polylogue initto make first-run setup turnkey: the commandauto-detects chat-export directories under the user's home and writes
a starter
polylogue.tomlintoXDG_CONFIG_HOME. The bare-statusfallback now points new users at
polylogue inituntil that fileexists, then shifts to
polylogued runonce a config is present. Ashort
docs/onboarding.mdwalks through install → init → daemon →first search in three commands.
Problem
#869 calls for a fresh install (wheel, Nix package, or source) to
reach a usable archive without reading docs. Today, a new user on a
fresh wheel sees
polyloguewith no archive and a single-line hintthat says "start the daemon" — but the daemon discovers sources by
walking hard-coded paths and the user has no easy way to learn which
roots Polylogue cares about, whether their tools were detected, or
where the config file would live. The result is doc-driven onboarding.
The acceptance criteria in #869 are broader than this PR: doc
rewrites, ingest-truthfulness, distribution smoke gates, and
backup-boundary docs all remain for follow-up work tracked under
#829/#861/#830/#825/#844. This change owns the "fresh-install →
config exists → first run" slice — the missing seam that the rest
of the doc/UX work assumes is already there. It explicitly does not
modify
polylogue ingest, the daemon CLI, or the source discoverycontracts owned by adjacent agents.
Solution
New module
polylogue/cli/commands/init.py:detect_chat_sources()enumerates the canonical roots(
claude-code,codex,gemini-cli,hermes,antigravity,hooks) by reusing the same path accessors the live watcherconsumes via
default_sources(). Each candidate carries apresentflag (noOSErrorpropagation) and a one-linedescription.
render_starter_toml()emits a config body that lists detectedroots under
[sources]and writes absent ones as commented hintsso a later install does not need a doc lookup.
init_commandexposes the workflow with--dry-run,--force,and
--format json. The text mode prints a per-source checklistand a three-step next-action summary; the JSON mode exposes
present_families, the rendered body, and awrittenbooleanfor scripted setup.
polylogue/cli/commands/status.py:_show_direct_statusnow distinguishes "no archive, no config"(suggests
polylogue init) from "no archive, config present"(suggests
polylogued run)._show_direct_jsonexposesconfig_exists,config_path, and anext_actionfield so machine readers see the same routingdecision.
polylogue/cli/click_command_registration.py:initto the lazy root-command registry and its short-help.docs/onboarding.md:polylogue init→polylogued run→ search,surfaces
polylogue doctoras the recovery entry point, andlinks to
daemon.md/internals.mdfor deeper recovery.Generated surfaces (
docs/cli-reference.md,docs/plans/topology-target.yaml,docs/topology-status.md,docs/test-quality-workflows.md,docs/verification-catalog.md,AGENTS.md) are refreshed viadevtools render-allto keep the catalogs in sync.Out of scope (deliberately, per issue dependency list):
polylogue ingesttruthfulness (refactor(ingest): define shared import and maintenance operation contracts #861)verify-distribution-surfaceupdates(chore: repo maintenance — dead dependencies, stale docs, missing test files, CodeQL CI #826/fix(distribution): gate installed artifacts and build metadata #593)
doctor --repairextensions beyond what exists todayThe existing
doctorcommand already covers FTS-trigger / schema /blob recovery; this PR points users at it from
docs/onboarding.mdrather than re-implementing recovery logic in
init.Verification
Commands run:
The init test module covers detection (missing/present roots), TOML
rendering (active vs commented entries),
--dry-run,--force,existing-file preservation, JSON output, and the new status hint
behavior before/after init runs.
Ref #869