Skip to content

feat(init): name the ignore entries a project's formatter and linters need - #735

Merged
aibex-agent[bot] merged 3 commits into
mainfrom
aibex/t_iJrrlTE4tSyKzidfnEPZ8Ac3
Dec 2, 2026
Merged

aibex-agent[bot] merged 3 commits into
mainfrom
aibex/t_iJrrlTE4tSyKzidfnEPZ8Ac3

Conversation

@aibex-agent

@aibex-agent aibex-agent Bot commented Dec 2, 2026

Copy link
Copy Markdown

After taskless init, a project's formatter and type-aware linter failed on files Taskless installed (.taskless/bin/cli.mjs, cli.lock.json, taskless.json, the skill file) and on rule fixtures under .taskless/rules, until the person excluded each one by hand. This is the first of the "two smaller things" in #732.

What changes

init (batch and wizard) now names the ignore entries each detected formatter or linter still needs. It covers prettier, eslint, biome, oxlint, ruff and black, the tools detect recognises that walk the whole tree:

Exclude Taskless's files from your formatter and linters: init rewrites what is in .taskless/, and its rule fixtures are meant to fail. Add:
  prettier, in .prettierignore:
    .taskless/
    .claude/skills/taskless/
  eslint, in eslint.config.js:
    { ignores: [".taskless/"] }
  • Every tool gets .taskless/. Prettier, which formats markdown, also gets each tool directory's Taskless skill stub.
  • A tool drops out once its root config or ignore file mentions .taskless (black needs the escaped \.taskless, so ruff's entry in a shared pyproject.toml doesn't count for it). The notice goes away once the project has handled it, so it doesn't repeat on every init.
  • init --json carries the same list as ignores (always present). The init recipe tells an agent to offer the edit in the same commit as the install, and to make it only when the user agrees.

Why print rather than write

These are the person's configs. Several are code (eslint.config.js, oxlint.config.ts) or JSON with comments, none is a file init owns, and outside .taskless/ init writes only its own skill stubs and permission rules. An agent working from the --json envelope can apply the entries once the user agrees.

detect is unchanged: it runs before anything is installed, so there are no Taskless files or stub paths to name yet.

Checks

pnpm typecheck, pnpm lint, and the full cli suite (3424 passed). OpenSpec change init-tool-ignores is archived in this PR (one ADDED requirement in cli-init). Patch changeset.

Refs #732

… need

After init, a detected prettier, eslint, biome, oxlint, ruff or black is
told which entries keep it off .taskless/ (and, for prettier, the skill
stubs), in its own syntax. Printed, never written; carried on --json as
ignores. A tool whose config already mentions .taskless is left out.

Refs #732
@aibex-agent

aibex-agent Bot commented Dec 2, 2026

Copy link
Copy Markdown
Author

@claude /review

@aibex-agent
aibex-agent Bot force-pushed the aibex/t_iJrrlTE4tSyKzidfnEPZ8Ac3 branch from 1025427 to 2a945b4 Compare December 2, 2026 07:35
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @aibex-agent[bot]'s task in 3m 0s —— View job


Review complete

Review mode: incremental — read 0 prior review thread(s) before reviewing. The .prior-review.json snapshot contained no prior review threads, review summaries, or inline comments (only the @claude /review trigger comment itself), so this is the first review of this PR — there is nothing previously raised to classify as addressed or still-open.

  • Read prior review state (none found)
  • Fetch PR diff and changed files
  • Review tool-ignores.ts logic
  • Review init.ts / wizard/index.ts integration
  • Review tests
  • Review openspec/docs changes
  • Post findings

