Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
56a7275
feat(pdk): add configuration system support
ulivz Dec 8, 2025
c05e64b
refactor: make CLI and Config API completely isomorphic
ulivz Dec 13, 2025
eca2598
docs: update config.ts example to use flat structure
ulivz Dec 13, 2025
6fd6687
docs: add comprehensive type documentation for PDK
ulivz Dec 13, 2025
793c05e
refactor: update types.ts comment format
ulivz Dec 13, 2025
7c33b7e
refactor: eliminate PDKConfig redundancy with composition
ulivz Dec 13, 2025
b025575
fix: correct PDK name from Package Development Kit to PNPM Dev Kit
ulivz Dec 13, 2025
f60329e
chore: tweaks
ulivz Dec 13, 2025
8b4b1b2
refactor: simplify defineConfig documentation example
ulivz Dec 13, 2025
98e6f81
docs(pdk): add configuration design philosophy and usage guidelines
ulivz Dec 13, 2025
b1eec84
fix: cli path
ulivz Dec 13, 2025
5112c9a
feat(pdk): migrate to esm
ulivz Dec 13, 2025
2c0c884
Revert "feat(pdk): migrate to esm"
ulivz Dec 13, 2025
940403f
chore: refine pdk usage
ulivz Dec 13, 2025
a92b188
fix: remove all default options from cli since it has beed handled wh…
ulivz Dec 13, 2025
3a09bd9
fix: build error due to tsconfig
ulivz Dec 13, 2025
e3bb5d1
chore: clean `infra/pdk/pdk.config.example.ts`
ulivz Dec 13, 2025
bcd18f3
docs(pdk): rewrite readme with professional structure
ulivz Dec 13, 2025
7d05b7c
refactor(pdk): simplify verbose comments in types and config
ulivz Dec 13, 2025
78ea393
feat(multimodal): migrate pdk release config to config file
ulivz Dec 13, 2025
cc28a02
fix(multimodal): remove useAi default to prevent unexpected costs
ulivz Dec 13, 2025
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
8 changes: 4 additions & 4 deletions infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"format": "pnpm prettier --write .",
"release": "pdk release --tag-prefix 'pdk@' --push-tag --build --ignore-scripts --auto-create-release-branch",
"release:dryrun": "pdk release --tag-prefix 'pdk@' --push-tag --build --ignore-scripts --auto-create-release-branch --dry-run",
"release:canary": "pdk release --tag-prefix 'pdk@' --canary --push-tag --build --ignore-scripts --auto-create-release-branch",
"release:full": "pdk release --tag-prefix 'pdk@' --push-tag --build --ignore-scripts --create-github-release",
"release": "pdk release ",
"release:dryrun": "pdk release --dry-run",
"release:canary": "pdk release --canary",
"release:full": "pdk release --create-github-release",
"github-release": "pdk github-release",
"github-release:dryrun": "pdk github-release --dry-run",
"changelog": "pdk changelog",
Expand Down
9 changes: 9 additions & 0 deletions infra/pdk.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'pnpm-dev-kit'

export default defineConfig({
autoCreateReleaseBranch: true,
build: true,
tagPrefix: 'pdk@',
pushTag: true,
ignoreScripts: true,
});
224 changes: 140 additions & 84 deletions infra/pdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,128 +5,184 @@
<a href="https://www.npmjs.com/package/pnpm-dev-kit"><img src="https://img.shields.io/npm/dm/pnpm-dev-kit.svg?style=flat-square" alt="npm downloads"></a>
<a href="https://github.com/license"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="license"></a>
</p>
<p align="center">PDK - PNPM Dev Kit, An efficient PNPM workspace development and publishing tool.</p>
<p align="center">Efficient PNPM workspace development and publishing toolkit</p>
</p>

## Features

- 💻 **Dev Mode**: Quickly launch on-demand development builds for monorepo packages
- 🚀 **Release Management**: Automated version bumping and publishing
- 🔧 **Patch System**: Repair failed package publications
- 📝 **Changelog Generation**: Automatic, customizable changelog creation
- 🏷️ **GitHub Release**: Automatic GitHub release creation with changelog extraction
- **Dev Mode**: On-demand builds with file watching
- **Release**: Automated versioning and publishing
- **Patch**: Targeted fixes for failed releases
- **Changelog**: AI-powered or conventional changelog generation
- **GitHub Release**: Automatic GitHub releases with changelog

