Skip to content

Commit 6e19277

Browse files
claudesinelaw
authored andcommitted
docs: correct dashboard, init.ts, devcontainer docs against shipped impl
Audit pass against the actual 0.3.0 implementations turned up several drift points where the docs over- or under-described the feature: - dashboard: weather and github are opt-in (only git/disk register by default); document the `Show Dashboard` palette command, the `auto-open` config flag, and `builtinHandlers` for opting in. Round out the symbolic-color list with `number` and `branch`. - init.ts: command names include the `init.ts` suffix; `init: Edit init.ts` also writes `types/plugins.d.ts`; `init: Check init.ts` is a syntax check (oxc), not a TypeScript type-check; document the 3-failure crash fuse. - devcontainer: add the missing palette commands (`Cancel Startup`, `Show Build Logs`, `Show Forwarded Ports`) and correct the failed- attach popup actions to `Retry`, `Show Build Logs`, `Reopen Locally`. https://claude.ai/code/session_019puRSPYLWiAQXbSCzYttR9
1 parent 19f957d commit 6e19277

4 files changed

Lines changed: 29 additions & 11 deletions

File tree

docs/blog/fresh-0.3.0/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ See the [Startup Script guide](/configuration/init) for the full picture.
2121

2222
## Dashboard
2323

24-
A built-in TUI dashboard replaces the default `[No Name]` buffer with weather info, git status + repo URL, a "vs master" commits-ahead/behind row, open GitHub PRs for the current repo, and disk usage for common mounts. Enable it via `plugins.dashboard.enabled` in `config.json` or the Settings UI. Third-party plugins and your `init.ts` can contribute custom sections through the `registerSection()` API — see the [Dashboard feature page](/features/dashboard).
24+
A built-in TUI dashboard replaces the default `[No Name]` buffer with git status + repo URL, a "vs master" commits-ahead/behind row, and disk usage for common mounts. Optional weather and GitHub-PR widgets ship in the box and can be wired up from `init.ts` since they hit the network. Enable the plugin via `plugins.dashboard.enabled` in `config.json` or the Settings UI. Third-party plugins and your `init.ts` can contribute custom sections through the `registerSection()` API — see the [Dashboard feature page](/features/dashboard).
2525

2626
<div class="showcase-demo">
2727
<img src="./dashboard/showcase.gif" alt="Dashboard demo" />

