@ducci/jarvis 1.0.55 → 1.0.56
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/package.json +1 -1
- package/src/server/tools.js +3 -3
package/package.json
CHANGED
package/src/server/tools.js
CHANGED
|
@@ -38,7 +38,7 @@ const SEED_TOOLS = {
|
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
code: `
|
|
41
|
-
const targetPath = path.resolve(
|
|
41
|
+
const _p = args.path; const targetPath = path.resolve(_p === '~' || _p.startsWith('~/') ? require('os').homedir() + _p.slice(1) : _p);
|
|
42
42
|
const raw = await fs.promises.readFile(targetPath, 'utf8');
|
|
43
43
|
const lines = raw.split('\\n');
|
|
44
44
|
const offset = args.offset ? args.offset - 1 : 0;
|
|
@@ -308,7 +308,7 @@ const SEED_TOOLS = {
|
|
|
308
308
|
},
|
|
309
309
|
},
|
|
310
310
|
code: `
|
|
311
|
-
const targetPath = path.resolve(
|
|
311
|
+
const _p = args.path; const targetPath = path.resolve(_p === '~' || _p.startsWith('~/') ? require('os').homedir() + _p.slice(1) : _p);
|
|
312
312
|
await fs.promises.mkdir(path.dirname(targetPath), { recursive: true });
|
|
313
313
|
await fs.promises.writeFile(targetPath, args.content, 'utf8');
|
|
314
314
|
if (args.mode) {
|
|
@@ -345,7 +345,7 @@ const SEED_TOOLS = {
|
|
|
345
345
|
},
|
|
346
346
|
},
|
|
347
347
|
code: `
|
|
348
|
-
const targetPath = path.resolve(
|
|
348
|
+
const _p = args.path; const targetPath = path.resolve(_p === '~' || _p.startsWith('~/') ? require('os').homedir() + _p.slice(1) : _p);
|
|
349
349
|
const content = await fs.promises.readFile(targetPath, 'utf8');
|
|
350
350
|
const count = content.split(args.old_string).length - 1;
|
|
351
351
|
if (count === 0) {
|