@khaale/kaiten-cli
v0.3.0
Published
Read-oriented Kaiten explorer CLI for tasks/cards
Readme
ktc
ktc is a Kaiten explorer CLI built for agents and shell users.
It is designed around a few constraints that matter in practice:
- explicit noun-verb commands
- no interactive login, prompts, or pagers
- read-only access in this version
- brief default output instead of full API dumps
- stable machine-readable JSON when requested
- Markdown output that is compact and agent-friendly by default
- local JSON-file caching to avoid repeated expensive API reads
- anonymized user-identifying fields in output
The intended use case is exploration and inspection of Kaiten cards from shells, scripts, and LLM-driven workflows.
Status
This repository currently contains a first working scaffold:
doctorapi requesttasks minetasks findtasks gettask-comments get
The CLI is Kaiten-only and read-oriented in this version.
Current implementation notes:
tasks mineresolves the current user throughGET /api/latest/users/currenttasks mineandtasks finduseGET /api/latest/cardstasks getusesGET /api/latest/cards/{card_id}tasks getkeeps a broader board-scan fallback if direct lookup does not resolve
Why ktc
Product CLIs often assume a human operator who already knows the model well and is comfortable with mixed modes, aliases, and interactive flows.
ktc takes a different approach:
- commands follow one stable grammar:
ktc tasks <verb> ... - selectors are explicit:
--space,--board,--assignee - positional arguments are used only where they simplify the obvious case
- output defaults to a concise readable task view
- JSON is opt-in with
--json - output can be narrowed with
--fields
That makes the next command easier to generate for both people and weaker models.
Installation
Node.js 22+ is required.
For development in this repo:
npm install
node ./bin/ktc.js --helpIntended package usage:
npm install -g @khaale/kaiten-cli
ktc --helpor:
npx @khaale/kaiten-cli --helpRecommended first-run smoke test:
command -v ktc
ktc --json doctorPublishing
The package metadata is set up so publishing only includes the built runtime files:
dist/README.mdLICENSE
npm run pack:check and npm publish build a self-contained bundle into dist/ before packaging, so the published tarball does not depend on workspace-only packages.
Before publishing:
- Confirm the package name in package.json is the one you want on npm.
- Run:
npm run lint
npm test
npm run pack:check- Inspect the
npm pack --dry-runoutput and make sure no local-only files are included. - Publish:
npm publishprepublishOnly already runs lint, tests, and the dry-run pack check before a real publish.
Authentication
ktc reads Kaiten connection settings from either:
- environment variables
- a persisted global JSON config file
Per-key precedence is:
KAITEN_URL,KAITEN_API_TOKEN,KAITEN_API_BASE,KAITEN_BROKEN_API,KAITEN_CACHE_DIRfrom the environment- the same keys in the global
config.json - built-in OS-specific cache-dir default for
KAITEN_CACHE_DIR
The global config lives at:
- Linux:
${XDG_CONFIG_HOME:-~/.config}/ktc/config.json - macOS:
~/Library/Application Support/ktc/config.json - Windows:
%APPDATA%\ktc\config.json
Recommended setup:
export KAITEN_URL=https://your-domain.kaiten.ru
export KAITEN_API_TOKEN=your-token
ktc config initOptional:
export KAITEN_API_BASE=/api/latestYou can also persist config explicitly:
ktc config init \
--kaiten-url https://your-domain.kaiten.ru \
--kaiten-api-token your-tokenThere is no interactive login flow in v1.
Basic Usage
Command shape:
ktc tasks <mine|find|get> [args] [flags]
ktc task-comments get [args] [flags]
ktc doctor [flags]
ktc api request [flags]Nouns:
doctorapi requesttaskstask-commentsconfig
Verbs:
minefindget
Common selectors:
--space <id|uid|title>--board <id|uid|title>--assignee <me|id|uid|email|username|name>
Common filters:
--search <text>--state <open|done|archived|all>--limit <n>
Common output flags:
--fields a,b,c--json--md--raw--compact
Common control flags:
--refresh--verbose
Examples
Explore your work
Run the recommended preflight check:
ktc --json doctorList your open tasks:
ktc tasks mineThe same in JSON:
ktc tasks mine --jsonFind tasks
Find tasks by text:
ktc tasks find authFind tasks assigned to you:
ktc tasks find --assignee me --search authFind tasks for another assignee:
ktc tasks find --assignee alice --state openNarrow the search to a space or board:
ktc tasks find --space Engineering --board BackendInspect one task
Get one task by id:
ktc tasks get --id 9001Debug a slow request:
ktc tasks get --id 9001 --verboseInspect task comments
Get comments for a task:
ktc task-comments get --task 9001Use the raw escape hatch for a read-only endpoint:
ktc --json api request --path /api/latest/spaces --query query=platformOutput Model
The output rules are intentionally simple:
minedefaults to Markdownfinddefaults to Markdowngetdefaults to Markdown
Formatting flags control the rendered form:
--json: force JSON output--md: force Markdown output--compact: remove indentation from JSON output--fields a,b,c: project a smaller field set before rendering
Markdown output is intended to be readable by both humans and agents. Task detail output includes:
- core task facts
- anonymized assignee information
- brief parent and child task summaries when present
JSON output keeps the full structured object. User-identifying fields are anonymized before rendering:
- Markdown and debug logs use shortened
sha256:prefixes - JSON keeps the full
sha256:value - the hash is deterministic for the same normalized input value
List output is intentionally restricted by default. It should provide enough information for the next step, not a full API dump.
Examples:
ktc tasks mine
ktc tasks find auth --json
ktc tasks get --id 9001