@forwardimpact/guide 0.1.10 → 0.1.11
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/bin/fit-guide.js +39 -9
- package/package.json +2 -1
package/bin/fit-guide.js
CHANGED
|
@@ -18,12 +18,13 @@ if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
|
18
18
|
console.log(`fit-guide — Conversational agent for the Guide knowledge platform
|
|
19
19
|
|
|
20
20
|
Usage:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
echo "question" |
|
|
21
|
+
npx fit-guide Start interactive conversation
|
|
22
|
+
npx fit-guide --data=<path> Specify framework data directory
|
|
23
|
+
echo "question" | npx fit-guide Pipe a question directly
|
|
24
24
|
|
|
25
25
|
Options:
|
|
26
26
|
--data=<path> Path to framework data directory
|
|
27
|
+
--init Generate secrets and update .env
|
|
27
28
|
--help, -h Show this help message
|
|
28
29
|
--version, -v Show version
|
|
29
30
|
|
|
@@ -43,6 +44,35 @@ if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
|
43
44
|
process.exit(0);
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
// --init flag (works without SERVICE_SECRET)
|
|
48
|
+
if (process.argv.includes("--init")) {
|
|
49
|
+
const { generateJWT, generateSecret, getOrGenerateSecret, updateEnvFile } =
|
|
50
|
+
await import("@forwardimpact/libsecret");
|
|
51
|
+
|
|
52
|
+
const serviceSecret = generateSecret();
|
|
53
|
+
const jwtSecret = await getOrGenerateSecret("JWT_SECRET", () =>
|
|
54
|
+
generateSecret(32),
|
|
55
|
+
);
|
|
56
|
+
const jwtAnonKey = generateJWT(
|
|
57
|
+
{
|
|
58
|
+
iss: "supabase",
|
|
59
|
+
iat: Math.floor(Date.now() / 1000),
|
|
60
|
+
exp: Math.floor(Date.now() / 1000) + 10 * 365 * 24 * 60 * 60,
|
|
61
|
+
role: "anon",
|
|
62
|
+
},
|
|
63
|
+
jwtSecret,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
await updateEnvFile("SERVICE_SECRET", serviceSecret);
|
|
67
|
+
await updateEnvFile("JWT_SECRET", jwtSecret);
|
|
68
|
+
await updateEnvFile("JWT_ANON_KEY", jwtAnonKey);
|
|
69
|
+
|
|
70
|
+
console.log("SERVICE_SECRET was updated in .env");
|
|
71
|
+
console.log("JWT_SECRET is set in .env");
|
|
72
|
+
console.log("JWT_ANON_KEY was updated in .env");
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}
|
|
75
|
+
|
|
46
76
|
// SERVICE_SECRET gate — provide onboarding instructions instead of a cryptic error
|
|
47
77
|
if (!process.env.SERVICE_SECRET) {
|
|
48
78
|
console.log(`fit-guide — Conversational agent for the Guide knowledge platform
|
|
@@ -54,12 +84,12 @@ services must be available:
|
|
|
54
84
|
|
|
55
85
|
To get started:
|
|
56
86
|
|
|
57
|
-
1.
|
|
58
|
-
2.
|
|
59
|
-
3. Run:
|
|
87
|
+
1. Run: npx fit-guide --init
|
|
88
|
+
2. Start the service stack and set SERVICE_SECRET
|
|
89
|
+
3. Run: npx fit-guide
|
|
60
90
|
|
|
61
91
|
Documentation: https://www.forwardimpact.team/guide
|
|
62
|
-
Run
|
|
92
|
+
Run npx fit-guide --help for CLI options.`);
|
|
63
93
|
process.exit(1);
|
|
64
94
|
}
|
|
65
95
|
|
|
@@ -79,8 +109,8 @@ The agent maintains conversation context across multiple turns.
|
|
|
79
109
|
|
|
80
110
|
**Examples:**
|
|
81
111
|
|
|
82
|
-
echo "Tell me about the company" |
|
|
83
|
-
printf "What is microservices?\\nWhat are the benefits?\\n" |
|
|
112
|
+
echo "Tell me about the company" | npx fit-guide
|
|
113
|
+
printf "What is microservices?\\nWhat are the benefits?\\n" | npx fit-guide`;
|
|
84
114
|
|
|
85
115
|
// Parse --data flag from CLI args
|
|
86
116
|
const dataArg = process.argv.find((a) => a.startsWith("--data="));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forwardimpact/guide",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Conversational agent for engineering framework guidance — How do I find my bearing?",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "D. Olsson <hi@senzilla.io>",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@forwardimpact/libcodegen": "^0.1.32",
|
|
37
37
|
"@forwardimpact/libconfig": "^0.1.58",
|
|
38
|
+
"@forwardimpact/libsecret": "^0.1.7",
|
|
38
39
|
"@forwardimpact/librepl": "^0.1.0",
|
|
39
40
|
"@forwardimpact/librpc": "^0.1.77",
|
|
40
41
|
"@forwardimpact/libstorage": "^0.1.53",
|