@aisa-one/cli 0.2.2 → 0.2.3

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +134 -1
  2. package/README.md +249 -103
  3. package/dist/api.d.ts +46 -1
  4. package/dist/api.js +77 -8
  5. package/dist/cache.d.ts +18 -0
  6. package/dist/cache.js +65 -0
  7. package/dist/catalog.d.ts +90 -0
  8. package/dist/catalog.js +101 -0
  9. package/dist/commands/account.js +3 -1
  10. package/dist/commands/api.d.ts +18 -4
  11. package/dist/commands/api.js +357 -24
  12. package/dist/commands/cacheCmd.d.ts +2 -0
  13. package/dist/commands/cacheCmd.js +10 -0
  14. package/dist/commands/completionCmd.d.ts +7 -0
  15. package/dist/commands/completionCmd.js +37 -0
  16. package/dist/commands/configCmd.js +19 -1
  17. package/dist/commands/finance.d.ts +4 -0
  18. package/dist/commands/finance.js +212 -29
  19. package/dist/commands/models.js +6 -0
  20. package/dist/commands/run.d.ts +21 -0
  21. package/dist/commands/run.js +113 -6
  22. package/dist/commands/search.js +8 -3
  23. package/dist/commands/skills.d.ts +6 -2
  24. package/dist/commands/skills.js +189 -134
  25. package/dist/commands/twitter.js +2 -3
  26. package/dist/commands/video.d.ts +40 -0
  27. package/dist/commands/video.js +272 -55
  28. package/dist/completion.d.ts +26 -0
  29. package/dist/completion.js +293 -0
  30. package/dist/constants.d.ts +55 -5
  31. package/dist/constants.js +136 -11
  32. package/dist/index.js +84 -22
  33. package/dist/skills-registry.d.ts +64 -0
  34. package/dist/skills-registry.js +219 -0
  35. package/dist/types.d.ts +24 -0
  36. package/dist/utils/file.d.ts +5 -1
  37. package/dist/utils/file.js +5 -1
  38. package/dist/utils/pool.d.ts +8 -0
  39. package/dist/utils/pool.js +27 -0
  40. package/package.json +9 -3
  41. package/tests/account.test.ts +0 -89
  42. package/tests/streaming.test.ts +0 -73