docs/configuration/init.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ if (editor.getEnv("FRESH_PROFILE") === "writing") {
7272

7373
## Editing and reloading
7474

75-
- **`init: Edit`** from the command palette opens (or creates) `~/.config/fresh/init.ts` with a starter template. The same command also writes `types/fresh.d.ts` and a `tsconfig.json` so LSP gives you completions against the real plugin API.
76-
- **`init: Reload`** re-runs the file without restarting Fresh.
77-
- **`init: Check`** type-checks without running.
75+
- **`init: Edit init.ts`** from the command palette opens (or creates) `~/.config/fresh/init.ts` with a starter template. The same command also refreshes `types/fresh.d.ts`, writes `types/plugins.d.ts` (so `editor.getPluginApi("dashboard")` and friends are typed), and creates a `tsconfig.json` on first run.
76+
- **`init: Reload init.ts`** re-runs the file without restarting Fresh.
77+
- **`init: Check init.ts`** runs a syntax check (oxc parser) and reports parse errors. It does not run a full TypeScript type-check.
7878
- **`fresh --no-init`** (alias `--safe`) skips loading for a single launch — useful if the file errors out.
79+
- **Crash fuse:** if `init.ts` fails to evaluate three times in a row within five minutes, the next launch auto-skips it until you fix or remove the file. A successful evaluation clears the counter.
7980

8081
The full API surface is the same as plugins — see the [Plugin API reference](/plugins/api/).
8182

docs/features/dashboard.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Dashboard
22

3-
> **Activation:** `plugins.dashboard.enabled` in `config.json`, or in the Settings UI under **Plugins → dashboard**. No palette command.
3+
> **Activation:** `plugins.dashboard.enabled` in `config.json`, or in the Settings UI under **Plugins → dashboard**.
4+
>
5+
> **Palette:** `Show Dashboard` (available once the plugin is enabled).
46
5-
Fresh includes a built-in TUI dashboard plugin that replaces the default `[No Name]` buffer you see after `fresh` with no arguments. It shows weather info, git status and repo URL, a "vs master" row (commits ahead/behind), recent GitHub PRs for the current repo, and disk usage for common mounts.
7+
Fresh includes a built-in TUI dashboard plugin that replaces the default `[No Name]` buffer you see after `fresh` with no arguments. By default it shows git status and repo URL, a "vs master" row (commits ahead/behind), and disk usage for common mounts. Weather and recent GitHub PRs are bundled but opt-in — see [Built-in opt-in widgets](#built-in-opt-in-widgets) below.
68

79
## Enabling
810

@@ -16,14 +18,29 @@ The dashboard is off by default. Turn it on from the Settings UI (**Open Setting
1618
}
1719
```
1820

21+
Once enabled, the dashboard auto-opens at startup and after the last buffer is closed. To keep the plugin loaded but skip those ambient open paths — leaving `Show Dashboard` as the only entry point — set `plugins.dashboard.auto-open` to `false`. The default is `true`.
22+
1923
## Tips
2024

2125
- The dashboard only renders in buffers that have no file attached, so opening any file replaces it — you don't need to close it manually.
22-
- Weather and GitHub widgets need network access; if either is unreachable, the section is quietly hidden rather than blocking the rest of the dashboard.
2326
- `git` must be on `PATH` for the git and "vs master" rows to populate.
24-
- The GitHub section shows open PRs for the *current repo* (detected from the `origin` remote). Outside a GitHub clone, it renders a short explanatory message instead.
2527
- **Keyboard navigation**`Tab` / `Down` / `j` step to the next clickable row, `Shift+Tab` / `Up` / `k` step back, `Enter` activates. Mouse clicks still work.
2628

29+
## Built-in opt-in widgets
30+
31+
`weather` and `github` ship with the plugin but aren't registered by default — both hit the network on every refresh, so opting in is explicit. Their refresh handlers live on the plugin API as `builtinHandlers`; pass either to `registerSection` from your [`init.ts`](../configuration/init.md):
32+
33+
```ts
34+
editor.on("plugins_loaded", () => {
35+
const dash = editor.getPluginApi("dashboard");
36+
if (!dash) return;
37+
dash.registerSection("weather", dash.builtinHandlers.weather);
38+
dash.registerSection("github", dash.builtinHandlers.github);
39+
});
40+
```
41+
42+
The GitHub section shows open PRs for the *current repo* (detected from the `origin` remote). Outside a GitHub clone, it renders a short explanatory message instead. If either widget can't reach its endpoint, the section surfaces a one-line error rather than blocking the rest of the dashboard.
43+
2744
## Adding Your Own Sections
2845

2946
Third-party plugins and your [`init.ts`](../configuration/init.md) can contribute their own rows through the dashboard's plugin API:
@@ -44,7 +61,7 @@ editor.on("plugins_loaded", () => {
4461
});
4562
```
4663

47-
The `ctx` parameter exposes `kv`, `text`, `newline`, and `error` primitives. Colors are symbolic (`"muted"`, `"accent"`, `"ok"`, `"warn"`, `"err"`, `"value"`), so sections pick up theme changes automatically. `onClick` is routed through the editor's mouse-click dispatcher and works even in terminals that strip OSC-8 hyperlinks.
64+
The `ctx` parameter exposes `kv`, `text`, `newline`, and `error` primitives. Colors are symbolic (`"muted"`, `"accent"`, `"value"`, `"number"`, `"ok"`, `"warn"`, `"err"`, `"branch"`), so sections pick up theme changes automatically. `onClick` is routed through the editor's mouse-click dispatcher and works even in terminals that strip OSC-8 hyperlinks.
4865

4966
`registerSection` returns a function you can call to remove that one section later; `dash.clearAllSections()` drops every section a plugin has registered. Call these when your plugin unloads so hot-reload doesn't leave stale rows.
5067

docs/features/devcontainer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Devcontainers
22

3-
> **Palette:** `Dev Container: Attach`, `Dev Container: Detach`, `Dev Container: Rebuild`, `Dev Container: Create Config`, `Dev Container: Show Info`, `Dev Container: Show Ports`, `Dev Container: Show Logs`, `Dev Container: Show Features`, `Dev Container: Open Config`, `Dev Container: Run Lifecycle Command`. A proactive popup also appears on launch for projects with a `.devcontainer/devcontainer.json`.
3+
> **Palette:** `Dev Container: Attach`, `Dev Container: Detach`, `Dev Container: Rebuild`, `Dev Container: Cancel Startup`, `Dev Container: Create Config`, `Dev Container: Show Info`, `Dev Container: Show Ports`, `Dev Container: Show Forwarded Ports`, `Dev Container: Show Logs`, `Dev Container: Show Build Logs`, `Dev Container: Show Features`, `Dev Container: Open Config`, `Dev Container: Run Lifecycle Command`. A proactive popup also appears on launch for projects with a `.devcontainer/devcontainer.json`.
44
55
Fresh detects projects that ship a `.devcontainer/devcontainer.json` and prompts to **Attach** or **Rebuild** the container. When attached, the embedded terminal runs *inside* the container, and filesystem and process operations target the container instead of your host — including LSP servers, which Fresh spawns through the container so you don't need a host toolchain.
66

@@ -20,7 +20,7 @@ If a project doesn't have a `.devcontainer/devcontainer.json` yet, run **Dev Con
2020

2121
Open a project that contains `.devcontainer/devcontainer.json`. Run **Dev Container: Attach** from the command palette (`Ctrl+P`). The first attach runs the devcontainer `initializeCommand` (if any) on the host, then builds and starts the container; subsequent attaches reuse it. **Dev Container: Rebuild** forces a full rebuild — reach for it after changing the Dockerfile or `devcontainer.json`.
2222

23-
During build or attach, the **build log** streams into a workspace split. If an attach fails, a recovery popup offers **Retry**, **Show Logs**, or **Detach**; subsequent launches don't re-prompt. The status-bar **{remote}** indicator tracks the lifecycle — `Connecting`, `Connected`, or `FailedAttach` — and clicking it opens a context-aware menu.
23+
During build or attach, the **build log** streams into a workspace split. If an attach fails, a recovery popup offers **Retry**, **Show Build Logs**, or **Reopen Locally** (Esc dismisses without changing authority). The launch-time attach prompt itself is one-shot per workspace: once you choose Attach or Dismiss, reopening the same project doesn't re-prompt. The status-bar **{remote}** indicator tracks the lifecycle — `Connecting`, `Connected`, or `FailedAttach` — and clicking it opens a context-aware menu.
2424

2525
While attached:
2626

0 commit comments

Comments
 (0)