drtrace 0.1.0 → 0.3.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.
Files changed (43) hide show
  1. package/README.md +29 -0
  2. package/agents/CONTRIBUTING.md +296 -0
  3. package/agents/README.md +174 -0
  4. package/agents/daemon-method-selection.md +298 -0
  5. package/agents/integration-guides/cpp-best-practices.md +218 -0
  6. package/agents/integration-guides/cpp-ros-integration.md +88 -0
  7. package/agents/log-analysis.md +217 -0
  8. package/agents/log-help.md +226 -0
  9. package/agents/log-init.md +933 -0
  10. package/agents/log-it.md +1126 -0
  11. package/bin/init.js +4 -4
  12. package/dist/bin/init.js +31 -0
  13. package/dist/config-schema.d.ts +2 -2
  14. package/dist/init.d.ts +49 -4
  15. package/dist/init.js +494 -35
  16. package/dist/resources/agents/CONTRIBUTING.md +296 -0
  17. package/dist/resources/agents/README.md +174 -0
  18. package/dist/resources/agents/daemon-method-selection.md +298 -0
  19. package/dist/resources/agents/integration-guides/cpp-best-practices.md +218 -0
  20. package/dist/resources/agents/integration-guides/cpp-ros-integration.md +88 -0
  21. package/dist/resources/agents/log-analysis.md +217 -0
  22. package/dist/resources/agents/log-help.md +226 -0
  23. package/dist/resources/agents/log-init.md +933 -0
  24. package/dist/resources/agents/log-it.md +1126 -0
  25. package/dist/resources/cpp/drtrace_sink.hpp +1248 -0
  26. package/package.json +9 -2
  27. package/.eslintrc.js +0 -20
  28. package/jest.config.js +0 -11
  29. package/src/client.ts +0 -68
  30. package/src/config-schema.ts +0 -115
  31. package/src/config.ts +0 -326
  32. package/src/index.ts +0 -3
  33. package/src/init.ts +0 -410
  34. package/src/logger.ts +0 -56
  35. package/src/queue.ts +0 -105
  36. package/src/transport.ts +0 -60
  37. package/src/types.ts +0 -20
  38. package/tests/client.test.ts +0 -66
  39. package/tests/config-schema.test.ts +0 -198
  40. package/tests/config.test.ts +0 -456
  41. package/tests/queue.test.ts +0 -72
  42. package/tests/transport.test.ts +0 -52
  43. package/tsconfig.json +0 -18
package/bin/init.js CHANGED
@@ -5,9 +5,9 @@
5
5
  * Usage: npx drtrace init [--project-root <path>]
6
6
  */
7
7
 
8
- import yargs from "yargs";
9
- import { hideBin } from "yargs/helpers";
10
- import { runInitProject } from "./init";
8
+ const yargs = require("yargs");
9
+ const { hideBin } = require("yargs/helpers");
10
+ const { runInitProject } = require("../init");
11
11
 
12
12
  yargs(hideBin(process.argv))
13
13
  .command(
@@ -20,7 +20,7 @@ yargs(hideBin(process.argv))
20
20
  description: "Project root directory (default: current directory)",
21
21
  }),
22
22
  async (argv) => {
23
- const exitCode = await runInitProject(argv["project-root"] as string);
23
+ const exitCode = await runInitProject(argv["project-root"]);
24
24
  process.exit(exitCode);
25
25
  }
