Commit Graph
21 Commits
Author SHA1 Message Date
valknarandClaude Sonnet 5 3131d8ce5b Add search, filtering, sorting, and pagination to Run History
The runs page was a flat top-100 list with no way to narrow it down.
It's now driven entirely by the URL (?q=&status=&scriptId=&sort=&dir=&page=),
so filtered/sorted views are shareable and survive back/forward
navigation:

- free-text search across script name, triggered-by, and the resolved
  command
- status and script dropdown filters
- sortable Script/Status/Triggered-by/Started column headers
- offset pagination (25/page) with a real total count, clamped so an
  out-of-range page falls back to the last valid one instead of
  showing a misleading "no results"

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-16 00:17:49 +02:00
valknarandClaude Sonnet 5 d4e4c2c7d2 Show the full resolved command and variables on the run detail page
The command lived in a narrow truncate'd grid cell, so anything but a
short invocation was unreadable. It now gets its own scrollable code
block, plus a breakdown of each variable (using the script's configured
labels when available) and the value it resolved to for that run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-16 00:11:27 +02:00
valknarandClaude Sonnet 5 004586ee64 Enforce required on string/multiselect variables without explicit bounds
required:true only worked by accident: a bare z.string() or
z.array(...) accepts "" / [] just fine, so a required field with no
minLength (e.g. secret tokens like webhookToken, apiKey) could be
submitted empty and the run would start anyway. Required now implies
min(1) when no stricter bound is already configured, for both string
and multiselect fields. This is the single schema shared by the client
form resolver and the server run-creation route, so both now reject it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-16 00:06:39 +02:00
valknarandClaude Sonnet 5 e6008a22cd Fix live output missing for fast-finishing scripts
Scripts that finish in milliseconds (e.g. notify.js) could complete and
broadcast all their output/status before a client's WS subscribe message
even arrived, leaving the run page's terminal permanently blank with no
way to catch up. The server now answers every subscribe with whatever
log bytes were written past what the client's server-rendered page
already had, plus the run's current status, before it starts streaming
live broadcasts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-16 00:02:57 +02:00
valknarandClaude Sonnet 5 c3312f5dc6 Remove theme toggle from the login page
Keep it in the main app header only.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 21:17:49 +02:00
valknarandClaude Sonnet 5 79a7c8f5cb Tighten xterm terminal line height
1.4 was too loose for a log/terminal view; 1.2 stays readable while
fitting more output on screen.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 21:14:11 +02:00
valknarandClaude Sonnet 5 a4db53f44d Add dark theme support with a toggle
shadcn had already generated full light/dark CSS variable sets in
globals.css (keyed off a .dark class via @custom-variant), but nothing
ever added that class - the app was always light regardless of OS
preference. Wires up next-themes (already a dependency, pulled in by
sonner.tsx but never provided) with attribute="class", defaulting to
the system preference. Adds a sun/moon ThemeToggle button - in the
header for the authenticated app, and in the top-right corner of the
login page since that route sits outside the header layout.

suppressHydrationWarning moves to <html> too (next-themes sets the
class there via a pre-hydration script, so server/client will
legitimately differ on first paint).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 21:11:27 +02:00
valknarandClaude Sonnet 5 35b0d95792 Remove unused create-next-app placeholder assets
file.svg, globe.svg, next.svg, vercel.svg, and window.svg were only
ever referenced by the scaffolded demo homepage, which is long gone.
Nothing else in the app references them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 21:02:26 +02:00
valknarandClaude Sonnet 5 e779c5a93b Use the header's Terminal icon as the app favicon
Replaces the default create-next-app favicon.ico with an icon.svg
matching lucide-react's Terminal glyph (same one used in the header)
exactly, on a dark rounded-square backdrop so it stays legible at
16x16 in the browser tab regardless of the OS/browser chrome theme.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 21:01:13 +02:00
valknarandClaude Sonnet 5 acc6715a88 Allow timeoutSeconds: 0 to mean no timeout
Previously every script was forced to have a positive timeout capped
at 24h, with no way to run something genuinely unbounded. execa only
enforces its timeout option when it's greater than 0, so this just
relaxes the schema's lower bound from positive to >= 0 and lets that
flow through unchanged - no engine logic needed beyond a clarifying
comment. The 1800s default and 86400s cap for finite timeouts are
unchanged; 0 is an explicit opt-in, not the default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 20:57:24 +02:00
valknarandClaude Sonnet 5 97bb6cc092 Add per-page titles
Root layout now defines a title template (%s · TriggerShell) so every
page just sets its own short title instead of repeating the brand
name. Static titles for the dashboard, login, and run history pages;
dynamic generateMetadata for the script and run detail pages, since
those need the script/run name which isn't known until the route
params resolve.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 20:52:11 +02:00
valknarandClaude Sonnet 5 7daaa95ab9 Hide the Next.js dev-mode route indicator badge
Sets devIndicators: false in next.config.ts. Compile/runtime error
overlays are unaffected - only the floating route-info badge is hidden.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 20:45:46 +02:00
valknarandClaude Sonnet 5 6d7788e48b Keep the TriggerShell wordmark visible on mobile
Only the icon-only nav links, username, and logout label needed to
collapse to fit a phone-width header - the brand text alone doesn't
push it over, so keep it always shown for identity.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 20:40:37 +02:00
valknarandClaude Sonnet 5 88f561230e Fix header horizontal overflow on mobile
The nav bar's brand text, both nav-link labels, the username, and the
logout label were all always rendered, easily exceeding a phone-width
viewport since nothing could shrink or wrap. Collapse to icon-only
below the sm breakpoint (labels stay in the DOM via sr-only so they're
still announced to screen readers, just not painted) and truncate a
long username instead of letting it force overflow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 20:36:55 +02:00
valknarandClaude Sonnet 5 7269886f9e Render run output with xterm.js instead of plain text
Replaces the plain-text output <div> with a real xterm.js terminal
(@xterm/xterm + @xterm/addon-fit), so ANSI color/control codes from
scripts render as actual colors instead of raw escape characters.
stderr chunks are wrapped in ANSI red so failures stand out even from
tools that don't colorize their own output. Also sets FORCE_COLOR=1/
CLICOLOR_FORCE=1 as env defaults (real/script env still wins) since
scripts run without a real TTY and most tools auto-disable color
without one of these overrides.

