Skip to content

fix(toggle): report a toggle that another ignore rule overrides - #989

Merged
runkids merged 1 commit into
mainfrom
runkids/toggle-glob-rules
Nov 23, 2026
Merged

runkids merged 1 commit into
mainfrom
runkids/toggle-glob-rules

Conversation

@runkids

@runkids runkids commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)
  • Approved feature or large change (the linked issue has the approved label)

Linked Issue

No issue. Listed under "Not in this PR" in #985 and #987.

What was wrong

The list TUI toggle (t) and skillshare enable/disable assumed the line they wrote or removed decided the item's state. Often another rule decides it:

  • a glob such as draft-*;
  • a folder rule such as frontend/ or archive/;
  • a tracked repo's own .skillignore;
  • a ! rule in .skillignore.local or .agentignore.local.

Then the TUI flipped the row and the CLI printed success or "not disabled" and exited 0, while sync kept doing the opposite. The dashboard already checked the result after writing, but with its own copy of the logic, and its 409 message named .skillignore even for agents.

Names also missed the item the user meant:

  • enable inner did not remove a group/inner line, which the TUI and dashboard write.
  • disable reviewer --kind agent wrote reviewer, which never matches reviewer.md. The docs taught this form and showed .agentignore examples without .md.

Fix

internal/toggle now does the work for the CLI, the TUI and the dashboard:

  1. It resolves the name through the same discovery that list and the dashboard use, including agents in ignored folders since fix(agents): list agents in .agentignore'd folders as disabled #987.
  2. It writes or removes the lines.
  3. It discovers again and reports each item that did not reach the requested state. The message names the file whose rule decides it, including a tracked repo's .skillignore.

Entry points choose only which lines to write:

  • Dashboard and TUI: the item's path, as before. HTTP status codes and fields are unchanged. The batch toggle now logs partial or error instead of always ok. The single toggle's 409 is now logged.
  • CLI:
    • An exact path or flat name picks that item alone.
    • A folder name picks every skill with that folder name.
    • A typed line that matches the named items is written as typed. An agent typed without .md gets .md appended.
    • If the typed line cannot match the item, as with a frontmatter name or a flat name, the item's path is written instead.
    • enable also removes each named item's path line.
    • Each item gets its own row, and the row names the line actually added or removed. --dry-run lists every line.
    • A blocked item exits 1. The oplog records error, or partial when other items changed.
    • Text that matches no item, such as a glob, keeps today's behavior.

Herdr: when the CLI exits non-zero, the panel shows its last line, which carries the reason. With an older CLI that exits 0, the panel still re-checks list --json as before.

$ cat skills/.skillignore
draft-*
$ skillshare enable draft-one -g

✗ could not enable draft-one: still disabled: another rule in .skillignore or .skillignore.local matches it — remove that rule to enable it
$ echo $?
1

Behavior changes

  • skillshare enable/disable exits 1 when another rule keeps an item from changing. Scripts that ignored the result will now see the failure.
  • enable <name> matching several skills enables all of them and reports each one. disable <name> with an unanchored line disables all of them, as before.
  • disable <frontmatter name> --kind agent and disable <flat name> now write the item's path, so they take effect.
  • The dashboard resolves names the same way. An exact path or flat name now wins over a folder-name match found earlier in the walk. Before, toggling a root foo could toggle a/foo instead.

Tests

Each fails on main, except where noted, and passes with the fix:

  • internal/toggle:
    • Apply names the deciding file, catches a ! rule that undoes a disable, and reports the lines it changed;
    • Lines covers globs, exact paths, flat names, frontmatter names, a nested agent's file name, .md appending and several matches.
  • tests/integration/enable_test.go (wiring):
    • enable blocked for a skill and for an agent in a folder rule, which names .agentignore;
    • disable undone by ! in .skillignore.local and in .agentignore.local, with the oplog error;
    • partial failure;
    • project mode;
    • enable inner removes group/inner;
    • --dry-run lists the path line;
    • frontmatter-name agent disable takes effect;
    • an exact path wins over a same-named skill in another folder. main passes this one because it did not check.
  • List TUI: blocked skill, blocked agent in a folder rule, and a ! rule. In each case the row keeps its state and shows the reason.
  • Server:
    • an agent's 409 names .agentignore and is logged;
    • a batch partial failure logs partial.
  • Herdr: a non-zero exit shows the CLI's reason.

Checks

  • make check passes in the devcontainer, including the Herdr tests.
  • End to end with the built binary in global mode:
    • a frontmatter-name agent disable shows the agent as disabled in list --json;
    • enable react-ui with an ignored archive/react-ui exits 0;
    • enable inner with group/inner and a blocking other/ rule prints a ✓ row, a ✗ line and the sync hint, exits 1 and logs partial.
  • enable reviewer.md --kind agent for team/reviewer.md under a team/ rule exits 1 and names .agentignore.
  • A TUI screenshot shows the row unchanged and the reason in the key bar. I took it with scripts/screenshots/record-tui.sh and a ! rule added to a local copy of its fixture. The scenario is not added to the script.
  • The website build was not run. make check includes the docs checks.

Not in this PR

  • The list TUI toggle writes no oplog entry, as on main.
  • The TUI and the dashboard remove only the item's path line. A nested skill disabled with skillshare disable inner (line inner) cannot be enabled from them. They now say so and name the file, and skillshare enable inner removes the line.
  • A disable undone by a ! rule leaves its line in the ignore file, where it has no effect.

Checklist

  • I've read CONTRIBUTING.md, including its AI-assisted contributions section
  • I've reviewed every line of the diff and can explain it
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

The list TUI and `skillshare enable/disable` trusted the line they wrote
or removed. When a glob, a folder rule, a tracked repo's own .skillignore
or a "!" rule in the .local file still decided the state, the TUI flipped
the row and the CLI printed success, while sync kept doing the opposite.
The dashboard already checked the result, but with its own copy of the
logic.

internal/toggle now owns the flow for all three: resolve the name through
the same discovery list and the dashboard use, write or remove the lines,
discover again, and report each item that did not reach the requested
state, naming the file whose rule decides it. The CLI exits 1 and logs
error or partial, the TUI keeps the row and shows the reason, and Herdr
shows the CLI's reason.

Names now reach the item the user means. An exact path or flat name picks
that item alone. A name that the written line could not match, such as an
agent's frontmatter name or a flat name, writes the item's path, as the
dashboard does. Enable also removes each named item's path line, so
`enable inner` undoes the `group/inner` line the TUI or dashboard wrote.
An agent typed without .md gets .md, which `.agentignore` rules need to
match the file. Docs that showed agent lines without .md are fixed.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T04:01:06.880062Z 7d664e1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@runkids
runkids merged commit 2ba1214 into main Nov 23, 2026
10 checks passed
@runkids
runkids deleted the runkids/toggle-glob-rules branch November 23, 2026 04:06
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