@taskless/cli-nightly 0.11.0-20260820055459x599d3f3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Taskless
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,235 @@
1
+ # @taskless/cli
2
+
3
+ > A Work in Progress
4
+
5
+ CLI companion for [Taskless](https://taskless.io). Designed to be invoked by skills via `npx` or `pnpm dlx`. Useful for agents, and works for humans too.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ # npm
11
+ npx @taskless/cli@latest info
12
+
13
+ # pnpm
14
+ pnpm dlx @taskless/cli@latest info
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ ### `taskless info`
20
+
21
+ Outputs CLI version, tool status, and login info as JSON to stdout:
22
+
23
+ ```json
24
+ {
25
+ "version": "0.0.3",
26
+ "tools": [],
27
+ "loggedIn": true,
28
+ "auth": { "user": "jake", "email": "jake@example.com", "orgs": ["my-org"] }
29
+ }
30
+ ```
31
+
32
+ ### `taskless init`
33
+
34
+ Launches an interactive wizard that detects supported tool directories in the
35
+ current project (`.claude/`, `.opencode/`, `.cursor/`, `.agents/`), asks which
36
+ tools to enable Taskless for, and walks through the auth tradeoff before
37
+ writing anything. Running `taskless` with no subcommand in a TTY also launches
38
+ this wizard. Without a TTY, bare `taskless` prints a short context preamble
39
+ followed by the topic index from `taskless agent`.
40
+
41
+ In v0.7+, there is exactly one skill (`taskless`) and one command (`tskl`) —
42
+ no opt-in selection needed.
43
+
44
+ The skill and command content is written **once** to a canonical store in
45
+ `.taskless/skills/` and `.taskless/commands/`. Each enabled tool directory
46
+ receives only a thin reference stub — an ordinary file with a delegating body,
47
+ never a symlink — so there is a single source of truth and no drift between
48
+ copies. Stale layouts from earlier versions (full per-tool copies, symlinks)
49
+ are converged into stubs automatically on the next `init`/`update`.
50
+
51
+ For CI and scripted installs, pass `--no-interactive` to skip all prompts:
52
+
53
+ ```bash
54
+ taskless init # interactive wizard (default in a TTY)
55
+ taskless init --no-interactive # scripted install, no prompts
56
+ ```
57
+
58
+ The wizard records what it installed in `.taskless/taskless.json` so later
59
+ runs can compute a diff and surgically remove files that are no longer
60
+ selected. Upgrading from v0.6 automatically removes the obsolete per-task
61
+ skills and commands during this diff. Cancelling the wizard at any step
62
+ (Ctrl-C) aborts cleanly with no filesystem changes.
63
+
64
+ ### `taskless onboard`
65
+
66
+ Post-install discovery flow that helps a fresh user go from zero rules to a
67
+ useful starter set. Run it after `taskless init`. The CLI prints an
68
+ agent-facing recipe that walks the host AI tool through scanning the
69
+ codebase, agent-memory files (CLAUDE.md / AGENTS.md / .cursorrules),
70
+ recent PR review comments (when `gh` is available), and issue tracker
71
+ tickets (when a relevant MCP is wired in) for high-signal rule
72
+ candidates, then surfaces them as a bullet list the user can choose to
73
+ materialize via `taskless rule create`.
74
+
75
+ ```bash
76
+ taskless onboard # print the recipe (refused if already complete)
77
+ taskless onboard --force # re-run even when previously marked complete
78
+ taskless onboard --mark-complete # record completion in .taskless/taskless.json
79
+ # (invoked by the agent after explicit user
80
+ # confirmation; never automatically)
81
+ ```
82
+
83
+ Onboarding state lives in `.taskless/taskless.json` as
84
+ `install.onboarded` — a 3-state optional field (absent / `false` / `true`).
85
+ Only the agent writes it, and only with the user's explicit confirmation.
86
+ `taskless init` does not set it. Pass `--force` to re-run regardless of the
87
+ current value.
88
+
89
+ After a successful `taskless init`, the CLI prints a one-line trailer
90
+ pointing the user at this command. The trailer wording adapts to the
91
+ install plan: when the install included slash commands (Claude Code or
92
+ Cursor), it mentions `/tskl onboard` along with the Taskless skill and the
93
+ bare CLI; when the install only wrote skills (OpenCode, Codex, the
94
+ `.agents/` fallback), it mentions the skill and the bare CLI only.
95
+
96
+ ### `taskless check`
97
+
98
+ Run ast-grep rules from `.taskless/sg/rules/` against the codebase. Exits with code 1 if any error-severity matches are found.
99
+
100
+ ```bash
101
+ taskless check # human-readable output, scans whole project
102
+ taskless check --json # JSON output
103
+ ```
104
+
105
+ Accepts optional positional path arguments to scan only specific files or
106
+ directories — useful for CI workflows that only want to check changed files.
107
+ Paths that don't exist on disk (e.g. files deleted in a diff) are silently
108
+ filtered, so raw git-diff output can be piped in directly:
109
+
110
+ ```bash
111
+ taskless check src/foo.ts src/bar.ts
112
+ taskless check $(git diff --name-only main...HEAD) # PR-only scan
113
+ taskless check $(git diff --cached --name-only) # pre-commit scan
114
+ ```
115
+
116
+ If every supplied path is missing, the command exits 0 with empty results.
117
+
118
+ ### `taskless auth login` / `taskless auth logout`
119
+
120
+ Authenticate with taskless.io using the device flow. Tokens are stored in `~/.config/taskless/auth.json`.
121
+
122
+ ### `taskless rule create`
123
+
124
+ Generate ast-grep rules via the taskless.io API. Reads a JSON request from stdin, submits it, polls for results, and writes rule and test files to `.taskless/sg/rules/` and `.taskless/sg/rule-tests/`.
125
+
126
+ ```bash
127
+ echo '{"prompt": "detect console.log usage"}' | taskless rule create
128
+ echo '{"prompt": "find innerHTML assignments", "language": "typescript"}' | taskless rule create --json
129
+ ```
130
+
131
+ Requires authentication and a `.taskless/taskless.json` with `orgId` and `repositoryUrl`.
132
+
133
+ ### `taskless rule delete <id>`
134
+
135
+ Remove a rule file and its associated test files from disk. No authentication required.
136
+
137
+ ```bash
138
+ taskless rule delete no-console-log
139
+ ```
140
+
141
+ ### `taskless --help`
142
+
143
+ Lists available subcommands.
144
+
145
+ ### `taskless agent [topic]`
146
+
147
+ Returns agent-facing recipes. With no args, prints the topic index. With a
148
+ topic (e.g. `taskless agent route`), prints the full step-by-step recipe
149
+ for that operation, including an embedded JSON Schema for any `--from` input
150
+ and a table of stable error codes. Append `--anonymous` to fetch the
151
+ local-only variant where one exists (currently `rule create`/`rule improve`).
152
+
153
+ Recipes are how the consolidated `taskless` skill stays small while still
154
+ covering every operation — the skill body is a router that fetches the
155
+ relevant recipe on demand.
156
+
157
+ ### `--anonymous` flag
158
+
159
+ Recognized on every command. Behavior matrix:
160
+
161
+ - `rule create` / `rule improve` — exits with a pointer to
162
+ `taskless agent <topic> --anonymous`. The local-only flow runs in the agent
163
+ per the recipe variant.
164
+ - `info` — skips the API/auth probe; reports local state only.
165
+ - `auth login` — rejected (auth commands cannot be anonymous).
166
+ - All others — accepted as no-op.
167
+
168
+ ## For skill authors
169
+
170
+ Skills should detect the package manager by checking for lock files and invoke the CLI accordingly:
171
+
172
+ 1. If `pnpm-lock.yaml` exists, use `pnpm dlx @taskless/cli@latest <command>`
173
+ 2. Otherwise, use `npx @taskless/cli@latest <command>`
174
+
175
+ All commands output structured JSON to stdout by default. Parse with `JSON.parse()` and handle non-zero exit codes as errors.
176
+
177
+ ## Developing
178
+
179
+ ### Testing
180
+
181
+ ```bash
182
+ pnpm --filter @taskless/cli test # run the suite once
183
+ pnpm --filter @taskless/cli exec vitest # watch mode
184
+ ```
185
+
186
+ The suite runs entirely locally under vitest — no network, no auth, no agent.
187
+ Integration tests that exercise the built binary (for example `detect`) run
188
+ against `dist/`, so run `pnpm --filter @taskless/cli build` first (or after any
189
+ source change) before invoking them directly.
190
+
191
+ **Two kinds of test, one of which is not fully automatable.** Most tests are
192
+ deterministic unit/integration checks. The route-honesty dataset
193
+ (`test/fixtures/route-eval.json`) is different: the actual routing decision is
194
+ made by an _agent_ following `help/route.txt`, so it cannot be asserted by a
195
+ code classifier. The automated test (`test/route-eval.test.ts`) therefore only
196
+ **guards the dataset** — that it stays structurally valid and balanced across
197
+ every route and both failure directions (over-claim / over-escalate). Running
198
+ the dataset _as an evaluation_ — feeding each case to an agent and scoring its
199
+ chosen destination — is a separate, manual calibration step with more setup; it
200
+ is not part of `pnpm test`. Keep the two distinct: the suite proves the fixtures
201
+ are well-formed; an agent run proves the recipe routes honestly.
202
+
203
+ ### API base URL
204
+
205
+ The CLI resolves the API base URL in this order:
206
+
207
+ 1. `TASKLESS_API_URL` env var
208
+ 2. `~/.config/taskless/config.json` → `apiUrl` field
209
+ 3. Default: `https://app.taskless.io/cli`
210
+
211
+ For local development against the taskless.io app:
212
+
213
+ ```bash
214
+ TASKLESS_API_URL=http://localhost:5173/cli taskless info
215
+ ```
216
+
217
+ ### API schema introspection
218
+
219
+ All `/cli/api/*` endpoints support the `x-explain: 1` header. When present, the endpoint returns its JSON schema instead of executing — no authentication required.
220
+
221
+ ```bash
222
+ # List available endpoints
223
+ curl -s -H "x-explain: 1" http://localhost:5173/cli/api
224
+
225
+ # Get the schema for rule generation
226
+ curl -s -H "x-explain: 1" -X POST http://localhost:5173/cli/api/rule
227
+
228
+ # Get the schema for rule status polling
229
+ curl -s -H "x-explain: 1" http://localhost:5173/cli/api/rule/any-id
230
+
231
+ # Get the schema for whoami
232
+ curl -s -H "x-explain: 1" http://localhost:5173/cli/api/whoami
233
+ ```
234
+
235
+ This is useful for verifying that CLI types align with the production API contract.