Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/detect-help-topic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@taskless/cli": patch
---

Add a 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. The new recipe documents
the `--json` output shape (linters, languages, ruleStyles) and cross-links to
the `route`/`existing` authoring flow that consumes it.
64 changes: 64 additions & 0 deletions packages/cli/src/help/detect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Topic: detect (CLI v%(CLI_VERSION)s / topic v1)

## Goal
Scan the working directory for the linters it configures, the
languages it uses, and the styles of any rules the repo already
authors. Offline and deterministic β€” no network, no auth, no state
change. This is the discovery step that feeds rule-authoring: the
routing flow reads `detect` to decide where a new rule should live.

## Preconditions
- None. Works in any directory; doesn't require `.taskless/`.

## Steps

1. **Invoke the CLI** with JSON output:
```
npx @taskless/cli detect --json
```

2. **Parse the response.** Shape:
```json
{
"success": true,
"linters": [
{
"name": "eslint",
"evidence": ["eslint.config.js", "dependency eslint (package.json)"]
}
],
"languages": ["typescript", "javascript"],
"ruleStyles": [
{
"source": ".taskless/rules",
"description": "ast-grep rules with YAML metadata sidecars"
}
]
}
```
- `linters` β€” each has a `name` and `evidence` (config-file paths,
a pyproject table marker, or a dependency marker from the
language's package file; not every entry is a path).
- `languages` β€” inferred from manifests and the detected linters.
- `ruleStyles` β€” how the repo authors its own rules, surfaced for
downstream reuse.

3. **Use the signals to route.** Feed the output into rule authoring:
- A detected linter the repo already uses β†’ author the rule there
(`taskless help existing`).
- No suitable linter, local-only β†’ `taskless help static`.
- See `taskless help route` for the full decision.

## Errors

When `--json` is set, failures emit `{ ok: false, code, message }`:

| code | meaning | fix |
|-------------------|----------------------------------|---------------------------|
| `INTERNAL_ERROR` | Internal schema validation | Report; likely a CLI bug |

## See Also

- `taskless help route` β€” decide where to author a rule from these signals
- `taskless help existing` β€” author a rule in a linter the repo already uses
- `taskless help check` β€” run rules against the codebase
Loading