mcpField
U
utels-project-bootstrap

utels-project-bootstrap

github.com/mizchiCloud & DevOps41642 installsUpdated 1w ago
Repository

About utels-project-bootstrap

A bootstrap guide for registering utels.dev production and staging projects and setting Cloudflare Worker secrets. It passes ingest tokens through stdin rather than command arguments, temporary files, or logs.

Key features

  1. 01Register production and staging utels projects
  2. 02Write tokens to Worker secrets through stdin
  3. 03Support single-environment runs and DRY_RUN
  4. 04Handle registration collisions and recovery
  5. 05Test the flow with mocked operations

Use cases

  1. 01Set up utels telemetry for a Cloudflare Worker
  2. 02Pass project ingest tokens securely
  3. 03Retry registration for one environment
  4. 04Test registration and secret writes without remote changes

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mizchi/skills --skill utels-project-bootstrap

After installing, type/utels-project-bootstrapin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

README.md
assets/scripts/
setup-utels.test.ts
setup-utels.ts

Details

From the project README

utels project bootstrap

Register production/staging utels.dev projects and send each returned ingest token to pnpm exec cf workers secrets update UTELS_INGEST_TOKEN --worker <name> --body @/dev/stdin. The JSON body travels through stdin on macOS/Linux; the token is not placed in argv, a temporary file or command logs.

Helper

Copy setup-utels.ts to the Worker's scripts/ directory. Use Node.js 24+ with a project-local cf dependency. The checked implementation targets cf beta.5; verify cf schema workers secrets update and the installed implementation when upgrading.

Inputs:

InputPurpose
UTELS_BOOTSTRAP_TOKENRequired registration credential, normally decrypted by dotenvx
APP_WORKER_PROD / APP_WORKER_STAGINGRequired Worker names for each selected target; cf resource commands do not use old --env selection
APP_SERVER_DIRWorker project directory; defaults to the parent of the copied script directory
APP_UTELS_PROJECT_PROD / APP_UTELS_PROJECT_STAGINGProject slugs; replace the example defaults
UTELS_ENDPOINT / --endpoint=<url>Registration host, default https://utels.dev
--only=production / --only=stagingRegister just one environment, including retries after a partial failure
DRY_RUN=1Skip registration and secret writes

Customize display names and origin URLs in targets before use. utels validates origins even for server-side projects. Provide cf authentication with CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID, including through an explicitly selected dotenvx file.

The helper uses --body @/dev/stdin, not --text "$TOKEN" or @-. It ignores child output because API errors can contain request bodies; on failure it reports cf's exit status. Inspect authentication separately with cf auth whoami. A registered slug can remain after a failed secret write; registration is not guaranteed idempotent and the helper does not delete projects automatically.

Registration collision

A previously registered slug can trigger a D1 unique-constraint error, exposed as HTTP 500 / Worker 1101. Query the utels database by ID before retrying:

pnpm exec cf d1 query DATABASE_ID --sql "SELECT project_id FROM project WHERE project_id LIKE '<your-slug>%';"

Choose another slug or recover the existing token through the operator's supported procedure. Destructive deletion is not part of bootstrap.

Validation and related guidance

The integration test mocks utels registration and the pnpm child to verify Worker selection, stdin JSON, failed writes and token-free output without remote mutations.

Comments

Markdown supported