name: hookcode-yml-generator
description: Generate or update a repo-specific .hookcode.yml for this HookCode monorepo. Use when asked to create, modify, or validate .hookcode.yml (dependency installs, preview instances, dev commands, or failure modes) for this repository.
tags:
- config
- yaml
- preview
Hookcode Yml Generator
Overview
Generate a valid .hookcode.yml tailored to this repository's dependency install workflow and preview dev-server setup, using the latest parser/runtime rules (display, named {{PORT:<instance>}}, and no fixed local ports).
Workflow
- Read
references/hookcode-yml-logic.mdfor schema rules, allowlists, and preview behavior. - Confirm repo scripts:
- Root
package.jsonuses pnpm workspaces and exposesdev:frontendanddev. frontend/package.jsonusesvitefordev.
- Root
- Build the dependency section:
- Use
version: 1. - Prefer
failureMode: softunless the user explicitly wants hard failure. - Add one Node runtime with
install: "pnpm install --frozen-lockfile"at repo root (workdir optional).
- Use
- Build the preview section:
- Define 1-5
preview.instancesentries with uniquenamevalues. - For frontend, prefer:
name: frontendworkdir: "frontend"command: "pnpm dev --host 127.0.0.1 --port {{PORT:frontend}}"display: webviewreadyPattern: "Local:"
- For backend (optional), prefer:
name: backendworkdir: "backend"command: "pnpm run prisma:generate && pnpm exec nest start"display: terminalenv.PORT: "{{PORT:backend}}"
- Do not use
port:in preview instances (unsupported by schema). - Do not use the deprecated
-- --portCLI pattern.
- Define 1-5
- Validate constraints:
workdiris relative and inside the repo.- No blocked shell characters in install commands.
- Max 5 runtimes and 5 preview instances.
- Any env key ending with
PORTmust use{{PORT}}or{{PORT:<instance>}}. - Loopback URLs such as
localhost,127.0.0.1,0.0.0.0, and::1must not hardcode numeric ports. - Named placeholders must reference defined preview instance names.
- Output
.hookcode.ymlat repo root and list assumptions (e.g., pnpm workspace install).
Quick Start Template
Copy assets/hookcode.yml.template to <repo-root>/.hookcode.yml, then adjust if the user wants different commands, additional runtimes, or multiple preview instances.
Project Defaults (Recommended)
- Package manager: pnpm workspace install from repo root.
- Runtime: Node (engine >= 18 from
package.json). - Preview: Vite frontend in
frontend/and optional backend preview inbackend/.
Output Checklist
.hookcode.ymlincludesversion: 1.- Dependency install command is allowlisted and uses pnpm.
- Preview instances use explicit
displaymodes (webviewfor frontend,terminalfor backend when enabled). - Preview command/env values do not hardcode local fixed ports and do not include deprecated
port:fields. - Placeholder usage is valid (
{{PORT}}and{{PORT:<instance>}}target defined instances). - Notes mention robot overrides can change dependency behavior.