@agent-smith/cli 0.0.87 → 0.0.88

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.
@@ -1,15 +1,6 @@
1
1
  import clipboard from 'clipboardy';
2
- import { execute } from "./execute.js";
3
- const { platform } = process;
4
2
  async function readClipboard() {
5
- let res = "";
6
- if (platform == "linux") {
7
- res = await execute("xclip", ["-o", "-selection", "primary"]);
8
- }
9
- else {
10
- res = await clipboard.read();
11
- }
12
- return res;
3
+ return await clipboard.read();
13
4
  }
14
5
  async function writeToClipboard(data) {
15
6
  await clipboard.write(data);
@@ -1,11 +1,13 @@
1
1
  import { spawn } from "child_process";
2
+ import { platform } from "os";
2
3
  async function execute(command, args = [], { onStdout = (data) => { }, onStderr = (data) => { }, onError = (data) => { }, stream = false, } = {
3
4
  onStderr: (data) => console.log("stderr:", data),
4
5
  onError: (err) => { if (err)
5
6
  throw err; },
6
7
  }) {
7
8
  let buffer = new Array();
8
- const child = spawn(command, args, { shell: false });
9
+ const useShell = platform() === 'win32';
10
+ const child = spawn(command, args, { shell: useShell });
9
11
  child.stdout.setEncoding('utf8');
10
12
  child.stdout.on('data', (data) => {
11
13
  buffer.push(data);
@@ -32,7 +34,8 @@ function run(command, args = [], { onStdout = (data) => { }, onStderr = (data) =
32
34
  throw err; },
33
35
  onFinished: () => { },
34
36
  }) {
35
- var child = spawn(command, args);
37
+ const useShell = platform() === 'win32';
38
+ var child = spawn(command, args, { shell: useShell });
36
39
  child.stdout.setEncoding('utf8');
37
40
  child.stdout.on('data', (data) => onStdout(data));
38
41
  child.stderr.setEncoding('utf8');
package/dist/conf.js CHANGED
@@ -5,6 +5,7 @@ import { runtimeError } from "./cmd/lib/user_msgs.js";
5
5
  import { localBackends } from "./const.js";
6
6
  import { homedir } from 'os';
7
7
  import { join } from 'path';
8
+ import { createDirectoryIfNotExists } from "./cmd/sys/dirs.js";
8
9
  function getConfigPath(appName, filename) {
9
10
  let confDir;
10
11
  let dbPath;
@@ -24,6 +25,7 @@ function getConfigPath(appName, filename) {
24
25
  }
25
26
  const { confDir, dbPath } = getConfigPath("agent-smith", "config.db");
26
27
  async function processConfPath(confPath) {
28
+ createDirectoryIfNotExists(confDir);
27
29
  const { found, data } = readConf(confPath);
28
30
  if (!found) {
29
31
  runtimeError(`Config file ${confPath} not found`);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@agent-smith/cli",
3
3
  "description": "Agent Smith: terminal client for language model agents",
4
4
  "repository": "https://github.com/synw/agent-smith",
5
- "version": "0.0.87",
5
+ "version": "0.0.88",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",