Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 5 additions & 8 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,10 @@ jobs:
# so if state is ever lost/reset the deploy re-imports the existing
# cloud resources instead of failing or duplicating them.
# Website.Nextjs builds OpenNext itself; do not pre-run wrangler.
bunx alchemy deploy --stage ${{ needs.stage.outputs.stage }} --yes --adopt \
2>&1 | tee /tmp/alchemy-deploy.log
url="$(sed -nE 's/.*url: "(https:\/\/[^"]+)".*/\1/p' /tmp/alchemy-deploy.log | tail -n1)"
if [[ -z "$url" ]]; then
echo "::error::alchemy deploy produced no url output"
exit 1
fi
bunx alchemy deploy --stage "$STAGE" --yes --adopt
# Stack output is JSON; deploy's human-readable quotes vary by CLI.
url="$(ALCHEMY_LOG_LEVEL=error bunx alchemy state read "stackpanel-docs/$STAGE/output" |
jq -er '.url | strings | select(test("^https://[A-Za-z0-9.-]+/?\\z")) | rtrimstr("/")')"
echo "url=$url" >> "$GITHUB_OUTPUT"
echo "Deployed $url"
- name: Smoke check
Expand Down Expand Up @@ -190,7 +187,7 @@ jobs:
SOPS_AGE_KEY: ${{ secrets.SECRETS_AGE_KEY_DEV }}
run: |
set -euo pipefail
bunx alchemy destroy --stage ${{ needs.stage.outputs.stage }} --yes
bunx alchemy destroy --stage "$STAGE" --yes
- name: Mark preview comment as torn down
uses: marocchino/sticky-pull-request-comment@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
# --adopt: resources use stable physical names (stackpanel-web-<stage>),
# so if state is ever lost/reset the deploy re-imports the existing
# cloud resources instead of failing or duplicating them.
bunx alchemy deploy --stage ${{ needs.stage.outputs.stage }} --yes --adopt
bunx alchemy deploy --stage "$STAGE" --yes --adopt
- name: Comment preview URL on PR
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v3
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
SOPS_AGE_KEY: ${{ secrets.SECRETS_AGE_KEY_DEV }}
run: |
set -euo pipefail
bunx alchemy destroy --stage ${{ needs.stage.outputs.stage }} --yes
bunx alchemy destroy --stage "$STAGE" --yes
- name: Mark preview comment as torn down
uses: marocchino/sticky-pull-request-comment@v3
with:
Expand Down
32 changes: 10 additions & 22 deletions .github/workflows/secrets-codegen-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ jobs:
extra-substituters = https://darkmatter.cachix.org
extra-trusted-public-keys = darkmatter.cachix.org-1:7R5qAiOVHxDpFy7yguECfC1JqVDgMdckGc+CDKk2pWA=

- name: Setup Cachix
uses: cachix/cachix-action@v17
with:
name: darkmatter
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Run codegen
env:
# Same key the deploy workflows use — it has decrypt access for every
Expand All @@ -77,15 +72,11 @@ jobs:
SOPS_AGE_KEY: ${{ secrets.SECRETS_AGE_KEY_DEV }}
run: |
set -euo pipefail
# Devshell entry runs the shell-hook which:
# 1. writes .stack/gen/codegen/env-manifest.json (the codegen input)
# 2. invokes `stack codegen build` itself
# We re-invoke `stack codegen build` explicitly afterwards as a
# belt-and-braces guarantee that the build was run with the same SOPS
# key the embedded payloads were encrypted with.
nix develop --command bash -lc '
set -euo pipefail
stack codegen build
# A missing manifest is a valid no-op for projects without env codegen,
# but this repository has encrypted deploy payloads to verify.
nix develop --command bash -ec '
test -s .stack/gen/codegen/env-manifest.json || { echo "Missing env codegen manifest" >&2; exit 1; }
stack codegen build env
'

- name: Verify no drift
Expand All @@ -103,17 +94,14 @@ jobs:
packages/gen/env/src/runtime/generated-payloads/_envs
)

if git diff --quiet -- "${target_paths[@]}"; then
changes=$(git status --porcelain --untracked-files=all -- "${target_paths[@]}")
if [[ -z "$changes" ]]; then
echo "OK: embedded SOPS payloads are in sync with source schemas."
exit 0
fi

