T4: hyp ignore / unignore / ignore --check CLI for .hypignore#209
Merged
philcunliffe merged 1 commit intoJun 30, 2026
Merged
Conversation
…#cli) Implement the usage-policy CLI verbs on top of the shared core matcher (T1). These are imperative, cwd-relative, filesystem-mutating commands, so they register as plain `ctx.commands` CommandRegistrations alongside the existing `ignore`/`attach`/`detach` commands — not LLP 0034 verbs (whose `VerbOperationContext` has no `cwd` and whose tools are remotely invokable). LLP 0009 itself draws this line: "imperative/interactive commands stay `ctx.commands.register`". - `hyp ignore [path]` writes a self-documenting `.hypignore` (comment header + `ignore` token) at the git repo root, else the cwd; an explicit `path` overrides. Idempotent (R5): a path already governed by an ancestor `.hypignore` is a no-op success, never a redundant nested file. - `hyp unignore [path]` removes the nearest governing `.hypignore`. Idempotent: a no-op when nothing governs. - `hyp ignore --check [path]` reports ignored?/governing file/residual already-cached row count; prospective-only, never purges (LLP 0049 #prospective-only). The residual count pushes a superset LIKE filter into `ai_gateway_messages` then refines with an exact subtree match in JS (squirreling LIKE treats `_`/`%` as wildcards), and degrades to `unknown` when the dataset is unavailable. Repo-root resolution is a new `findRepoRoot` in the core usage-policy module: a dependency-free, fs-injectable `.git` ancestor walk mirroring the adapters' `git rev-parse --show-toplevel`, kept in core so the CLI need not spawn git and stays hermetically testable. Tests: idempotency for ignore/unignore, repo-root vs cwd vs explicit-path placement, `--check` output (ignored/clean/--json/graceful-unknown), a real residual count proving the LIKE-superset + exact-refine, and direct findRepoRoot unit tests. Task-Id: T4 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23e3375
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 T4 of hypignore-usage-policy.
CLI verbs for the
.hypignorefolder-scoped usage policy (LLP 0049 #cli), built on the shared core matcher from T1:hyp ignore [path]writes a self-documenting.hypignoreat the git repo root (else cwd; explicit path overrides), idempotent (R5).hyp unignore [path]removes the governing.hypignore, idempotent.hyp ignore --check [path]reports ignored?/governing file/residual already-cached row count; prospective-only, no purge.Registered as plain
ctx.commandsCommandRegistrations (not LLP 0034 verbs:VerbOperationContexthas nocwdand these are local, filesystem-mutating, cwd-relative imperatives — LLP 0009 keeps such commands onctx.commands.register). Repo-root resolution is a new fs-injectablefindRepoRootin the core usage-policy module.Checks: lint, typecheck, and
npm test(1511 pass / 1 skip) all green.Task-Id: T4
🤖 Generated with Claude Code