#Flow dependencies
Use a library from an approved Flow. This example escapes HTML characters
in <note> with escape-html.
#Before you start
Use a project from the quickstart and Bun 1.4.4 for authoring. Jig
runs FLOW.ts with its installed Bun runtime. A Flow can import supported
Bun/Node built-ins, its own files, and declared production dependencies.
#Published packages
#1. Add the dependency
From the project root:
Bun records the dependency in flows/escape/package.json and writes its lock.
Keep both files with the Flow. Runtime imports belong in dependencies.
Development-only tools belong in devDependencies.
Declare every runtime library in the Flow that imports it, including
@jigging/flow. Installing the SDK only at the application root does not
declare it for a nested Flow. Jig prepares the Flow's declared dependency
closure, not the application's ambient node_modules.
The application manifest separately declares dependencies used by jig.ts
and its npm: Flow targets. A library import and an invocation slot are
different dependencies.
If jig.ts uses explicit membership, add flows/escape to its flows list.
#2. Use the library
Replace flows/escape/FLOW.ts:
#3. Review and run
Review may fetch the locked packages. It disables installation scripts and asks for approval before execution. Run uses the approved copy without fetching or installing packages.
#4. Check the result
Expect execution status succeeded, method outcome done, and output
<note>. Try input "A & B". Expect A & B. Review again if you
change the code or dependencies.
If review cannot prepare dependencies, use dependency troubleshooting.
#Fresh resolution and network access
When no lock exists, the operator can permit fresh resolution for this review:
Bun can contact dependency-selected destinations before Jig validates the
resolved graph, including host-reachable private and loopback services.
Declining execution or failing resolution cannot undo those requests. The flag
does not filter destinations or authorize network access during Runs. --yes
approves execution only.
--yes does not grant resolution permission.
External dependencies must use the supported default registry. Declared local workspaces use the workspace path below. Git, file, tarball, and custom-registry dependencies remain unsupported. Known unsupported root declarations fail before resolution. Transitive declarations may fail after requests.
Jig identifies each Flow before resolution.
Jig retains generated locks and prepared packages privately. Review does not
write bun.lock or node_modules into your Flow. Separate machines resolving
unlocked source may select different versions. jig.lock identifies source.
It is not the generated dependency lock.
#Lock formats
Prefer an authored lock when sharing dependencies across machines. Generate the text lock:
This command may use the network and Bun's cache. Run it beside the package manifest with a supported Bun version:
Jig installs valid supplied locks frozen, without conversion. Frozen installation still fetches locked registry artifacts. Resolution permission permits fresh version selection. It is not permission merely to fetch locked bytes.
Invalid or stale locks remain errors even with that permission.
Root name or version edits do not make a lock stale. Bun does not reliably
retain that metadata. Jig still checks dependency selections and member metadata.
Root manifest changes still require review.
#Dependency preparation proxy
Set JIG_DEPENDENCY_HTTPS_PROXY in the operator environment when review needs an HTTPS proxy.
Use a trusted HTTP or HTTPS proxy URL, with optional URL credentials.
If you already trust the shell's HTTPS_PROXY, select it explicitly.
The setting applies to HTTPS requests from the dependency installer during review.
The installer still uses the default registry, verifies TLS and lock integrity, and disables scripts.
With a supplied valid lock, preparation can fetch the locked bytes through the proxy.
Resolving a missing lock still needs --allow-resolution-network.
Keep proxy credentials in the operator's environment. Jig leaves them out of project files, review diagnostics, and Flow environments. Use host or proxy policy to restrict destinations.
#Consuming a frozen candidate
Use the candidate's exact published dependency versions in each importing Flow.
A moving @alpha tag does not identify frozen bytes.
Generate a supported lock to retain the resolved registry versions and integrity.
Installing an SDK archive at the application root does not supply a nested
Flow's execution dependencies. Declaring that archive as a Flow-local file:
dependency is also unsupported. For an unpublished candidate, use a declared
workspace with the package's exported files present before review.
A complete built package archive can instead supply an ordinary workspace member. Extract the whole archive unchanged into that member:
Declare both the importing Flow and extracted library in the workspace root:
Declare the SDK in the importing Flow's package.json:
Keep the archive's manifest, exports, and files unchanged. Follow the workspace steps below to install and review. This consumes extracted regular files through workspace capture, not an archive dependency. Private TypeScript sources are not required when exported files already exist.
#Local workspace packages
Use ordinary Bun workspaces to share a library before publishing it. Declare the Flow and library in the ancestor root:
Declare the dependency in the Flow:
- Run
bun installat the workspace root. - If exported generated files are missing, build those libraries before review.
- Run
jig reviewfrom the Jig application.
No publication, copied library, or separate Flow installation is needed. An exact dependency version also selects a same-name workspace member at that version. Outside a declared workspace, that exact version uses registry preparation.
The Jig application can be the root or a declared member. Declare its npm:
Flow targets in that application's dependencies. When the outer workspace
declares the application or Flow, its membership list controls selection.
Include nested Flows explicitly.
An application's own workspace list cannot expand the outer root. An application may retain its own workspace declaration for standalone use.
If a supplied lock is stale, follow the lock recovery instructions to update the workspace root lock and review again.
#Separately mounted workspace roots
Neighboring directories can belong to separate mounts, including bind mounts on the same filesystem. Review requires explicit selection of additional mounted directories containing declared workspace members.
For example, apps/demo can use a declared library at packages/helper.
From their workspace/ directory, run:
Review captures the helper's declared sources before ordinary approval.
Repeat --source-root for each additional root needed by that review.
An absolute path is also accepted. Relative operands start at the invocation
directory, independently of the apps/demo project operand.
The selected application directory already supplies its own source root, even
when the whole application is separately mounted. Do not select it again.
Each additional root must be below the enclosing workspace root and contain at
least one actual declared member. A mounted parent such as packages can be
selected when it contains those members.
Select the directory where traversal crosses the mount. If packages itself
is mounted, use --source-root packages. Selecting only packages/helper
cannot authorize that earlier unselected crossing.
Selection preserves the workspace's membership, dependency and file rules. It does not permit symbolic links, mounted files, or mounts inside captured package source. Separately mounted Flow directories inside the application keep their existing capture restriction. Unselected mount boundaries remain refused. Every selected root must satisfy the host's existing filesystem requirements.
The fixed limits allow 32 additional roots and 4,096 UTF-8 bytes per operand and resolved absolute path. These bounds and other capture limits appear in the limits reference.
Diagnostics identify logical locations relative to the reviewed application,
such as ../../packages/helper. Source-root operands instead use the invocation
directory. Mount, missing-source, link and access failures have distinct codes.
Source selection grants no dependency networking or Run filesystem access.
jig run uses retained approved bytes, and jig inspect reads retained approval.
Neither needs these options. Select the roots again on each later review.
Jig does not retain their host paths as project configuration or authority.
#Capture, reuse, and supported boundaries
Review captures declared workspace inputs and selected local sources. Existing approvals keep their original bytes. Review again after code, dependency, or patch changes. Preparation may reuse that project's approved dependencies when installer inputs and preparation support still match.
It is never shared between Jig projects.
Ensure exported files exist before review. Missing members or outputs fail without
registry fallback. Members need unique names and safe relative paths. Root
patchedDependencies supports exact versions and bounded root-relative .patch
files.
Member locks, filesystem links, overrides, member-level patches, and catalogs are unsupported. The local installation is not an execution input. A Run's working directory is disposable scratch.
Workspace capture owns root selection, captured files, aliases, linker behavior, and patch handling. Prepared execution owns reuse conditions and preparation bounds. Follow the checkout's development setup before running repository examples. Distribute a standalone Flow with published dependency versions or its declared workspace.
#Limits and other package files
Review defaults to sixteen distinct dependency preparations.
For a larger Flow library, set limits.dependencies.maxPreparations or its operator environment override.
Prepared production trees default to 32 MiB and 4,096 file/alias records per
package. Set limits.dependencies.maxPreparedBytes and maxPreparedFiles in
jig.ts, or use their environment overrides. The limits reference
owns supported ranges, precedence, shared budgets, and fixed constraints.
A package with no external dependencies needs neither a dependency manifest nor a lock for execution. Relative imports of its own source files remain supported.
When review finds an eager, explicit relative source import outside the Flow whose
module is absent from the captured Run files, it reports PACKAGE_FLOW_IMPORT_OUTSIDE_CAPTURE.
Use a configured Flow call for delegation or a declared dependency for shared code.
A FLOW.md package uses the bundled interpreter and needs no SDK dependency or
installation. Its resources do not trigger dependency preparation.
Project policy
owns the exact capture, preparation, reuse, and admission requirements.