@stacksjs/defaults 0.75.301 → 0.75.305

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ai/AGENTS.md CHANGED
@@ -78,6 +78,10 @@ review the generated SQL and snapshot, then apply with `./buddy migrate`.
78
78
  and `stacks-router` for selection, authentication, ownership, and mount behavior.
79
79
  Use `stacks-auto-imports` to distinguish browser bindings from declarations
80
80
  and explicit module imports.
81
+ Before adding imports in app code, read the relevant section of
82
+ `storage/framework/auto-imports/RUNTIME.md` and use its listed names directly
83
+ in their stated context. `buddy generate`, `buddy generate:auto-imports` and
84
+ `buddy setup:ai` refresh this inventory from the runtime registries.
81
85
 
82
86
  **Subsystem reference**, one per area (`stacks-orm`, `stacks-router`,
83
87
  `stacks-queue`, ...), each documenting it authoritatively. Read the relevant
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-auto-imports
3
- description: Use when checking browser/server binding delivery, model globals, registry generation, or the difference between ambient declarations and runtime imports. Covers Stacks auto-imports, stx client delivery, server boot and generated registries (107 models).
3
+ description: Use before adding imports in Stacks app code, checking available runtime functions, browser/server delivery, model globals, or registry generation. Covers Stacks auto-imports, the generated runtime inventory, stx client delivery and server boot (107 models).
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -8,6 +8,21 @@ allowed-tools: Read Edit Write Bash Grep Glob
8
8
 
9
9
  # Auto-imports and runtime delivery
10
10
 
11
+ ## Available names in this project
12
+
13
+ Before adding imports, read the relevant section of
14
+ `storage/framework/auto-imports/RUNTIME.md` (relative to the project root).
15
+ Use its listed names directly in their stated execution context to avoid
16
+ redundant imports. This compact reference groups server globals by package
17
+ and barrel, and STX client helpers by runtime, macro and demand delivery.
18
+ It is generated from runtime registries, including app helpers and overrides.
19
+
20
+ `buddy generate`, `buddy generate:types`, `buddy generate:auto-imports` and
21
+ `buddy setup:ai` refresh it. If missing, run `buddy generate:auto-imports`.
22
+ The inventory stays in the project so copied skills read the current app's
23
+ names after subsequent generation. Keep package implementation files and
24
+ standalone scripts self-contained with explicit imports.
25
+
11
26
  A declaration, a delivered client binding, and an initialized server global are
12
27
  three different facts. Inspect the relevant runtime rather than inferring all
13
28
  three from an ambient type file.
@@ -48,9 +63,10 @@ utilities are imported types; UserRequest/UserRequestModel are not generated
48
63
  runtime model variants. Names colliding with built-ins, such as Error/Request,
49
64
  need explicit imports and safe local aliases.
50
65
 
51
- Import Action, route, response, schema, path, storage, logging and Auth from their
52
- packages. An ambient helper declaration alone does not establish its global
53
- runtime initialization. Follow the built-in action's import pattern.
66
+ The server's primitiveModules registry also injects framework helpers such as
67
+ Action, route, response, schema, path, storage, log and Auth. Use the generated
68
+ inventory to select bare names after Stacks boot. Package internals, standalone
69
+ tools and tests without boot still import their dependencies explicitly.
54
70
 
55
71
  ## Generation and project overrides
56
72
 
@@ -28,7 +28,7 @@ The driver finds a browser at runtime in this order, and falls through to the ne
28
28
  won't launch:
29
29
 
30
30
  1. `$BROWSE_BROWSER` (explicit override — set to an absolute browser path)
31
- 2. PATH: `chromium`, `google-chrome`, `brave-browser`, `microsoft-edge`, …
31
+ 2. PATH: `google-chrome-stable`, `google-chrome`, `chromium`, `chromium-browser`, `brave-browser`, `microsoft-edge`, …
32
32
  3. macOS app bundles (Google Chrome, Chromium, Brave, Edge)
33
33
  4. A Chromium binary already cached on disk (e.g. under `~/Library/Caches/ms-playwright`) —
34
34
  the **binary only** is borrowed; Playwright is never imported.
@@ -121,6 +121,10 @@ bun storage/framework/defaults/ai/skills/stacks-browse/scripts/browse.ts scenari
121
121
  Steps run in order within one isolated browser page, preserving reactive STX state and SPA navigation. Supported actions are `click`, `fill`, `focus`, `press`, `wait`, `evaluate`, and `assert`. Each step is a JSON object passed through a repeatable `--step` flag. Click and focus steps may include `text` to select the matching control from their CSS selector. They scroll matched controls into view before interacting, including controls inside horizontal overflow regions. Evaluate steps run a JavaScript expression in the isolated page and return its serialized value, which is useful for inspecting STX signals and DevTools state between interactions. The command reports every completed step, the final URL and page text, console messages, console exceptions, failed requests, and an optional screenshot. It exits nonzero when the scenario assertion, evaluation, browser console, or network fails.
122
122
  On a failed step, execution stops and the report retains its number and error,
123
123
  the completed steps, final page state and requested screenshot.
124
+ If final page or screenshot collection fails, the report keeps the completed
125
+ steps and available console/network observations, sets the missing result to
126
+ `null`, and records its phase and error in `collectionErrors`. The command still
127
+ exits nonzero. A missing capture does not qualify an older raster as evidence.
124
128
  Use `{"action":"assert","selector":"...","absent":true}` to verify that an element is missing or hidden after an interaction.
125
129
  Use `{"action":"assert","selector":"button","text":"Save","focused":true}` to verify keyboard focus and focus restoration.
126
130
  `press` sends native virtual key codes for Enter, Escape, Tab, the arrow keys,
@@ -45,7 +45,9 @@ function collectCandidates(): string[] {
45
45
  if (process.env.BROWSE_BROWSER)
46
46
  add(process.env.BROWSE_BROWSER)
47
47
 
48
- for (const bin of ['chromium', 'chromium-browser', 'google-chrome-stable', 'google-chrome', 'brave-browser', 'microsoft-edge', 'chrome'])
48
+ // Some distribution Chromium launchers answer --version but cannot open a
49
+ // DevTools target. Prefer an installed Chrome before spending their bounds.
50
+ for (const bin of ['google-chrome-stable', 'google-chrome', 'chromium', 'chromium-browser', 'brave-browser', 'microsoft-edge', 'chrome'])
49
51
  add(which(bin))
50
52
 
51
53
  for (const p of [
@@ -703,7 +705,9 @@ export async function runScenarioStep(cdp: Pick<Cdp, 'send'>, step: ScenarioStep
703
705
  const key = step.key || ''
704
706
  // CDP's key name alone does not perform native navigation or scrolling.
705
707
  // Supply the matching virtual key on both events, as a real keyboard does.
706
- const keyCode = key.length === 1 ? key.charCodeAt(0) : ({
708
+ const letter = /^[a-z]$/i.test(key), digit = /^[0-9]$/.test(key)
709
+ const code = letter ? `Key${key.toUpperCase()}` : digit ? `Digit${key}` : key === ' ' ? 'Space' : key
710
+ const keyCode = key.length === 1 ? (letter ? key.toUpperCase() : key).charCodeAt(0) : ({
707
711
  Backspace: 8, Tab: 9, Enter: 13, Escape: 27,
708
712
  PageUp: 33, PageDown: 34, End: 35, Home: 36,
709
713
  ArrowLeft: 37, ArrowUp: 38, ArrowRight: 39, ArrowDown: 40,
@@ -712,8 +716,8 @@ export async function runScenarioStep(cdp: Pick<Cdp, 'send'>, step: ScenarioStep
712
716
  if (!keyCode) throw new Error(`Unsupported scenario key: ${JSON.stringify(key)}`)
713
717
  // Enter's text generates the keypress that activates native buttons/forms.
714
718
  const text = key === 'Enter' ? '\r' : undefined
715
- await cdp.send('Input.dispatchKeyEvent', { type: 'keyDown', key, code: key, windowsVirtualKeyCode: keyCode, text, unmodifiedText: text })
716
- await cdp.send('Input.dispatchKeyEvent', { type: 'keyUp', key, code: key, windowsVirtualKeyCode: keyCode })
719
+ await cdp.send('Input.dispatchKeyEvent', { type: 'keyDown', key, code, windowsVirtualKeyCode: keyCode, text, unmodifiedText: text })
720
+ await cdp.send('Input.dispatchKeyEvent', { type: 'keyUp', key, code, windowsVirtualKeyCode: keyCode })
717
721
  return { action: step.action, key, ok: true }
718
722
  }
719
723
 
@@ -999,8 +1003,11 @@ async function main() {
999
1003
  await Bun.sleep(step.settle ?? 250)
1000
1004
  }
1001
1005
 
1002
- const finalState = await cdp.send('Runtime.evaluate', {
1003
- expression: `({
1006
+ const collectionErrors: { phase: string, error: string }[] = []
1007
+ let finalState: unknown = null
1008
+ try {
1009
+ const collected = await cdp.send('Runtime.evaluate', {
1010
+ expression: `({
1004
1011
  url: location.href,
1005
1012
  title: document.title,
1006
1013
  focusHistory: window.__browseFocusHistory || [],
@@ -1014,26 +1021,38 @@ async function main() {
1014
1021
  } : null,
1015
1022
  bodyText: (document.body.innerText || '').replace(/\\s+/g, ' ').trim().slice(0, 500),
1016
1023
  })`,
1017
- returnByValue: true,
1018
- })
1024
+ returnByValue: true,
1025
+ })
1026
+ finalState = collected.result?.value ?? null
1027
+ }
1028
+ catch (error) {
1029
+ collectionErrors.push({ phase: 'final-state', error: error instanceof Error ? error.message : String(error) })
1030
+ }
1019
1031
  let screenshot: string | null = null
1020
1032
  if (typeof flags.out === 'string') {
1021
- screenshot = flags.out
1022
- mkdirSync(screenshot.split('/').slice(0, -1).join('/') || '.', { recursive: true })
1023
- await Bun.write(screenshot, await captureScreenshot(cdp, { full: !!flags.full }))
1033
+ try {
1034
+ const output = flags.out
1035
+ mkdirSync(output.split('/').slice(0, -1).join('/') || '.', { recursive: true })
1036
+ await Bun.write(output, await captureScreenshot(cdp, { full: !!flags.full }))
1037
+ screenshot = output
1038
+ }
1039
+ catch (error) {
1040
+ collectionErrors.push({ phase: 'screenshot', error: error instanceof Error ? error.message : String(error) })
1041
+ }
1024
1042
  }
1025
1043
  const failedRequests = state.responses.filter(response => response.status >= 400)
1026
1044
  console.log(JSON.stringify({
1027
1045
  url,
1028
1046
  viewport: `${viewport.w}x${viewport.h}`,
1029
1047
  steps: results,
1030
- final: finalState.result?.value,
1048
+ final: finalState,
1031
1049
  screenshot,
1050
+ collectionErrors,
1032
1051
  consoleMessages: state.console,
1033
1052
  consoleErrors: state.consoleErrors,
1034
1053
  failedRequests,
1035
1054
  }, null, 2))
1036
- if (scenarioFailed || state.consoleErrors.length || failedRequests.length)
1055
+ if (scenarioFailed || collectionErrors.length || state.consoleErrors.length || failedRequests.length)
1037
1056
  process.exitCode = 1
1038
1057
  state.dispose()
1039
1058
  cdp.close()
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-buddy
3
- description: Use when working with the Stacks CLI (buddy/bud/stacks/stx) - understanding every command with its flags and options, adding custom commands, the make:* scaffolding commands, development server commands, build commands, deployment commands, email/mail commands, environment management, or domain/DNS commands. Covers @stacksjs/buddy and all CLI command files.
3
+ description: Use when working with the Stacks CLI (buddy/bud/stacks) - understanding every command with its flags and options, adding custom commands, the make:* scaffolding commands, development server commands, build commands, deployment commands, email/mail commands, environment management, or domain/DNS commands. Covers @stacksjs/buddy and all CLI command files.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -22,7 +22,8 @@ The complete CLI runtime for the Stacks framework, lazy-loaded for fast cold sta
22
22
  - Make templates: `storage/framework/defaults/`
23
23
 
24
24
  ## CLI Aliases
25
- All invoke the same CLI: `./buddy`, `bud`, `stacks`, `stx`
25
+ `./buddy`, `bud`, and `stacks` invoke the Stacks CLI. The `stx` binary belongs
26
+ to the STX template engine; use it for template and native screen compilation.
26
27
 
27
28
  ## Architecture
28
29
 
@@ -12,6 +12,10 @@ Choose the execution surface before copying a composable signature. An STX
12
12
  client script, an explicitly imported `@stacksjs/composables` module, and a
13
13
  server script can expose similarly named functions with different contracts.
14
14
  Read [BROWSER.md](BROWSER.md) for template delivery, forms and motion examples.
15
+ For the complete installed client surface, read the STX section of
16
+ `storage/framework/auto-imports/RUNTIME.md` at the project root. Use those
17
+ helpers directly in client scripts; generation refreshes runtime, macro and
18
+ demand names from the installed STX registries.
15
19
 
16
20
  ## Eager window aliases
17
21
 
@@ -21,7 +21,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
21
21
  | `@stacksjs/auth` | [`stacks-auth`](../stacks-auth/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/index.ts) | 120 |
22
22
  | `@stacksjs/browser` | [`stacks-browser`](../stacks-browser/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/index.ts) | 8 |
23
23
  | `@stacksjs/browser-extension` | [`stacks-browser-extension`](../stacks-browser-extension/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser-extension/src/index.ts) | 7 |
24
- | `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 165 |
24
+ | `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 166 |
25
25
  | `@stacksjs/build` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/build/src/index.ts) | 3 |
26
26
  | `@stacksjs/cache` | [`stacks-cache`](../stacks-cache/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cache/src/index.ts) | 14 |
27
27
  | `@stacksjs/calendar-api` | [`stacks-calendar`](../stacks-calendar/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/calendar-api/src/index.ts) | 2 |
@@ -79,7 +79,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
79
79
  | `@stacksjs/scheduler` | [`stacks-scheduler`](../stacks-scheduler/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/src/index.ts) | 14 |
80
80
  | `@stacksjs/search-engine` | [`stacks-search-engine`](../stacks-search-engine/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/search-engine/src/index.ts) | 11 |
81
81
  | `@stacksjs/security` | [`stacks-security`](../stacks-security/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/security/src/index.ts) | 11 |
82
- | `@stacksjs/server` | [`stacks-server`](../stacks-server/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/index.ts) | 27 |
82
+ | `@stacksjs/server` | [`stacks-server`](../stacks-server/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/index.ts) | 28 |
83
83
  | `@stacksjs/shell` | [`stacks-shell`](../stacks-shell/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/shell/src/index.ts) | 1 |
84
84
  | `@stacksjs/sites` | [`stacks-sites`](../stacks-sites/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/sites/src/index.ts) | 3 |
85
85
  | `@stacksjs/skills` | [`stacks-skills`](../stacks-skills/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/skills/src/index.ts) | 1 |
@@ -217,7 +217,7 @@ Read the entrypoint and package export map for re-exported or type-only surfaces
217
217
 
218
218
  Local source modules: [src/commands/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/commands/index.ts).
219
219
 
220
- Evidence directory: [165 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
220
+ Evidence directory: [166 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
221
221
 
222
222
  ### @stacksjs/build
223
223
 
@@ -765,7 +765,7 @@ Declared runtime exports: `server`.
765
765
 
766
766
  Local source modules: [src/config.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/config.ts), [src/controllers/base.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/controllers/base.ts), [src/imports.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/imports.ts), [src/maintenance.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/maintenance.ts), [src/proxy.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/proxy.ts), [src/redirects.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/redirects.ts), [src/response-headers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/response-headers.ts), [src/rewrites.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/rewrites.ts), [src/security-headers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/security-headers.ts), [src/shadowed-defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/shadowed-defaults.ts).
767
767
 
768
- Evidence directory: [27 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
768
+ Evidence directory: [28 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
769
769
 
770
770
  ### @stacksjs/shell
771
771
 
@@ -48,6 +48,10 @@ the cases that require an action, job, policy, or explicit route.
48
48
 
49
49
  ## Important boundaries
50
50
 
51
+ - Before adding imports in app code, consult the context-specific names in
52
+ `storage/framework/auto-imports/RUNTIME.md` at the project root. Use listed
53
+ runtime helpers directly; read `stacks-auto-imports` for initialization and
54
+ module boundaries. Generation refreshes the inventory for this app.
51
55
  - `app/` overrides framework defaults. Use `extendModel` for additive model
52
56
  changes; an ordinary override replaces the definition.
53
57
  - Generated CRUD defaults to authenticated routes. Ownership and policies
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.301",
5
+ "version": "0.75.305",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.301",
5
+ "version": "0.75.305",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -45,9 +45,9 @@
45
45
  "dependencies": {
46
46
  "@iconify-json/f7": "^1.2.2",
47
47
  "@iconify-json/hugeicons": "^1.2.35",
48
- "@stacksjs/mobile": "0.75.301",
49
- "@stacksjs/sanitizer": "0.2.687",
50
- "@stacksjs/stx": "0.2.687",
48
+ "@stacksjs/mobile": "0.75.305",
49
+ "@stacksjs/sanitizer": "0.2.691",
50
+ "@stacksjs/stx": "0.2.691",
51
51
  "@xterm/addon-fit": "^0.11.0",
52
52
  "@xterm/xterm": "^6.0.0",
53
53
  "ts-qr-codes": "^0.1.8"