Skip to content
IndianOpinionPublic

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

indianopinion: the Indian Opinion CLI

Indian news briefs, the daily digest, topic alerts and Breaking News from the command line, for people and AI agents. One file, no dependencies, Node 20 or newer. Guide: https://indianopinion.org/agents/

MIT licensed. The MCP server this CLI bridges to is at https://github.com/IndianOpinion/mcp.

Install

The package is not on the npm registry yet (the first publish is pending), so install it from this repository or from the site:

npm i -g github:IndianOpinion/cli#v0.2.2                  # this repository, a release tag
npm i -g github:IndianOpinion/cli                         # this repository, the main branch
npm i -g https://indianopinion.org/agents/cli/latest.tgz   # the copy the site serves
npx --yes github:IndianOpinion/cli briefs --q "monsoon"   # run once without installing

github:IndianOpinion/cli without a tag installs whatever is on main, which can be ahead of the newest release; add #v<version> (see Releases) to install a tagged release.

Check a site download against https://indianopinion.org/agents/cli/SHA256SUMS or latest.json ({version, url, sha256}). After the first npm publish, npm i -g indianopinion and npx --yes indianopinion work too, and registry releases carry npm provenance that links each version to the GitHub Actions run in this repository that built it.

Without Node, io.sh covers the same commands and flags except mcp and skill (bash and curl):

mkdir -p ~/bin && curl -fsSL https://indianopinion.org/agents/cli/io.sh -o ~/bin/io && chmod +x ~/bin/io
~/bin/io briefs --q monsoon --limit 3      # or add ~/bin to PATH and run io

With jq installed, io.sh prints the same JSON as the CLI, errors from the API included ({"ok":false,"error":...,"message":...,"status":...} on stderr); without jq it prints the API's JSON unchanged, and the few flags that need reshaping (digest --limit, topics list --limit, breaking recent --limit or --would-send, brief --include) say they need jq and exit 2 before any request. A flag a command does not take is a usage error (exit 2) in both.

Use

indianopinion briefs --q "bengaluru metro" --limit 10     # no account needed
indianopinion brief https://indianopinion.org/<slug>/      # no account needed
indianopinion login start --email you@yourdomain.example   # emails a 6-digit code
indianopinion login verify --email you@yourdomain.example --code 123456
indianopinion digest                                       # needs the token from login verify
indianopinion topics follow "Supreme Court" --tier instant
indianopinion breaking recent --days 7
indianopinion breaking set --threshold 0.4 --composite mean --max-per-day 3
indianopinion prefs set --format text --hour 7
indianopinion unsubscribe --what all --yes                 # stop every email
indianopinion account close --yes                          # close the account (see below)
indianopinion token list
indianopinion mcp                  # stdio MCP bridge to https://indianopinion.org/mcp
indianopinion skill install        # writes ~/.claude/skills/indianopinion/SKILL.md
indianopinion doctor
indianopinion --help --json        # every command and flag, machine-readable

Verifying a new address switches on the daily digest and Breaking News: the digest in plain text at 7 am India time by default, Breaking News at most 5 a day under the default rule. unsubscribe --what all --yes stops both, topic alerts and reminders; --what digest or --what breaking stops one. An address that already had an account keeps its own settings.

account close --yes closes the account: every token is revoked, every email stops and the address can no longer sign in. It is deactivation, not deletion: the account record is kept, deactivated, under the retention terms of https://indianopinion.org/privacy-policy/. To ask for erasure, a copy of your data or reopening, write to hello@indianopinion.org.

Every command rejects a flag or extra word it does not take (exit 2), --since and --until must be ISO 8601 (exit 6), --until must be later than --since when both are given (exit 6, rather than an empty answer that reads like "no news"), and brief --include takes only brief, analysis, coverage and sources (exit 6).

brief without --include prints the REST payload as it is, where the per-outlet framing is the stances array (outlet, stance, note). With --include, only the named parts are kept, and coverage comes back as coverage: [{outlet, framing, note}], the same as the MCP get_brief tool.

Output is JSON when stdout is not a terminal, or with --json; text on a terminal or with --text. Errors go to stderr (a JSON object in JSON mode).

Exit Meaning
0 ok
1 unexpected, or a doctor check failed (a missing token is reported but is not a failure: exit 0, signed_in: false)
2 usage (including a missing --yes)
3 auth: no token, or it was refused
4 not found
5 rate limited (retry_after in the error)
6 validation
7 network or server
8 needs a choice (an ambiguous topic; options are listed)

