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
18 changes: 12 additions & 6 deletions .ai/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,31 @@ APIMatic CLI (`@apimatic/cli`) — the official CLI for APIMatic, built on oclif

```bash
# Build
npm run build # tsc -b → outputs to lib/
pnpm build # tsc -b → outputs to lib/

# Lint
npm run lint # ESLint on src/**/*.{js,ts}
npm run lint:fix # ESLint with --fix --quiet
pnpm lint # ESLint on src/**/*.{js,ts}
pnpm lint:fix # ESLint with --fix --quiet

# Format
npm run format # Prettier write on src/**/*.{js,ts}
pnpm format # Prettier write on src/**/*.{js,ts}

# Test (all)
npm test # tsx + mocha, runs test/**/*.test.ts
pnpm test # tsx + mocha, runs test/**/*.test.ts

# Test (single file)
npx tsx node_modules/mocha/bin/_mocha "test/actions/portal/serve.test.ts" --timeout 99999
pnpm exec tsx node_modules/mocha/bin/_mocha "test/actions/portal/serve.test.ts" --timeout 99999

# Run CLI locally
node bin/run.js <command>
```

## Adding / upgrading dependencies

`pnpm-workspace.yaml` sets `minimumReleaseAge: 10080` (7 days) as a supply-chain defense. Brand-new package versions are blocked from install until they've been on the registry for at least a week. `@apimatic/*` is exempt via `minimumReleaseAgeExclude`.

If you hit `ERR_PNPM_PACKAGE_RECENTLY_PUBLISHED` adding a fresh release, either wait it out or run a one-off install with `pnpm install --ignore-minimum-release-age` (CI uses `--frozen-lockfile`, which bypasses the check entirely, so this only blocks manual `pnpm add` / `pnpm update`).

## Architecture — 5-Layer Stack

```
Expand Down
22 changes: 17 additions & 5 deletions .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Run and check build for current commit
on:
# Triggers the workflow on pull request events but only for the alpha and dev branches
pull_request:
branches: [ alpha, dev ]
branches: [ alpha, dev, beta ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '18', '20', '22', '24' ]
node: [ '22', '24' ]
name: Node ${{ matrix.node }} sample
steps:
- name: checkout cli
Expand All @@ -29,12 +29,24 @@ jobs:
path: cli

- name: setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: enable corepack
run: corepack enable

- name: configure pnpm cache
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
cache-dependency-path: cli/pnpm-lock.yaml

- name: Install dependencies
working-directory: cli
run: npm install
run: pnpm install --frozen-lockfile

- name: Check Build
working-directory: 'cli'
run: npm run build
run: pnpm build
19 changes: 15 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '20' ]
node: [ '22' ]
name: Release with Node version ${{ matrix.node }}
steps:
- name: Checkout CLI
Expand All @@ -26,16 +26,27 @@ jobs:
with:
node-version: ${{ matrix.node }}

- name: enable corepack
run: corepack enable

- name: configure pnpm cache
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
cache-dependency-path: cli/pnpm-lock.yaml

- name: Install dependencies
working-directory: cli
run: npm install
run: pnpm install --frozen-lockfile

- name: Check Build
working-directory: 'cli'
run: npm run build
run: pnpm build

- name: Release
working-directory: cli
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm exec semantic-release
run: pnpm exec semantic-release
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
pnpm exec commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
pnpm exec lint-staged
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@apimatic:registry=https://registry.npmjs.org/
@apimatic:registry=https://registry.npmjs.org/
Loading
Loading