diff --git a/package.json b/package.json index c88d71237..537fb1dec 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ ], "scripts": { "clean": "npm run clean --workspaces", - "build": "cd packages/tui && npm run build && cd ../ai && npm run build && cd ../agent && npm run build && cd ../coding-agent && npm run build", + "build": "cd packages/tui && npm run build && cd ../ai && npm run build && cd ../agent && npm run build && cd ../coding-agent && npm run build && cd ../orchestrator && npm run build", "check": "biome check --write --error-on-warnings . && npm run check:pinned-deps && npm run check:ts-imports && npm run check:shrinkwrap && tsgo --noEmit && npm run check:browser-smoke", "check:browser-smoke": "node scripts/check-browser-smoke.mjs", "check:pinned-deps": "node scripts/check-pinned-deps.mjs", diff --git a/packages/orchestrator/CHANGELOG.md b/packages/orchestrator/CHANGELOG.md new file mode 100644 index 000000000..1a588142c --- /dev/null +++ b/packages/orchestrator/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog + +## [Unreleased] diff --git a/packages/orchestrator/README.md b/packages/orchestrator/README.md new file mode 100644 index 000000000..ee05c9eb2 --- /dev/null +++ b/packages/orchestrator/README.md @@ -0,0 +1,9 @@ +# orchestrator + +Orchestrator package for pi. + +## CLI + +```bash +orchestrator --help +``` diff --git a/packages/orchestrator/package.json b/packages/orchestrator/package.json new file mode 100644 index 000000000..a614b8da7 --- /dev/null +++ b/packages/orchestrator/package.json @@ -0,0 +1,46 @@ +{ + "name": "@earendil-works/pi-orchestrator", + "version": "0.79.6", + "description": "orchestrator package for pi", + "type": "module", + "bin": { + "orchestrator": "dist/cli.js" + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "files": [ + "dist", + "README.md", + "CHANGELOG.md" + ], + "scripts": { + "clean": "shx rm -rf dist", + "dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput", + "build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js", + "prepublishOnly": "npm run clean && npm run build" + }, + "keywords": [ + "pi", + "orchestrator" + ], + "author": "Earendil Works", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/badlogic/pi-mono.git", + "directory": "packages/orchestrator" + }, + "engines": { + "node": ">=22.19.0" + }, + "dependencies": {}, + "devDependencies": { + "shx": "0.4.0" + } +} diff --git a/packages/orchestrator/src/cli.ts b/packages/orchestrator/src/cli.ts new file mode 100644 index 000000000..0ad2da39c --- /dev/null +++ b/packages/orchestrator/src/cli.ts @@ -0,0 +1,30 @@ +#!/usr/bin/env node +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8")) as { + version: string; +}; + +function printHelp(): void { + console.log(`orchestrator v${packageJson.version}\n\nUsage:\n orchestrator --help\n orchestrator --version`); +} + +const args = process.argv.slice(2); + +if (args.length === 0 || args[0] === "--help" || args[0] === "-h") { + printHelp(); + process.exit(0); +} + +if (args[0] === "--version" || args[0] === "-v") { + console.log(packageJson.version); + process.exit(0); +} + +console.error(`Unknown command: ${args[0]}`); +printHelp(); +process.exit(1); diff --git a/packages/orchestrator/src/index.ts b/packages/orchestrator/src/index.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/orchestrator/tsconfig.build.json b/packages/orchestrator/tsconfig.build.json new file mode 100644 index 000000000..695dd9ad2 --- /dev/null +++ b/packages/orchestrator/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src" + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "dist", "**/*.d.ts", "src/**/*.d.ts"] +} diff --git a/tsconfig.json b/tsconfig.json index 903f80f3c..1e212e9de 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,8 @@ "@earendil-works/pi-coding-agent": ["./packages/coding-agent/src/index.ts"], "@earendil-works/pi-coding-agent/hooks": ["./packages/coding-agent/src/core/hooks/index.ts"], "@earendil-works/pi-coding-agent/*": ["./packages/coding-agent/src/*"], + "@earendil-works/pi-orchestrator": ["./packages/orchestrator/src/index.ts"], + "@earendil-works/pi-orchestrator/*": ["./packages/orchestrator/src/*"], "typebox": ["./node_modules/typebox"], "@earendil-works/pi-tui": ["./packages/tui/src/index.ts"], "@earendil-works/pi-tui/*": ["./packages/tui/src/*"],