feat(cli): Add deterministic detect command for rule routing#24
Open
thecodedrift wants to merge 4 commits into
Open
feat(cli): Add deterministic detect command for rule routing#24thecodedrift wants to merge 4 commits into
thecodedrift wants to merge 4 commits into
Conversation
Add `taskless detect --json`: an offline, deterministic scan of the repo for configured linters (config files, pyproject tool tables, package deps), inferred languages/frameworks, and the repo's own rule styles. No LLM, no network, no auth — it emits stable signal JSON to feed the routing recipe. Includes a focused scanner module, output schema, and integration tests covering detection, language/framework inference, no-packaged-rule-claims, and the offline/no-auth contract. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new taskless detect subcommand intended to provide a deterministic, offline JSON “repo signals” scan that downstream rule-routing recipes can consume (linters, languages/frameworks, and existing local rule styles).
Changes:
- Introduces a filesystem-only repository scanner (
packages/cli/src/detect/scan.ts) to infer linters, languages/frameworks, and local rule style signals. - Adds a
detectCLI command with--jsonoutput and registers it in the CLI entrypoint. - Adds Vitest integration tests for linter detection, language/framework inference, rule-style surfacing, and stable JSON shape.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/test/detect.test.ts | New integration tests that execute the built CLI and validate detect JSON signals. |
| packages/cli/src/schemas/detect.ts | New Zod schema describing taskless detect --json output. |
| packages/cli/src/index.ts | Registers the new detect subcommand. |
| packages/cli/src/detect/scan.ts | Implements deterministic repo signal scanning for linters/languages/frameworks/rule styles. |
| packages/cli/src/commands/detect.ts | Adds the detect CLI command and JSON/human output modes. |
| openspec/changes/local-rule-routing/tasks.md | Adds/updates spec task tracking for the local-rule-routing change set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* feat/local-rule-routing: docs(openspec): Clarify detect output schema is internal, not published docs(openspec): Address review feedback on local-rule-routing contract
Address review on PR #24: - Guard package.json dependency parsing: a malformed field (array/string/ null) no longer yields bogus dependency names via Object.keys. - Match pyproject tool tables exactly: `[tool.ruff]` or a nested `[tool.ruff.lint]`, never a similarly-prefixed sibling like `[tool.ruff-lsp]`. Anchored at line start to avoid value matches. - Rename the linter `configFiles` output field to `evidence`: it holds config paths AND non-path markers (pyproject tables, package deps), so the old name/contract was misleading. - Drop the divergent unused detect errorSchema; the error path emits the standard `{ ok, code, message }` envelope via makeErrorEnvelope. - Run detect tests with telemetry disabled (DO_NOT_TRACK), keeping the offline scan path hermetic, and add coverage for the table-prefix and malformed-manifest cases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
thecodedrift
added a commit
that referenced
this pull request
Jun 12, 2026
PR #25 review: - remote.txt: stop advertising runtime rules / check.ts as current behavior, since runtime-rule support isn't shipped end-to-end yet. Reframe the recipe around gathering inputs and delegating to `rule create`; the service owns rule-type selection and today writes ast-grep rules under .taskless/rules/. - static.txt: instruct writing the matching `id` field in the test file (alongside valid/invalid), as rule create --anonymous and the CLI's test-file writer do and ast-grep test filtering expects. - route.txt: update the detect output example to the renamed `evidence` field (follows the detect rename on PR #24). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6923eb3 to
934cfb9
Compare
* feat/local-rule-routing: ci(openspec): Skip the archive check on non-tip stacked PRs (#31) docs(openspec): Clarify detect output schema is internal, not published docs(openspec): Address review feedback on local-rule-routing contract docs(openspec): Propose local-rule-routing change chore(skill): Refine the stacked-PR archive-check guidance chore(skill): Scope iterate-pr archive check to the stack tip chore(config): Allow git-town in project settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
taskless detect --json: an offline, deterministic scan of the working directory that emits the signals the routing recipes consume.It reports configured linters (evidenced by config files,
pyproject.toml[tool.x]tables, or package.json dependencies), inferred languages and frameworks, and the styles of the repo's own existing rules. There is no LLM, no network, and no auth — the command is a stable, testable input that keeps the routing agent from hallucinating the repo's tooling.By design,
detectreports only repo signals; it never matches a request against a catalog of packaged rules. That judgment is effectively infinite across ecosystems and is left to theexistingrecipe (repo + WebFetch), not baked into the CLI.Implementation is a focused scanner module (
detect/scan.ts) behind a thin command, a Zod output schema, and integration tests covering linter detection across eslint/ruff/rubocop/biome/stylelint, language/framework inference, the no-packaged-rule-claims contract, and the offline/no-auth guarantee.Stacked on #23 (the change contract). Review/merge that first.
Refs TSKL Runtime Rules
Stack generated by Git Town