feat: expand slash-command goals from command templates

Resolves armed slash-command objectives from authoritative templates before dispatch
Applies OpenCode argument expansion for goal metadata in UI and scheduled tasks
Falls back to the raw invocation when command details are unavailable
This commit is contained in:
Bohdan Triapitsyn
2026-07-29 00:47:29 +03:00
parent 7331ee626e
commit b0028283fb
8 changed files with 221 additions and 65 deletions
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { computeNextRunAt, formatScheduledSessionTitle, parseScheduledCommandPrompt } from './runtime.js';
import { computeNextRunAt, expandCommandGoalObjective, formatScheduledSessionTitle, parseScheduledCommandPrompt } from './runtime.js';
describe('scheduled-tasks runtime helpers', () => {
it('computes next daily run in timezone', () => {
@@ -97,4 +97,15 @@ describe('scheduled-tasks runtime helpers', () => {
expect(parseScheduledCommandPrompt('Summarize open issues')).toBeNull();
expect(parseScheduledCommandPrompt('/')).toBeNull();
});
it('expands command arguments into the goal objective', () => {
expect(expandCommandGoalObjective(
'Run the issue pipeline for $ARGUMENTS. Verify $ARGUMENTS is represented by the PR.',
'LIN-123 --draft',
)).toBe('Run the issue pipeline for LIN-123 --draft. Verify LIN-123 --draft is represented by the PR.');
expect(expandCommandGoalObjective(undefined, 'LIN-123')).toBeNull();
expect(expandCommandGoalObjective('Move $1 to $2', '"src old" dist extra')).toBe('Move src old to dist extra');
expect(expandCommandGoalObjective('Review the requested scope.', 'auth module'))
.toBe('Review the requested scope.\n\nauth module');
});
});