Repository navigation
feat(cli): route Wiki Graph URIs by scope kind - #96
Conversation
WalkthroughThis PR replaces the archive Sequence Diagram(s)sequenceDiagram
participant User
participant Args as src/cli/args.ts
participant CLI as src/cli/archive.ts
participant ArchiveView as src/archive/query/archive-view.ts
participant SearchIndex as src/archive/search-index/search-index.ts
User->>Args: wikigraph <archive-uri> inspect
Args->>CLI: parsed inspect action
CLI->>SearchIndex: check index currency / settings
CLI->>ArchiveView: read chapters, titles, coverage data
CLI-->>User: inspect report
User->>Args: wikigraph <scope-uri> --query <text>
Args->>CLI: parsed search/list action
CLI->>ArchiveView: query archive objects
ArchiveView-->>CLI: chapter-title / chunk / entity hits
CLI-->>User: formatted results
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/cli/args.ts (1)
1628-1677: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReject bare chapter
get
wikg://chapter/<id>is a scope URI, but this branch still routesgettoparseArchiveArguments, so the CLI accepts it and only fails later with the scope-URI error fromarchive-view.ts. Rejectgethere and point users to/titleor/state.inspectstill doesn’t reject--query,--chapter,--from, or--cursor, so those flags are silently ignored on this path.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cli/args.ts` around lines 1628 - 1677, The chapter URI parser still accepts bare `get` for `wikg://chapter/<id>` and lets invalid scope URIs fail later, so update `parseSingleChapterUriArguments` to reject `get` for chapter objects and return a help/error pointing users to `/title` or `/state`. Also tighten the `inspect` branch in `parseArchiveArguments`/`parseSingleChapterUriArguments` so `--query`, `--chapter`, `--from`, and `--cursor` are explicitly rejected instead of being ignored on this path.docs/en/quickstart.md (1)
77-81: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReword the URI guidance around
/sourceand/summary.This paragraph still presents those lenses as search targets, but the new routing contract treats object URIs as
get-by-default and reserves search/list behavior for scope URIs. Please rewrite this to distinguish scope vs. object routing.Suggested fix
-Use URI lenses to choose a search target: `<archive-uri>/chunk` for Reading Graph structure, `<archive-uri>/summary` for quick overview, `<archive-uri>/source` for original source wording, or `<archive-uri>/entity` and `<archive-uri>/triple` for Knowledge Graph objects. +Use URI lenses to choose a scope or object target: `<archive-uri>/chunk` for Reading Graph structure, `<archive-uri>/entity` and `<archive-uri>/triple` for Knowledge Graph objects, and treat `<archive-uri>/summary` / `<archive-uri>/source` as object URIs that default to `get`.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/en/quickstart.md` around lines 77 - 81, The URI guidance in the quickstart still describes /source and /summary as search targets, but the routing contract now treats object URIs as get-by-default and scope URIs as the ones for search/list behavior. Update the paragraph in the quickstart URI section to clearly distinguish scope versus object routing, using the existing wiki graph URI guidance and the retrieval help references, so readers know when to use object URIs versus scope URIs.docs/zh-CN/ai-agents.md (1)
17-26: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUpdate these examples to the new
--querysyntax.The prose and sample commands in this block still use positional query arguments (
search "keyword",evidence "objectivity",related "objectivity"). That contradicts the new CLI contract and will teach the removed form.Suggested fix
-wikigraph wkg://book.wikg/source search "keyword" -wikigraph wkg://book.wikg/entity search "keyword" +wikigraph wkg://book.wikg/source search --query "keyword" +wikigraph wkg://book.wikg/entity search --query "keyword" @@ -wikigraph <archive-uri>/entity/Q830077 evidence "objectivity" -wikigraph <archive-uri>/entity/Q830077 related "objectivity" --evidence 2 +wikigraph <archive-uri>/entity/Q830077 evidence --query "objectivity" +wikigraph <archive-uri>/entity/Q830077 related --query "objectivity" --evidence 2Also applies to: 30-42
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/zh-CN/ai-agents.md` around lines 17 - 26, The command examples in the AI agents docs still use the old positional query form in wikigraph samples, so update the affected examples to the new --query syntax instead. In the relevant markdown section, revise the wikigraph usage examples for search, related, and evidence to use the updated flag-based form, keeping the surrounding commands and references like wikigraph and the chapter/entity URI examples consistent with the current CLI contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@data/help/commands/archive/list.jinja`:
- Around line 13-27: The usage signature in the wikigraph help text is missing
the --query option, even though the notes already mention it. Update the command
synopsis in list.jinja so the primary usage line for wikigraph includes --query
<query> alongside the existing flags, keeping the help text consistent with the
guidance in the Notes section.
In `@src/cli/args.ts`:
- Around line 2890-2923: The new inspect branch in parseArchiveAction is missing
several reject checks that sibling read actions enforce, so unsupported flags
are being silently accepted. Update the inspect case to explicitly reject
--query, --chapter, --from, and --cursor using the same
rejectArchiveFlag/rejectArchiveBooleanFlag helpers already used for
list/get/search, alongside the existing validations. Keep the behavior
consistent with the other read-action handlers in src/cli/args.ts so inspect
fails fast on ignored inputs.
---
Outside diff comments:
In `@docs/en/quickstart.md`:
- Around line 77-81: The URI guidance in the quickstart still describes /source
and /summary as search targets, but the routing contract now treats object URIs
as get-by-default and scope URIs as the ones for search/list behavior. Update
the paragraph in the quickstart URI section to clearly distinguish scope versus
object routing, using the existing wiki graph URI guidance and the retrieval
help references, so readers know when to use object URIs versus scope URIs.
In `@docs/zh-CN/ai-agents.md`:
- Around line 17-26: The command examples in the AI agents docs still use the
old positional query form in wikigraph samples, so update the affected examples
to the new --query syntax instead. In the relevant markdown section, revise the
wikigraph usage examples for search, related, and evidence to use the updated
flag-based form, keeping the surrounding commands and references like wikigraph
and the chapter/entity URI examples consistent with the current CLI contract.
In `@src/cli/args.ts`:
- Around line 1628-1677: The chapter URI parser still accepts bare `get` for
`wikg://chapter/<id>` and lets invalid scope URIs fail later, so update
`parseSingleChapterUriArguments` to reject `get` for chapter objects and return
a help/error pointing users to `/title` or `/state`. Also tighten the `inspect`
branch in `parseArchiveArguments`/`parseSingleChapterUriArguments` so `--query`,
`--chapter`, `--from`, and `--cursor` are explicitly rejected instead of being
ignored on this path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a17e3ba3-c26b-40da-a650-ea9a156b8f68
📒 Files selected for processing (34)
README.mddata/help/commands/archive/estimate.jinjadata/help/commands/archive/evidence.jinjadata/help/commands/archive/inspect.jinjadata/help/commands/archive/list.jinjadata/help/commands/archive/related.jinjadata/help/commands/archive/search.jinjadata/help/commands/root.jinjadata/help/topics/ai.jinjadata/help/topics/command.jinjadata/help/topics/recipe.jinjadata/help/topics/retrieval.jinjadata/help/topics/task.jinjadata/help/topics/uri.jinjadocs/en/ai-agents.mddocs/en/architecture.mddocs/en/cli.mddocs/en/quickstart.mddocs/zh-CN/ai-agents.mddocs/zh-CN/architecture.mddocs/zh-CN/cli.mddocs/zh-CN/quickstart.mdsrc/archive/query/archive-view.tssrc/archive/query/index.tssrc/archive/search-index/search-index.tssrc/cli/archive.tssrc/cli/args.tssrc/cli/help.tssrc/cli/queue.tssrc/facade/index.tstest/archive/query/archive-view.test.tstest/cli/archive.test.tstest/cli/args.test.tstest/wikg/spine-digest-file.test.ts
💤 Files with no reviewable changes (3)
- data/help/commands/archive/estimate.jinja
- src/archive/query/index.ts
- src/facade/index.ts
Summary
--query, and object URIs to get by defaultTesting
chapter 3 Reading Graph and Knowledge Graph coverage, and manually tested chapter/title/source/chunk/entity/triple list/search/get/related/evidence routing
Notes
feat: add archive inspect reportcommit.