@mu-cabin/coding-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # coding-cli
2
+
3
+ Agent-first CLI + Claude Code skill for operating a **self-hosted CODING** instance over its
4
+ OpenAPI surface (429 actions, 17 categories). Built as a **generic spec-driven passthrough**: one
5
+ `coding call <Action>` invokes any action, backed by a bundled action index for discovery,
6
+ validation, and safety.
7
+
8
+ - **Base URL:** your CODING instance's OpenAPI endpoint, e.g. `https://<your-coding-host>/open-api` — set it via `--base-url` / `CODING_API_BASE` / `config init` (the built-in default is a `coding.example.com` placeholder)
9
+ - **Auth:** personal access token (`Authorization: token <…>`)
10
+
11
+ ## Install (dev)
12
+
13
+ ```bash
14
+ npm install
15
+ npm run regen # tsc + build the action index/docs from the spec
16
+ npm link # expose the `coding` binary on PATH (optional)
17
+ ```
18
+
19
+ ## Quick start
20
+
21
+ ```bash
22
+ coding config init --base-url https://<your-coding-host>/open-api # writes ~/.coding/config.json
23
+ coding auth login # hidden token prompt (or: coding auth login --token -)
24
+ coding auth status --json # verify -> current user
25
+
26
+ coding actions --search issue --json # discover actions
27
+ coding schema CreateIssue --json # params / response / errors / risk
28
+ coding call DescribeProjectIssueList \
29
+ --param ProjectName=demo --select 'Data.List[].Code,Data.List[].Name' --limit 20 --json
30
+ ```
31
+
32
+ `CODING_TOKEN` / `CODING_API_BASE` / `CODING_PROFILE` env vars override config.
33
+
34
+ ## Output contract
35
+
36
+ Pass `--json` for the envelope:
37
+
38
+ ```jsonc
39
+ { "ok": true, "action": "DescribeTeam", "requestId": "…", "data": { /* Response minus RequestId */ } }
40
+ { "ok": false, "action": "…", "requestId": "…", "error": { "code|type": "…", "message": "…", "hint": "…" } }
41
+ ```
42
+
43
+ Exit codes: `0` ok · `2` usage · `3` auth · `4` not-found · `5` remote/network · `6/7` config ·
44
+ `8` forbidden/scope · `9` rate-limit · `10` confirmation-required · `11` validation.
45
+
46
+ ## Safety
47
+
48
+ Destructive actions (`Delete*`, `Remove*`, `Disable*`, …) are gated: calling one without `--yes`
49
+ exits `10` with a `confirmation_required` envelope. Preview any request with `--dry-run` (redacts the
50
+ token, never sends, never trips the gate). Validation rejects unknown action / missing-required /
51
+ unknown-param by default; `--force` (`--no-validate`) bypasses it for actions your instance has that
52
+ the public spec lacks.
53
+
54
+ ## The skill
55
+
56
+ [`skills/coding/SKILL.md`](./skills/coding/SKILL.md) teaches an agent the bootstrap, discovery,
57
+ call recipe, output/exit-code contract, error/scope playbook, and the exit-10 protocol. Curated
58
+ per-domain playbooks (issues, code/MRs, CI, CD, artifacts, project, test, permissions, org, wiki,
59
+ service hooks, programs, files, export, admin) live in
60
+ [`skills/coding/references/`](./skills/coding/references/) and load **on demand** — SKILL.md §9 is the
61
+ router. Keeping them as reference files (rather than separate skills) means only one skill description
62
+ sits in the agent's context, so the playbooks add no always-on token cost.
63
+
64
+ ## Regenerating the spec artifacts
65
+
66
+ `generate_docs.py` (the original Python doc generator) is superseded by `src/core/specBuild.ts`,
67
+ which emits **both** `generated/index.json` and the `docs/*.md` reference from one parse. Two ways to run it:
68
+
69
+ ```bash
70
+ npm run regen # dev: tsc + build from spec/coding-openapi.yaml (cache-first), else fetch
71
+ coding update # refresh from the LIVE spec, persist the cache, report an added/removed diff
72
+ coding update --offline # rebuild from the cached spec only (no network)
73
+ coding update --dry-run # report what would change without writing
74
+ ```
75
+
76
+ `coding update` fetches the latest spec, then **atomically** swaps in the rebuilt `docs/` (pruning
77
+ stale files) and `generated/index.json`. Distribution is local/dev for now, so CLI/skill *code*
78
+ upgrades happen via `git pull` + `npm run regen`; `update` keeps the spec artifacts current.