Skip to content

Commit 53b2d30

Browse files
thecodedriftclaude
andcommitted
fix(cli): Add help recipe for the detect command
`detect` is a registered subcommand, so it appeared in the `taskless help` topic index — but `taskless help detect` had no backing `detect.txt` and fell through to "Unknown command", exiting 1. Every other registered command already had a matching help file; `detect` was the lone gap. Add `detect.txt` documenting the `--json` output shape (linters, languages, ruleStyles) and cross-linking to the route/existing authoring flow that consumes those signals. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 60bd8f1 commit 53b2d30

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

.changeset/detect-help-topic.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@taskless/cli": patch
3+
---
4+
5+
Add a help recipe for the `detect` command.
6+
7+
`detect` is a registered subcommand, so it appeared in the `taskless help`
8+
topic index — but `taskless help detect` had no backing `detect.txt` and fell
9+
through to "Unknown command", exiting 1. Every other registered command already
10+
had a matching help file; `detect` was the lone gap. The new recipe documents
11+
the `--json` output shape (linters, languages, ruleStyles) and cross-links to
12+
the `route`/`existing` authoring flow that consumes it.

packages/cli/src/help/detect.txt

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Topic: detect (CLI v%(CLI_VERSION)s / topic v1)
2+
3+
## Goal
4+
Scan the working directory for the linters it configures, the
5+
languages it uses, and the styles of any rules the repo already
6+
authors. Offline and deterministic — no network, no auth, no state
7+
change. This is the discovery step that feeds rule-authoring: the
8+
routing flow reads `detect` to decide where a new rule should live.
9+
10+
## Preconditions
11+
- None. Works in any directory; doesn't require `.taskless/`.
12+
13+
## Steps
14+
15+
1. **Invoke the CLI** with JSON output:
16+
```
17+
npx @taskless/cli detect --json
18+
```
19+
20+
2. **Parse the response.** Shape:
21+
```json
22+
{
23+
"success": true,
24+
"linters": [
25+
{
26+
"name": "eslint",
27+
"evidence": ["eslint.config.js", "dependency eslint (package.json)"]
28+
}
29+
],
30+
"languages": ["typescript", "javascript"],
31+
"ruleStyles": [
32+
{
33+
"source": ".taskless/rules",
34+
"description": "ast-grep rules with YAML metadata sidecars"
35+
}
36+
]
37+
}
38+
```
39+
- `linters` — each has a `name` and `evidence` (config-file paths,
40+
a pyproject table marker, or a dependency marker from the
41+
language's package file; not every entry is a path).
42+
- `languages` — inferred from manifests and the detected linters.
43+
- `ruleStyles` — how the repo authors its own rules, surfaced for
44+
downstream reuse.
45+
46+
3. **Use the signals to route.** Feed the output into rule authoring:
47+
- A detected linter the repo already uses → author the rule there
48+
(`taskless help existing`).
49+
- No suitable linter, local-only → `taskless help static`.
50+
- See `taskless help route` for the full decision.
51+
52+
## Errors
53+
54+
When `--json` is set, failures emit `{ ok: false, code, message }`:
55+
56+
| code | meaning | fix |
57+
|-------------------|----------------------------------|---------------------------|
58+
| `INTERNAL_ERROR` | Internal schema validation | Report; likely a CLI bug |
59+
60+
## See Also
61+
62+
- `taskless help route` — decide where to author a rule from these signals
63+
- `taskless help existing` — author a rule in a linter the repo already uses
64+
- `taskless help check` — run rules against the codebase

0 commit comments

Comments
 (0)