Skip to content

Add IDE and exclusion pack rules (#1)#475

Merged
garysheng merged 1 commit intoPeonPing:mainfrom
kibermaks:main
Apr 19, 2026
Merged

Add IDE and exclusion pack rules (#1)#475
garysheng merged 1 commit intoPeonPing:mainfrom
kibermaks:main

Conversation

@kibermaks
Copy link
Copy Markdown
Contributor

Summary

This PR makes pack selection work the way users actually reason about it: not only by filesystem path, but also by which IDE/agent is generating the session.

Problem

Today, path_rules are the only structured way to steer pack selection before rotation/default fallback. That works for simple “one repo, one tool” setups, but it breaks in multi-agent and multi-IDE workflows where different tools share the same workspace tree or create short-lived session directories under a common root.

In practice, that means users cannot reliably isolate one agent or IDE from another if both happen to run under the same folder pattern. A path match wins too early, and there is no supported way to say “ignore path routing here, then choose by IDE instead.”

User impact

This is especially noisy in setups like Conductor or CodexBar, where one project path may contain multiple start/stop cycles, delegated runs, or cross-tool session handoffs in a single round. Instead of hearing signals that reflect which tool is active, the user hears whichever pack was selected by the broadest matching path rule.

That makes notification behavior harder to trust, harder to tune, and harder to interpret.

Expected outcome

Users should be able to:

  • keep using path_rules where directory-based routing is the right model
  • explicitly exclude specific paths or globbed trees from path-based routing
  • assign packs by IDE/source when the filesystem is no longer a useful discriminator
  • get predictable precedence with clear status output

After this change, selection behaves as:

session_override -> path_rules -> ide_rules -> pack_rotation -> default_pack -> peon

If the current working directory matches exclude_dirs, the path_rules layer is skipped for that invocation, allowing ide_rules to take over.

What this PR changes

  • adds exclude_dirs for glob- or directory-based path exclusions
  • adds ide_rules for pack selection by IDE/source
  • adds CLI controls for both features
  • updates Unix and Windows runtimes to use the same hierarchy
  • tags adapters with explicit source ids so IDE routing is based on actual adapter metadata
  • updates docs, completions, OpenCode config typing/sync, and tests

Why this should hold up

The implementation is covered at the points where the feature can regress:

  • precedence tests verify that path_rules still beat ide_rules, and that exclude_dirs correctly skip path routing
  • CLI tests verify that the new commands persist the intended config
  • adapter updates make IDE detection explicit instead of relying only on path/session heuristics
  • status output now exposes the active IDE context, excluded-path state, and active IDE rule, so misrouting is diagnosable instead of opaque

Validation

  • bash -n passed for modified shell scripts
  • git diff --check passed
  • bats tests/peon.bats passed 379/380 tests after installing bats-core
  • the added exclude_dirs / ide_rules coverage passed

Known limitation

One pre-existing BATS test still fails in this environment:

  • PRD-002: missing audio backend on linux logs play error

That failure is outside the new pack-selection logic introduced here.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 18, 2026

@kibermaks is attempting to deploy a commit to the Gary Sheng's projects Team on Vercel.

A member of the Team first needs to authorize it.

@garysheng garysheng merged commit 09feda9 into PeonPing:main Apr 19, 2026
1 check failed
garysheng added a commit that referenced this pull request Apr 19, 2026
Features:
- feat: IDE rules and exclude_dirs pack selection (#475, closes #298)

Fixes:
- fix: populate summary template from hook payload fallbacks (#477, closes #476)
muunkky added a commit to muunkky/peon-ping that referenced this pull request Apr 22, 2026
Five pre-existing Pester failures on main (and PR 487) from PR PeonPing#475
trailed the install.ps1 refactor that replaced raw `-like` matching
with the Test-PathRuleMatch helper.

- adapters-windows.Tests.ps1 (3x "bindings marks active rule with
  asterisk"): regex updated from '\$marker.*-like.*\$rule\.pattern' to
  match the Test-PathRuleMatch call site.
- adapters-windows.Tests.ps1 ("evaluates path_rules against event
  cwd"): regex updated from 'cwd.*-like.*\$pattern' to the
  Test-PathRuleMatch call form.
- peon-packs.Tests.ps1 ("ide_rules evaluation runs after path_rules
  and before rotation"): IndexOf('\$config.pack_rotation') was
  matching the earlier '\$config.pack_rotation_mode' substring,
  making rotIdx smaller than ideIdx. Anchored on
  'elseif (\$config.pack_rotation' which only appears at the rotation
  fallback site.

The 6th CI-only failure ("status --verbose shows IDE rule and excluded
path context") passes locally on Windows but fails on GH Windows
runner, likely due to short-path (RUNNER~1) vs long-path resolution
in Test-PathRuleMatch when comparing \$PWD.Path to a config value.
Left for a separate investigation.
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.

2 participants