Findings (2 new, posted inline)

  1. packages/cli/src/install/tool-ignores.ts:78-93 — The eslint target's files list includes legacy ESLint configs (.eslintrc*) via ESLINT_CONFIG_FILES, but render always emits flat-config-only syntax ({ ignores: [...] }). For a project detected as using eslint purely through a legacy config (or the bare eslint dependency, with no config file at all), the printed snippet is invalid for that config format — there's no ignores key in the legacy schema, and { ignores: [...] } isn't even valid JSON to paste into .eslintrc.json.

  2. packages/cli/src/install/tool-ignores.ts:129-165 — The already-handled check does plain substring matching on the needle. For a shared pyproject.toml, black's rendered escaped-regex entry (\.taskless) contains ruff's plain needle (.taskless) as a substring. So a project with only [tool.black] excluding .taskless (no [tool.ruff] exclude) will cause ruff to be falsely marked as already handled. The new test only covers the direction the PR description calls out (ruff's entry not counting for black) — not this reverse case.

Everything else — the detection/skip logic for the other tools, the init/wizard notice placement (confirmed it prints above the uncommitted-install notice and before the onboarding trailer, matching the spec), the --json envelope's ignores field, and the openspec spec/changeset — looked correct and consistent with the stated behavior.

Comment on lines +78 to +93
tool: "eslint",
files: [...ESLINT_CONFIG_FILES, ".eslintignore"],
needle: ".taskless",
markdown: false,
location: (found) =>
found === undefined || found === ".eslintignore"
? "your ESLint config"
: found,
render: (patterns) => ({
patterns: [...patterns],
// A config object holding only `ignores` is a global ignore in a flat
// config, which is what keeps typescript-eslint from type-checking a
// fixture no tsconfig includes.
snippet: `{ ignores: [${quoted(patterns)}] }`,
}),
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[New] The eslint target's files list reuses ESLINT_CONFIG_FILES, which includes the legacy configs (.eslintrc, .eslintrc.js/.cjs/.mjs/.json/.yml/.yaml) ahead of the flat configs in the array. But render always emits flat-config-only syntax: { ignores: [...] }.

If a project is detected as using eslint (e.g. only .eslintrc.json, or via eslintConfig in package.json/the eslint dependency with no config file at all) and has no flat eslint.config.*, location(found) will report that legacy file (or "your ESLint config") as where to add the snippet, but { ignores: [".taskless/"] } is not valid in a legacy .eslintrc* file — there is no ignores key in that schema, and pasting a bare object literal into .eslintrc.json isn't even valid JSON. The correct legacy mechanism is a .eslintignore file (gitignore syntax) or ignorePatterns in the config, not a flat-config ignore object.

Since detectRepository can mark eslint detected purely via the legacy configs or a bare dependency, this isn't an edge case — any project still on ESLint 8/legacy config (not yet migrated to flat config) will get a snippet that doesn't apply to its actual config format.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cc86297. A project with only a legacy .eslintrc* (or .eslintignore) is now pointed at .eslintignore with gitignore-style lines. The flat { ignores: [...] } object is used only when a flat eslint.config.* exists, or when no config file exists at all (only the dependency), since flat is ESLint 9's default. Flat configs are checked first, so a project in the middle of migrating gets the form ESLint 9 reads. Tests cover the legacy case and the both-present case, and the spec states the rule.

Comment on lines +129 to +165
{
tool: "ruff",
files: ["ruff.toml", ".ruff.toml", PYPROJECT],
needle: ".taskless",
markdown: false,
location: (found) =>
found === undefined || found === PYPROJECT
? `${PYPROJECT}, under [tool.ruff]`
: found,
render: (patterns) => {
const bare = patterns.map((pattern) => pattern.replace(/\/$/, ""));
return {
patterns: bare,
snippet: `extend-exclude = [${quoted(bare)}]`,
};
},
},
{
tool: "black",
files: [PYPROJECT],
// black takes a regular expression, so its entry is the escaped form.
// ruff's plain `.taskless` in the same file does not count for black.
needle: String.raw`\.taskless`,
markdown: false,
location: () => `${PYPROJECT}, under [tool.black]`,
render: (patterns) => {
const expression = `/(${patterns
.map((pattern) =>
pattern.replace(/\/$/, "").replaceAll(".", String.raw`\.`)
)
.join("|")})/`;
return {
patterns: [expression],
snippet: `extend-exclude = '${expression}'`,
};
},
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[New] The already-handled check (lines 204-212) uses plain substring matching, which breaks in the other direction from the one the tests cover.

ruff's needle is the plain string .taskless. black's rendered entry in a shared pyproject.toml is the escaped regex form, e.g. extend-exclude = '/(\.taskless)/'. That string contains the substring .taskless (just drop the leading backslash), so if a project has only [tool.black] configured with that exclude and no [tool.ruff] exclude at all, findToolIgnores will read pyproject.toml for the ruff target, find .taskless as a substring of black's \.taskless entry, and mark ruff as already "handled" — even though ruff itself was never excluded.

The test added at packages/cli/test/tool-ignores.test.ts ("does not count ruff's entry as black's") only checks the direction where ruff is configured and black isn't; it doesn't check the reverse (black configured, ruff isn't), which is exactly the case that breaks here. Worth either using a less substring-prone check (e.g. a word/table-scoped match) or adding the reverse-direction test and fixing the false positive.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cc86297. The needles are now regexes. Every tool except black matches .taskless only when it isn't preceded by a backslash, so black's \.taskless no longer counts as ruff's entry. Black keeps matching the escaped form only. Added the reverse-direction test (black excluded, ruff not → ruff is named), and the spec now says black's entry doesn't count as another tool's.

…ry from counting for ruff

Review findings on #735.
@aibex-agent
aibex-agent Bot merged commit 5597317 into main Dec 2, 2026
8 checks passed
@aibex-agent
aibex-agent Bot deleted the aibex/t_iJrrlTE4tSyKzidfnEPZ8Ac3 branch December 2, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant