-
Notifications
You must be signed in to change notification settings - Fork 0
Cleanups
Historical log of code we deleted and why. If something breaks or you need a deleted helper back, find it here first; the entry tells you what it was and what to do.
This page grows over time. Newest at the top.
The picker's "Choose Folder…" entry used to push a Raycast Form view containing a Form.FilePicker (configured for directories only). The user clicked through the form, clicked the FilePicker to open the OS folder dialog, picked, then clicked the Submit action. Two screens and three clicks for what is logically one operation.
What replaced it: A direct shell-out to osascript -e 'POSIX path of (choose folder ...)' from the action's onAction. The native macOS folder dialog opens immediately; on pick, we resolve the target and launchSpawn as before. Cancellation is detected by osascript exiting non-zero, treated as a silent no-op.
Side removals: the Form and useNavigation imports in src/start.tsx (no longer used), and the entire ChooseFolderForm component (~45 lines).
If you want it back: restore the component and the import. The shape was a Form with one Form.FilePicker (canChooseDirectories, canChooseFiles={false}, allowMultipleSelection={false}) and an Action.SubmitForm whose onSubmit did the same target-resolution + launchSpawn the current handler does inline.
Why you might want it back: if a Windows port lands and there's no equivalent to osascript for that platform, the Form fallback is what you'd revert to. The Form.FilePicker API is cross-platform; the native shell-out isn't.
After landing the Start Dev Server command and the dashboard's spawn state machine, a review pass surfaced a few unused exports and outdated comments. Removed in commit chore: post-review cleanup.
What: A field on the RecentProject interface in src/recents.ts, mirroring the projectKey from DevServer (the git common-dir path or cwd for non-git projects).
Why removed: The comment claimed "for joining against running servers" but nothing ever read it. The picker joined by cwd directly. Dead data stored in every recents entry.
If you want it back: Re-add to the interface, populate from s.projectKey in toRecent(), and update the recordSeen call in the dashboard's spawn flow. Use case would be grouping recents by repo (worktree-collapsing) the way the dashboard does; currently the picker shows each cwd as a separate row.
What: An exported async function that returned the recents array sorted by lastSeen desc.
Why removed: Never imported. The picker uses useLocalStorage directly for the same data with reactivity included.
If you want it back: Trivial, just three lines:
export async function getRecents(): Promise<RecentProject[]> {
const recents = await readAll();
recents.sort((a, b) => b.lastSeen - a.lastSeen);
return recents;
}Use case would be a non-React caller (a no-view command, a menu-bar command) that needs to peek at recents without mounting a view.
What: An exported async function that canonicalized a cwd and removed any matching entry from LocalStorage by direct write.
Why removed: Only caller was the picker's row delete action, which now uses setRecents(filtered) to drive the deletion through useLocalStorage (the hook is the single writer). Direct LocalStorage writes from outside the hook risk getting overwritten by subsequent setValue calls; see the "picker refresh" entry below.
If you want it back: Restore the body:
export async function removeRecent(cwd: string): Promise<void> {
const target = canonicalCwd(cwd);
const recents = await readAll();
await writeAll(recents.filter((r) => canonicalCwd(r.cwd) !== target));
}Use case would be deletions from non-React contexts (e.g., a "Clear all recents" no-view command).
What: An optional second parameter on startDevServer(cwd, scriptName?) that bypassed pickDevScript and used the provided script name instead.
Why removed: No caller ever passed it. The signature suggested a feature (override the script) that wasn't actually plumbed through any UI.
If you want it back: Re-add the parameter and the ?? default:
export async function startDevServer(cwd: string, scriptName?: string) {
const script = scriptName ?? pickDevScript(cwd);
// ...
}This is the natural entry point for the per-project script override feature on the Roadmap. When you build that feature, this is the parameter you'll plumb through.
What: startDevServer returned Promise<{ pm: PackageManager; script: string }> so callers could surface the detected manager and chosen script in success messages.
Why removed: No caller used the return value. Comments claimed it was "for surfacing in success messages", which was aspirational, not factual.
If you want it back: Change the return type and add the return statement:
export async function startDevServer(cwd: string): Promise<{ pm: PackageManager; script: string }> {
// ... existing body
return { pm, script };
}Use case: a success toast saying "Started Artusion with pnpm run dev" instead of just "Artusion is running". Cosmetic but informative.
What was wrong: The picker's "Remove from Recents" flow used to write directly to LocalStorage via removeRecent(cwd), then call setValue([...recents]) to force a re-render. useLocalStorage doesn't re-read storage on setValue; it writes the passed value. So the second call could overwrite the deletion with the (still-stale) in-memory value.
What replaced it: A handleRemove(targetCwd) in PickerView that filters the current recents and calls setRecents(filtered). The hook is the single writer; no dual-write race.
If you ever need to write to the recents store from a non-React context: Use the read-modify-write pattern (read via LocalStorage.getItem, mutate, write back). Don't mix with a useLocalStorage hook in the same path.
Not a removal. Both helpers remain. But the comments now spell out the semantic difference:
-
killProcess(pid): SIGTERM, graceful. Used by user-initiated Kill / Kill All actions from the dashboard. Gives the dev server a chance to flush logs and close connections. -
killServer(pid): SIGKILL + wait-for-exit. Used by the restart pre-spawn step where we need the port released immediately so the new server can bind without racing.
If you add a new "kill" code path, pick based on whether the user wants graceful (killProcess) or immediate-port-release (killServer).
Not a removal, but it had been an unused export. The restart-timeout toast in the dashboard previously showed a wildcard hint (dev-servers-spawn-*.log) which forced the user to guess. It now uses spawnLogPath(server.cwd) to point at the exact file.
Anywhere else that surfaces a spawn-log location should use this helper too; it keeps the path format in one place.