## Install
## Quick Start

```bash
# Using npm
npm install --save-dev pnpm-dev-kit
npm install -D pnpm-dev-kit
```

# Using yarn
yarn add --dev pnpm-dev-kit
### Basic Usage

# Using pnpm
pnpm add -D pnpm-dev-kit
```bash
# Development mode
pdk dev

# Release with changelog and GitHub release
pdk release --push-tag --create-github-release

# Generate changelog
pdk changelog --use-ai --provider openai --model gpt-4o

# Fix failed release
pdk patch --version 1.0.0 --tag latest
```

For global installation:
## Configuration

```bash
npm install -g pnpm-dev-kit
Create `pdk.config.ts` in your project root:

```typescript
import { defineConfig } from 'pnpm-dev-kit';

export default defineConfig({
// Core options
tagPrefix: 'v',
dryRun: false,
runInBand: false,
ignoreScripts: false,

// AI changelog
useAi: true,
model: 'gpt-4o',
provider: 'openai',
apiKey: process.env.OPENAI_API_KEY,

// Changelog filters
filterTypes: ['feat', 'fix', 'perf'],
filterScopes: ['core', 'ui', 'api'],

// Release defaults
changelog: true,
pushTag: true,
createGithubRelease: true,
autoCreateReleaseBranch: false,

// Dev mode
exclude: ['@scope/package-to-exclude'],
packages: ['@scope/package-to-start'],
});
```

## Usage
### Configuration Options

### Development Mode
#### Core Options

Quickly start development mode to build packages on demand when files change:
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `cwd` | `string` | `process.cwd()` | Working directory |
| `dryRun` | `boolean` | `false` | Preview mode without changes |
| `runInBand` | `boolean` | `false` | Publish packages sequentially |
| `ignoreScripts` | `boolean` | `false` | Skip npm scripts |
| `tagPrefix` | `string` | `'v'` | Git tag prefix |

```bash
# Using the CLI
pdk dev
#### AI Options

# Or with npm script
npm run dev
```
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `useAi` | `boolean` | `false` | Enable AI changelog generation |
| `model` | `string` | `'gpt-4o'` | LLM model |
| `provider` | `string` | `'openai'` | LLM provider |
| `apiKey` | `string` | - | API key (use env var) |
| `baseURL` | `string` | - | Custom API endpoint |

**Interactive Features:**
#### Filter Options

- Type `n` to select a package to build manually
- Type `ps` to list running processes
- Type package name to build a specific package
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `filterTypes` | `string[]` | `['feat', 'fix']` | Commit types to include |
| `filterScopes` | `string[]` | `[]` | Scopes to include (empty = all) |

### Release Process
#### Command-Specific Options

**Standard Release:**
```bash
# Complete release (recommended)
pdk release --push-tag --create-github-release
**Development (`dev`)**:
- `exclude`: Packages to exclude from startup
- `packages`: Packages to start by default

# Canary release for CI/CD
pdk release --canary
```
**Release (`release`)**:
- `changelog`: Generate changelog (default: `true`)
- `build`: Build before publishing (`false` or script name)
- `pushTag`: Push git tags (default: `false`)
- `canary`: Canary release (default: `false`)
- `createGithubRelease`: Create GitHub release (default: `false`)
- `autoCreateReleaseBranch`: Auto-create release branch (default: `false`)

**Release Flow:**
1. Select version type (patch/minor/major/prerelease)
2. Choose NPM tag (latest/next/beta)
3. Update workspace dependencies
4. Publish packages to NPM
5. Create git tag and push to remote
6. Generate CHANGELOG.md
7. Create GitHub Release
**Changelog (`changelog`)**:
- `version`: Target version
- `beautify`: Format markdown (default: `false`)
- `commit`: Git commit changelog (default: `false`)
- `gitPush`: Push commit (default: `false`)
- `attachAuthor`: Include author info (default: `false`)
- `authorNameType`: Author format (`'name'` or `'email'`, default: `'name'`)

**Failed Release Recovery:**
```bash
pdk patch --version 1.0.0 --tag latest
```
**Patch (`patch`)**:
- `version`: Version to patch
- `tag`: Distribution tag

**Changelog Generation:**
```bash
# Standard changelog
pdk changelog --version 1.0.0 --beautify --commit --git-push
**GitHub Release (`github-release`)**:
- `version`: Release version