echo "::error title=Embedded SOPS payloads are stale::Run \`nix develop --command stackpanel codegen build\` and commit the resulting changes under packages/gen/env/."
echo
echo "===== drift detected in =====" >&2
git diff --name-only -- "${target_paths[@]}" >&2
echo
echo "===== diff (truncated to 200 lines) =====" >&2
git diff -- "${target_paths[@]}" | head -200 >&2
echo "::error title=Embedded SOPS payloads are stale::Run nix develop --command stack codegen build env and commit the changed payloads."
# Report filenames only. Never print generated secret payload contents.
printf '%s\n' "$changes" >&2

exit 1
1 change: 0 additions & 1 deletion .stack/config.apps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ in

linting.oxlint = {
enable = true;
fix = true;
categories = {
correctness = "error";
suspicious = "warn";
Expand Down
2 changes: 1 addition & 1 deletion .stack/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Machine writes will sort keys alphabetically and format with nixfmt.
# For config that needs pkgs/lib (computed values, custom packages),
# use .stack/modules/ (or .stackpanel/modules/) which has full NixOS module context.
# use .stack/modules/ or .stack/nix/ for the full NixOS module context.
# ==============================================================================
{
lib,
Expand Down
5 changes: 0 additions & 5 deletions .stack/data/modules/oxlint.yaml

This file was deleted.

12 changes: 5 additions & 7 deletions apps/docs/alchemy.run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
selectStateBackend,
} from "@stackpanel/infra/lib/deploy";
import * as Alchemy from "alchemy";
import * as Cloudflare from "alchemy/Cloudflare";
import * as Cloudflare from "@alchemy.run/cloudflare";
import * as Effect from "effect/Effect";

const PROJECT = "stackpanel";
Expand Down Expand Up @@ -38,10 +38,9 @@ const program = Effect.gen(function* () {
const stage = yield* Alchemy.Stage;
const hostname = hostnameFor(stage);

// Website.Nextjs runs the wrangler-free OpenNext pipeline from
// `@alchemy.run/frontend-frameworks/nextjs`. Build command lives in
// `open-next.config.ts` (`buildCommand`) — the resource no longer
// accepts a `nextjs.buildCommand` prop.
// Website.Nextjs loads OpenNext from @alchemy.run/frontend-frameworks.
// Keep `bun run build` and the static cache adapter in open-next.config.ts;
// an openNext.buildCommand here would override that native config.
const website = yield* Cloudflare.Website.Nextjs("Docs", {
// Stable physical name prevents orphaned workers when Alchemy's
// per-deploy InstanceId changes (e.g. state loss between CI runs).
Expand Down Expand Up @@ -69,8 +68,7 @@ const program = Effect.gen(function* () {
runWorkerFirst: false,
},
compatibility: {
// Website.Nextjs defaults to 2026-05-12; keep explicit so node:perf_hooks
// (required by OpenNext/Next edge) stays available.
// Preserve the OpenNext runtime independently of the provider's default.
date: "2026-05-12",
flags: [
"nodejs_compat",
Expand Down
26 changes: 18 additions & 8 deletions apps/docs/content/docs/agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,24 @@ When triggered by a config change or manual command, the Agent writes generated

## Authentication

The Agent runs on `localhost` and uses a JWT-based authentication flow:

1. Studio opens in the browser and initiates a pairing request
2. The Agent displays a confirmation prompt (or auto-approves in dev mode)
3. A JWT token is issued for the session
4. All subsequent API calls include the token

This prevents other applications on your machine from accessing the Agent API without your consent.
Choose **Connect to Agent** in Studio and approve the request in the agent's browser window.
Studio saves that pairing for the exact hostname and port you approved. `localhost:9876`,
`127.0.0.1:9876`, and a module development agent on another port have separate pairings.
If you previously paired before endpoint-scoped storage was introduced, pair again once:
Studio discards the old credential rather than guessing which agent it belongs to.
Use a matching Studio and agent version for pairing. If the popup has lost its opener,
it can return to Studio with a short-lived, single-use code. The reusable JWT never
travels in a redirect or bookmark; links containing tokens do not pair a browser.

Before sending a credential, Studio checks the agent ID reported by the public `/health`
endpoint against the ID in the JWT. A replacement agent with a different ID requires a
new pairing. The agent validates the credential before Studio enables clients. Event
streams use an authorization header, never a token in their request URL.

Each Studio tab pins an explicit project ID. On first connect it resolves the current
repository using the agent's project registry and reported root; if there is no current
repository, it can use the registered default. Until a project is known, project-scoped
module actions are unavailable. Use the project picker to select one explicitly.

<Callout type="info">
The Agent only listens on `localhost`—it's never exposed to the network. The JWT auth is an additional layer of protection for multi-user machines or shared environments.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/cli/debug/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Without subcommands (enable/disable/status), this is equivalent to:

The repo path is resolved in order:
1. STACKPANEL_DEV_REPO environment variable
2. dev_mode.repo_path from ~/.config/stackpanel/stackpanel.yaml
2. dev_mode.repo_path from ~/.config/stackpanel/config.yaml
3. Auto-detected from the current working directory

Any arguments after 'debug' are forwarded to the 'go run' invocation.
Expand Down
4 changes: 1 addition & 3 deletions apps/docs/content/docs/cli/project/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ icon: Terminal

Manage Stackpanel projects across your system.

Projects are stored in ~/.config/stackpanel/stackpanel.yaml and can be
accessed from any directory. Each project has a unique ID; v1 API
requests select their project by sending it in the X-Stackpanel-Project header.
Projects and local module links are stored in `~/.config/stackpanel/config.yaml` (or under `XDG_CONFIG_HOME`). Each project has a stable ID; Connect requests select it with the `X-Stackpanel-Project` header.

Examples:
stack project list # List all known projects
Expand Down
4 changes: 1 addition & 3 deletions apps/docs/content/docs/cli/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,7 @@ denials stop the experiment with the provider's diagnostic.
{ "version": 1, "seen": { "playwright": { "revision": 1, "answer": false, "at": "2026-09-04T01:22:11Z" } } }
```

An offer is re-shown only when its author bumps `revision`, or with
`--reconsider`. `.stack/addons.json` from older releases is migrated
automatically.
An offer is shown again only when its author bumps `revision`, or with `--reconsider`. No decisions means no ledger write. If `.stack/reconcile.json` changes between discovery and save, setup refuses to overwrite it; rerun setup to review the current state.

## Global Flags

Expand Down
5 changes: 3 additions & 2 deletions apps/docs/content/docs/concepts/module-system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ All Stackpanel options live under `stackpanel.*`:
| `stackpanel.services.*` | Background service definitions |
| `stackpanel.globalServices.*` | Convenience services (postgres, redis, minio) |
| `stackpanel.secrets.*` | Encrypted secrets and master keys |
| `stackpanel.extensions.*` | Extension registration and config |
| `stackpanel.modules.*` | Module registration, actions, settings, and activation |
| `stackpanel.panels.*` | Module-owned panels and their placement in Studio |
| `stackpanel.ports.*` | Port computation settings |
| `stackpanel.ide.*` | IDE integration (VS Code, Zed) |
| `stackpanel.apps.*` | Application definitions |
Expand All @@ -92,7 +93,7 @@ Your flake.nix
→ loads .stack/config.nix (your config)
→ loads .stack/config.local.nix (per-user overrides, gitignored)
→ loads all builtin modules (services, IDE, secrets, etc.)
→ loads all enabled extensions
→ imports local modules and discovered flake inputs; enablement gates behavior
→ the module system merges everything
→ outputs: devshell, generated files, scripts, services
```
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/dev-environment/flake-inputs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ stack flake add-input process-compose-flake \

### Adding an Import at the Same Time

If the input provides a Stackpanel module, you probably also need to add it to `stackpanelImports` in your flake outputs. Use `--module-path` to do both in one command:
Direct inputs that export `stackpanelModules.default` are discovered when automatic imports are enabled. To import a module explicitly, pass its attribute path:

```bash
stack flake add-input my-module github:author/my-module \
--module-path stackpanelModules.default
```

This inserts the input **and** adds `inputs.my-module.stackpanelModules.default` to your `stackpanelImports` list. The command detects whether `stackpanelImports` is defined anywhere in your flake (inside `mkFlake`, in the outputs function, etc.) and inserts into the right place.
This adds the input and an explicit `inputs.my-module.stackpanelModules.default` entry to `stackpanelImports` in a supported flake. If the editor cannot locate a safe insertion point, the command fails instead of silently dropping the import.

## Previewing Changes

Expand Down
Loading
Loading