T1: Core .hypignore usage-policy module (parser + shared resolver)#206
Merged
philcunliffe merged 1 commit intoJun 30, 2026
Merged
Conversation
…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>
d9e53bb
into
integration/hypignore-usage-policy
6 checks passed
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.
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