# AI-powered changelog
pdk changelog --version 1.0.0 --use-ai --provider openai --model gpt-4o
```
## Configuration vs CLI

**GitHub Release:**
```bash
pdk github-release --version 1.0.0
pdk github-release --dry-run # Preview
```
### Use Config File For

**Key Options:**
- `--dry-run`: Preview without changes
- `--run-in-band`: Publish packages in series
- `--build`: Custom build script before release
- `--ignore-scripts`: Skip npm scripts
- `--auto-create-release-branch`: Auto-create release branch
- `--filter-scopes`: Filter by scope (default: tars,agent,tarko,o-agent,tars-stack,browser,infra,mcp,all)
- `--filter-types`: Filter by commit type (default: feat,fix)
- **Project conventions**: `tagPrefix`, `filterTypes`, `filterScopes`
- **Team preferences**: `useAi`, `model`, `provider`, `runInBand`
- **Workflow defaults**: `changelog`, `pushTag`, `createGithubRelease`

## Configuration
### Use CLI For

- **Environment-specific**: `dryRun`, `cwd`, `version`
- **One-time operations**: `exclude`, `packages`, `build`, `canary`
- **Sensitive data**: `apiKey` (use environment variables)

### Priority Order

1. CLI arguments
2. Environment variables
3. Configuration file
4. Default values

## API Usage

```typescript
import { loadPDKConfig, dev, release } from 'pnpm-dev-kit';

// Load configuration
const config = await loadPDKConfig({ cwd: './my-project' });

// Use with commands
await dev(config.resolved);
await release(config.resolved);
```

## package.json Scripts

**package.json Scripts:**
```json
{
"scripts": {
"dev": "pdk dev",
"release": "pdk release --push-tag",
"release": "pdk release",
"release:full": "pdk release --push-tag --create-github-release",
"release:canary": "pdk release --canary",
"github-release": "pdk github-release",
"changelog": "pdk changelog",
"patch": "pdk patch --version $(node -p \"require('./package.json').version\") --tag latest"
}
}
```

**Workspace Setup:**
- Uses `pnpm-workspace.yaml` for package discovery
- Follows conventional commit standards
- Auto-updates internal workspace dependencies
## CI/CD Integration

**CI/CD Integration:**
```yaml
# .github/workflows/release.yml
name: Release
Expand All @@ -150,14 +206,14 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```

**Best Practices:**
- Always release from latest main branch
- Ensure clean working directory
- Run tests before release
## Best Practices

- Always release from clean `main` branch
- Use `--dry-run` for testing
- Canary format: `{version}-canary-{commitHash}-{timestamp}`
- Auto-rollback on publish failure
- Keep sensitive data in environment variables
- Review config changes in pull requests

## License

This project is licensed under the Apache License 2.0.
Apache License 2.0
2 changes: 1 addition & 1 deletion infra/pdk/bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require('../dist/cli').bootstrapCli();
require('../dist/index').bootstrapCli();
6 changes: 4 additions & 2 deletions infra/pdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"description": "PDK (pnpm dev kit), an efficient pnpm workspace development and publishing tool",
"version": "0.0.5",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"publishConfig": {
"access": "public",
Expand All @@ -19,9 +18,11 @@
"scripts": {
"dev": "rslib build --watch",
"build": "rslib build",
"test": "vitest run",
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@tarko/config-loader": "0.3.0",
"@tarko/model-provider": "0.3.0",
"boxen": "4",
"cac": "^6.5.10",
Expand All @@ -47,6 +48,7 @@
"@types/string-width": "^4.0.1",
"@types/text-table": "^0.2.0",
"rimraf": "4.1.0",
"typescript": "5.8.3"
"typescript": "5.8.3",
"vitest": "3.2.4"
}
}
Loading
Loading