@polka-codes/runner 0.8.21 → 0.8.22

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/dist/index.js +45 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32748,7 +32748,7 @@ var {
32748
32748
  Help
32749
32749
  } = import__.default;
32750
32750
  // package.json
32751
- var version = "0.8.21";
32751
+ var version = "0.8.22";
32752
32752
 
32753
32753
  // src/runner.ts
32754
32754
  import { execSync } from "node:child_process";
@@ -42903,7 +42903,48 @@ var searchFiles_default = {
42903
42903
  };
42904
42904
  // ../core/src/tools/updateKnowledge.ts
42905
42905
  var import_yaml = __toESM(require_dist(), 1);
42906
- import { join } from "node:path";
42906
+
42907
+ // ../core/src/path.ts
42908
+ function normalize(path) {
42909
+ const isAbsolute = path.startsWith("/");
42910
+ const segments = path.split("/").filter(Boolean);
42911
+ const stack = [];
42912
+ for (const seg of segments) {
42913
+ if (seg === ".")
42914
+ continue;
42915
+ if (seg === "..") {
42916
+ if (stack.length && stack[stack.length - 1] !== "..") {
42917
+ stack.pop();
42918
+ } else if (!isAbsolute) {
42919
+ stack.push("..");
42920
+ }
42921
+ } else {
42922
+ stack.push(seg);
42923
+ }
42924
+ }
42925
+ let result = stack.join("/");
42926
+ if (!result && !isAbsolute)
42927
+ return ".";
42928
+ if (result && path.endsWith("/"))
42929
+ result += "/";
42930
+ return (isAbsolute ? "/" : "") + result;
42931
+ }
42932
+ function join(...parts) {
42933
+ if (parts.length === 0)
42934
+ return ".";
42935
+ let combined = "";
42936
+ for (const p2 of parts) {
42937
+ if (typeof p2 !== "string") {
42938
+ throw new TypeError("Arguments to join must be strings");
42939
+ }
42940
+ if (p2) {
42941
+ combined = combined ? `${combined}/${p2}` : p2;
42942
+ }
42943
+ }
42944
+ return normalize(combined);
42945
+ }
42946
+
42947
+ // ../core/src/tools/updateKnowledge.ts
42907
42948
  var toolInfo9 = {
42908
42949
  name: "update_knowledge",
42909
42950
  description: "Update knowledge in a knowledge.ai.yml file with smart merging capabilities. This tool lets you add, update, or remove information using path-based updates and special directives.",
@@ -52663,7 +52704,7 @@ var readConfig = (path) => {
52663
52704
  var import_ignore2 = __toESM(require_ignore(), 1);
52664
52705
  import { spawn as spawn2 } from "node:child_process";
52665
52706
  import { mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
52666
- import { dirname } from "node:path";
52707
+ import { dirname as dirname2 } from "node:path";
52667
52708
 
52668
52709
  // ../../node_modules/@inquirer/core/dist/esm/lib/key.js
52669
52710
  var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
@@ -54119,7 +54160,7 @@ var getProvider = (agentName, config2, options = {}) => {
54119
54160
  if (ig.ignores(path)) {
54120
54161
  throw new Error(`Not allow to access file ${path}`);
54121
54162
  }
54122
- await mkdir(dirname(path), { recursive: true });
54163
+ await mkdir(dirname2(path), { recursive: true });
54123
54164
  return await writeFile(path, content, "utf8");
54124
54165
  },
54125
54166
  removeFile: async (path) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/runner",
3
- "version": "0.8.21",
3
+ "version": "0.8.22",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",