# Norn Extension - Copilot Instructions

These instructions apply to all conversations about the Norn VS Code extension.

## Repo Boundary

These instructions apply only inside `/Users/petercrest/Worktable/Projects/vsApi`.

- Do **not** apply them to standalone work in sibling repos such as `/Users/petercrest/Worktable/Projects/norn_website`.
- If a task is website-only, prefer the website repo's local instructions instead.
- Only use these rules for cross-repo work when the task explicitly includes `vsApi`.

## CLI Support is Mandatory

Every feature implementation must work in both:
1. **VS Code Extension** - Interactive UI with response panel
2. **CLI** (`src/cli.ts`) - Command-line execution

Before considering any feature complete, verify it works in the CLI. The CLI shares code with the extension (`parser.ts`, `sequenceRunner.ts`, `assertionRunner.ts`, `httpClient.ts`).

### CRITICAL: Running the Local CLI

**NEVER use `npx norn`** - this runs the globally installed npm package, NOT your local changes!

**ALWAYS use the local compiled CLI:**
```bash
# Correct - runs your local development version
node ./dist/cli.js tests/file.norn --env prelive

# WRONG - runs the published npm package, ignores your changes
npx norn tests/file.norn
```

Before testing CLI changes:
1. Run `npm run compile` to build the latest code
2. Use `node ./dist/cli.js` to execute

## Skills Maintenance

When implementing features, check the `.github/skills/` directory for relevant skills:

- **If a skill is incorrect or outdated:** Update it with the correct information
- **If a skill is missing:** Create a new one following the Agent Skills format
- After creating or editing skills, run `npm run validate:skills`

Skills should capture lessons learned and patterns discovered during implementation to help future development.

## Code Style

- TypeScript with strict typing
- Simple IntelliSense completions (no complex snippets)
- Keep parsing logic in dedicated functions
- Test both extension and CLI after changes

## Test Verification

**MANDATORY:** When the user asks to publish, prepare a release, bump version, or create a patch:
1. **FIRST** invoke the Test Verification subagent using `runSubagent`
2. Wait for it to complete and report results
3. Only if all tests pass, invoke the Website Documentation Review subagent using `runSubagent`
4. Only proceed if tests pass and the docs review reports either:
   - website docs were updated and the website build passed, or
   - no docs changes were needed because the release is only bug fixes, refactors, or design/styling work

The Test Verification agent runs:
- `npm test` (must pass compile/lint, Extension Host editor diagnostics, Test Explorer support, and runtime-negative automation)
- `npm run test:regression` (local CLI Regression suite; all tests must pass)

The Website Documentation Review agent:
- reviews release changes in `/Users/petercrest/Worktable/Projects/vsApi`
- updates `/Users/petercrest/Worktable/Projects/norn_website` when user-facing features changed or new ones were added
- skips docs work for bug fixes, refactors, internal cleanup, and design/styling-only changes

**Trigger words:** publish, release, version, patch, bump, deploy

## Publishing Ownership

When release verification and version prep are complete, **do not run publishing commands** (`npm run publish:npm`, `npm run publish:vsce`, `npm run publish:all`).

The **user runs publish commands manually**.

## Key Files

| Purpose | File |
|---------|------|
| Syntax highlighting | `syntaxes/norn.tmLanguage.json` |
| IntelliSense | `src/completionProvider.ts` |
| Sequence execution | `src/sequenceRunner.ts` |
| Assertions | `src/assertionRunner.ts` |
| HTTP requests | `src/httpClient.ts` |
| CLI | `src/cli.ts` |
| Parser | `src/parser.ts` |
| Response panel | `src/responsePanel.ts` |
| Diagnostics | `src/diagnosticProvider.ts` |
| Test Explorer | `src/testProvider.ts` |
