studioflow 0.1.4 → 0.1.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 +151 -9
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/scripts/sync-skills.mjs +60 -0
- package/skills/manifest.json +14 -0
package/package.json
CHANGED
package/scripts/sync-skills.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
2
3
|
import fs from "node:fs/promises";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -12,6 +13,64 @@ const targetFlowsRoot = path.join(packageRoot, "flows");
|
|
|
12
13
|
const skillNames = ["studioflow-cli", "studioflow-investigate"];
|
|
13
14
|
const flowNames = ["billing.yaml", "onboarding.yaml", "onboarding_billing.yaml"];
|
|
14
15
|
|
|
16
|
+
async function listFilesRecursively(rootDir) {
|
|
17
|
+
const entries = await fs.readdir(rootDir, { withFileTypes: true });
|
|
18
|
+
const files = [];
|
|
19
|
+
|
|
20
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
21
|
+
const fullPath = path.join(rootDir, entry.name);
|
|
22
|
+
if (entry.isDirectory()) {
|
|
23
|
+
files.push(...(await listFilesRecursively(fullPath)));
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (entry.isFile()) {
|
|
27
|
+
files.push(fullPath);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return files;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function hashDirectoryContents(rootDir) {
|
|
35
|
+
const hasher = createHash("sha256");
|
|
36
|
+
const files = await listFilesRecursively(rootDir);
|
|
37
|
+
|
|
38
|
+
for (const filePath of files) {
|
|
39
|
+
const relativePath = path.relative(rootDir, filePath).split(path.sep).join("/");
|
|
40
|
+
hasher.update(relativePath);
|
|
41
|
+
hasher.update("\n");
|
|
42
|
+
hasher.update(await fs.readFile(filePath));
|
|
43
|
+
hasher.update("\n");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return hasher.digest("hex");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function readPackageVersion() {
|
|
50
|
+
const packageJsonPath = path.join(packageRoot, "package.json");
|
|
51
|
+
const raw = await fs.readFile(packageJsonPath, "utf8");
|
|
52
|
+
const parsed = JSON.parse(raw);
|
|
53
|
+
return typeof parsed.version === "string" ? parsed.version : "0.0.0";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function buildSkillsManifest() {
|
|
57
|
+
const skills = {};
|
|
58
|
+
for (const skillName of skillNames) {
|
|
59
|
+
const skillPath = path.join(sourceSkillsRoot, skillName);
|
|
60
|
+
skills[skillName] = {
|
|
61
|
+
hash: await hashDirectoryContents(skillPath)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
schemaVersion: 1,
|
|
67
|
+
packageName: "studioflow",
|
|
68
|
+
packageVersion: await readPackageVersion(),
|
|
69
|
+
generatedAt: new Date().toISOString(),
|
|
70
|
+
skills
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
15
74
|
async function ensureSkillExists(skillName) {
|
|
16
75
|
const skillPath = path.join(sourceSkillsRoot, skillName, "SKILL.md");
|
|
17
76
|
await fs.access(skillPath);
|
|
@@ -34,6 +93,7 @@ async function main() {
|
|
|
34
93
|
const target = path.join(targetSkillsRoot, skillName);
|
|
35
94
|
await fs.cp(source, target, { recursive: true });
|
|
36
95
|
}
|
|
96
|
+
await fs.writeFile(path.join(targetSkillsRoot, "manifest.json"), `${JSON.stringify(await buildSkillsManifest(), null, 2)}\n`);
|
|
37
97
|
|
|
38
98
|
await fs.rm(targetFlowsRoot, { recursive: true, force: true });
|
|
39
99
|
await fs.mkdir(targetFlowsRoot, { recursive: true });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"packageName": "studioflow",
|
|
4
|
+
"packageVersion": "0.1.5",
|
|
5
|
+
"generatedAt": "2026-02-14T00:24:03.533Z",
|
|
6
|
+
"skills": {
|
|
7
|
+
"studioflow-cli": {
|
|
8
|
+
"hash": "50cb91859a39b682eda7e8defe273eacb6146c49579f7f97328617b842f759c3"
|
|
9
|
+
},
|
|
10
|
+
"studioflow-investigate": {
|
|
11
|
+
"hash": "69850be6246b5bd99633aa0db48eb55f63948e9fc8b47e9f37037455ab9edfcf"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|