@wax0629/pi-manager 0.1.0 → 0.1.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.mjs +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wax0629/pi-manager",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Local control plane for Pi: providers, models, and live import into ~/.pi/agent.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -144,8 +144,16 @@ async function main(argv = process.argv.slice(2)) {
144
144
  return 0;
145
145
  }
146
146
 
147
- const isDirectRun = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
148
- if (isDirectRun) {
147
+ export function isCliEntrypoint(argv1 = process.argv[1], moduleUrl = import.meta.url) {
148
+ if (!argv1) return false;
149
+ try {
150
+ return fs.realpathSync(argv1) === fs.realpathSync(fileURLToPath(moduleUrl));
151
+ } catch {
152
+ return path.resolve(argv1) === fileURLToPath(moduleUrl);
153
+ }
154
+ }
155
+
156
+ if (isCliEntrypoint()) {
149
157
  main().catch((error) => {
150
158
  console.error(error instanceof Error ? error.message : String(error));
151
159
  process.exitCode = 1;