omni-pi 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +10 -13
  2. package/bin/omni.js +94 -0
  3. package/package.json +6 -2
package/README.md CHANGED
@@ -19,22 +19,26 @@ Requires Node.js 22 or newer.
19
19
 
20
20
  ## Install
21
21
 
22
- Install the package into Pi:
22
+ Install the standalone executable:
23
23
 
24
24
  ```bash
25
- pi install npm:omni-pi
25
+ npm install -g omni-pi
26
26
  ```
27
27
 
28
- For a project-local install instead of a global one:
28
+ Then run it in any project:
29
29
 
30
30
  ```bash
31
- pi install -l npm:omni-pi
31
+ cd your-project
32
+ omni
32
33
  ```
33
34
 
34
35
  For local development from this checkout:
35
36
 
36
37
  ```bash
37
- pi install /Users/edgy/personal/Omni-Pi
38
+ git clone https://github.com/EdGy2k/Omni-Pi.git
39
+ cd Omni-Pi
40
+ npm install
41
+ npm run chat
38
42
  ```
39
43
 
40
44
  ## Use
@@ -66,14 +70,7 @@ Omni-Pi keeps its working notes in `.omni/`:
66
70
 
67
71
  ## Development
68
72
 
69
- ```bash
70
- git clone https://github.com/EdGy2k/Omni-Pi.git
71
- cd Omni-Pi
72
- npm install
73
- npm run chat
74
- ```
75
-
76
- `npm run chat` launches Pi with this package loaded from the local checkout.
73
+ `npm run chat` launches the local `omni` wrapper from this checkout, which in turn starts Pi with this package loaded.
77
74
 
78
75
  For local verification:
79
76
 
package/bin/omni.js ADDED
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { realpathSync } from "node:fs";
5
+ import path from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ export function getOmniPackageDir() {
9
+ return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
10
+ }
11
+
12
+ export function resolvePiCliPath() {
13
+ return path.join(
14
+ getOmniPackageDir(),
15
+ "node_modules",
16
+ "@mariozechner",
17
+ "pi-coding-agent",
18
+ "dist",
19
+ "cli.js",
20
+ );
21
+ }
22
+
23
+ export function buildOmniEnvironment(baseEnv = process.env) {
24
+ return {
25
+ ...baseEnv,
26
+ };
27
+ }
28
+
29
+ export function buildPiProcessSpec(
30
+ argv = process.argv.slice(2),
31
+ baseEnv = process.env,
32
+ ) {
33
+ return {
34
+ command: process.execPath,
35
+ args: [resolvePiCliPath(), "-e", getOmniPackageDir(), ...argv],
36
+ env: buildOmniEnvironment(baseEnv),
37
+ };
38
+ }
39
+
40
+ export async function runOmni(argv = process.argv.slice(2), options = {}) {
41
+ const spec = buildPiProcessSpec(argv, options.env);
42
+
43
+ await new Promise((resolve, reject) => {
44
+ const child = spawn(spec.command, spec.args, {
45
+ cwd: options.cwd ?? process.cwd(),
46
+ env: spec.env,
47
+ stdio: "inherit",
48
+ });
49
+
50
+ const forwardSignal = (sig) => child.kill(sig);
51
+ process.on("SIGINT", forwardSignal);
52
+ process.on("SIGTERM", forwardSignal);
53
+
54
+ child.on("exit", (code, signal) => {
55
+ process.off("SIGINT", forwardSignal);
56
+ process.off("SIGTERM", forwardSignal);
57
+
58
+ if (signal) {
59
+ reject(new Error(`omni terminated with signal ${signal}`));
60
+ return;
61
+ }
62
+
63
+ process.exitCode = code ?? 0;
64
+ resolve(code ?? 0);
65
+ });
66
+ child.on("error", (err) => {
67
+ process.off("SIGINT", forwardSignal);
68
+ process.off("SIGTERM", forwardSignal);
69
+ reject(err);
70
+ });
71
+ });
72
+ }
73
+
74
+ export function isOmniEntrypointInvocation(
75
+ argvPath = process.argv[1],
76
+ moduleUrl = import.meta.url,
77
+ ) {
78
+ if (!argvPath) {
79
+ return false;
80
+ }
81
+
82
+ try {
83
+ return realpathSync(argvPath) === realpathSync(fileURLToPath(moduleUrl));
84
+ } catch {
85
+ return path.resolve(argvPath) === fileURLToPath(moduleUrl);
86
+ }
87
+ }
88
+
89
+ if (isOmniEntrypointInvocation()) {
90
+ runOmni().catch((error) => {
91
+ console.error(error instanceof Error ? error.message : String(error));
92
+ process.exit(1);
93
+ });
94
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-pi",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Single-agent Pi package that interviews the user, documents the spec, and implements work in bounded slices.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -16,6 +16,9 @@
16
16
  "engines": {
17
17
  "node": ">=22"
18
18
  },
19
+ "bin": {
20
+ "omni": "bin/omni.js"
21
+ },
19
22
  "keywords": [
20
23
  "pi-package",
21
24
  "pi",
@@ -25,6 +28,7 @@
25
28
  "interview"
26
29
  ],
27
30
  "files": [
31
+ "bin",
28
32
  "agents",
29
33
  "extensions",
30
34
  "prompts",
@@ -35,7 +39,7 @@
35
39
  "CREDITS.md"
36
40
  ],
37
41
  "scripts": {
38
- "chat": "node ./node_modules/@mariozechner/pi-coding-agent/dist/cli.js -e .",
42
+ "chat": "node ./bin/omni.js",
39
43
  "check": "tsc --noEmit",
40
44
  "lint": "biome check .",
41
45
  "format": "biome check --write .",