@weave-tools/weave-it 0.1.1 → 0.1.2
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/cli.d.ts +2 -1
- package/dist/cli.js +41 -31
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
|
|
3
|
+
declare function readPackageVersion(moduleUrl?: string): string;
|
|
3
4
|
declare function createProgram(): Command;
|
|
4
5
|
declare function isDirectCliInvocation(scriptPath?: string, moduleUrl?: string): boolean;
|
|
5
6
|
|
|
6
|
-
export { createProgram, isDirectCliInvocation };
|
|
7
|
+
export { createProgram, isDirectCliInvocation, readPackageVersion };
|
package/dist/cli.js
CHANGED
|
@@ -18,60 +18,60 @@ import { realpath } from "fs/promises";
|
|
|
18
18
|
import { constants } from "fs";
|
|
19
19
|
import { access, mkdir, readFile, readdir, rename, stat, writeFile } from "fs/promises";
|
|
20
20
|
import { dirname } from "path";
|
|
21
|
-
async function pathExists(
|
|
21
|
+
async function pathExists(path15) {
|
|
22
22
|
try {
|
|
23
|
-
await access(
|
|
23
|
+
await access(path15, constants.F_OK);
|
|
24
24
|
return true;
|
|
25
25
|
} catch {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
async function writeNewFile(
|
|
30
|
-
await writeFile(
|
|
29
|
+
async function writeNewFile(path15, contents) {
|
|
30
|
+
await writeFile(path15, contents, { flag: "wx" });
|
|
31
31
|
}
|
|
32
|
-
async function writeFileIfMissing(
|
|
33
|
-
if (await pathExists(
|
|
32
|
+
async function writeFileIfMissing(path15, contents) {
|
|
33
|
+
if (await pathExists(path15)) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
|
-
await writeNewFile(
|
|
36
|
+
await writeNewFile(path15, contents);
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
|
-
async function writeFileAtomic(
|
|
40
|
-
const tempPath = `${
|
|
39
|
+
async function writeFileAtomic(path15, contents) {
|
|
40
|
+
const tempPath = `${path15}.${process.pid}.tmp`;
|
|
41
41
|
await writeFile(tempPath, contents);
|
|
42
|
-
await rename(tempPath,
|
|
42
|
+
await rename(tempPath, path15);
|
|
43
43
|
}
|
|
44
|
-
async function ensureDir(
|
|
45
|
-
await mkdir(
|
|
44
|
+
async function ensureDir(path15) {
|
|
45
|
+
await mkdir(path15, { recursive: true });
|
|
46
46
|
}
|
|
47
|
-
async function createDirExclusive(
|
|
48
|
-
await mkdir(
|
|
47
|
+
async function createDirExclusive(path15) {
|
|
48
|
+
await mkdir(path15, { recursive: false });
|
|
49
49
|
}
|
|
50
|
-
async function ensureDirectory(
|
|
51
|
-
const value = await stat(
|
|
50
|
+
async function ensureDirectory(path15) {
|
|
51
|
+
const value = await stat(path15);
|
|
52
52
|
if (!value.isDirectory()) {
|
|
53
|
-
throw new Error(`Expected a directory: ${
|
|
53
|
+
throw new Error(`Expected a directory: ${path15}`);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
async function isDirectoryEmpty(
|
|
57
|
-
const entries = await readdir(
|
|
56
|
+
async function isDirectoryEmpty(path15) {
|
|
57
|
+
const entries = await readdir(path15);
|
|
58
58
|
return entries.length === 0;
|
|
59
59
|
}
|
|
60
60
|
async function movePath(source, target) {
|
|
61
61
|
await rename(source, target);
|
|
62
62
|
}
|
|
63
|
-
async function readJsonCache(
|
|
63
|
+
async function readJsonCache(path15) {
|
|
64
64
|
try {
|
|
65
|
-
const contents = await readFile(
|
|
65
|
+
const contents = await readFile(path15, "utf8");
|
|
66
66
|
return JSON.parse(contents);
|
|
67
67
|
} catch {
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
async function writeJsonCache(
|
|
71
|
+
async function writeJsonCache(path15, data) {
|
|
72
72
|
try {
|
|
73
|
-
await mkdir(dirname(
|
|
74
|
-
await writeFileAtomic(
|
|
73
|
+
await mkdir(dirname(path15), { recursive: true });
|
|
74
|
+
await writeFileAtomic(path15, JSON.stringify(data, null, 2));
|
|
75
75
|
return true;
|
|
76
76
|
} catch {
|
|
77
77
|
return false;
|
|
@@ -1274,8 +1274,8 @@ function formatFullFileDiff(installedPath, defaultName, installed, currentDefaul
|
|
|
1274
1274
|
function splitLines(value) {
|
|
1275
1275
|
return value.endsWith("\n") ? value.slice(0, -1).split("\n") : value.split("\n");
|
|
1276
1276
|
}
|
|
1277
|
-
function result(agent, artifact,
|
|
1278
|
-
return { agent, kind: artifact.kind, skill: artifact.name, path:
|
|
1277
|
+
function result(agent, artifact, path15, status, message) {
|
|
1278
|
+
return { agent, kind: artifact.kind, skill: artifact.name, path: path15, status, message };
|
|
1279
1279
|
}
|
|
1280
1280
|
function summarize(results) {
|
|
1281
1281
|
return {
|
|
@@ -2991,9 +2991,9 @@ async function safeListDefaultSkills(templatesDir) {
|
|
|
2991
2991
|
return [];
|
|
2992
2992
|
}
|
|
2993
2993
|
}
|
|
2994
|
-
async function safeHashFile(
|
|
2994
|
+
async function safeHashFile(path15) {
|
|
2995
2995
|
try {
|
|
2996
|
-
const content = await readFile8(
|
|
2996
|
+
const content = await readFile8(path15, "utf8");
|
|
2997
2997
|
return `sha256:${createHash3("sha256").update(content).digest("hex")}`;
|
|
2998
2998
|
} catch {
|
|
2999
2999
|
return null;
|
|
@@ -4513,11 +4513,20 @@ function workspaceCommand() {
|
|
|
4513
4513
|
}
|
|
4514
4514
|
|
|
4515
4515
|
// src/cli.ts
|
|
4516
|
-
import { realpathSync } from "fs";
|
|
4516
|
+
import { readFileSync, realpathSync } from "fs";
|
|
4517
|
+
import path14 from "path";
|
|
4517
4518
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4519
|
+
function readPackageVersion3(moduleUrl = import.meta.url) {
|
|
4520
|
+
const packageJsonPath = path14.join(path14.dirname(fileURLToPath4(moduleUrl)), "..", "package.json");
|
|
4521
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
4522
|
+
if (typeof packageJson.version !== "string") {
|
|
4523
|
+
throw new Error(`Missing version in ${packageJsonPath}`);
|
|
4524
|
+
}
|
|
4525
|
+
return packageJson.version;
|
|
4526
|
+
}
|
|
4518
4527
|
function createProgram() {
|
|
4519
4528
|
const program = new Command10();
|
|
4520
|
-
program.name("weave").description("Repo-local LLM wiki and temporary multi-folder AI session tooling.").version(
|
|
4529
|
+
program.name("weave").description("Repo-local LLM wiki and temporary multi-folder AI session tooling.").version(readPackageVersion3());
|
|
4521
4530
|
program.addCommand(initCommand());
|
|
4522
4531
|
program.addCommand(addCommand());
|
|
4523
4532
|
program.addCommand(workspaceCommand());
|
|
@@ -4545,6 +4554,7 @@ if (isDirectCliInvocation()) {
|
|
|
4545
4554
|
}
|
|
4546
4555
|
export {
|
|
4547
4556
|
createProgram,
|
|
4548
|
-
isDirectCliInvocation
|
|
4557
|
+
isDirectCliInvocation,
|
|
4558
|
+
readPackageVersion3 as readPackageVersion
|
|
4549
4559
|
};
|
|
4550
4560
|
//# sourceMappingURL=cli.js.map
|