@yesvara/svara 0.2.7 → 0.2.9
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/index.js
CHANGED
|
@@ -97,7 +97,9 @@ function generatePackageJson(name) {
|
|
|
97
97
|
start: "node dist/index.js"
|
|
98
98
|
},
|
|
99
99
|
dependencies: {
|
|
100
|
-
"@yesvara/svara": "^0.
|
|
100
|
+
"@yesvara/svara": "^0.2.8",
|
|
101
|
+
"better-sqlite3": "^12.8.0",
|
|
102
|
+
chokidar: "^3.6.0",
|
|
101
103
|
dotenv: "^16.4.5"
|
|
102
104
|
},
|
|
103
105
|
devDependencies: {
|
|
@@ -160,6 +162,7 @@ app.listen(3000);` : channels.length > 0 ? `agent
|
|
|
160
162
|
await agent.start();` : "";
|
|
161
163
|
return `import 'dotenv/config';
|
|
162
164
|
import { SvaraApp, SvaraAgent, createTool } from '@yesvara/svara';
|
|
165
|
+
import chokidar from 'chokidar';
|
|
163
166
|
|
|
164
167
|
/**
|
|
165
168
|
* ${name} \u2014 powered by SvaraJS
|
|
@@ -187,6 +190,19 @@ const agent = new SvaraAgent({
|
|
|
187
190
|
knowledge: './docs/**/*', // Add your documents here for RAG
|
|
188
191
|
});
|
|
189
192
|
|
|
193
|
+
// Auto-reload knowledge when files change
|
|
194
|
+
if (agent.knowledgeBase) {
|
|
195
|
+
const watcher = chokidar.watch('./docs', { ignored: /^\\./ });
|
|
196
|
+
watcher.on('add', async () => {
|
|
197
|
+
console.log('\u{1F4C4} Document detected, reloading knowledge...');
|
|
198
|
+
await agent.knowledgeBase.load('./docs/**/*');
|
|
199
|
+
});
|
|
200
|
+
watcher.on('unlink', async () => {
|
|
201
|
+
console.log('\u{1F5D1}\uFE0F Document removed, reloading knowledge...');
|
|
202
|
+
await agent.knowledgeBase.load('./docs/**/*');
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
190
206
|
// Setup channels
|
|
191
207
|
${channelSetup}
|
|
192
208
|
|
package/dist/cli/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ var pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
|
9
9
|
var program = new Command();
|
|
10
10
|
program.name("svara").description(pkg.description).version(pkg.version, "-v, --version");
|
|
11
11
|
program.command("new <name>").description("Create a new SvaraJS project").option("--provider <provider>", "LLM provider (openai|anthropic|ollama)", "openai").option("--channel <channels...>", "Channels to include", ["web"]).option("--no-install", "Skip npm install").action(async (name, opts) => {
|
|
12
|
-
const { newProject } = await import("../new-
|
|
12
|
+
const { newProject } = await import("../new-AJEDYF4B.mjs");
|
|
13
13
|
await newProject({
|
|
14
14
|
name,
|
|
15
15
|
provider: opts.provider,
|
|
@@ -66,7 +66,9 @@ function generatePackageJson(name) {
|
|
|
66
66
|
start: "node dist/index.js"
|
|
67
67
|
},
|
|
68
68
|
dependencies: {
|
|
69
|
-
"@yesvara/svara": "^0.
|
|
69
|
+
"@yesvara/svara": "^0.2.8",
|
|
70
|
+
"better-sqlite3": "^12.8.0",
|
|
71
|
+
chokidar: "^3.6.0",
|
|
70
72
|
dotenv: "^16.4.5"
|
|
71
73
|
},
|
|
72
74
|
devDependencies: {
|
|
@@ -129,6 +131,7 @@ app.listen(3000);` : channels.length > 0 ? `agent
|
|
|
129
131
|
await agent.start();` : "";
|
|
130
132
|
return `import 'dotenv/config';
|
|
131
133
|
import { SvaraApp, SvaraAgent, createTool } from '@yesvara/svara';
|
|
134
|
+
import chokidar from 'chokidar';
|
|
132
135
|
|
|
133
136
|
/**
|
|
134
137
|
* ${name} \u2014 powered by SvaraJS
|
|
@@ -156,6 +159,19 @@ const agent = new SvaraAgent({
|
|
|
156
159
|
knowledge: './docs/**/*', // Add your documents here for RAG
|
|
157
160
|
});
|
|
158
161
|
|
|
162
|
+
// Auto-reload knowledge when files change
|
|
163
|
+
if (agent.knowledgeBase) {
|
|
164
|
+
const watcher = chokidar.watch('./docs', { ignored: /^\\./ });
|
|
165
|
+
watcher.on('add', async () => {
|
|
166
|
+
console.log('\u{1F4C4} Document detected, reloading knowledge...');
|
|
167
|
+
await agent.knowledgeBase.load('./docs/**/*');
|
|
168
|
+
});
|
|
169
|
+
watcher.on('unlink', async () => {
|
|
170
|
+
console.log('\u{1F5D1}\uFE0F Document removed, reloading knowledge...');
|
|
171
|
+
await agent.knowledgeBase.load('./docs/**/*');
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
159
175
|
// Setup channels
|
|
160
176
|
${channelSetup}
|
|
161
177
|
|
package/package.json
CHANGED
package/src/cli/commands/new.ts
CHANGED
|
@@ -86,7 +86,9 @@ function generatePackageJson(name: string): string {
|
|
|
86
86
|
start: 'node dist/index.js',
|
|
87
87
|
},
|
|
88
88
|
dependencies: {
|
|
89
|
-
'@yesvara/svara': '^0.
|
|
89
|
+
'@yesvara/svara': '^0.2.8',
|
|
90
|
+
'better-sqlite3': '^12.8.0',
|
|
91
|
+
chokidar: '^3.6.0',
|
|
90
92
|
dotenv: '^16.4.5',
|
|
91
93
|
},
|
|
92
94
|
devDependencies: {
|
|
@@ -163,6 +165,7 @@ function generateIndexFile(
|
|
|
163
165
|
|
|
164
166
|
return `import 'dotenv/config';
|
|
165
167
|
import { SvaraApp, SvaraAgent, createTool } from '@yesvara/svara';
|
|
168
|
+
import chokidar from 'chokidar';
|
|
166
169
|
|
|
167
170
|
/**
|
|
168
171
|
* ${name} — powered by SvaraJS
|
|
@@ -190,6 +193,19 @@ const agent = new SvaraAgent({
|
|
|
190
193
|
knowledge: './docs/**/*', // Add your documents here for RAG
|
|
191
194
|
});
|
|
192
195
|
|
|
196
|
+
// Auto-reload knowledge when files change
|
|
197
|
+
if (agent.knowledgeBase) {
|
|
198
|
+
const watcher = chokidar.watch('./docs', { ignored: /^\\./ });
|
|
199
|
+
watcher.on('add', async () => {
|
|
200
|
+
console.log('📄 Document detected, reloading knowledge...');
|
|
201
|
+
await agent.knowledgeBase.load('./docs/**/*');
|
|
202
|
+
});
|
|
203
|
+
watcher.on('unlink', async () => {
|
|
204
|
+
console.log('🗑️ Document removed, reloading knowledge...');
|
|
205
|
+
await agent.knowledgeBase.load('./docs/**/*');
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
193
209
|
// Setup channels
|
|
194
210
|
${channelSetup}
|
|
195
211
|
|