Fixed a React Strict Mode bug found while testing: the initial log was
written to the terminal via a "write once" ref flag in the parent,
but Strict Mode's dev-only mount->cleanup->remount cycle creates a
fresh Terminal on the real mount, so that flag silently skipped
writing to the surviving instance - the terminal looked completely
blank until live output arrived. Fixed by writing initialData inside
the same effect that creates the Terminal, so it's correct by
construction regardless of how many times the effect runs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 20:29:03 +02:00
valknarandClaude Sonnet 5 20989987f6 Suppress hydration-warning noise from browser-extension DOM tweaks on body
cz-shortcut-listen is ColorZilla's own marker attribute, injected into
<body> client-side before React hydrates - not an app bug. This only
silences mismatches on body's own attributes, not its children, so a
real hydration bug elsewhere would still surface normally.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 19:49:08 +02:00
valknarandClaude Sonnet 5 9dc45f751a Delegate non-/ws/runs upgrade requests to Next instead of dropping them
Our upgrade handler on the shared httpServer was destroying every socket
that wasn't for /ws/runs, which silently killed Next's own dev-mode HMR
websocket (/_next/hmr) too - breaking hot reload with no useful error,
just a failed WebSocket connection in the browser console. Delegate to
app.getUpgradeHandler() instead, which must be called after prepare().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 19:46:41 +02:00
valknarandClaude Sonnet 5 d3e3360d6e Remove deprecated url.parse() usage from the custom server
Node flags legacy url.parse() (DEP0169) as having security implications
and recommends the WHATWG URL API instead. The main request handler's
parsedUrl argument to Next's handle() is optional and unused by us, so
that call is dropped entirely (matching Next's own minimal custom-server
example); the WS upgrade path-check now uses `new URL()` instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 19:41:37 +02:00
valknarandClaude Sonnet 5 466458a664 Point repo URLs at dev.pivoine.art
Replace the placeholder GitHub URL in the scaffolded config template
with the project's real repo, and add matching Repository/repository
metadata to pyproject.toml and app/package.json.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 19:34:54 +02:00
valknarandClaude Sonnet 5 80c11d3bd3 Externalize auth secrets to .env and rename default config to triggershell.yml
sessionSecret was previously baked directly into the scaffolded config file;
`triggershell init` now generates a .env with TRIGGERSHELL_SESSION_SECRET
instead and references it via ${VAR} interpolation, keeping the actual
secret out of the (often committed) config file. `triggershell dev/start/
validate` load that .env automatically without overriding real env vars.

Also renames the default config filename from triggershell.config.yaml to
triggershell.yml throughout the CLI, app, docs, and examples.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 19:15:03 +02:00
valknarandClaude Sonnet 5 ced99a8e75 Initial implementation of TriggerShell
A Python CLI (typer) that bootstraps Node/pnpm and launches a Next.js 16 web
app for running configured shell scripts: YAML config validated by a shared
Zod schema, dynamic per-script forms mapped to shadcn controls, argv-safe
execa execution with live WebSocket streaming, SQLite/Drizzle run history,
and optional argon2 session + API token auth.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-15 18:37:30 +02:00