package/CHANGELOG.md CHANGED
@@ -7,6 +7,138 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.3] — 2026-08-07
11
+
12
+ Every command documented in the README was checked against the live gateway.
13
+ Eight were broken. This release fixes everything that the gateway already
14
+ supports today; nothing here depends on a backend change.
15
+
16
+ ### Added
17
+
18
+ - **`aisa run --show-cost`** prints the gateway's billing headers
19
+ (`X-AISA-Price-USD`, accounted/estimated credits, credit model, pricing
20
+ strategy, price key, request id) on stderr, leaving `--raw | jq` a clean
21
+ pipe. Metered providers are the reason it exists: DataForSEO and Jina bill
22
+ per consumed credit, but `/info/apis` reports every provider's pricing as
23
+ flat `per_request`, so the headers are the only accurate record of what a
24
+ call cost. Routes that report no amount say so explicitly rather than
25
+ printing nothing, which would read as "this was free".
26
+
27
+ - **Shell completion.** `aisa completion <bash|zsh|fish>` prints an installable
28
+ script; with no argument it detects the shell from `$SHELL`. Beyond commands
29
+ and flags it completes provider slugs, a provider's endpoints, skill names,
30
+ and model ids from the local cache. Completion never makes a network request —
31
+ a cold cache simply offers no dynamic values rather than stalling the prompt.
32
+ - **`aisa api list` / `show` / `search` / `code` now work.** They read the
33
+ public `/info/apis` catalog — 29 providers, 950+ endpoints — and **no longer
34
+ require an API key**, so the catalog is browsable before signup. Note that a
35
+ provider's id is not always its URL slug (`brave-search` serves
36
+ `/apis/v1/brave/...`); `api show` prints the runnable path.
37
+ - **`aisa cache clear` / `cache path`** for the on-disk catalog and skills
38
+ cache (`~/.aisa/cache`, overridable with `AISA_CACHE_DIR`). Most commands
39
+ accept `--refresh` to bypass it.
40
+ - **`aisa run --llm` / `--domain`** to override base-URL detection.
41
+ - **`aisa video create` now builds the right request body per model family.**
42
+ The gateway rewrites only the top-level `model` and forwards the rest, so the
43
+ body belongs to the owning vendor: Seedance needs a `content` array and
44
+ rejects the Bailian `input`/`parameters` shape with a 400, while i2v and r2v
45
+ models need `input.media[]`. New `--image` (shorthand for
46
+ `--media first_frame=<url>`), `--media <type=url>` covering `first_frame`,
47
+ `last_frame`, `driving_audio` and `first_clip`, and `--body '<json>'` as a
48
+ verbatim escape hatch. A model that needs source media now fails immediately
49
+ instead of being accepted, billed, and failing upstream a minute later.
50
+ - **`aisa video create --resolution` / `--duration`**, and `--output` now
51
+ actually downloads the finished clip (it was previously accepted and ignored).
52
+ - **`aisa screener --min-market-cap` and `--filter field:op:value`**; sector
53
+ names are normalised to GICS, so `--sector Technology` resolves to
54
+ `Information Technology` rather than silently matching nothing.
55
+ - **`aisa crypto --id` and `--source`**; `aisa skills install --force`;
56
+ `aisa skills list --category` / `--limit` (previously accepted and ignored).
57
+ - `GITHUB_TOKEN` / `GH_TOKEN` is used for skills-registry requests when set,
58
+ raising the GitHub rate limit from 60/hr to 5000/hr.
59
+
60
+ ### Fixed
61
+
62
+ - **`aisa run` reached only 6 of 29 providers.** The slug whitelist listed nine
63
+ entries, two of which (`services`, `crypto`) do not exist, and everything
64
+ outside it was sent to the LLM gateway and 404'd. Detection is inverted: the
65
+ whitelist now covers LLM gateway routes, which are hardcoded server-side, and
66
+ everything else defaults to the integration base — so newly added providers
67
+ work without a CLI release. A 404 now suggests near-miss slugs.
68
+ - **`aisa run classify ...` reached the wrong base.** The gateway serves
69
+ `POST /v1/classify` (Jina classification), but it was missing from the LLM
70
+ route whitelist, so `run` treated `classify` as a provider slug and sent it
71
+ to `/apis/v1/classify` — a 404 with "api endpoint not found". The whitelist
72
+ is now pinned to the server's route table by a test that lists every
73
+ registered `/v1` segment.
74
+ - **Every `aisa skills` subcommand except `init` returned nothing.** The
75
+ registry read only the top level of a repo that nests skills two deep, so it
76
+ treated the six category directories as skills. Slugs are now derived from
77
+ `SKILL.md` locations at any depth, all 42 skills are listed, and a bare name
78
+ (`marketpulse`) resolves to its canonical slug. The repo tree is fetched once
79
+ per process and cached for an hour instead of being re-fetched per command.
80
+ - **`aisa video create` and `video status` always 404'd.** They called
81
+ `/apis/v1/services/aigc/...`, a provider that does not exist; the real
82
+ endpoints are `POST /v1/video/generations` and
83
+ `GET /v1/video/generations/:task_id`. The default model `wan2.6-t2v` also did
84
+ not exist. Polling checked for `PENDING`/`RUNNING`, which the current status
85
+ enum never returns, so `--wait` exited immediately as a failure. Task ids are
86
+ now the gateway's own `video_task_<hex>` — ids saved from 0.2.2 will report
87
+ `task not found`, since they never worked in the first place.
88
+ - **`aisa screener` 404'd** — the path was missing its `/screener` suffix and
89
+ used the wrong method — and it sent an empty filter set, which the upstream
90
+ rejects.
91
+ - **`aisa web-search` defaulted to a broken backend.** `smart` and `full` return
92
+ an upstream 404 for every parameter shape; the default is now `tavily`. The
93
+ same stale example was baked into the `skills init` search template, which
94
+ would have taught agents to call the broken endpoint.
95
+ - **`aisa crypto` returned `403 Crypto access restricted`.** It now uses the
96
+ coingecko provider, which is healthy and cheaper, with a symbol → coin-id
97
+ table; ambiguous symbols list candidates instead of guessing.
98
+ - **`aisa config set baseUrl` only affected half the requests.** Integration
99
+ calls hardcoded their base. All three bases are now derived from one root,
100
+ and `config list` shows what they resolve to. Existing configs holding the
101
+ historical `https://api.aisa.one/v1` default keep working.
102
+ - **`aisa skills install` now replaces the target directory instead of merging
103
+ into it**, so a previous skill's scripts and assets cannot linger and keep
104
+ being loaded by an agent. A partial download aborts the whole install and
105
+ leaves the existing directory untouched, rather than replacing a working
106
+ skill with an incomplete one. Installs record the canonical slug in
107
+ `.aisa-skill.json`: frontmatter `name:` is not an identity, and two skills in
108
+ different categories sharing a leaf name would otherwise overwrite each other
109
+ silently. `aisa skills remove <category>/<name>` checks that marker before
110
+ deleting, so it cannot take out a same-named skill from another category.
111
+ Naming a category means "this specific skill", so both install and remove
112
+ refuse to touch a directory whose ownership they cannot verify — including
113
+ ones installed before markers existed; `--force` overrides. A bare name still
114
+ works unguarded, since it only resolves when the leaf name is unique.
115
+ - Binary files in a skill (images, fonts) are no longer corrupted on install by
116
+ a UTF-8 round trip.
117
+ - Sub-cent prices no longer display as `$0.00` — real catalog values go down to
118
+ `$0.000001`.
119
+
120
+ ### Changed
121
+
122
+ - `aisa api code` defaults to `--lang curl` (was `typescript`) and never
123
+ interpolates your real key — snippets read `AISA_API_KEY` from the
124
+ environment. The catalog reports every method as `GET` server-side, so the
125
+ generated method is advisory; use `--method` to override.
126
+ - `tests/` is no longer published to npm (the package now ships an explicit
127
+ `files` allowlist), and `npm run build` cleans `dist/` first so stale
128
+ artefacts cannot ship.
129
+
130
+ ### Known issues
131
+
132
+ - **`aisa usage` still reports that the API is unavailable.** The gateway does
133
+ not serve `GET /v1/credits/usage` — it 404s in production even though
134
+ `/v1/credits/balance` on the same route group works. The CLI side is
135
+ unblocked and will be wired up once that route ships.
136
+ - `aisa mcp setup` writes `https://docs.aisa.one/mcp`, a domain with no DNS
137
+ record, and **overwrites your agent's MCP config if it cannot parse it** —
138
+ a file with comments or a trailing comma will be emptied. This release does
139
+ not touch the MCP commands; avoid `aisa mcp setup` until it is fixed.
140
+ - `web-search --type smart` and `--type full` remain degraded upstream.
141
+
10
142
  ## [0.2.2] — 2026-08-03
