openlap
v0.1.11
Published
Request-lapping wrapper for the OpenCode CLI
Readme
Note:
openlapis an independent community project related to OpenCode. It is not built by the OpenCode team and is not officially affiliated with OpenCode.
Installation
Recommended (release artifact + PATH fix):
curl -fsSL https://openlap.dev/install.sh | bash -s -- --channel release --fix-pathInstall from npm:
npm install -g openlapInstall from source:
npm install
npm run build
npm linkQuick Start
# inline prompt
openlap "Review this repository for launch readiness"
# prompt selector from configured paths
openlap prompt
# prompt from file
openlap --file ./prompt.md
# prompt from file with extra instruction
openlap --file ./prompt.md --instruction "Prioritize docs and tests"
# built-in examples
openlap --list-examples
openlap --example explain
# open the OpenTUI input view with a loaded prompt file
npm run test:load-ppropt
# stdin / clipboard modes
echo "Audit security config" | openlap
openlap --copy
# CI-safe one-shot JSON output
openlap --no-interactive --output-format json-final --file ./prompt.md
# launch directly into OpenCode TUI with combined prompt text
openlap --launch-tui --file ./prompt.md --instruction "Prioritize risk and rollout steps"How It Works
- Choose one input source: inline text,
--file, or--example - Run once from terminal/scripts/CI
- In TTY terminals,
openlapautomatically hands off to interactive OpenCode for the same session
One-shot mode (no handoff):
openlap --no-interactive "Audit this repository and suggest refactors"JavaScript API
import lap from 'openlap';
await lap({
promptFilePath: './prompt.md',
cwd: process.cwd(),
showToolOutput: true,
});Common Flags
--model <name>set model id--inputappend extra input after your primary prompt source (interactive prompt or piped stdin)--inputinteractive mode now uses an OpenTUI editor; submit withCtrl+D(orCmd/Ctrl+Enter), cancel withEsc--output-format <pretty|raw|json-events|json-final|jsonl>set output shape--launch-tuilaunch OpenCode TUI directly viaopencode --promptwith your fully combined prompt--show-tool-outputprint tool output lines--print-logs --log-level <DEBUG|INFO|WARN|ERROR>include OpenCode logs--status-jsonemit one machine-readable run-end status JSON object to stderr--question-policy <fail-fast|default-answer|abort>control behavior when a run calls a question tool in non-interactive mode--question-default-answer <text>default answer text used with--question-policy default-answer--thinking-models <csv>and--thinking-color <yellow|cyan|magenta|blue|gray>style thinking output--completions <bash|zsh|fish>print shell completion script--doctorrun environment diagnostics
Use openlap --help for the full option list.
CI example using --status-json:
if ! openlap --no-interactive --status-json --output-format json-final --file ./prompt.md 2>status.log >result.json; then
exit 1
fi
status=$(jq -r 'select(.type=="openlap.run.terminal_state") | .status' status.log | tail -n 1)
if [ "$status" != "completed" ]; then
echo "openlap run ended with status: $status" >&2
exit 1
fiConfiguration
Set defaults in either:
openlap.json.openlap.jsonpackage.jsonunderopenlap
Supported keys:
modelthinking-modelsthinking-colorno-interactiveprompt-search-paths(string or array of paths/aliases to markdown prompt files)
When prompt-search-paths is configured, run openlap prompt to open a prompt selector TUI and choose a markdown prompt before running.
Example openlap.json:
{
"prompt-search-paths": ["@prompt-templates/", "./prompts/"]
}Environment variable overrides:
OPENLAP_MODELOPENLAP_CWDOPENLAP_THINKING_MODELSOPENLAP_NO_INTERACTIVEOPENLAP_PROMPT_SEARCH_PATHS
Development
npm install
npm run lint
npm run build
npm testUseful scripts:
npm run devrun CLI from source (tsx src/cli.ts)npm run typecheckrun TypeScript checks onlynpm run webstart website dev servernpm run release:patch|minor|majorbump version, tag, and push
Git hooks:
pre-commit: runsnpm run check:precommit(lint)pre-push: runsnpm run check:prepush(test+build)
Release process:
- See
RELEASING.mdfor version/tag/publish workflow.
Website (web/)
This repo includes the Astro site used for openlap.dev.
npm run web:install
npm run web:dev
npm run web:build
npm run web:previewDeploy to Cloudflare Pages:
npm run web:deployDirect Wrangler CLI deploy (uses web/wrangler.toml):
npx wrangler pages deploy --config ./web/wrangler.tomlTroubleshooting
openlapnot found: runopenlap --doctorand verify your npm global bin is inPATHopencodenot found: install/link OpenCode CLI soopencodeis available- Invalid
--fileor--cwd: verify paths exist and are accessible
