# Code Deb CLI

A Node.js developer CLI for project scaffolding, SDK generation, local development, OpenAPI mocks and Vercel operations. The npm package source is in `packages/codedeb-cli`.

## Publication status

**Private 0.1.0 package candidate.** It is not yet confirmed on npm. Do not advertise `npm install -g @codedeb/cli` as available until the reviewed tarball is published and independently verified through npm. You can install from a trusted repository checkout:

```bash
npm install -g ./packages/codedeb-cli
codedeb --help
```

## Project scaffolding

```bash
codedeb init inventory-api --template=api
cd inventory-api
codedeb dev
```

This generates a runnable localhost-only Node API with `GET /health`, a manifest, environment example and Git ignore file. Use `--template=web` for a basic website. Existing directories are not overwritten, and path traversal is rejected.

## SDK generation

```bash
codedeb sdk create order-kit
cd order-kit
npm install
npm run build
npm test
```

This creates a standalone private TypeScript package with ESM exports, declaration files, a test scaffold and a separate release boundary. SDK generation does **not** imply readiness to publish: review implementation, complete license, tests, dependency security and package allowlists before an authenticated npm publication.

## Mocking an API locally

```bash
codedeb mock openapi.json --port=4100
curl http://127.0.0.1:4100/products
```

The CLI reads a local OpenAPI 3.0/3.1 JSON contract, resolves operation examples/schema defaults, and listens only on `127.0.0.1`. Use the `X-Mock-Status: 400` request header to test an explicit error response declared by the OpenAPI document. It does not send requests to target systems.

## Deployment and provider operations

```bash
codedeb deploy --dry-run=true
codedeb deploy
codedeb logs https://YOUR_DEPLOYMENT.vercel.app
codedeb secrets ls
codedeb secrets add API_SECRET
codedeb secrets rm API_SECRET
```

The deployment/logs/secrets commands require Vercel CLI to be installed and authenticated. They invoke it directly via `spawn()`, without shell interpolation. `deploy` explicitly targets production for the current linked project. Environment values are entered through Vercel's native interactive flow, never as CLI arguments. No deployment is claimed successful without a provider response.

## API Hub client

```bash
# Export CODEDEB_API_KEY securely before invocation
codedeb api test PROJECT_UUID /products --method=GET
```

This calls a project-scoped mock endpoint. A project key needs `mock:invoke`. The CLI never prints its value.

## Security and compatibility

Requires Node 20 or newer. Does not install remote scripts, run `sh -c`, expose a browser control panel, or create unauthorized cloud resources. Windows and Linux use the platform's native npm/Vercel command wrappers.

[API Hub](/docs/platform/api-hub) · [Mock](/docs/platform/mock) · [All developer tools](/docs/platform)
