Support wildcard suffix matching for slash_command#40369
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
slash_command
There was a problem hiding this comment.
Pull request overview
This PR extends on.slash_command to support a trailing * wildcard suffix for prefix-based matching, and wires that behavior through both decentralized activation checks (compiled if: conditions) and centralized routing/JS runtime helpers so a single workflow can handle a family of related command names.
Changes:
- Added wildcard-aware slash-command matching in the Go workflow condition builder (
startsWith("/<prefix>")forname: prefix*). - Introduced a shared JS matcher module and updated routing, command-position validation, and command neutralization to use it.
- Updated the workflow schema patterns/descriptions and added tests covering wildcard matching across Go + JS paths.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/command.go | Adds wildcard-suffix detection and emits startsWith conditions for wildcard command names. |
| pkg/workflow/command_precision_test.go | Adds coverage ensuring wildcard slash commands compile to prefix checks. |
| pkg/parser/schemas/main_workflow_schema.json | Allows an optional trailing * in slash command names and documents wildcard behavior. |
| actions/setup/js/slash_command_matcher.cjs | New shared JS helper for parsing and matching exact vs wildcard command names. |
| actions/setup/js/sanitize_content.test.cjs | Adds a test ensuring wildcard-configured commands are neutralized correctly. |
| actions/setup/js/sanitize_content_core.cjs | Uses the shared matcher to neutralize the actual matched command name (including wildcard matches). |
| actions/setup/js/route_slash_command.test.cjs | Adds tests for dot-containing commands and wildcard routing dispatch behavior. |
| actions/setup/js/route_slash_command.cjs | Switches routing to shared parsing/matching and resolves routes by wildcard prefix as well as exact name. |
| actions/setup/js/check_command_position.test.cjs | Adds tests for wildcard matching in both workflow_dispatch aw_context and comment bodies. |
| actions/setup/js/check_command_position.cjs | Updates command-position validation to use shared parsing/matching for wildcard support. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 10/10 changed files
- Comments generated: 1
| function parseSlashCommand(text) { | ||
| const match = /^\/([a-zA-Z0-9][a-zA-Z0-9._-]*)\b/.exec(String(text).trim()); | ||
| return match ? match[1] : ""; | ||
| } |
|
✅ Test Quality Sentinel completed test quality analysis. |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. |
|
|
|
@copilot Investigate why reviewers were unable to create safe-outputs. https://github.com/github/gh-aw/actions/runs/27841406528/job/82402381056 |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Root cause was a runtime packaging gap in Fixed in commit |
|
/smoke-copilot |
|
📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing... |
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment. Warning Firewall blocked 5 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "accounts.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
|
There was a problem hiding this comment.
Smoke run: inline notes attached.
Warning
Firewall blocked 5 domains
The following domains were blocked by the firewall during workflow execution:
accounts.google.comclients2.google.comcontentautofill.googleapis.comsafebrowsingohttpgateway.googleapis.comwww.google.com
To allow these domains, add them to the
network.allowedlist in your workflow frontmatter:
network:
allowed:
- defaults
- "accounts.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
📰 BREAKING: Report filed by Smoke Copilot · 406.4 AIC · ⊞ 19.2K
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 0995042. I tightened slash-command parsing to require whitespace/end after the command (so punctuation-suffixed tokens no longer match) and updated/addded JS tests accordingly. |
This updates
slash_commandto accept a trailing*, enabling prefix-based matching so one workflow can handle a family of related command names. The change applies consistently to both decentralized command checks and centralized command routing.Trigger semantics
slash_command.namenow supports a wildcard suffix.smoke*matches commands such assmoke-copilotandsmoke-copilot-sdk.Decentralized matching
*as a prefix matcher instead of an exact literal.Centralized routing
Shared runtime handling
Schema and docs surface
*in command names and documented the new behavior in field descriptions.Example:
With that configuration, comments like these would match the same workflow: