Repository navigation
feat: scripts, steps that are code - #23
Merged
Merged
Conversation
…s, run in flows or on their own Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… embed them Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e, in flows Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nstile demo Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…icon Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A script is a step of a flow that is code instead of a request, such as a payment SDK that needs a browser or a library that runs anywhere. It is modelled on a request:
with(),withMock(),capture,assert,tagsandsafe.scripts/<name>.script.tsholds the inputs (the same controls a flow uses), where it runs, and the body.outputfield. What the body returns is the output type, so the next step reads it asctx.captured.<name>and the compiler checks the name.withMockreturns what themockenvironment answers, from the inputs. A script without one fails onmock, andspecbook checkwarns.run, or in its own file withload: () => import('./x.browser'). That file exportsrun, so the portal fetches an SDK's code only when the step runs and a bundle leaves it out.specbook testand bundles run node and isomorphic ones. A flow that needs another host is skipped as a whole and counts as passed. Onmockevery script answers, so CI still checks the flow.specbook testrunsscripts/**/*.script.ts, the catalog lists it under Scripts, and an embed opens it withdata-specbook-script.h.loadScript(url, { global, integrity, once }). Loads a file once per address by default, for the page's life or one test run.once: falseloads it again on that call.Commits
Six commits by area (core, vite, cli, ui, example, docs), plus one that orders the reference sidebar and gives the custom pages the same section link icon as Starlight. Squash is fine.
Testing
specbook checkandspecbook testpass on the example app.🤖 Generated with Claude Code