mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-20 10:06:54 +03:00
Allow context roots to be declared in .impeccable/config.json (decoupled from package managers) (#307)
* Allow context roots to be declared in .impeccable/config.json Monorepo detection previously read workspace roots only from package managers (package.json workspaces, pnpm-workspace.yaml, lerna.json), coupling "where design context lives" to the dependency graph. Add a `contextRoots` glob list to .impeccable/config.json / config.local.json so non-JS repos -- and design-context boundaries that don't match packages -- can declare nested PRODUCT.md/DESIGN.md roots directly. The new source is folded into readWorkspacePatterns(), so detection, project resolution, and the app picker pick it up unchanged. Negation and config.local.json extension work for free. * Define projectRoots composition with package workspaces Address review feedback on #307: - Rename the config key contextRoots -> projectRoots: the globs establish project boundaries and app-picker targets, not just where context files live. - Make cross-source precedence explicit: a path matched by any impeccable pattern, positive or negated, is governed by the impeccable group alone; package-manager patterns fill in the paths it does not match, and `!` negations apply only within their own source. readWorkspacePatterns() becomes readProjectPatternGroups() / readProjectPatterns(), with package workspaces as one discovery source. - Drop app-picker candidates that would resolve elsewhere: a package workspace subsumed by a broader impeccable boundary is no longer listed, since choosing it would silently resolve to that boundary. - Add five composition tests and document the key in the config and context reference pages (path relativity, glob and negation syntax, shared/local merge, precedence).
This commit is contained in:
@@ -12,7 +12,8 @@ Use config for:
|
||||
|
||||
- detector ignores shared by `npx impeccable detect` and the design hook;
|
||||
- private local ignores that should not be committed;
|
||||
- hook lifecycle settings such as enabled, quiet mode, and audit logging.
|
||||
- hook lifecycle settings such as enabled, quiet mode, and audit logging;
|
||||
- project roots, for repos where design boundaries are not declared by a package manager.
|
||||
|
||||
Use `PRODUCT.md` and `DESIGN.md` for product and design intent. See [Design Context](/docs/context).
|
||||
|
||||
@@ -52,6 +53,24 @@ npx impeccable ignores add-file "src/private-experiment/**" --local
|
||||
|
||||
Local settings go into `.impeccable/config.local.json`, which Impeccable keeps out of git.
|
||||
|
||||
## Project Roots
|
||||
|
||||
Impeccable normally finds nested projects through package-manager workspace declarations: `package.json` workspaces, `pnpm-workspace.yaml`, or `lerna.json`. When those files do not exist, or when design boundaries do not line up with packages, declare the roots directly:
|
||||
|
||||
```json
|
||||
{
|
||||
"projectRoots": ["docs/design/skins/*"]
|
||||
}
|
||||
```
|
||||
|
||||
Each matched folder becomes its own project: it can carry its own `PRODUCT.md` and `DESIGN.md`, it appears in the app picker, and it falls back to the repo root per file for any context it does not define. See [Design Context](/docs/context).
|
||||
|
||||
How the patterns behave:
|
||||
|
||||
- Patterns are relative to the repo root and use the same glob syntax as `package.json` workspaces, including `*`, `**`, and `!` negation.
|
||||
- `projectRoots` in `config.local.json` extends the shared list, so one developer can add private roots without committing them.
|
||||
- A path matched by any `projectRoots` pattern, positive or negated, is governed by this config alone. Package-manager workspaces apply only to paths these patterns do not match, and each source's `!` negations apply only to its own patterns. So `"!apps/internal"` here hides a package workspace from Impeccable, while a package-level negation never hides a folder that `projectRoots` declares.
|
||||
|
||||
## Value ignores
|
||||
|
||||
Prefer value ignores when a rule reports a specific value:
|
||||
|
||||
@@ -107,6 +107,7 @@ Treat context files like any other design artifact: review them in code review w
|
||||
<div>
|
||||
<p>For normal projects, put <code>PRODUCT.md</code> and <code>DESIGN.md</code> in the project root.</p>
|
||||
<p>Skill commands look in the root first. If root context is missing, they also check <code>.agents/context/</code> and <code>docs/</code>.</p>
|
||||
<p>In a monorepo, each workspace child resolves its own <code>PRODUCT.md</code> and <code>DESIGN.md</code> first, then falls back to the repo root per file. Project boundaries come from package-manager workspace declarations, or from <code>projectRoots</code> globs in <code>.impeccable/config.json</code> when no package manager declares them. See <a href="/docs/config">Config and ignores</a>.</p>
|
||||
<p>The detector's design-system rules use the same root-first behavior for <code>DESIGN.md</code>. For generated design metadata, the primary path is <code>.impeccable/design.json</code>. Legacy <code>DESIGN.json</code> files are still accepted as fallbacks, but new projects should use <code>.impeccable/design.json</code>.</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user