26
26
  )
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CLI entry point for drtrace init command
5
+ * Usage: npx drtrace init [--project-root <path>]
6
+ */
7
+
8
+ const yargs = require("yargs");
9
+ const { hideBin } = require("yargs/helpers");
10
+ const { runInitProject } = require("../init");
11
+
12
+ yargs(hideBin(process.argv))
13
+ .command(
14
+ "init",
15
+ "Interactive DrTrace project initialization with config and templates",
16
+ (yargs) =>
17
+ yargs.option("project-root", {
18
+ alias: "p",
19
+ type: "string",
20
+ description: "Project root directory (default: current directory)",
21
+ }),
22
+ async (argv) => {
23
+ const exitCode = await runInitProject(argv["project-root"]);
24
+ process.exit(exitCode);
25
+ }
26
+ )
27
+ .demandCommand()
28
+ .strict()
29
+ .help()
30
+ .alias("h", "help")
31
+ .parse();
@@ -5,7 +5,7 @@
5
5
  export interface DrTraceConfig {
6
6
  project_name: string;
7
7
  application_id: string;
8
- language?: "python" | "javascript" | "both";
8
+ language?: "python" | "javascript" | "cpp" | "both";
9
9
  daemon_url?: string;
10
10
  enabled?: boolean;
11
11
  environments?: string[];
@@ -23,7 +23,7 @@ export declare class ConfigSchema {
23
23
  static getDefaultConfig(options: {
24
24
  project_name: string;
25
25
  application_id: string;
26
- language?: "python" | "javascript" | "both";
26
+ language?: "python" | "javascript" | "cpp" | "both";
27
27
  daemon_url?: string;
28
28
  enabled?: boolean;
29
29
  environments?: string[];
package/dist/init.d.ts CHANGED
@@ -34,7 +34,9 @@ export declare class ProjectInitializer {
34
34
  */
35
35
  private promptMultiSelect;
36
36
  /**
37
- * Handle existing config
37
+ * Handle existing config - prompt user before overwriting
38
+ *
39
+ * Returns true if initialization should proceed, false if user declined.
38
40
  */
39
41
  private handleExistingConfig;
40
42
  /**
@@ -46,16 +48,59 @@ export declare class ProjectInitializer {
46
48
  */
47
49
  private generateEnvironmentConfigs;
48
50
  /**
49
- * Copy agent spec to _drtrace/agents/
51
+ * Copy all agent files from packaged resources to _drtrace/agents/
52
+ * Copies everything from agents/ directory including:
53
+ * - Agent spec files (*.md)
54
+ * - Integration guides (integration-guides/*.md)
55
+ * - Any other files (README.md, CONTRIBUTING.md, etc.)
50
56
  */
51
57
  private copyAgentSpec;
52
58
  /**
53
- * Get default agent spec
59
+ * Recursively copy all files from sourceDir to targetDir
60
+ */
61
+ private copyAgentsRecursive;
62
+ /**
63
+ * Copy framework-specific integration guides to _drtrace/agents/integration-guides/
64
+ * Dynamically discovers all .md files in agents/integration-guides/ directory
65
+ * Guides are stored in agents folder so agents can access them on client side
66
+ */
67
+ private copyFrameworkGuides;
68
+ /**
69
+ * Copy C++ header file to third_party/drtrace/ for C++ projects.
70
+ *
71
+ * This enables header-only integration:
72
+ * - Header is copied to third_party/drtrace/drtrace_sink.hpp
73
+ * - Users include it via #include "third_party/drtrace/drtrace_sink.hpp"
74
+ * - Note: third_party/drtrace/ should be committed to git (unlike _drtrace/ which is gitignored)
75
+ */
76
+ private copyCppHeader;
77
+ /**
78
+ * Find drtrace_sink.hpp source file for header-only C++ integration.
79
+ *
80
+ * Search order:
81
+ * 1. npm package location: dist/resources/cpp/drtrace_sink.hpp (production mode)
82
+ * 2. Monorepo development layout: packages/cpp/drtrace-client/src/drtrace_sink.hpp
83
+ * 3. pip package location: site-packages/drtrace_service/.../packages/cpp/drtrace-client/src/drtrace_sink.hpp (if Python available)
84
+ *
85
+ * @returns Path to header file if found, null otherwise
86
+ */
87
+ private findCppHeaderSource;
88
+ /**
89
+ * Get default agent spec from shared agents/ or bundled resources
90
+ *
91
+ * Search order:
92
+ * 1. Root repo agents/ directory (development)
93
+ * 2. Bundled default agent from node_modules
94
+ *
95
+ * @param agentName - Name of the agent: "log-analysis", "log-it", "log-init", or "log-help"
54
96
  */
55
97
  private getDefaultAgentSpec;
56
98
  /**
57
- * Generate .env.example file
99
+ * Get bundled agent spec (fallback when root agents/ not available)
100
+ *
101
+ * @param agentName - Name of the agent: "log-analysis", "log-it", "log-init", or "log-help"
58
102
  */
103
+ private getBundledAgentSpec;
59
104
  private generateEnvExample;
60
105
  /**
61
106
  * Generate README.md