Add slash command shorthand syntax: on: /command#7146
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Implement support for the slash command shorthand syntax similar to "on: daily".
Now users can write "on: /command" which automatically expands to:
on:
slash_command: command
workflow_dispatch:
Changes:
- Modified preprocessScheduleFields to detect and expand slash command shorthand
- Added comprehensive tests in TestSlashCommandShorthand
- Updated JSON schema to document the new shorthand format
- Added debug logging for troubleshooting
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
All tests pass and workflows compile successfully with the new slash command shorthand syntax. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added documentation for the new `on: /command` shorthand format in: - reference/triggers.md - Added ultra-short syntax section - reference/command-triggers.md - Updated shorthand examples The documentation explains that `on: /my-bot` automatically expands to include slash_command and workflow_dispatch triggers, similar to `on: daily`. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
reviewed
Dec 21, 2025
| // Check if "on" is a string - might be a schedule expression shorthand | ||
| // Check if "on" is a string - might be a schedule expression or slash command shorthand | ||
| if onStr, ok := onValue.(string); ok { | ||
| schedulePreprocessingLog.Printf("Processing on field as string: %s", onStr) |
Contributor
There was a problem hiding this comment.
@copilot move schedule parser to helper function in own file, add extensive tests
Contributor
Author
There was a problem hiding this comment.
Refactored slash command parser into separate file with extensive tests in commit e2e3b8f.
Created:
pkg/workflow/slash_command_parser.gowithparseSlashCommandShorthand()andexpandSlashCommandShorthand()helper functionspkg/workflow/slash_command_parser_test.gowith 24 comprehensive test cases covering valid commands, errors, edge cases, and whitespace handling
All existing tests pass and end-to-end compilation verified.
Copilot
AI
changed the title
[WIP] Add support for slash command short syntax
Add slash command shorthand syntax: Dec 21, 2025
on: /command
- Extracted parseSlashCommandShorthand() and expandSlashCommandShorthand() helper functions - Created new file pkg/workflow/slash_command_parser.go for parser logic - Added pkg/workflow/slash_command_parser_test.go with 4 test suites covering: - Valid commands (simple, hyphens, underscores, numbers, long names) - Error cases (empty command after slash) - Non-slash commands (regular events, schedules, cron) - Edge cases (single char, spaces, special chars, unicode, multiple slashes) - Whitespace handling (leading, trailing, tabs) - Total of 24 test cases ensuring comprehensive coverage - Updated schedule_preprocessing.go to use the new helper functions - All existing tests pass, end-to-end compilation verified Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
Dec 21, 2025
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.
Implementation Plan for Slash Command Shorthand Syntax
Goal: Add support for
on: /commandas shorthand foron: { slash_command: command, workflow_dispatch: null }Analysis Complete
on: dailyshorthand workspkg/workflow/schedule_preprocessing.gopkg/workflow/compiler_safe_outputs.goandpkg/workflow/frontmatter_extraction.gopkg/parser/schemas/main_workflow_schema.jsonImplementation Tasks
preprocessScheduleFieldsinschedule_preprocessing.goon: /commandformat to convert to proper structureonfieldRefactoring (Latest Commit)
✅ Created
pkg/workflow/slash_command_parser.gowith dedicated helper functions✅ Created
pkg/workflow/slash_command_parser_test.gowith 24 comprehensive test cases✅ Updated
schedule_preprocessing.goto use the extracted helpers✅ All tests pass (existing + new)
✅ End-to-end compilation verified
Test Coverage Summary
Implementation complete!
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.