Repository navigation
briefs --category: an empty answer for an unknown category says so (warning, categories_seen) - #34
Merged
Merged
Conversation
The API keeps no list of categories, so a misspelt --category returned an empty page with exit 0, the same answer as a real category with nothing in it. When a category filter finds nothing on the first page, the CLI and io.sh (with jq) now compare it with the categories of the newest 100 briefs and, if it is not among them, add a warning and categories_seen. The exit code stays 0. README and SKILL.md say how --category matches and how to list the categories in use. The REST stub's paging /briefs now filters by category, case-insensitive on the section, as the issue reports the live route does. Test: test/briefs-category.test.mjs.
Contributor
Author
|
Review by Grok Bot (Indian Opinion QA agent) Tested at head Fixes: Refs #30 (a partial fix, as the PR says). An empty What I checked
Not checked
Review
Automated checks (this head vs current main)
I'm Grok Bot, the automated QA agent for Indian Opinion. This is a comment-only review. I don't approve, request changes or merge. Local stack: PHP 8.4.28, Composer 2.11.3, MariaDB 11.8.9, Node 24.22.1, WordPress 7.1.5. |
makriman
marked this pull request as ready for review
December 5, 2026 20:17
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.
Problem
briefs --category nonexistentcatreturns{"ok":true,"count":0,"items":[],"next_cursor":null}with exit 0. That is the same answer as a real category with nothing in it, so an agent cannot tell a typo from a quiet day. The valid categories are not documented anywhere in this repository either.Root cause
The CLI passes
--categoryto the API unchecked (cmdBriefs, andio.shthe same way), and the API filters on it. Nothing in the CLI knows which categories exist: there is no category list in this repository and no API route that returns one. That is why the issue's ideal fix, an exit 2 that names the valid categories, cannot be built honestly on the CLI side alone.Change
This is the part the CLI can do on its own.
--categoryfilter returns nothing on the first page, the CLI makes one more request for the newest 100 briefs and compares the category with theirs, ignoring case. If it is not among them, the answer carries awarningnaming the category and the categories seen, pluscategories_seenas an array. The exit code stays 0, because a real but quiet category can also be missing from the newest 100. The warning says "check the spelling", not "invalid".io.shdoes the same with jq. The sample request runs in a subshell on purpose: if it fails, the original answer is printed without a hint. Without jq,io.shprints the API's JSON unchanged, as documented.--textprints the warning under "No briefs matched."--categorymatches a brief's category exactly, ignoring case, and give a one-liner to list the categories in use.skill/SKILL.mdwas regenerated withindianopinion skill install --print.CHANGELOG.mdhas an Unreleased entry.Tests
test/briefs-category.test.mjs:warningandcategories_seen['Business', 'India', 'Politics']. Checked for the CLI andio.shagainst the paging stub, and for the CLI against the older non-paging stub.politics) filters with no warning.--category Business --q metro) gets no warning.Before the change, the first and last tests fail.
The REST stub's paging
/briefsnow filters bycategory(exact, ignoring case, onsection). That models what the issue reports from the live API (Governanceandgovernanceboth match).Commands run on this branch:
npm test(Node 22.23.4, jq 1.7,../mcpinstalled): 36 tests, 36 pass, 0 skipped.npm pack --dry-run: the same 6 files.For the reviewer
category(exact name, ignoring case) is taken from the issue's report and from the CLI's own local-filter fallback, not re-checked.--category, so the cost is one request on a path that has already found nothing.--categoryand exit 2 as the issue asks, and the MCPsearch_briefstool could do the same. A list hard-coded here would go stale without anyone noticing, so this PR does not add one.Refs #30