@yesvara/svara 0.2.8 → 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,8 +97,9 @@ function generatePackageJson(name) {
97
97
  start: "node dist/index.js"
98
98
  },
99
99
  dependencies: {
100
- "@yesvara/svara": "^0.2.7",
100
+ "@yesvara/svara": "^0.2.8",
101
101
  "better-sqlite3": "^12.8.0",
102
+ chokidar: "^3.6.0",
102
103
  dotenv: "^16.4.5"
103
104
  },
104
105
  devDependencies: {
@@ -161,6 +162,7 @@ app.listen(3000);` : channels.length > 0 ? `agent
161
162
  await agent.start();` : "";
162
163
  return `import 'dotenv/config';
163
164
  import { SvaraApp, SvaraAgent, createTool } from '@yesvara/svara';
165
+ import chokidar from 'chokidar';
164
166
 
165
167
  /**
166
168
  * ${name} \u2014 powered by SvaraJS
@@ -188,6 +190,19 @@ const agent = new SvaraAgent({
188
190
  knowledge: './docs/**/*', // Add your documents here for RAG
189
191
  });
190
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
+
191
206
  // Setup channels
192
207
  ${channelSetup}
193
208
 
@@ -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-NTRI4APN.mjs");
12
+ const { newProject } = await import("../new-AJEDYF4B.mjs");
13
13
  await newProject({
14
14
  name,
15
15
  provider: opts.provider,
@@ -66,8 +66,9 @@ function generatePackageJson(name) {
66
66
  start: "node dist/index.js"
67
67
  },
68
68
  dependencies: {
69
- "@yesvara/svara": "^0.2.7",
69
+ "@yesvara/svara": "^0.2.8",
70
70
  "better-sqlite3": "^12.8.0",
71
+ chokidar: "^3.6.0",
71
72
  dotenv: "^16.4.5"
72
73
  },
73
74
  devDependencies: {
@@ -130,6 +131,7 @@ app.listen(3000);` : channels.length > 0 ? `agent
130
131
  await agent.start();` : "";
131
132
  return `import 'dotenv/config';
132
133
  import { SvaraApp, SvaraAgent, createTool } from '@yesvara/svara';
134
+ import chokidar from 'chokidar';
133
135
 
134
136
  /**
135
137
  * ${name} \u2014 powered by SvaraJS
@@ -157,6 +159,19 @@ const agent = new SvaraAgent({
157
159
  knowledge: './docs/**/*', // Add your documents here for RAG
158
160
  });
159
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
+
160
175
  // Setup channels
161
176
  ${channelSetup}
162
177
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yesvara/svara",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Build AI agents in 15 lines of code. Multi-channel, RAG-ready, production-grade.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -86,8 +86,9 @@ function generatePackageJson(name: string): string {
86
86
  start: 'node dist/index.js',
87
87
  },
88
88
  dependencies: {
89
- '@yesvara/svara': '^0.2.7',
89
+ '@yesvara/svara': '^0.2.8',
90
90
  'better-sqlite3': '^12.8.0',
91
+ chokidar: '^3.6.0',
91
92
  dotenv: '^16.4.5',
92
93
  },
93
94
  devDependencies: {
@@ -164,6 +165,7 @@ function generateIndexFile(
164
165
 
165
166
  return `import 'dotenv/config';
166
167
  import { SvaraApp, SvaraAgent, createTool } from '@yesvara/svara';
168
+ import chokidar from 'chokidar';
167
169
 
168
170
  /**
169
171
  * ${name} — powered by SvaraJS
@@ -191,6 +193,19 @@ const agent = new SvaraAgent({
191
193
  knowledge: './docs/**/*', // Add your documents here for RAG
192
194
  });
193
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
+
194
209
  // Setup channels
195
210
  ${channelSetup}
196
211