Repository navigation
docs: plain English README and AGENTS.md #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,43 @@ | ||
| # kagi | ||
|
|
||
| ## Goal | ||
|
|
||
| Unofficial Unix-style CLIs for Kagi: `kagi-search`, `kagi-maps`, `kagi-summarize`. | ||
| Three Unix-style CLIs for Kagi: `kagi-search`, `kagi-maps`, and `kagi-summarize`. `README.md` | ||
| covers install, the token, and usage. | ||
|
|
||
| ## Gates | ||
|
|
||
| - `task ci` runs `task check`, the release-profile check, `nix build`, | ||
| cargo-machete, and cargo-deny. GitHub Actions runs all but `task test:nix`, so | ||
| run `task ci` yourself after you touch `flake.nix`, `flake.lock`, or | ||
| `Cargo.toml`. A lock-only input refresh still ships a Nix build nothing else | ||
| checks. | ||
| - `task lint` calls `zizmor`. The `nix develop` shell does not ship it, so put | ||
| `zizmor` on `PATH` before you run lint or check. | ||
| - `task test:live` hits the real Kagi service. Run it when you change the | ||
| request path or a parser: `src/cli.rs`, `src/client.rs`, or `src/parse.rs`. It | ||
| needs `KAGI_SESSION_TOKEN` or `~/.config/kagi/session-token` and fails without | ||
| one. | ||
|
|
||
| ## Decisions | ||
|
|
||
| - Three separate binaries. Do not reintroduce a combined command. | ||
| - Never hardcode a session token. The client reads `KAGI_SESSION_TOKEN` (empty | ||
| counts as unset), then `$XDG_CONFIG_HOME/kagi/session-token`, falling back to | ||
| `~/.config/kagi/session-token`. It refuses a token file that is group- or | ||
| world-readable. | ||
| - `--sort` means two different things. `kagi-search` sends it to Kagi as the | ||
| `order` parameter. `kagi-maps` fetches the whole page, sorts locally, then | ||
| truncates to `--limit`. | ||
| - `install.sh` is the one installer. `task install` and the release smoke test | ||
| run it on local archives. `task install` packs the local build like a | ||
| release archive, so it runs only on the two release platforms. | ||
| - The repo ships no agent skill; an agent that uses these CLIs brings its own. | ||
| On the upgrade from 0.5 or earlier, `install.sh` removes the skill that | ||
| release installed; later runs leave any `kagi` skill alone. | ||
| - A version bump is the release trigger: on each push to `main`, `release.yml` | ||
| reads `version` from `Cargo.toml`. When the tag `v<version>` does not exist, | ||
| it tags and publishes. The tag decides, not the parent commit, so a | ||
| multi-commit push or a cancelled run does not lose a release. A tag deleted by | ||
| hand comes back on the next push. Recover a failed build or release through | ||
| `workflow_dispatch` on `release.yml`. | ||
| - `task ci` runs `task check`, the release-profile check, `nix build`, cargo-machete, and | ||
| cargo-deny. GitHub Actions runs all of it except `task test:nix`. Run `task ci` yourself after | ||
| you touch `flake.nix`, `flake.lock`, or `Cargo.toml`, because nothing else builds the Nix | ||
| package. This includes a lock-only input refresh. | ||
| - `task lint`, and with it `task check` and `task ci`, runs `zizmor`. The `nix develop` shell does | ||
| not include it, so put `zizmor` on `PATH` first. | ||
| - `task test:live` calls the real Kagi service. Run it when you change the request path or a | ||
| parser: `src/cli.rs`, `src/client.rs`, or `src/parse.rs`. It needs a session token (see | ||
| `README.md`) and fails without one. | ||
|
|
||
| ## Rules | ||
|
|
||
| - Keep three separate binaries. Do not add a combined command again. | ||
| - Never hardcode a session token. | ||
| - `--sort` means two things. `kagi-search` sends it to Kagi as the `order` parameter. `kagi-maps` | ||
| gets the whole result page, sorts it locally, then cuts it to `--limit`. | ||
| - `install.sh` is the one installer. `task install` and the release smoke test run it on local | ||
| archives. `task install` packs the local build like a release archive, so it runs only on the | ||
| two release platforms. | ||
| - The repo ships no agent skill. An agent that uses these CLIs brings its own. On the upgrade from | ||
| 0.5 or earlier, `install.sh` removes the skill that release installed. Later runs leave any | ||
| `kagi` skill alone. | ||
| - A version bump is the release trigger. On each push to `main`, `release.yml` reads `version` | ||
| from `Cargo.toml`. When the tag `v<version>` does not exist, it tags and publishes. The tag | ||
| decides, not the parent commit, so a push of many commits or a cancelled run does not lose a | ||
| release. A tag that someone deletes comes back on the next push. To recover a failed build or | ||
| release, run `release.yml` through `workflow_dispatch`. | ||
|
|
||
| ## Pitfalls | ||
|
|
||
| - `flake.nix` repeats the package version as a literal. Bump it in the same | ||
| commit as `Cargo.toml`, or `nix build` produces a package with the old | ||
| version. | ||
| - `install.sh` runs under `sh` on Linux with GNU tools and on macOS with BSD | ||
| tools. Use POSIX sh and flags both sets have: no `realpath --relative-to`, no | ||
| `ln -T`. | ||
| - `ci.yml` skips a pull request whose author is not the repository owner. A | ||
| contributor PR shows no checks; that is the gate, not a broken run. | ||
| - `flake.nix` repeats the package version as a literal. Bump it in the same commit as | ||
| `Cargo.toml`, or `nix build` makes a package with the old version. | ||
| - `install.sh` runs under `sh` on Linux with GNU tools and on macOS with BSD tools. Use POSIX sh | ||
| and only flags that both sets have: no `realpath --relative-to`, no `ln -T`. | ||
| - `ci.yml` skips a pull request whose author is not the repository owner. A contributor PR shows | ||
| no checks. That is the gate, not a broken run. | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.