Fix pi-agent CLI execution issue when installed globally

- Remove isMainModule check that was preventing execution via npm symlink
- CLI now runs main function directly when executed
- Bump version to 0.5.1
This commit is contained in:
Mario Zechner 2025-08-09 18:02:34 +02:00
parent c615f3f011
commit d304f377d7
10 changed files with 19 additions and 110 deletions

View file

@ -1,87 +0,0 @@
# Publishing Guide
## Publishing Workflow
### 1. Pre-publish Checks
```bash
# Clean everything and rebuild from scratch
npm run clean
npm run build
# Run all checks
npm run check
# Test packages work correctly
cd packages/agent && npx tsx src/cli.ts --help
cd packages/pods && npx tsx src/cli.ts --help
```
### 2. Version Bump
All packages use lockstep versioning (same version number):
```bash
# Patch version bump (0.5.0 -> 0.5.1)
npm run version:patch
# Minor version bump (0.5.0 -> 0.6.0)
npm run version:minor
# Major version bump (0.5.0 -> 1.0.0)
npm run version:major
```
This automatically:
- Updates all package versions
- Syncs inter-package dependencies
### 3. Commit & Tag
```bash
# Commit the version bump
git add -A
git commit -m "Release v0.5.1"
# Tag the release
git tag -a v0.5.1 -m "Release v0.5.1"
# Push to GitHub
git push origin main --tags
```
### 4. Publish to npm
```bash
# Dry run first (see what would be published)
npm run publish:dry
# If everything looks good, publish for real
npm run publish:all
```
This will:
1. Clean all dist folders
2. Build all packages in dependency order
3. Run all checks
4. Publish all packages to npm with public access
### 5. Verify Publication
```bash
# Check npm registry
npm view @mariozechner/pi-tui
npm view @mariozechner/pi-agent
npm view @mariozechner/pi
# Test installation
npx @mariozechner/pi --help
npx @mariozechner/pi-agent --help
```
## Notes
- All packages are published with `--access public` flag
- The `prepublishOnly` script in each package ensures clean builds
- Dependencies between packages use `^` version ranges for flexibility
- The monorepo itself (`pi-monorepo`) is private and not published

View file

@ -73,9 +73,6 @@ These commands automatically:
### Publishing
See [PUBLISHING.md](PUBLISHING.md) for the complete publishing workflow.
Quick version:
```bash
# Dry run to see what would be published
npm run publish:dry

6
package-lock.json generated
View file

@ -778,7 +778,7 @@
},
"packages/agent": {
"name": "@mariozechner/pi-agent",
"version": "0.5.0",
"version": "0.5.1",
"license": "MIT",
"dependencies": {
"@mariozechner/pi-tui": "^0.5.0",
@ -1222,7 +1222,7 @@
},
"packages/pods": {
"name": "@mariozechner/pi",
"version": "0.5.0",
"version": "0.5.1",
"license": "MIT",
"dependencies": {
"@mariozechner/pi-agent": "^0.5.0",
@ -1238,7 +1238,7 @@
},
"packages/tui": {
"name": "@mariozechner/pi-tui",
"version": "0.5.0",
"version": "0.5.1",
"license": "MIT",
"dependencies": {
"@types/mime-types": "^2.1.4",

View file

@ -1,12 +1,12 @@
{
"name": "@mariozechner/pi-agent",
"version": "0.5.0",
"version": "0.5.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@mariozechner/pi-agent",
"version": "0.5.0",
"version": "0.5.1",
"license": "MIT",
"dependencies": {
"@mariozechner/tui": "^0.1.1",

View file

@ -1,6 +1,6 @@
{
"name": "@mariozechner/pi-agent",
"version": "0.5.0",
"version": "0.5.1",
"description": "General-purpose agent with tool calling and session persistence",
"type": "module",
"bin": {
@ -18,7 +18,7 @@
"prepublishOnly": "npm run clean && npm run build"
},
"dependencies": {
"@mariozechner/pi-tui": "^0.5.0",
"@mariozechner/pi-tui": "^0.5.1",
"@types/glob": "^8.1.0",
"chalk": "^5.5.0",
"glob": "^11.0.3",

View file

@ -286,9 +286,8 @@ export async function main(args: string[]): Promise<void> {
}
// Run as CLI if invoked directly
if (import.meta.url === `file://${process.argv[1]}`) {
// Run main function when executed directly
main(process.argv.slice(2)).catch((err) => {
console.error(err);
process.exit(1);
});
}

View file

@ -1,12 +1,12 @@
{
"name": "@mariozechner/pi",
"version": "0.5.0",
"version": "0.5.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@mariozechner/pi",
"version": "0.5.0",
"version": "0.5.1",
"license": "MIT",
"dependencies": {
"@ai-sdk/openai": "^2.0.5",

View file

@ -1,6 +1,6 @@
{
"name": "@mariozechner/pi",
"version": "0.5.0",
"version": "0.5.1",
"description": "CLI tool for managing vLLM deployments on GPU pods",
"type": "module",
"bin": {
@ -33,7 +33,7 @@
"node": ">=20.0.0"
},
"dependencies": {
"@mariozechner/pi-agent": "^0.5.0",
"@mariozechner/pi-agent": "^0.5.1",
"chalk": "^5.5.0"
},
"devDependencies": {}

View file

@ -1,12 +1,12 @@
{
"name": "@mariozechner/tui",
"version": "0.5.0",
"version": "0.5.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@mariozechner/tui",
"version": "0.5.0",
"version": "0.5.1",
"license": "MIT",
"dependencies": {
"@types/mime-types": "^2.1.4",

View file

@ -1,6 +1,6 @@
{
"name": "@mariozechner/pi-tui",
"version": "0.5.0",
"version": "0.5.1",
"description": "Terminal User Interface library with differential rendering for efficient text-based applications",
"type": "module",
"main": "dist/index.js",