Skip to content

T4: hyp ignore / unignore / ignore --check CLI for .hypignore#209

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

T4: hyp ignore / unignore / ignore --check CLI for .hypignore#209
philcunliffe merged 1 commit into
integration/hypignore-usage-policyfrom
task/hypignore-usage-policy/T4

Conversation

@philcunliffe

Copy link
Copy Markdown
Contributor

Implements task T4 of hypignore-usage-policy.

CLI verbs for the .hypignore folder-scoped usage policy (LLP 0049 #cli), built on the shared core matcher from T1:

  • hyp ignore [path] writes a self-documenting .hypignore at 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.commands CommandRegistrations (not LLP 0034 verbs: VerbOperationContext has no cwd and these are local, filesystem-mutating, cwd-relative imperatives — LLP 0009 keeps such commands on ctx.commands.register). Repo-root resolution is a new fs-injectable findRepoRoot in the core usage-policy module.

Checks: lint, typecheck, and npm test (1511 pass / 1 skip) all green.

Task-Id: T4

🤖 Generated with Claude Code

…#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>
@philcunliffe philcunliffe merged commit 23e3375 into integration/hypignore-usage-policy Jun 30, 2026
6 checks passed
@philcunliffe philcunliffe deleted the task/hypignore-usage-policy/T4 branch June 30, 2026 03: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