Skip to content

Preview /park for: as it's typed (#200, 2/3) - #216

Open
NinjaLikesCheez wants to merge 2 commits into
time-input-parsersfrom
time-input-preview
Open

NinjaLikesCheez wants to merge 2 commits into
time-input-parsersfrom
time-input-preview

Conversation

@NinjaLikesCheez

@NinjaLikesCheez NinjaLikesCheez commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Second PR of the stack for #200 (spec: #200 (comment)). Merge #215 first. PR 3 (every input on the shared pieces, consistent form text) stacks on this one.

What changes

/park for: previews what you type:

Typed Suggestion
2h 2h → until 12:00
h 1h → until 11:00, 2h → until 12:00, 4h → until 14:00 (the offered lengths that contain it, as before, now with their end)
rest of day rest of day → until 23:59
ages Not understood yet. Try 30m, 2h30, rest of day
  • src/core/time-suggest.ts (new): previewSuggestions shows what was typed and what it means first, then the examples that contain it, each with what it means. When nothing can be offered, a single suggestion says why. Its value is what was typed, so picking it gets the full refusal with examples. whyNot gives that text: the reason from time-help.ts, in plain text, or examples while it isn't understood yet.
  • Picking a suggestion submits the text, not the resolved time, and the handler reads it again, as AGENTS.md asks.
  • services/parking-time.ts gets previewParkingDuration. For now it reads parking's own durations and rest of day. PR 3 moves /park onto readHowLong, so until 17:00 works and previews too.

Why only /park for

The spec asked for a preview on every slash option that takes a time. /park for is the only one: /admin → Parking is one subcommand that opens a panel, and its From, Until, How long and Reset are typed on forms, like /schedule's times. Discord forms (modals) can't autocomplete. An earlier version of this PR added suggestions to the panel's operations, but nothing calls them. That code is gone (thanks to the Sentry review). On forms, the draft or reply shows what was understood, and PR 3 gives those fields consistent placeholders. When a time becomes a slash option later (#197, #199), previewSuggestions and whyNot are ready for it.

After deploying

Nothing extra: /park for: already had autocomplete.

Review

Core: one new file, core/time-suggest.ts. Suggestions go through Dispatcher.suggest as before (same access checks, 25 at most, names clipped). Nothing typed is logged. No rule 14 paths are touched.

Testing

  • just check passes.
  • New: tests/core/time-suggest.test.ts, the /park for suggestion test (now with previews and the not-understood hint), and previewParkingDuration tests.

Part of #200.

🤖 Generated with Claude Code

Second of the stack for #200. core/time-suggest.ts turns a typed time into
autocomplete suggestions that show what Pixel understood ("fri 8pm → Fri 16
Oct 2026, 20:00", "2h → until 12:30") or why it can't use it, followed by
examples that contain what was typed. Picking one submits the text, and
the handler reads it again.

Used by /park for and by from, until, for and reset in /admin → Parking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/features/admin/parking.ts Resolved
/admin → Parking is one subcommand that opens a panel; its times are typed
on forms, which can't autocomplete, so the suggestions on its operations
never ran. /park for is the only slash option that takes a time. Keep
core/time-suggest.ts to what it uses: previewSuggestions and whyNot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NinjaLikesCheez NinjaLikesCheez changed the title Preview times as they're typed in slash options (#200, 2/3) Preview /park for: as it's typed (#200, 2/3) Nov 14, 2026

This branch has not been deployed

No deployments
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