Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 22
node-version-file: .nvmrc

- name: Install dependencies
run: bun install --frozen-lockfile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
bun-version: 1.3.11
- uses: actions/setup-node@v4
with:
node-version: 22
node-version-file: .nvmrc
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Check documentation app
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
bun-version: 1.3.11
- uses: actions/setup-node@v4
with:
node-version: 22
node-version-file: .nvmrc
- name: Install dependencies
run: bun install --frozen-lockfile
- uses: actions/download-artifact@v4
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Publish anatomy-cli
run-name: npm ${{ inputs.channel || (startsWith(github.ref, 'refs/tags/canary-') && 'canary' || 'stable') }} from ${{ github.ref_name }}

on:
push:
branches: [main]
tags: ['canary-*']
paths:
- 'apps/anatomy-cli/**'
- 'packages/anatomy/**'
- 'packages/schemas/**'
- 'package.json'
- 'bun.lock'
- 'tsconfig.json'
- '.nvmrc'
- '.github/workflows/publish-npm.yml'
workflow_dispatch:
inputs:
channel:
description: 'stable increments 0.0.x; canary publishes only to the canary tag'
type: choice
options: [stable, canary]
default: stable
required: true

permissions:
contents: read

concurrency:
group: npm-publication
cancel-in-progress: false

jobs:
publish:
if: github.repository == 'forge-town/anatomy-cli'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
id-token: write
env:
RELEASE_CHANNEL: ${{ inputs.channel || (startsWith(github.ref, 'refs/tags/canary-') && 'canary' || 'stable') }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.11
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
- name: Validate channel and publication credentials
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ "$RELEASE_CHANNEL" = stable ] && [ "$GITHUB_REF" != refs/heads/main ]; then
echo '::error::Stable releases must run from main. Select channel=canary for a branch.'
exit 1
fi
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo '::error::Configure NPM_TOKEN with publish access to anatomy-cli.'
exit 1
fi
npm whoami --registry=https://registry.npmjs.org
- run: bun install --frozen-lockfile
- name: Test and build the source snapshot
run: bun run quality
- name: Prepare the next patch and verify packed consumers
run: bun apps/anatomy-cli/src/release-main.ts prepare
- name: Publish and verify registry consumers
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: bun apps/anatomy-cli/src/release-main.ts publish
- name: Upload release plan, tarballs, and verification results
if: always()
uses: actions/upload-artifact@v4
with:
name: npm-release-${{ github.run_id }}-${{ github.run_attempt }}
path: |
docs/verification/npm-release/artifacts/release-plan.json
docs/verification/npm-release/artifacts/*.tgz
docs/verification/npm-release/artifacts/*-consumer.json
if-no-files-found: ignore
- name: Summarize the verified release
run: |
echo '### Published and installed successfully' >> "$GITHUB_STEP_SUMMARY"
cat docs/verification/npm-release/artifacts/registry-consumer.json >> "$GITHUB_STEP_SUMMARY"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ yarn-error.log*
# Local agent/editor state
.agents/
/docs/
.github/
.github/instructions/
.github/prompts/
.qodo/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.21.0
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,41 @@ The CLI lives in `apps/anatomy-cli`; reusable tree logic is in
`packages/anatomy`; schemas and bundled definitions live in the other two
workspace packages. Keep changes self-contained and add or update tests with
behavior changes.

Run `bun run anatomy:check` for a fast whole-repository structure and function
export check. `bun run quality` includes this check and the source-role audit;
the pull-request workflow invokes the same quality command. After building, the
workspace-installed executable also works: `./node_modules/.bin/anatomy . --git-files`.

The root `anatomy.json` is a reviewed contract, not a snapshot regenerated by
tests. Every project file has an explicit required rule. When adding, moving or
removing files:

1. Update the corresponding node in `anatomy.json`. Keep structural policies at
`block`; do not introduce a catch-all placeholder to silence a failure.
2. Function modules, hooks and components must export exactly one named function
whose name matches the filename. Use `"exports": { "name": "file_stem" }`.
Type exports do not count. Split additional functions or runtime constants
into their own files and update imports and existing barrels.
3. For a non-function source file, record its exact runtime exports, role and
reason in `anatomy.coverage.json`. Tests validate these declarations. Schemas
export one same-named `*Schema` value with inferred types; barrels only contain
relative wildcard re-exports; tests and process entrypoints expose no runtime
API. Framework-owned modules use explicit reviewed exceptions.
4. For changes inside the CLI source directory or schemas package, update the
matching subtree in `apps/anatomy-cli/anatomies/cli-source.anatomy.json` or
`packages/schemas/anatomy.json` as well. Tests prevent these focused copies
from diverging. `scan:self` and `scan:schemas` use our own contracts, while the
Tellyn catalogue remains a separate set of example conventions.
5. Run `bun run quality`. For documentation-app changes also run
`bun run docs:build:cloudflare` and
`bun --cwd apps/docs scripts/check-cloudflare-build.ts`.

Git selection includes tracked files and non-ignored new files. Keep project
source and CI files visible to Git; only local state and generated output should
be ignored. Retain temporary plans, reports and demos under the ignored root
`docs/` directory, and never force-add them. Git mode rejects symlinks and
submodules, and does not inventory empty directories.

The module split keeps named package-level exports available, but internal file
paths have changed. Prefer the package barrels over old source-file deep imports.
Loading
Loading