11
143
 
12
144
  ### Added
@@ -66,7 +198,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66
198
  - Config commands (`aisa config get|set|list|reset`) and auth
67
199
  (`aisa login|logout|whoami`).
68
200
 
69
- [Unreleased]: https://github.com/AIsa-team/cli/compare/v0.2.2...HEAD
201
+ [Unreleased]: https://github.com/AIsa-team/cli/compare/v0.2.3...HEAD
202
+ [0.2.3]: https://github.com/AIsa-team/cli/compare/v0.2.2...v0.2.3
70
203
  [0.2.2]: https://github.com/AIsa-team/cli/compare/v0.2.1...v0.2.2
71
204
  [0.2.1]: https://github.com/AIsa-team/cli/releases/tag/v0.2.1
72
205
  [0.2.0]: https://github.com/AIsa-team/cli/releases/tag/v0.2.0
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @aisa-one/cli
2
2
 
3
- CLI for the [AISA](https://aisa.one) unified AI infrastructure platform. Access 70+ LLMs, web search, financial data, Twitter/X, and video generation APIs — all from one command line.
3
+ Command-line access to [AISA](https://aisa.one): **one API key for 80+ LLMs and
4
+ 950+ endpoints** across 29 API providers — finance, web search, social,
5
+ research, and video generation.
4
6
 
5
7
  ## Install
6
8
 
@@ -11,130 +13,218 @@ npm install -g @aisa-one/cli
11
13
  ## Quick Start
12
14
 
13
15
  ```bash
14
- # Authenticate
16
+ # Authenticate (or set AISA_API_KEY)
15
17
  aisa login --key sk-your-api-key
16
18
 
17
- # Chat with any LLM
19
+ # See what's available — no API key needed for this part
20
+ aisa api list
21
+ aisa api search "insider trades"
22
+
23
+ # Chat with any model
18
24
  aisa chat "Explain quantum computing" --model claude-opus-4-6
19
25
 
26
+ # Look up a stock
27
+ aisa stock AAPL
28
+
20
29
  # Search the web
21
30
  aisa web-search "latest AI research"
22
31
 
23
- # Look up stock data
24
- aisa stock AAPL
32
+ # Call any endpoint in the catalog directly
33
+ aisa run financial /insider-trades -q "ticker=AAPL"
34
+ ```
35
+
36
+ Get your API key at [aisa.one/dashboard](https://aisa.one/dashboard). New
37
+ accounts receive $5 in free credits.
38
+
39
+ ## API Catalog
40
+
41
+ The catalog is the fastest way to find what the platform can do. It reads a
42
+ public endpoint, so `list`, `show`, `search`, and `code` all work before you log
43
+ in.
25
44
 
26
- # Post a tweet
27
- aisa tweet "Hello from AISA CLI!"
45
+ ```bash
46
+ aisa api list # all 29 providers
47
+ aisa api list --category finance # finance, search, social, productivity, other
48
+ aisa api list --health # include provider health
49
+
50
+ aisa api show financial # every endpoint in one provider
51
+ aisa api show financial /news # one endpoint: params, price, run command
52
+ aisa api show dataforseo --all # 453 endpoints (truncated to 40 by default)
53
+
54
+ aisa api search "stock screener" # search across all 950+ endpoints
55
+ aisa api search rank --provider dataforseo
28
56
 
29
- # Generate a video
30
- aisa video create "A cat playing piano" --wait
57
+ aisa api code financial /news --lang curl # curl, python, node, typescript
31
58
  ```
32
59
 
33
- Get your API key at [aisa.one/dashboard](https://aisa.one/dashboard). New accounts receive $5 in free credits.
60
+ Two things worth knowing: a provider's **id is not always its URL slug** —
61
+ `brave-search` serves `/apis/v1/brave/...`, and `api show` prints the path you
62
+ actually call. And the catalog reports every method as `GET`; pass `--method` to
63
+ `api code` when an endpoint takes a POST.
34
64
 
35
- ## Commands
65
+ The catalog is cached in `~/.aisa/cache` (override with `AISA_CACHE_DIR`). Pass
66
+ `--refresh` to any command to bypass it, or `aisa cache clear`.
36
67
 
37
- ### Authentication
68
+ ## Execute Any Endpoint
38
69
 
39
70
  ```bash
40
- aisa login --key <key> # Store API key (also reads AISA_API_KEY env var)
41
- aisa logout # Remove stored key
42
- aisa whoami # Show auth status
71
+ aisa run financial /insider-trades -q "ticker=AAPL"
72
+ aisa run coingecko /simple/price -q "ids=bitcoin&vs_currencies=usd"
73
+ aisa run brave /web/search -q "q=AI agents"
74
+ aisa run tavily /search -d '{"query": "AI news"}'
75
+ aisa run twitter /tweet/advanced_search -q "query=AI agents" --raw
76
+ aisa run dataforseo /serp/google/organic/live -d '{...}' --show-cost
43
77
  ```
44
78
 
45
- ### LLM Gateway
79
+ `run` sends anything that isn't a known LLM gateway route to the integration
80
+ APIs, so providers added to the platform work without a CLI upgrade. Use
81
+ `--llm` or `--domain` to force a base.
82
+
83
+ `--show-cost` prints the gateway's billing headers on stderr, so it stays out of
84
+ the way of `--raw | jq`. Metered providers (DataForSEO, Jina) report the amount
85
+ actually charged and the credits consumed — for those the catalog's flat
86
+ per-request price is not what you pay. Other routes report only a price key, and
87
+ the LLM gateway reports nothing; the output says so rather than implying a call
88
+ was free.
46
89
 
47
- Chat with 70+ models (GPT, Claude, Gemini, Qwen, Deepseek, Grok) through a single OpenAI-compatible endpoint.
90
+ ## LLM Gateway
91
+
92
+ 80+ models (GPT, Claude, Gemini, Qwen, Deepseek, Grok) behind one
93
+ OpenAI-compatible endpoint.
48
94
 
49
95
  ```bash
50
96
  aisa chat "your message" --model gpt-4.1-mini
51
- aisa chat "explain this" --model claude-opus-4-6 --stream
97
+ aisa chat "explain this" --model claude-opus-4-6
52
98
  aisa chat "respond in JSON" --model gemini-2.5-pro --json
53
- echo "summarize this" | aisa chat # pipe support
99
+ echo "summarize this" | aisa chat # pipe support
54
100
 
55
101
  aisa models # list all models
56
102
  aisa models --provider anthropic # filter by provider
57
103
  aisa models show gpt-4.1-mini # model details
58
104
  ```
59
105
 
60
- ### API Discovery & Execution
106
+ Streaming is on by default; pass `--no-stream` to disable it.
107
+
108
+ ## Finance
61
109
 
62
110
  ```bash
63
- aisa api list # 🚧 WIP — not yet available
64
- aisa api search "email finder" # 🚧 WIP
65
- aisa api show finance /stock/price # 🚧 WIP
66
- aisa api code finance /stock/price --lang python # 🚧 WIP
111
+ aisa stock AAPL # summary: company info + estimates + news
112
+ aisa stock AAPL --field insider # insider trades
113
+ aisa stock AAPL --field news # company news
114
+ aisa stock TSLA --field filings # SEC filings
115
+ aisa stock MSFT --field estimates # analyst EPS & revenue estimates
116
+ aisa stock AAPL --field financials # balance sheets, income statements
67
117
 
68
- # Execute any API (works now)
69
- aisa run financial /insider-trades -q "ticker=AAPL"
70
- aisa run tavily /search -d '{"query": "AI news"}'
71
- aisa run twitter /tweet/advanced_search -q "query=AI agents" --raw
118
+ aisa crypto BTC # price, 24h change, market cap
119
+ aisa crypto ETH --period 30d # historical
120
+ aisa crypto --id render-token RNDR # exact CoinGecko id when a symbol is ambiguous
121
+
122
+ aisa screener --sector "Information Technology"
123
+ aisa screener --min-market-cap 1000000000000 --limit 10
124
+ aisa screener --filter market_cap:gt:1e12 --filter sector:eq:Financials
72
125
  ```
73
126
 
74
- ### Web Search
127
+ Sectors use GICS names; short forms like `Technology` are mapped automatically.
128
+
129
+ ## Web Search
75
130
 
76
131
  ```bash
77
- aisa web-search "query" # smart search (default)
78
- aisa web-search "query" --type full # full-text search
132
+ aisa web-search "query" # Tavily (default)
79
133
  aisa web-search "query" --type youtube # YouTube search
80
- aisa web-search "query" --type tavily # Tavily deep search
81
134
  aisa scholar "transformer architecture" # academic papers
82
135
  ```
83
136
 
84
- ### Finance
85
-
86
- ```bash
87
- aisa stock AAPL # summary: company info + estimates + news
88
- aisa stock AAPL --field insider # insider trades
89
- aisa stock AAPL --field news # company news
90
- aisa stock TSLA --field filings # SEC filings
91
- aisa stock MSFT --field estimates # analyst EPS & revenue estimates
92
- aisa stock AAPL --field financials # balance sheets, income statements
93
- aisa crypto BTC # crypto price snapshot
94
- aisa crypto ETH --period 30d # historical
95
- aisa screener --sector Technology # stock screener
96
- ```
137
+ `--type smart` and `--type full` are currently degraded upstream and return 404
138
+ regardless of parameters. Use `tavily` until that is resolved.
97
139
 
98
- ### Twitter/X
140
+ ## Twitter/X
99
141
 
100
142
  ```bash
101
143
  aisa twitter user elonmusk # user profile
102
144
  aisa twitter search "AI agents" --limit 20 # search tweets
103
145
  aisa twitter trends # trending topics
104
- aisa tweet "Hello world!" # post (⚠️ requires login cookies, see docs)
146
+ aisa twitter user-tweets elonmusk # recent tweets
147
+ aisa twitter thread <tweet-id> # full conversation
105
148
  ```
106
149
 
107
- ### Video Generation
150
+ Read operations work with just your API key. **Write operations** (`aisa tweet`,
151
+ `like`, `retweet`, `follow`, `dm`) additionally require Twitter login cookies
152
+ and a proxy — run `aisa twitter login --username <u> --password <p> --proxy <url>`
153
+ first. Run `aisa twitter --help` for the full list of 30+ subcommands.
154
+
155
+ ## Video Generation
108
156
 
109
157
  ```bash
110
- aisa video create "A sunset timelapse" # create task
111
- aisa video create "Dancing robot" --wait # wait for result
112
- aisa video status <task-id> # check status
158
+ aisa video create "A sunset timelapse" # returns a task id
159
+ aisa video create "Dancing robot" --wait # poll until done
160
+ aisa video create "A cat" --output cat.mp4 # wait and download
161
+ aisa video status <task-id>
162
+
163
+ # image-to-video: --image is shorthand for --media first_frame=<url>
164
+ aisa video create "the bird turns its head" --model wan2.7-i2v --image https://…/photo.jpg
165
+ aisa video create "extend this clip" --model wan2.7-r2v --media first_clip=https://…/in.mp4
166
+
167
+ # Seedance uses a different request shape; the CLI handles it
168
+ aisa video create "a cat walking" --model dreamina-seedance-2-0-fast-260128
113
169
  ```
114
170
 
115
- ### Account
171
+ | Model | Needs | Billing |
172
+ |-------|-------|---------|
173
+ | `wan2.7-t2v` (default), `happyhorse-1.1-t2v` | prompt only | per second |
174
+ | `wan2.7-i2v`, `happyhorse-1.1-i2v` | `--image` / `--media first_frame=` | per second |
175
+ | `wan2.7-r2v`, `happyhorse-1.1-r2v` | `--media first_clip=` | per second |
176
+ | `dreamina-seedance-2-0-260128`, `…-fast-260128` | prompt only | per token |
177
+
178
+ Media types: `first_frame`, `last_frame`, `driving_audio`, `first_clip`.
179
+
180
+ The gateway forwards the request body to whichever vendor owns the model, so the
181
+ shape differs per family — the CLI builds it for you and refuses up front if a
182
+ model needs source media you did not supply (the upstream would otherwise accept
183
+ the job, bill it, and fail a minute later). For a vendor or parameter the CLI
184
+ does not model, `--body '<json>'` is sent verbatim.
185
+
186
+ ## Account
116
187
 
117
188
  ```bash
118
- aisa balance # Show wallet and API key credit balance
119
- aisa balance --json # Output the balance response as JSON
120
- aisa usage --limit 20 # 🚧 WIP
189
+ aisa balance # wallet and API key credit balance
190
+ aisa balance --json
121
191
  ```
122
192
 
123
- ## Skills
193
+ `aisa usage` is not available yet — the gateway does not serve
194
+ `GET /v1/credits/usage` (it 404s, while `/v1/credits/balance` on the same route
195
+ group works). Use the [dashboard](https://aisa.one/dashboard) for usage history
196
+ in the meantime.
124
197
 
125
- Skills are markdown files that teach AI coding agents (Claude Code, Cursor, Copilot, etc.) how to use AISA APIs. Skills are sourced from the [agent-skills](https://github.com/AIsa-team/agent-skills) repository.
198
+ ## Skills
126
199
 
127
- ### Browse & Install
200
+ Skills are markdown files that teach AI coding agents (Claude Code, Cursor,
201
+ Copilot, …) how to use AISA APIs. They come from the
202
+ [agent-skills](https://github.com/AIsa-team/agent-skills) repository — 42 skills
203
+ across six categories.
128
204
 
129
205
  ```bash
130
- aisa skills list # list all available skills
131
- aisa skills search "financial analysis" # search by keyword
132
- aisa skills show marketpulse # show skill details
133
- aisa skills install marketpulse # install to agent directories
134
- aisa skills remove marketpulse # uninstall
206
+ aisa skills list # all skills
207
+ aisa skills list --category financial # one category
208
+ aisa skills search "financial analysis"
209
+ aisa skills show marketpulse # bare name or financial/marketpulse
210
+ aisa skills install marketpulse # install to detected agent directories
211
+ aisa skills install marketpulse --force # replace whatever occupies that directory
212
+ aisa skills remove marketpulse
135
213
  ```
136
214
 
137
- Skills install to agent directories automatically:
215
+ Installing replaces the target directory rather than merging into it, so a
216
+ previous skill's scripts and assets cannot linger and keep being loaded, and a
217
+ partial download aborts without touching what is already there. Each install
218
+ writes a small `.aisa-skill.json` recording which skill owns the directory —
219
+ that marker is what lets the CLI tell two same-named skills apart.
220
+
221
+ Naming a category (`financial/marketpulse`) means "this specific skill", so the
222
+ CLI checks the marker before replacing or removing anything. A directory
223
+ installed before markers existed cannot be verified that way, so those need
224
+ `--force`. A bare name (`marketpulse`) means "whatever holds that directory" and
225
+ always works — it only resolves when the leaf name is unique across the repo.
226
+
227
+ Skills install to whichever agent directories exist on your machine:
138
228
 
139
229
  | Agent | Directory |
140
230
  |-------|-----------|
@@ -149,45 +239,80 @@ Skills install to agent directories automatically:
149
239
  ### Create Skills
150
240
 
151
241
  ```bash
152
- aisa skills init my-skill # create from default template
153
- aisa skills init my-skill --template finance # finance template
154
- aisa skills init my-skill --template llm # LLM template
242
+ aisa skills init my-skill # default template
243
+ aisa skills init my-skill --template finance # finance, llm, search, twitter, video
155
244
  ```
156
245
 
157
- Available templates: `default`, `llm`, `search`, `finance`, `twitter`, `video`
158
-
159
- To publish a skill, submit a pull request to [AIsa-team/agent-skills](https://github.com/AIsa-team/agent-skills).
246
+ To publish a skill, open a pull request against
247
+ [AIsa-team/agent-skills](https://github.com/AIsa-team/agent-skills).
160
248
 
161
249
  ## MCP Server
162
250
 
163
- Auto-configure AISA's MCP server for your AI agents:
164
-
165
251
  ```bash
166
- aisa mcp setup # configure all detected agents
167
- aisa mcp setup --agent cursor # Cursor only
168
- aisa mcp setup --agent claude-desktop # Claude Desktop only
252
+ aisa mcp setup # configure detected agents
169
253
  aisa mcp status # check configuration
170
254
  ```
171
255
 
256
+ > **Not currently usable.** These commands write
257
+ > `https://docs.aisa.one/mcp`, which has no DNS record, and `mcp setup`
258
+ > overwrites an agent config file it cannot parse — a `mcp.json` with comments
259
+ > or a trailing comma will be emptied. Avoid `aisa mcp setup` until this is
260
+ > fixed.
261
+
262
+ ## Shell Completion
263
+
264
+ ```bash
265
+ # zsh
266
+ aisa completion zsh > "${fpath[1]}/_aisa" # then restart your shell
267
+ # or, without touching fpath:
268
+ echo 'eval "$(aisa completion zsh)"' >> ~/.zshrc
269
+
270
+ # bash
271
+ aisa completion bash > /usr/local/etc/bash_completion.d/aisa
272
+ # or:
273
+ echo 'eval "$(aisa completion bash)"' >> ~/.bashrc
274
+
275
+ # fish
276
+ aisa completion fish > ~/.config/fish/completions/aisa.fish
277
+ ```
278
+
279
+ `aisa completion` with no argument detects your shell from `$SHELL`.
280
+
281
+ Completion covers commands, subcommands, and options, plus values pulled from
282
+ the local cache:
283
+
284
+ ```
285
+ aisa run <TAB> → 29 provider slugs
286
+ aisa run financial <TAB> → that provider's endpoints
287
+ aisa api show <TAB> → provider ids
288
+ aisa skills show <TAB> → 42 skill names
289
+ aisa chat --model <TAB> → model ids
290
+ aisa web-search --type <TAB> → tavily, youtube, scholar, …
291
+ ```
292
+
293
+ The cache-backed suggestions only appear once the relevant command has been run
294
+ at least once — completion never makes a network request, so a cold cache
295
+ completes commands and flags but no dynamic values. Run `aisa api list`,
296
+ `aisa models`, and `aisa skills list` once to warm everything up.
297
+
172
298
  ## Configuration
173
299
 
174
300
  ```bash
175
- aisa config set defaultModel claude-opus-4-6 # change default model
176
- aisa config get defaultModel # read a value
177
- aisa config list # show all settings
178
- aisa config reset # reset to defaults
301
+ aisa config set defaultModel claude-opus-4-6
302
+ aisa config get defaultModel
303
+ aisa config list # also shows derived base URLs
304
+ aisa config reset
179
305
  ```
180
306
 
181
307
  Settings:
182
308
  - `defaultModel` — default model for `aisa chat` (default: `gpt-4.1-mini`)
183
- - `baseUrl` — API base URL (default: `https://api.aisa.one`)
184
- - `outputFormat` — output format: `text` or `json`
185
-
186
- Environment variable `AISA_API_KEY` takes precedence over stored key.
309
+ - `baseUrl` — platform root; the LLM (`/v1`), integration (`/apis/v1`), and
310
+ catalog bases are all derived from it
311
+ - `outputFormat` — `text` or `json`
187
312
 
188
- ## Known Issues
189
-
190
- **GPT-4.1 streaming returns empty output.** The AISA gateway currently strips `choices[].delta.content` from GPT model SSE chunks, so streaming mode produces blank output for GPT models. Workaround: use `--no-stream` or switch to Claude/Qwen models which stream correctly. Non-streaming GPT works fine.
313
+ Environment variables: `AISA_API_KEY` takes precedence over the stored key.
314
+ `AISA_CACHE_DIR` relocates the cache. `GITHUB_TOKEN` raises the GitHub rate
315
+ limit for skills commands.
191
316
 
192
317
  ## Development
193
318
 
@@ -200,23 +325,44 @@ npm run dev # watch mode
200
325
  npm test # run tests
201
326
  ```
202
327
 
203
- ## Appendix: Architecture Notes for Contributors
204
-
205
- **Two base URLs.** The AISA platform uses separate base paths:
206
- - LLM endpoints (chat, models): `https://api.aisa.one/v1/`
207
- - Domain API endpoints (search, finance, twitter, video): `https://api.aisa.one/apis/v1/`
208
-
209
- The `domain: true` option in `RequestOptions` (see `src/api.ts`) selects which base URL to use. The `run` command auto-detects based on the slug prefix.
210
-
211
- **Parameter naming varies by endpoint.** Smart/full search uses `q`, scholar uses `query`, finance uses `ticker` (not `symbol`), Twitter uses `userName` (camelCase). Always check the [API Reference](https://docs.aisa.one/reference) for exact parameter names.
212
-
213
- **Video generation is async.** POST to `/services/aigc/video-generation/video-synthesis` with header `X-DashScope-Async: enable`, then poll `GET /services/aigc/tasks?task_id=<id>` for status. Response shape uses `output.task_id`, `output.task_status`, `output.video_url`.
214
-
215
- **Twitter write operations require login cookies.** `create_tweet_v2` and other action endpoints need `login_cookies` and `proxy` fields — they don't work with just the API key.
216
-
217
- **Models API follows OpenAI format.** The `/v1/models` endpoint returns `owned_by` (not `provider`) and has no `name`, `pricing`, or `contextWindow` fields.
218
-
219
- **Some financial endpoints return empty data.** `financial/prices` and `financial/financial-metrics/snapshot` return `{}` for all tickers (backend issue). The default `aisa stock` now fetches `company/facts` + `analyst-estimates` + `news` instead. Working fields: `info`, `estimates`, `financials`, `filings`, `insider`, `institutional`, `news`.
328
+ ## Appendix: Notes for Contributors
329
+
330
+ **Three bases, one root.** `resolveBases()` in `src/api.ts` derives the LLM base
331
+ (`/v1`), the integration base (`/apis/v1`), and the catalog root from a single
332
+ configured `baseUrl`. It tolerates a value with either suffix already attached,
333
+ because the shipped default has always included `/v1` and is persisted in every
334
+ existing user's config.
335
+
336
+ **Routing in `run`.** `resolveRunTarget()` (`src/commands/run.ts`) treats the LLM
337
+ gateway routes as the whitelist and everything else as an integration API. That
338
+ direction matters: gateway routes are hardcoded server-side and change roughly
339
+ annually, while provider slugs are database rows that operations edit
340
+ continuously.
341
+
342
+ **The catalog's shape has three traps.** `endpoints[].method` is hardcoded to
343
+ `GET` server-side. `endpoint_groups[].name` is an operator-entered label
344
+ (`Zero`, `One`, `default`) with no business meaning, which is why `api show`
345
+ flattens by default. And health is tracked per provider, not per endpoint, so
346
+ per-endpoint counts are one value repeated.
347
+
348
+ **Parameter naming varies by endpoint.** Scholar uses `query`, finance uses
349
+ `ticker` (not `symbol`), Twitter uses `userName`. `aisa api show <api> <path>`
350
+ prints each endpoint's description and path parameters.
351
+
352
+ **Video generation is async.** `POST /v1/video/generations` returns `202` with a
353
+ gateway-local `video_task_<hex>` id. Poll `GET /v1/video/generations/:id` until
354
+ `status` is one of `completed`, `failed`, or `cancelled`. The finished URL sits
355
+ at a different place in `result` for each vendor, so `findVideoUrl()` searches
356
+ for it.
357
+
358
+ **Twitter write operations require login cookies.** `create_tweet_v2` and the
359
+ other action endpoints need `login_cookies` and `proxy` in the body — the
360
+ gateway does not hold your Twitter session.
361
+
362
+ **Some financial endpoints return empty data.** `financial/prices` and
363
+ `financial/financial-metrics/snapshot` return `{}` for all tickers. `aisa stock`
364
+ uses `company/facts` + `analyst-estimates` + `news` instead. Working fields:
365
+ `info`, `estimates`, `financials`, `filings`, `insider`, `institutional`, `news`.
220
366
 
221
367
  ## License
222
368