pai-zero 0.10.2 → 0.10.3

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.
package/dist/bin/pai.js CHANGED
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
10
4
  var __esm = (fn, res) => function __init() {
11
5
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
6
  };
@@ -882,6 +876,8 @@ __export(platform_exports, {
882
876
  });
883
877
  import os from "os";
884
878
  import fs3 from "fs";
879
+ import path from "path";
880
+ import { execFileSync } from "child_process";
885
881
  function diagnoseWindowsEnv() {
886
882
  const issues = [];
887
883
  const warnings = [];
@@ -923,16 +919,15 @@ function getPlatformInfo() {
923
919
  function getShellRcPath() {
924
920
  const home = os.homedir();
925
921
  if (isWindows) {
926
- const ps7 = __require("path").join(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1");
927
- const ps5 = __require("path").join(home, "Documents", "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1");
928
- if (fs3.existsSync(__require("path").dirname(ps7))) return ps7;
922
+ const ps7 = path.join(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1");
923
+ const ps5 = path.join(home, "Documents", "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1");
924
+ if (fs3.existsSync(path.dirname(ps7))) return ps7;
929
925
  return ps5;
930
926
  }
931
927
  const shell = process.env["SHELL"] || "";
932
- return shell.includes("zsh") ? __require("path").join(home, ".zshrc") : __require("path").join(home, ".bashrc");
928
+ return shell.includes("zsh") ? path.join(home, ".zshrc") : path.join(home, ".bashrc");
933
929
  }
934
930
  function spawnSubshell(cwd) {
935
- const { execFileSync } = __require("child_process");
936
931
  try {
937
932
  if (isWindows) {
938
933
  execFileSync("powershell.exe", ["-NoExit", "-Command", `Set-Location '${cwd}'`], {
@@ -2824,20 +2819,20 @@ npx pai-zero wakeup # \uC9C0\uAE08 \uB79C\uB364 \uBA54\uC2DC\uC9
2824
2819
  });
2825
2820
 
2826
2821
  // src/core/config.ts
2827
- import path from "path";
2822
+ import path2 from "path";
2828
2823
  import { createRequire } from "module";
2829
2824
  import fs7 from "fs-extra";
2830
2825
  async function loadConfig(cwd) {
2831
- const configPath = path.join(cwd, CONFIG_DIR, CONFIG_FILE);
2826
+ const configPath = path2.join(cwd, CONFIG_DIR, CONFIG_FILE);
2832
2827
  if (await fs7.pathExists(configPath)) {
2833
2828
  return fs7.readJson(configPath);
2834
2829
  }
2835
2830
  return null;
2836
2831
  }
2837
2832
  async function saveConfig(cwd, config) {
2838
- const configDir = path.join(cwd, CONFIG_DIR);
2833
+ const configDir = path2.join(cwd, CONFIG_DIR);
2839
2834
  await fs7.ensureDir(configDir);
2840
- await fs7.writeJson(path.join(configDir, CONFIG_FILE), config, { spaces: 2 });
2835
+ await fs7.writeJson(path2.join(configDir, CONFIG_FILE), config, { spaces: 2 });
2841
2836
  }
2842
2837
  function createDefaultConfig(projectName, mode) {
2843
2838
  return {
@@ -3097,7 +3092,7 @@ __export(detector_exports, {
3097
3092
  getPluginsForMode: () => getPluginsForMode,
3098
3093
  scanProjectState: () => scanProjectState
3099
3094
  });
3100
- import path2 from "path";
3095
+ import path3 from "path";
3101
3096
  import fs9 from "fs-extra";
3102
3097
  async function scanProjectState(cwd) {
3103
3098
  const result = {
@@ -3108,7 +3103,7 @@ async function scanProjectState(cwd) {
3108
3103
  missingPlugins: [],
3109
3104
  details: {}
3110
3105
  };
3111
- const paiConfigPath = path2.join(cwd, ".pai", "config.json");
3106
+ const paiConfigPath = path3.join(cwd, ".pai", "config.json");
3112
3107
  if (await fs9.pathExists(paiConfigPath)) {
3113
3108
  result.hasPaiConfig = true;
3114
3109
  try {
@@ -3120,7 +3115,7 @@ async function scanProjectState(cwd) {
3120
3115
  for (const [key, signatures] of Object.entries(PLUGIN_SIGNATURES)) {
3121
3116
  const installed = await Promise.any(
3122
3117
  signatures.map(async (sig) => {
3123
- if (await fs9.pathExists(path2.join(cwd, sig))) return true;
3118
+ if (await fs9.pathExists(path3.join(cwd, sig))) return true;
3124
3119
  throw new Error("not found");
3125
3120
  })
3126
3121
  ).catch(() => false);
@@ -3131,7 +3126,7 @@ async function scanProjectState(cwd) {
3131
3126
  result.missingPlugins.push(key);
3132
3127
  }
3133
3128
  }
3134
- const hasAnyContent = result.installedPlugins.length > 0 || await fs9.pathExists(path2.join(cwd, "package.json")) || await fs9.pathExists(path2.join(cwd, "src")) || await fs9.pathExists(path2.join(cwd, "README.md"));
3129
+ const hasAnyContent = result.installedPlugins.length > 0 || await fs9.pathExists(path3.join(cwd, "package.json")) || await fs9.pathExists(path3.join(cwd, "src")) || await fs9.pathExists(path3.join(cwd, "README.md"));
3135
3130
  result.isNewProject = !hasAnyContent;
3136
3131
  return result;
3137
3132
  }
@@ -3353,8 +3348,8 @@ async function checkCiCd(repoPath) {
3353
3348
  { path: "Jenkinsfile", label: "Jenkins" },
3354
3349
  { path: ".circleci", label: "CircleCI" }
3355
3350
  ];
3356
- for (const { path: path3, label } of ciConfigs) {
3357
- const found = await fs10.pathExists(join7(repoPath, path3));
3351
+ for (const { path: path4, label } of ciConfigs) {
3352
+ const found = await fs10.pathExists(join7(repoPath, path4));
3358
3353
  findings.push({ item: label, found, details: found ? "\uC874\uC7AC" : "\uC5C6\uC74C" });
3359
3354
  if (found) score += 40;
3360
3355
  }
@@ -3372,8 +3367,8 @@ async function checkHooks(repoPath) {
3372
3367
  { path: "commitlint.config.js", label: "commitlint" },
3373
3368
  { path: ".claude/settings.json", label: "Claude Code settings" }
3374
3369
  ];
3375
- for (const { path: path3, label } of hookConfigs) {
3376
- const found = await fs10.pathExists(join7(repoPath, path3));
3370
+ for (const { path: path4, label } of hookConfigs) {
3371
+ const found = await fs10.pathExists(join7(repoPath, path4));
3377
3372
  findings.push({ item: label, found, details: found ? "\uC874\uC7AC" : "\uC5C6\uC74C" });
3378
3373
  if (found) score += 20;
3379
3374
  }
@@ -3390,8 +3385,8 @@ async function checkRepoStructure(repoPath) {
3390
3385
  { path: ".env.example", label: "\uD658\uACBD\uBCC0\uC218 \uC608\uC2DC" },
3391
3386
  { path: ".gitignore", label: ".gitignore" }
3392
3387
  ];
3393
- for (const { path: path3, label } of structureChecks) {
3394
- const found = await fs10.pathExists(join7(repoPath, path3));
3388
+ for (const { path: path4, label } of structureChecks) {
3389
+ const found = await fs10.pathExists(join7(repoPath, path4));
3395
3390
  findings.push({ item: label, found, details: found ? "\uC874\uC7AC" : "\uC5C6\uC74C" });
3396
3391
  if (found) score += 25;
3397
3392
  }
@@ -3407,8 +3402,8 @@ async function checkDocumentation(repoPath) {
3407
3402
  { path: "docs", label: "docs/ \uB514\uB809\uD1A0\uB9AC", points: 25 },
3408
3403
  { path: "docs/openspec.md", label: "OpenSpec PRD", points: 25 }
3409
3404
  ];
3410
- for (const { path: path3, label, points } of docChecks) {
3411
- const found = await fs10.pathExists(join7(repoPath, path3));
3405
+ for (const { path: path4, label, points } of docChecks) {
3406
+ const found = await fs10.pathExists(join7(repoPath, path4));
3412
3407
  findings.push({ item: label, found, details: found ? "\uC874\uC7AC" : "\uC5C6\uC74C" });
3413
3408
  if (found) score += points;
3414
3409
  }
@@ -3426,8 +3421,8 @@ async function checkHarnessEngineering(repoPath) {
3426
3421
  { path: ".claude/commands", label: ".claude/commands/", points: 10 },
3427
3422
  { path: ".pai/config.json", label: "PAI config", points: 10 }
3428
3423
  ];
3429
- for (const { path: path3, label, points } of harnessChecks) {
3430
- const found = await fs10.pathExists(join7(repoPath, path3));
3424
+ for (const { path: path4, label, points } of harnessChecks) {
3425
+ const found = await fs10.pathExists(join7(repoPath, path4));
3431
3426
  findings.push({ item: label, found, details: found ? "\uC874\uC7AC" : "\uC5C6\uC74C" });
3432
3427
  if (found) score += points;
3433
3428
  }
@@ -5570,9 +5565,9 @@ var init_errors = __esm({
5570
5565
  recoverable;
5571
5566
  };
5572
5567
  ConfigNotFoundError = class extends PaiError {
5573
- constructor(path3) {
5568
+ constructor(path4) {
5574
5569
  super(
5575
- `.pai/config.json not found at ${path3}. Run 'pai init' first.`,
5570
+ `.pai/config.json not found at ${path4}. Run 'pai init' first.`,
5576
5571
  "CONFIG_NOT_FOUND",
5577
5572
  true
5578
5573
  );