briefs --category matches a brief's category exactly, ignoring case. The API keeps no list of categories, so an unknown one is not an error: the answer is empty with exit 0. When that happens and the category is not among those of the newest 100 briefs, the answer carries a warning and categories_seen (in io.sh, with jq). To list the categories in use: indianopinion briefs --limit 100 --json | jq -r '[.items[].category] | unique[]'.

List commands take --limit up to 100, the REST API's page size. The MCP tools (indianopinion mcp and the remote server) return at most 25 items per call; page on with their cursor.

Token order: --token (visible in ps, avoid), IO_TOKEN, then ${XDG_CONFIG_HOME:-~/.config}/indianopinion/token (written by login verify with mode 0600, directory 0700). IO_API changes the REST base (default https://indianopinion.org/wp-json/io/v1), IO_MCP_URL the MCP endpoint for mcp, IO_EMAIL the default for login.

MCP bridge

For clients that only speak stdio (Claude Desktop's config file, older Codex builds):

{ "mcpServers": { "indianopinion": { "command": "indianopinion", "args": ["mcp"] } } }

It forwards each JSON-RPC message to https://indianopinion.org/mcp with the stored token, and when signup_verify succeeds it stores the new token and uses it from the next call.

Tests

npm test

They run the CLI and io.sh against a local stub of the REST API (test/stub-rest.mjs). No network. The MCP bridge test also runs the io-mcp Worker when its source is found: set IO_MCP_DIR, or clone https://github.com/IndianOpinion/mcp next to this checkout as ../mcp and run npm ci there. Without the source, or without its node_modules, that one test is skipped with a hint.

The io.sh bats tests, when present in test/, run with bats test/.

The test workflow runs all of these on Node 20, 22 and 24 for every pull request and every push to main. A separate mcp-bridge job checks out IndianOpinion/mcp and fails if the bridge test is skipped.

Releasing

Releases go to npm from GitHub Actions through npm Trusted Publishing (OIDC). No npm token exists in this repository or its secrets.

One-time setup. Do these in this order: the GitHub environment must be protected before npm is told to trust the workflow, because GitHub creates a missing environment on first use with no protection.

  1. Publish the first version by hand, because npm attaches trusted publisher settings to an existing package. From a clean checkout of the newest release tag (v0.2.2), on your own machine with 2FA on: npm login, npm test, npm pack --dry-run (expect bin/indianopinion.mjs, skill/SKILL.md, README.md, LICENSE, CHANGELOG.md, package.json), then npm publish --access public. publishConfig.provenance only applies in CI; a local publish ignores it with a warning, or pass --provenance=false.
  2. Required: on GitHub, Settings, Environments, create the environment npm with
    • at least one required reviewer (turn on "Prevent self-review" if more than one maintainer can approve), so every publish waits for a second person, and
    • Deployment branches and tags: "Selected branches and tags", with one tag rule v* and no branch rule, so only a release tag can reach the environment. The publish workflow checks this and refuses to publish while the environment has no required reviewer or no v* tag rule.
  3. Only after step 2: on https://www.npmjs.com/package/indianopinion/access, under Trusted Publisher, choose GitHub Actions and enter: Organization or user IndianOpinion, Repository cli, Workflow filename publish.yml, Environment name npm. Save.
  4. On the same page, set Publishing access to "Require two-factor authentication and disallow tokens", so only the trusted workflow (and a human with 2FA) can publish.

Each release after that:

  1. Bump version in package.json, VERSION in bin/indianopinion.mjs and IO_SH_VERSION in io.sh (the test workflow fails if they differ), add a CHANGELOG.md entry, and update the github:IndianOpinion/cli#v<version> install line at the top of this README.
  2. Merge to main, then create a GitHub release with the tag v<version> on that main commit.
  3. A reviewer of the npm environment approves the run. The publish workflow then checks that the tagged commit is on main, that the tag matches the version, and that a GitHub prerelease carries a prerelease version (such as 0.3.0-rc.1) and a full release does not; it runs the tests and publishes with provenance, under the next dist-tag for a prerelease and latest otherwise.

The copy served at https://indianopinion.org/agents/cli/ is rebuilt from a release by the maintainers when the MCP Worker is deployed.

Security and contributing

Report a vulnerability privately to hello@indianopinion.org (see SECURITY.md), never in a public issue. How to propose a change: CONTRIBUTING.md.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages