create-task-ops
v0.1.18
Published
Next.js-first task-ops scaffold generator for task docs and task APIs
Maintainers
Readme
create-task-ops
create-task-ops is a Next.js-first scaffold generator for task docs and OrbitOps APIs.
Goals
- Start a new repo quickly
- Add task-ops structure to an existing repo
- Include
tasks/*.mdand the OrbitOps API contract by default
Usage
node packages/create-task-ops/bin/create-task-ops.js my-project
node packages/create-task-ops/bin/create-task-ops.js create my-project
node packages/create-task-ops/bin/create-task-ops.js add
node packages/create-task-ops/bin/create-task-ops.js add --target apps/server
node packages/create-task-ops/bin/create-task-ops.js add --print-targets
node packages/create-task-ops/bin/create-task-ops.js add --docs-onlyAfter publishing, the intended usage is:
npx create-task-ops my-project
npx create-task-ops create my-project
npx create-task-ops add
npx create-task-ops add --target apps/server
npx create-task-ops add --print-targets
npx create-task-ops add --docs-onlyCommands
create-task-ops my-projectCreate a new Next.js-based task-ops projectcreate-task-ops create my-projectSame as above, but explicitcreate-task-ops addAdd task docs and the OrbitOps API to the current repo. It scansapp,src/app,apps/*/app, andpackages/*/appto recommend a receiver target.create-task-ops add --target apps/serverKeep docs and tasks at the repo root, but install the OrbitOps receiver underapps/servercreate-task-ops add --print-targetsPrint detected receiver target candidates and exitcreate-task-ops add --docs-onlyAdd only the documentation and task-file conventions to the current repo
Internal Modes
createUses thefulltemplate internallyaddSelectively installs theapireceiver files internallyadd --docs-onlyUses thedocstemplate internally
Files Added By add
add does not overwrite an existing repo wholesale. By default, it only adds:
tasks/example-task.mdCLAUDE.mdAGENT.md.env.exampledocs/TASK_API_CONTRACT.mddocs/DASHBOARD_CONNECTION.mddocs/HEARTBEAT_SETUP.mddocs/COMMAND_RUNNER_SETUP.mdscripts/orbitops-agent.mjsscripts/orbitops-heartbeat.mjsscripts/orbitops-command-runner.mjsscripts/orbitops-dev.mjs- If a
package.jsonalready exists, missing OrbitOps scripts are added without overwriting existing ones app/api/orbitops/health/route.tsapp/api/orbitops/tasks/route.tsapp/api/orbitops/tasks/[id]/route.tsapp/api/orbitops/commands/[id]/log/route.tslib/orbitops/auth.tslib/orbitops/task-api.ts
It does not touch existing root files such as package.json, app/page.tsx, app/layout.tsx, or tsconfig.json.
For monorepos, --target is usually the right choice so the receiver lands in the real server app.
Example:
npx create-task-ops add --target apps/serverIn that case:
tasks/,CLAUDE.md,AGENT.md, anddocs/*are created at the repo rootscripts/orbitops-heartbeat.mjsis also created at the repo rootscripts/orbitops-command-runner.mjsis also created at the repo rootscripts/orbitops-agent.mjsis also created at the repo rootscripts/orbitops-dev.mjsis also created at the repo rootapp/api/orbitops/*,lib/orbitops/auth.ts, andlib/orbitops/task-api.tsare created underapps/server
Existing operational docs such as CLAUDE.md, AGENT.md, tasks/*, and docs/* are skipped by default.
If the following receiver paths already exist, the command stops with a warning because the conflict is likely real:
app/api/orbitops/health/route.tsapp/api/orbitops/tasks/route.tsapp/api/orbitops/tasks/[id]/route.tslib/orbitops/auth.tslib/orbitops/task-api.ts
Use --force only if you really want to replace those receiver files.
Local Testing
npm run create-task-ops -- my-project
npm run create-task-ops -- create my-project
npm run create-task-ops -- add
npm run create-task-ops -- add --target apps/server
npm run create-task-ops -- add --docs-only
cd packages/create-task-ops
npm run smoke:fullRuntime Token Flow
- The central dashboard heartbeat response returns a short-lived runtime token.
scripts/orbitops-agent.mjsstores that token in.orbitops-runtime-tokenby default.- The script loads
.envthroughdotenv/config, and the generator also includes.env.example. - The template now includes
ORBITOPS_SOURCE_SNAPSHOT_URLso the remote repo can push task snapshots back to the central dashboard cache. - The generator wires up
orbitops:dev,orbitops:agent,orbitops:heartbeat,orbitops:commands,orbitops:online,orbitops:offline, andorbitops:pausedwhen possible. orbitops:agentcombines heartbeat and command polling in one sidecar process.orbitops:devstarts the app dev server, detects the actual local URL, then startsorbitops:agentautomatically.- The central dashboard no longer re-pulls remote task APIs during every UI refresh. Instead,
orbitops:agentreads the localGET /api/orbitops/tasksresponse and pushes the current task snapshot to the central dashboard. - The command runner starts Codex with
codex exec --json, captures the session id, and reuses it withcodex exec --json resume ...for the same task when available. - The command runner starts Claude in non-interactive print mode by default:
claude -p --output-format stream-json, captures the session id, and reuses it with--resume ...for the same task when available. ORBITOPS_CODEX_SKIP_GIT_REPO_CHECK=autois enabled by default so Codex can still run from nested or non-trusted working directories when no.gitdirectory is present in the cwd ancestry.ORBITOPS_CLAUDE_PRINT_MODE=trueis the default. Set it tofalseonly if your local Claude CLI wrapper does not support-p --output-format stream-json.- When a command fails, the agent writes the log to
.orbitops/commands/<commandId>.logand creates a queued follow-up task draft undertasks/. - Generated
GET /api/orbitops/tasksandGET /api/orbitops/tasks/:idroutes read that file and validateAuthorization: Bearer <runtimeToken>. GET /api/orbitops/healthremains open for health checks.
Recommended Operating Modes
npm run devStart only the app server. Use this when OrbitOps integration is not needed.npm run orbitops:devStart the app server, detect the actual runtime URL, then startorbitops:agent.npm run orbitops:agentRun only the OrbitOps sidecar. Use this when the app server is already managed elsewhere.npm run orbitops:online,npm run orbitops:offline,npm run orbitops:pausedSend one-shot presence updates for debugging or manual control.
