@anythingai/cli 0.0.1

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/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@anythingai/cli",
3
+ "version": "0.0.1",
4
+ "homepage": "https://anything.com/",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "anything": "./dist/js/bin.mjs"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "skills"
12
+ ],
13
+ "exports": {
14
+ "./bin": "./dist/js/bin.mjs"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org"
19
+ },
20
+ "scripts": {
21
+ "build": "tsdown --no-dts --out-dir dist/js",
22
+ "prepublishOnly": "yarn build",
23
+ "test:unit": "jest --config=jest.unit.config.ts --passWithNoTests",
24
+ "test:ci": "jest --config=jest.unit.config.ts --coverage --reporters=default --reporters=github-actions --maxWorkers=2 --passWithNoTests",
25
+ "test:integration": "jest --config=jest.integration.config.ts --passWithNoTests",
26
+ "typecheck": "tsgo --noEmit"
27
+ },
28
+ "dependencies": {
29
+ "conf": "^15.1.0",
30
+ "graphql": "^16.12.0",
31
+ "graphql-ws": "^6.0.4",
32
+ "neverthrow": "^8.2.0",
33
+ "ws": "^8.18.0",
34
+ "yargs": "^17.7.2",
35
+ "zod": "^3.24.1"
36
+ },
37
+ "devDependencies": {
38
+ "@createinc/env": "^0.0.0",
39
+ "@createinc/flux-api": "0.0.0",
40
+ "@createinc/tsconfig": "0.0.0",
41
+ "@jest/environment": "^30.2.0",
42
+ "@swc/core": "^1.9.3",
43
+ "@swc/jest": "^0.2.37",
44
+ "@types/jest": "^30.0.0",
45
+ "@types/ws": "^8.18.0",
46
+ "@types/yargs": "^17.0.33",
47
+ "@typescript/native-preview": "^7.0.0-dev.20260113.1",
48
+ "dotenv-flow": "^4.1.0",
49
+ "jest": "^30.2.0",
50
+ "jest-environment-node": "^30.2.0",
51
+ "reflect-metadata": "^0.2.2",
52
+ "testcontainers": "^10.18.0",
53
+ "tsdown": "^0.20.3",
54
+ "typescript": "^5.9.3"
55
+ },
56
+ "engines": {
57
+ "node": ">=24.0.0"
58
+ }
59
+ }
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: anything-cli
3
+ description: Use when an agent needs to build, inspect, or manage an Anything app from the CLI. Covers auth, account and org checks, project creation, follow-up generations, secrets, publishing, domains, databases, deployments, members, and compound workflows. Best for OpenClaw, Claude Code, Codex, Cursor, or any agent that should drive Anything non-interactively.
4
+ allowed-tools:
5
+ - Bash(anything:*)
6
+ - Read
7
+ ---
8
+
9
+ # Anything CLI
10
+
11
+ Use `anything` as the control-plane CLI for Anything apps. Prefer this skill when the user wants to build or manage an Anything app without depending on the web UI.
12
+
13
+ ## Core Rules
14
+
15
+ - Prefer `ANYTHING_API_KEY` for non-interactive auth. Use `anything auth login --api-key <key>` for key-based login.
16
+ - Start with `anything user --json` for account, org, plan, and credit checks.
17
+ - Use the resource-first shape everywhere: `anything projects ...`, `anything domains ...`.
18
+ - **Always use `--json`** when another tool or agent will read the output. The JSON envelope format is: `{ "ok": true, "command": "...", "data": { ... }, "meta": { "duration_ms": 142 } }`.
19
+ - **Use `--quiet`** to get only the primary ID or URL for chaining: `PROJECT_ID="$(anything projects create --quiet --prompt "...")"`
20
+ - Capture `projectId` from create output and pass it explicitly on later commands.
21
+ - Pass flags for all inputs. Do not rely on prompts or hidden local state.
22
+ - `--non-interactive` is auto-enabled when `CLAUDECODE`, `CODEX`, `CI`, or `OPENCLAW` env vars are detected.
23
+ - Use `--dry-run` on state-modifying commands to preview actions before executing.
24
+ - If the user asks for something outside the known surface area, run `anything introspect` or `anything <subcommand> --help`.
25
+
26
+ ## Output Modes
27
+
28
+ | Flag | Behavior |
29
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------- |
30
+ | `--json` | Returns JSON envelope: `{ ok, command, data, meta }` or `{ ok: false, command, error: { code, message, hint } }` |
31
+ | `--quiet` | Prints only the primary identifier (ID or URL) — one per line for list commands |
32
+ | `--dry-run` | Outputs planned actions as JSON without executing |
33
+ | `--non-interactive` | Hard-fails instead of prompting; emits `ActionRequired` JSON to stderr |
34
+
35
+ ## Exit Codes
36
+
37
+ | Code | Meaning | Agent action |
38
+ | ---- | ------------------ | ------------------------------------------ |
39
+ | 0 | Success | Continue |
40
+ | 1 | General error | Inspect error |
41
+ | 2 | Invalid arguments | Fix command syntax |
42
+ | 3 | Resource not found | Check ID |
43
+ | 4 | Auth failure | Re-authenticate |
44
+ | 5 | Conflict | Resource exists |
45
+ | 6 | Timeout | Retry (also used for publish wait timeout) |
46
+ | 7 | Server error | Retry with backoff |
47
+
48
+ ## Quick Start
49
+
50
+ ```bash
51
+ anything user --json
52
+ anything projects create --org <org-id> --prompt "Build a CRM for a roofing company" --json
53
+ anything projects generate <project-id> --prompt "Add auth and billing" --json
54
+ anything projects messages <project-id> --json
55
+ anything projects get <project-id> --json
56
+ anything projects publish <project-id> --json # waits for deploy
57
+ ```
58
+
59
+ ## One-Shot Workflow
60
+
61
+ ```bash
62
+ anything ship --prompt "Build a todo app with auth" --json
63
+ ```
64
+
65
+ The `ship` command creates (or generates on existing), then publishes and waits for the deployment to finish. It streams progress as NDJSON in `--json` mode, or `[init]`/`[progress]`/`[done]` markers in text mode. Use `--no-wait` for fire-and-forget workflows.
66
+
67
+ ```bash
68
+ anything ship --project pg_123 --prompt "Add a settings page" --json
69
+ anything ship --project pg_123 --skip-publish --prompt "Add dark mode"
70
+ anything ship --no-wait --prompt "Build a landing page" --json
71
+ ```
72
+
73
+ ## Workflow
74
+
75
+ 1. Run `anything user --json`.
76
+ 2. Pick the recommended org if one is available. Otherwise use the org the user specifies.
77
+ 3. Create the project and store `projectId`.
78
+ 4. Iterate with `projects generate`, `projects messages`, and `projects get`.
79
+ 5. Add secrets before publish when the app needs third-party credentials.
80
+ 6. Publish once the project is ready.
81
+
82
+ ## Command Reference
83
+
84
+ ### Account and org discovery
85
+
86
+ ```bash
87
+ anything user --json
88
+ anything orgs --json
89
+ anything orgs get <org-id> --json
90
+ anything orgs members <org-id> --json
91
+ anything status --json
92
+ anything switch # interactive org/project picker
93
+ anything llm-context --json # combined agent context
94
+ anything introspect # full command tree as JSON
95
+ anything skill # print SKILL.md
96
+ ```
97
+
98
+ ### Project creation and iteration
99
+
100
+ ```bash
101
+ anything projects create --org <org-id> --prompt "<prompt>" --json
102
+ anything projects generate <project-id> --prompt "<prompt>" --json
103
+ anything projects messages <project-id> --limit 20 --json
104
+ anything projects get <project-id> --json
105
+ anything projects files list <project-id> --json
106
+ anything projects files get <project-id> app/page.tsx --json
107
+ anything projects rename <project-id> --name "New Name" --json
108
+ anything projects duplicate <project-id> --json
109
+ ```
110
+
111
+ ### Secrets and publish
112
+
113
+ ```bash
114
+ anything projects secrets add <project-id> --name "OPENAI_API_KEY" --value "$OPENAI_API_KEY" --json
115
+ anything projects secrets list <project-id> --json
116
+ anything projects publish <project-id> --json # waits for deploy
117
+ anything projects publish <project-id> --no-wait --json # fire-and-forget
118
+ anything projects publish status <project-id> <deployment-id> --json
119
+ anything projects unpublish <project-id> --yes --json
120
+ ```
121
+
122
+ ### Domains
123
+
124
+ ```bash
125
+ anything domains list <org-id> --json
126
+ anything domains add app.example.com --project pg_123 --json
127
+ anything domains remove dom_123 --yes --json
128
+ anything domains verify dom_123 --json
129
+ ```
130
+
131
+ ### Databases
132
+
133
+ ```bash
134
+ anything databases list --org <org-id> --json
135
+ anything databases get <database-id> --json
136
+ anything databases create --project pg_123 --json
137
+ anything databases query <database-id> "SELECT * FROM users LIMIT 5" --json
138
+ anything databases connect <database-id>
139
+ anything databases reset <database-id> --yes --json
140
+ ```
141
+
142
+ ### Deployments
143
+
144
+ ```bash
145
+ anything deployments list <project-id> --json
146
+ anything deployments get <deployment-id> --json
147
+ anything deployments logs <deployment-id> --json
148
+ anything deployments rollback <project-id> --yes --json
149
+ anything deployments rollback <project-id> <deployment-id> --yes --json
150
+ ```
151
+
152
+ ### Members
153
+
154
+ ```bash
155
+ anything members list --org <org-id> --json
156
+ anything members invite user@example.com --org <org-id> --json
157
+ anything members remove user@example.com --org <org-id> --yes --json
158
+ anything members role user@example.com admin --org <org-id> --json
159
+ ```
160
+
161
+ ### Assets
162
+
163
+ ```bash
164
+ anything assets upload <project-id> ./logo.png --json
165
+ anything assets list <project-id> --json
166
+ anything assets remove <project-id> <asset-id> --json
167
+ ```
168
+
169
+ ### Logs (with streaming)
170
+
171
+ ```bash
172
+ anything projects logs <project-id> --json
173
+ anything projects logs <project-id> --since 1h --json
174
+ anything projects logs <project-id> --follow --json # NDJSON stream
175
+ anything projects logs <project-id> --follow --level error # tail errors only
176
+ ```
177
+
178
+ ### Project context
179
+
180
+ ```bash
181
+ anything projects set <project-id> # set active project
182
+ anything projects unset # clear active project
183
+ anything orgs set <org-id> # set active org
184
+ anything orgs unset # clear active org
185
+ anything link <project-id> # link directory to project (.anything/)
186
+ anything unlink # remove directory link
187
+ anything pull # pull files + secret names
188
+ anything pull --files # pull project files only
189
+ anything pull --env # write secret names to .env.example
190
+ ```
191
+
192
+ ### Watch
193
+
194
+ ```bash
195
+ anything watch <project-id> # stream all events
196
+ anything watch <project-id> --events generation
197
+ anything watch <project-id> --json # stream events as NDJSON
198
+ ```
199
+
200
+ ## Chaining with --quiet
201
+
202
+ ```bash
203
+ PROJECT_ID="$(anything projects create --quiet --prompt "Build a todo app")"
204
+ anything projects generate "$PROJECT_ID" --prompt "Add dark mode" --quiet
205
+ PUBLISH_URL="$(anything projects publish "$PROJECT_ID" --quiet)"
206
+ echo "Published to: $PUBLISH_URL"
207
+ ```
208
+
209
+ ## Dry Run
210
+
211
+ ```bash
212
+ anything projects create --dry-run --org org_1 --prompt "test" --json
213
+ # Returns: { ok: true, command: "projects create", dry_run: true, planned_actions: [...] }
214
+
215
+ anything projects generate pg_123 --dry-run --prompt "Add auth" --json
216
+ anything projects rename pg_123 --dry-run --name "New Name" --json
217
+ anything databases create --dry-run --project pg_123 --json
218
+ anything domains add app.example.com --dry-run --project pg_123 --json
219
+ anything deployments rollback pg_123 --dry-run --json
220
+ ```
221
+
222
+ ## Failure Handling
223
+
224
+ - Missing auth: set `ANYTHING_API_KEY` or run `anything auth login --api-key <key>`.
225
+ - Missing org context: rerun `anything user --json` and choose an explicit org ID.
226
+ - Zero credits: switch to an org with credits or ask the user to top up before generating.
227
+ - Command uncertainty: run `anything introspect` or `anything <subcommand> --help`.
228
+ - Exit code 6 (timeout): retry the command.
229
+ - Exit code 7 (server error): retry with exponential backoff.
230
+
231
+ ## References
232
+
233
+ - For agent-specific installation in OpenClaw, Claude Code, Codex, and Cursor, see `references/setup.md`.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: 'Anything CLI'
3
+ short_description: 'Agent guide for building apps with Anything CLI'
4
+ default_prompt: 'Use $anything-cli to build or manage an Anything app from the CLI.'
@@ -0,0 +1,66 @@
1
+ # Setup
2
+
3
+ This skill ships with `@anythingai/cli`. Keep the skill identifier as `anything-cli`, but all command examples should invoke the public binary name `anything`.
4
+
5
+ ## Find the packaged skill
6
+
7
+ After installing `@anythingai/cli`, locate the packaged skill directory and copy it into the agent runtime you are configuring.
8
+
9
+ For a global npm install:
10
+
11
+ ```bash
12
+ GLOBAL_NPM_ROOT="$(npm root -g)"
13
+ SKILL_DIR="$GLOBAL_NPM_ROOT/@anythingai/cli/skills/anything-cli"
14
+ ```
15
+
16
+ For local repo development:
17
+
18
+ ```bash
19
+ SKILL_DIR="/absolute/path/to/escher/apps/anything-cli/skills/anything-cli"
20
+ ```
21
+
22
+ ## OpenClaw
23
+
24
+ ```bash
25
+ mkdir -p ~/skills
26
+ cp -R "$SKILL_DIR" ~/skills/anything-cli
27
+ ```
28
+
29
+ ## Claude Code
30
+
31
+ ```bash
32
+ mkdir -p ~/.claude/skills
33
+ cp -R "$SKILL_DIR" ~/.claude/skills/anything-cli
34
+ ```
35
+
36
+ ## Codex
37
+
38
+ ```bash
39
+ mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
40
+ cp -R "$SKILL_DIR" "${CODEX_HOME:-$HOME/.codex}/skills/anything-cli"
41
+ ```
42
+
43
+ ## Cursor
44
+
45
+ Cursor supports project rules in `.cursor/rules/*.mdc` and a root `AGENTS.md` file. The most portable setup is to paste the packaged skill guidance into one of those two places.
46
+
47
+ ### Option 1: project rule
48
+
49
+ Create `.cursor/rules/anything-cli.mdc`:
50
+
51
+ ```md
52
+ ---
53
+ description: Use Anything CLI to build and manage Anything apps non-interactively
54
+ alwaysApply: false
55
+ ---
56
+
57
+ [Paste the body of SKILL.md here]
58
+ ```
59
+
60
+ ### Option 2: root AGENTS.md
61
+
62
+ Append the skill guidance to the repo's root `AGENTS.md` under a section like `Anything CLI`.
63
+
64
+ ## Auth reminder
65
+
66
+ For public agent setups, prefer `ANYTHING_API_KEY`. Keep `ANYTHING_API_URL` for local or staging overrides only.