flowbook 0.2.1 → 0.2.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/README.md +0 -1
- package/dist/cli.js +3 -29
- package/package.json +1 -1
- package/src/node/init.ts +1 -32
package/README.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/node/init.ts
|
|
4
|
-
import { readFileSync, writeFileSync, existsSync
|
|
4
|
+
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
5
5
|
import { resolve } from "path";
|
|
6
6
|
import { execSync } from "child_process";
|
|
7
|
-
var EXAMPLE_FLOW = `---
|
|
8
|
-
title: Example Flow
|
|
9
|
-
category: Getting Started
|
|
10
|
-
tags: [example]
|
|
11
|
-
order: 1
|
|
12
|
-
description: An example flowchart to get you started
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
\`\`\`mermaid
|
|
16
|
-
flowchart TD
|
|
17
|
-
A[Start] --> B{Decision}
|
|
18
|
-
B -->|Yes| C[Action A]
|
|
19
|
-
B -->|No| D[Action B]
|
|
20
|
-
C --> E[End]
|
|
21
|
-
D --> E
|
|
22
|
-
\`\`\`
|
|
23
|
-
`;
|
|
24
7
|
async function initFlowbook() {
|
|
25
8
|
const cwd = process.cwd();
|
|
26
9
|
const pkgPath = resolve(cwd, "package.json");
|
|
@@ -55,15 +38,6 @@ async function initFlowbook() {
|
|
|
55
38
|
} else {
|
|
56
39
|
console.log(" \u2713 Scripts already exist in package.json");
|
|
57
40
|
}
|
|
58
|
-
const flowsDir = resolve(cwd, "flows");
|
|
59
|
-
const examplePath = resolve(flowsDir, "example.flow.md");
|
|
60
|
-
if (!existsSync(examplePath)) {
|
|
61
|
-
mkdirSync(flowsDir, { recursive: true });
|
|
62
|
-
writeFileSync(examplePath, EXAMPLE_FLOW);
|
|
63
|
-
console.log(" \u2713 Created flows/example.flow.md");
|
|
64
|
-
} else {
|
|
65
|
-
console.log(" \u2713 Example flow already exists");
|
|
66
|
-
}
|
|
67
41
|
const gitignorePath = resolve(cwd, ".gitignore");
|
|
68
42
|
if (existsSync(gitignorePath)) {
|
|
69
43
|
const gitignore = readFileSync(gitignorePath, "utf-8");
|
|
@@ -235,7 +209,7 @@ async function buildStatic(options) {
|
|
|
235
209
|
}
|
|
236
210
|
|
|
237
211
|
// src/node/skill.ts
|
|
238
|
-
import { existsSync as existsSync2, mkdirSync
|
|
212
|
+
import { existsSync as existsSync2, mkdirSync, copyFileSync } from "fs";
|
|
239
213
|
import { resolve as resolve3, dirname as dirname2 } from "path";
|
|
240
214
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
241
215
|
import { homedir } from "os";
|
|
@@ -357,7 +331,7 @@ function resolveAgents(agentArg) {
|
|
|
357
331
|
function installFile(src, destDir, destFilename) {
|
|
358
332
|
const dest = resolve3(destDir, destFilename);
|
|
359
333
|
if (existsSync2(dest)) return false;
|
|
360
|
-
|
|
334
|
+
mkdirSync(destDir, { recursive: true });
|
|
361
335
|
copyFileSync(src, dest);
|
|
362
336
|
return true;
|
|
363
337
|
}
|
package/package.json
CHANGED
package/src/node/init.ts
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, existsSync
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { execSync } from "node:child_process";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const EXAMPLE_FLOW = `---
|
|
7
|
-
title: Example Flow
|
|
8
|
-
category: Getting Started
|
|
9
|
-
tags: [example]
|
|
10
|
-
order: 1
|
|
11
|
-
description: An example flowchart to get you started
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
\`\`\`mermaid
|
|
15
|
-
flowchart TD
|
|
16
|
-
A[Start] --> B{Decision}
|
|
17
|
-
B -->|Yes| C[Action A]
|
|
18
|
-
B -->|No| D[Action B]
|
|
19
|
-
C --> E[End]
|
|
20
|
-
D --> E
|
|
21
|
-
\`\`\`
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
5
|
export async function initFlowbook() {
|
|
25
6
|
const cwd = process.cwd();
|
|
26
7
|
const pkgPath = resolve(cwd, "package.json");
|
|
@@ -64,18 +45,6 @@ export async function initFlowbook() {
|
|
|
64
45
|
console.log(" ✓ Scripts already exist in package.json");
|
|
65
46
|
}
|
|
66
47
|
|
|
67
|
-
// 3. Create example flow file
|
|
68
|
-
const flowsDir = resolve(cwd, "flows");
|
|
69
|
-
const examplePath = resolve(flowsDir, "example.flow.md");
|
|
70
|
-
|
|
71
|
-
if (!existsSync(examplePath)) {
|
|
72
|
-
mkdirSync(flowsDir, { recursive: true });
|
|
73
|
-
writeFileSync(examplePath, EXAMPLE_FLOW);
|
|
74
|
-
console.log(" ✓ Created flows/example.flow.md");
|
|
75
|
-
} else {
|
|
76
|
-
console.log(" ✓ Example flow already exists");
|
|
77
|
-
}
|
|
78
|
-
|
|
79
48
|
// 4. Add flowbook-static to .gitignore
|
|
80
49
|
const gitignorePath = resolve(cwd, ".gitignore");
|
|
81
50
|
if (existsSync(gitignorePath)) {
|