zhitalk 0.0.3 → 0.0.5

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/index.js CHANGED
@@ -40,6 +40,12 @@ const path_1 = require("path");
40
40
  const config_1 = require("./agent/config");
41
41
  const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../package.json'), 'utf-8'));
42
42
  async function main() {
43
+ const program = new commander_1.Command();
44
+ program.name(pkg.name).description(pkg.description).version(pkg.version);
45
+ if (process.argv.length > 2) {
46
+ program.parse();
47
+ return;
48
+ }
43
49
  if (!(0, fs_1.existsSync)(config_1.CONFIG_PATH)) {
44
50
  const { runInstall } = await Promise.resolve().then(() => __importStar(require('./install')));
45
51
  await runInstall();
@@ -59,14 +65,7 @@ async function main() {
59
65
  await shutdownMcp();
60
66
  process.exit(0);
61
67
  });
62
- const program = new commander_1.Command();
63
- program.name(pkg.name).description(pkg.description).version(pkg.version);
64
- if (process.argv.length > 2) {
65
- program.parse();
66
- }
67
- else {
68
- await interactiveChat();
69
- }
68
+ await interactiveChat();
70
69
  await shutdownMcp();
71
70
  }
72
71
  main();
package/dist/install.js CHANGED
@@ -41,8 +41,8 @@ const child_process_1 = require("child_process");
41
41
  const config_1 = require("./agent/config");
42
42
  const db_1 = require("./agent/db");
43
43
  const SKILLS_DIR = path.join(config_1.WORKSPACE_DIR, '.agents', 'skills');
44
- function run(command) {
45
- (0, child_process_1.execSync)(command, { stdio: 'inherit' });
44
+ function run(command, options) {
45
+ (0, child_process_1.execSync)(command, { stdio: 'inherit', ...options });
46
46
  }
47
47
  function installSkill(name, repo, skillPath, targetDir, tempDir) {
48
48
  if (fs.existsSync(targetDir)) {
@@ -53,13 +53,22 @@ function installSkill(name, repo, skillPath, targetDir, tempDir) {
53
53
  const tarPath = path.join(tempDir, `${name}.tar.gz`);
54
54
  const extractDir = path.join(tempDir, `${name}-extract`);
55
55
  fs.mkdirSync(extractDir, { recursive: true });
56
- run(`curl -fsSL -o "${tarPath}" "https://github.com/${repo}/archive/refs/heads/main.tar.gz"`);
57
- run(`tar -xzf "${tarPath}" -C "${extractDir}"`);
58
- const subDir = fs.readdirSync(extractDir)[0];
59
- fs.cpSync(path.join(extractDir, subDir, skillPath), targetDir, {
60
- recursive: true,
61
- });
62
- console.log(` ✅ ${name} 安装完成`);
56
+ try {
57
+ run(`curl -fsSL -o "${tarPath}" "https://github.com/${repo}/archive/refs/heads/main.tar.gz"`, { timeout: 20000 });
58
+ run(`tar -xzf "${tarPath}" -C "${extractDir}"`, { timeout: 20000 });
59
+ const subDir = fs.readdirSync(extractDir)[0];
60
+ fs.cpSync(path.join(extractDir, subDir, skillPath), targetDir, {
61
+ recursive: true,
62
+ });
63
+ console.log(` ✅ ${name} 安装完成`);
64
+ }
65
+ catch (error) {
66
+ if (error.killed) {
67
+ console.log(` ⏱️ ${name} 安装超时(超过 20s),已跳过,继续下一步`);
68
+ return;
69
+ }
70
+ throw error;
71
+ }
63
72
  }
64
73
  async function runInstall() {
65
74
  console.log('🚀 欢迎使用 Zhitalk!首次使用需要进行初始化配置。\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhitalk",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "A personal AI Agent like OpenClaw, including tools, skills, memory, hook, sub-agent, MCP server, etc. Run in the terminal.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@types/better-sqlite3": "^7.6.13",
41
41
  "better-sqlite3": "^12.10.0",
42
42
  "boxen": "^8.0.1",
43
- "chalk": "^5.6.2",
43
+ "chalk": "^4.1.2",
44
44
  "cli-table3": "^0.6.5",
45
45
  "commander": "^14.0.3",
46
46
  "figlet": "^1.11.0",
@@ -0,0 +1,4 @@
1
+ packages:
2
+ - '.'
3
+ onlyBuiltDependencies:
4
+ - better-sqlite3