Skip to content

T1: Core .hypignore usage-policy module (parser + shared resolver)#206

Merged
philcunliffe merged 1 commit into
integration/hypignore-usage-policyfrom
task/hypignore-usage-policy/T1
Jun 30, 2026
Merged

T1: Core .hypignore usage-policy module (parser + shared resolver)#206
philcunliffe merged 1 commit into
integration/hypignore-usage-policyfrom
task/hypignore-usage-policy/T1

Conversation

@philcunliffe

Copy link
Copy Markdown
Contributor

Implements task T1 of hypignore-usage-policy: the shared core matcher in src/core/usage-policy/ (format parser, ancestor-walk resolver with per-cwd cache, barrel, types) plus traditional tests. Realizes LLP 0049/0050/0052; capture-seam adapters (T2/T3) and CLI (T4) consume this module.

Task-Id: T1

…49/0050)

Add `src/core/usage-policy/`, the single shared, cwd-agnostic matcher for the
`.hypignore` folder-scoped usage policy. V1 enforces only the capture seam; this
task lands the core module the Claude/Codex adapters (T2/T3) and the CLI (T4)
will import.

- `format.js` `parseHypignore`: strip `#`/blank lines, first token is the class;
  empty/comment-only => `ignore`; unknown/unimplemented token => `ignore` + a
  `warn` string (the privacy fail-safe). `@ref LLP 0049#file-format`/`#fail-safe`.
- `matcher.js` `createUsagePolicyResolver({readFileSync,existsSync})`:
  gitignore-style ancestor walk from a cwd to the nearest `.hypignore`, per-cwd
  memo cache, fs injected. `resolve(cwd)` -> `{class,governedBy,declared}`,
  `isIgnored(cwd)`. `@ref LLP 0050`/`LLP 0049#scope`.
- `index.js` barrel + `types.d.ts` (`UsageClass`, `ParseResult`, `ResolveResult`,
  `UsagePolicyResolver`).
- Tests `test/core/usage-policy.test.js`: empty=>ignore, unknown=>ignore+warn,
  nearest-ancestor wins, no file=>full, cache stable + reads once.

Task-Id: T1

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@philcunliffe philcunliffe merged commit d9e53bb into integration/hypignore-usage-policy Jun 30, 2026
6 checks passed
@philcunliffe philcunliffe deleted the task/hypignore-usage-policy/T1 branch June 30, 2026 03:29
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