drtrace 0.1.0 → 0.2.0

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/init.d.ts CHANGED
@@ -50,12 +50,17 @@ export declare class ProjectInitializer {
50
50
  */
51
51
  private copyAgentSpec;
52
52
  /**
53
- * Get default agent spec
53
+ * Get default agent spec from shared agents/ or bundled resources
54
+ *
55
+ * Search order:
56
+ * 1. Root repo agents/ directory (development)
57
+ * 2. Bundled default agent from node_modules
54
58
  */
55
59
  private getDefaultAgentSpec;
56
60
  /**
57
- * Generate .env.example file
61
+ * Get bundled agent spec (fallback when root agents/ not available)
58
62
  */
63
+ private getBundledAgentSpec;
59
64
  private generateEnvExample;
60
65
  /**
61
66
  * Generate README.md
package/dist/init.js CHANGED
@@ -211,31 +211,65 @@ class ProjectInitializer {
211
211
  }
212
212
  }
213
213
  /**
214
- * Get default agent spec
214
+ * Get default agent spec from shared agents/ or bundled resources
215
+ *
216
+ * Search order:
217
+ * 1. Root repo agents/ directory (development)
218
+ * 2. Bundled default agent from node_modules
215
219
  */
216
220
  getDefaultAgentSpec() {
217
- return `# DrTrace Log Analysis Agent
221
+ // Try root agents/ first (development mode)
222
+ const rootAgentPath = path.join(this.projectRoot, "..", "..", "agents", "log-analysis.default.md");
223
+ try {
224
+ if (fs.existsSync(rootAgentPath)) {
225
+ return fs.readFileSync(rootAgentPath, "utf-8");
226
+ }
227
+ }
228
+ catch (error) {
229
+ // Fall through to bundled resource
230
+ }
231
+ // Fallback to bundled default agent
232
+ return this.getBundledAgentSpec();
233
+ }
234
+ /**
235
+ * Get bundled agent spec (fallback when root agents/ not available)
236
+ */
237
+ getBundledAgentSpec() {
238
+ return `---
239
+ name: "log-analysis"
240
+ description: "Log Analysis Agent"
241
+ ---
218
242
 
219
- This is the default agent spec for log analysis.
243
+ You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.
220
244
 
221
- ## Purpose
245
+ \`\`\`xml
246
+ <agent id="log-analysis.agent.yaml" name="drtrace" title="Log Analysis Agent" icon="📊">
247
+ <activation critical="MANDATORY">
248
+ <step n="1">Load persona from this current agent file (already in context)</step>
249
+ <step n="2">Remember: You are a Log Analysis Specialist</step>
250
+ <step n="3">Show greeting, then display numbered list of menu items</step>
251
+ <step n="4">STOP and WAIT for user input</step>
252
+ <step n="5">On user input: Process as natural language query</step>
253
+ </activation>
222
254
 
223
- Analyze logs and provide root cause analysis for errors.
255
+ <persona>
256
+ <role>Log Analysis Specialist</role>
257
+ <identity>Expert at analyzing application logs and identifying root causes of errors</identity>
258
+ <communication_style>Clear and concise. Provides structured markdown responses.</communication_style>
259
+ </persona>
260
+ \`\`\`
224
261
 
225
- ## Capabilities
262
+ ## Log Analysis Guide
226
263
 
227
- - Parse log entries and extract key information
228
- - Identify error patterns
229
- - Suggest remediation steps
264
+ This agent helps you understand what went wrong in your application by analyzing logs.
230
265
 
231
- ## Configuration
266
+ ### How to Use
232
267
 
233
- Environment-specific overrides can be set in config files.
268
+ 1. Describe the error or issue
269
+ 2. Provide log entries or time window
270
+ 3. Get root cause analysis with suggested fixes
234
271
  `;
235
272
  }
236
- /**
237
- * Generate .env.example file
238
- */
239
273
  generateEnvExample(config) {
240
274
  const envFile = path.join(this.drtraceDir, ".env.example");
241
275
  const content = `# DrTrace Configuration - Copy to .env and customize
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drtrace",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "DrTrace JavaScript/TypeScript client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/init.ts CHANGED
@@ -252,32 +252,73 @@ export class ProjectInitializer {
252
252
  }
253
253
 
254
254
  /**
255
- * Get default agent spec
255
+ * Get default agent spec from shared agents/ or bundled resources
256
+ *
257
+ * Search order:
258
+ * 1. Root repo agents/ directory (development)
259
+ * 2. Bundled default agent from node_modules
256
260
  */
257
261
  private getDefaultAgentSpec(): string {
258
- return `# DrTrace Log Analysis Agent
262
+ // Try root agents/ first (development mode)
263
+ const rootAgentPath = path.join(
264
+ this.projectRoot,
265
+ "..",
266
+ "..",
267
+ "agents",
268
+ "log-analysis.default.md"
269
+ );
259
270
 
260
- This is the default agent spec for log analysis.
271
+ try {
272
+ if (fs.existsSync(rootAgentPath)) {
273
+ return fs.readFileSync(rootAgentPath, "utf-8");
274
+ }
275
+ } catch (error) {
276
+ // Fall through to bundled resource
277
+ }
261
278
 
262
- ## Purpose
279
+ // Fallback to bundled default agent
280
+ return this.getBundledAgentSpec();
281
+ }
263
282
 
264
- Analyze logs and provide root cause analysis for errors.
283
+ /**
284
+ * Get bundled agent spec (fallback when root agents/ not available)
285
+ */
286
+ private getBundledAgentSpec(): string {
287
+ return `---
288
+ name: "log-analysis"
289
+ description: "Log Analysis Agent"
290
+ ---
291
+
292
+ You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.
293
+
294
+ \`\`\`xml
295
+ <agent id="log-analysis.agent.yaml" name="drtrace" title="Log Analysis Agent" icon="📊">
296
+ <activation critical="MANDATORY">
297
+ <step n="1">Load persona from this current agent file (already in context)</step>
298
+ <step n="2">Remember: You are a Log Analysis Specialist</step>
299
+ <step n="3">Show greeting, then display numbered list of menu items</step>
300
+ <step n="4">STOP and WAIT for user input</step>
301
+ <step n="5">On user input: Process as natural language query</step>
302
+ </activation>
303
+
304
+ <persona>
305
+ <role>Log Analysis Specialist</role>
306
+ <identity>Expert at analyzing application logs and identifying root causes of errors</identity>
307
+ <communication_style>Clear and concise. Provides structured markdown responses.</communication_style>
308
+ </persona>
309
+ \`\`\`
265
310
 
266
- ## Capabilities
311
+ ## Log Analysis Guide
267
312
 
268
- - Parse log entries and extract key information
269
- - Identify error patterns
270
- - Suggest remediation steps
313
+ This agent helps you understand what went wrong in your application by analyzing logs.
271
314
 
272
- ## Configuration
315
+ ### How to Use
273
316
 
274
- Environment-specific overrides can be set in config files.
317
+ 1. Describe the error or issue
318
+ 2. Provide log entries or time window
319
+ 3. Get root cause analysis with suggested fixes
275
320
  `;
276
321
  }
277
-
278
- /**
279
- * Generate .env.example file
280
- */
281
322
  private generateEnvExample(config: DrTraceConfig): void {
282
323
  const envFile = path.join(this.drtraceDir, ".env.example");
283
324
  const content = `# DrTrace Configuration - Copy to .env and customize