perf-skill 0.0.1 → 0.2.1

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 (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +404 -0
  3. package/SKILL.md +238 -0
  4. package/dist/cli/init.d.ts +29 -0
  5. package/dist/cli/init.d.ts.map +1 -0
  6. package/dist/cli/init.js +139 -0
  7. package/dist/cli/init.js.map +1 -0
  8. package/dist/cli/main.d.ts +6 -0
  9. package/dist/cli/main.d.ts.map +1 -0
  10. package/dist/cli/main.js +389 -0
  11. package/dist/cli/main.js.map +1 -0
  12. package/dist/cli/options.d.ts +37 -0
  13. package/dist/cli/options.d.ts.map +1 -0
  14. package/dist/cli/options.js +54 -0
  15. package/dist/cli/options.js.map +1 -0
  16. package/dist/convert/converter.d.ts +39 -0
  17. package/dist/convert/converter.d.ts.map +1 -0
  18. package/dist/convert/converter.js +99 -0
  19. package/dist/convert/converter.js.map +1 -0
  20. package/dist/convert/extract.d.ts +32 -0
  21. package/dist/convert/extract.d.ts.map +1 -0
  22. package/dist/convert/extract.js +235 -0
  23. package/dist/convert/extract.js.map +1 -0
  24. package/dist/convert/index.d.ts +7 -0
  25. package/dist/convert/index.d.ts.map +1 -0
  26. package/dist/convert/index.js +7 -0
  27. package/dist/convert/index.js.map +1 -0
  28. package/dist/convert/sanitize.d.ts +60 -0
  29. package/dist/convert/sanitize.d.ts.map +1 -0
  30. package/dist/convert/sanitize.js +169 -0
  31. package/dist/convert/sanitize.js.map +1 -0
  32. package/dist/diff/engine.d.ts +76 -0
  33. package/dist/diff/engine.d.ts.map +1 -0
  34. package/dist/diff/engine.js +386 -0
  35. package/dist/diff/engine.js.map +1 -0
  36. package/dist/diff/index.d.ts +6 -0
  37. package/dist/diff/index.d.ts.map +1 -0
  38. package/dist/diff/index.js +6 -0
  39. package/dist/diff/index.js.map +1 -0
  40. package/dist/diff/markdown.d.ts +16 -0
  41. package/dist/diff/markdown.d.ts.map +1 -0
  42. package/dist/diff/markdown.js +342 -0
  43. package/dist/diff/markdown.js.map +1 -0
  44. package/dist/index.d.ts +52 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +247 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/llm/client.d.ts +39 -0
  49. package/dist/llm/client.d.ts.map +1 -0
  50. package/dist/llm/client.js +270 -0
  51. package/dist/llm/client.js.map +1 -0
  52. package/dist/llm/index.d.ts +8 -0
  53. package/dist/llm/index.d.ts.map +1 -0
  54. package/dist/llm/index.js +8 -0
  55. package/dist/llm/index.js.map +1 -0
  56. package/dist/llm/prompt.d.ts +32 -0
  57. package/dist/llm/prompt.d.ts.map +1 -0
  58. package/dist/llm/prompt.js +146 -0
  59. package/dist/llm/prompt.js.map +1 -0
  60. package/dist/llm/schema.d.ts +150 -0
  61. package/dist/llm/schema.d.ts.map +1 -0
  62. package/dist/llm/schema.js +131 -0
  63. package/dist/llm/schema.js.map +1 -0
  64. package/dist/llm/validate.d.ts +33 -0
  65. package/dist/llm/validate.d.ts.map +1 -0
  66. package/dist/llm/validate.js +241 -0
  67. package/dist/llm/validate.js.map +1 -0
  68. package/dist/profile/duration.d.ts +2 -0
  69. package/dist/profile/duration.d.ts.map +1 -0
  70. package/dist/profile/duration.js +24 -0
  71. package/dist/profile/duration.js.map +1 -0
  72. package/dist/profile/preload.d.ts +2 -0
  73. package/dist/profile/preload.d.ts.map +1 -0
  74. package/dist/profile/preload.js +100 -0
  75. package/dist/profile/preload.js.map +1 -0
  76. package/dist/profile/runner.d.ts +22 -0
  77. package/dist/profile/runner.d.ts.map +1 -0
  78. package/dist/profile/runner.js +88 -0
  79. package/dist/profile/runner.js.map +1 -0
  80. package/dist/server/http.d.ts +27 -0
  81. package/dist/server/http.d.ts.map +1 -0
  82. package/dist/server/http.js +285 -0
  83. package/dist/server/http.js.map +1 -0
  84. package/dist/server/utils.d.ts +15 -0
  85. package/dist/server/utils.d.ts.map +1 -0
  86. package/dist/server/utils.js +71 -0
  87. package/dist/server/utils.js.map +1 -0
  88. package/dist/skill/handler.d.ts +77 -0
  89. package/dist/skill/handler.d.ts.map +1 -0
  90. package/dist/skill/handler.js +91 -0
  91. package/dist/skill/handler.js.map +1 -0
  92. package/dist/skill/index.d.ts +6 -0
  93. package/dist/skill/index.d.ts.map +1 -0
  94. package/dist/skill/index.js +6 -0
  95. package/dist/skill/index.js.map +1 -0
  96. package/dist/skill/manifest.d.ts +17 -0
  97. package/dist/skill/manifest.d.ts.map +1 -0
  98. package/dist/skill/manifest.js +231 -0
  99. package/dist/skill/manifest.js.map +1 -0
  100. package/dist/types.d.ts +260 -0
  101. package/dist/types.d.ts.map +1 -0
  102. package/dist/types.js +5 -0
  103. package/dist/types.js.map +1 -0
  104. package/dist/utils/fs.d.ts +52 -0
  105. package/dist/utils/fs.d.ts.map +1 -0
  106. package/dist/utils/fs.js +106 -0
  107. package/dist/utils/fs.js.map +1 -0
  108. package/dist/utils/index.d.ts +7 -0
  109. package/dist/utils/index.d.ts.map +1 -0
  110. package/dist/utils/index.js +7 -0
  111. package/dist/utils/index.js.map +1 -0
  112. package/dist/utils/limits.d.ts +38 -0
  113. package/dist/utils/limits.d.ts.map +1 -0
  114. package/dist/utils/limits.js +86 -0
  115. package/dist/utils/limits.js.map +1 -0
  116. package/dist/utils/logger.d.ts +21 -0
  117. package/dist/utils/logger.d.ts.map +1 -0
  118. package/dist/utils/logger.js +82 -0
  119. package/dist/utils/logger.js.map +1 -0
  120. package/package.json +70 -6
@@ -0,0 +1,139 @@
1
+ /**
2
+ * CLI init command helpers - install SKILL.md into a target directory
3
+ */
4
+ import { access, mkdir, readFile, writeFile } from "node:fs/promises";
5
+ import { homedir } from "node:os";
6
+ import { basename, dirname, extname, join, resolve, sep } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ function normalizeFrontmatterValue(value) {
9
+ const trimmed = value.trim();
10
+ if ((trimmed.startsWith("\"") && trimmed.endsWith("\"")) ||
11
+ (trimmed.startsWith("'") && trimmed.endsWith("'"))) {
12
+ return trimmed.slice(1, -1).trim();
13
+ }
14
+ return trimmed;
15
+ }
16
+ export function parseSkillFrontmatterName(markdown) {
17
+ const trimmed = markdown.trimStart();
18
+ if (!trimmed.startsWith("---"))
19
+ return null;
20
+ const lines = trimmed.split(/\r?\n/);
21
+ if (lines.length < 2 || lines[0].trim() !== "---")
22
+ return null;
23
+ for (let i = 1; i < lines.length; i += 1) {
24
+ const line = lines[i].trim();
25
+ if (line === "---")
26
+ break;
27
+ const match = line.match(/^name:\s*(.+)$/);
28
+ if (match?.[1]) {
29
+ return normalizeFrontmatterValue(match[1]);
30
+ }
31
+ }
32
+ return null;
33
+ }
34
+ function isMarkdownFile(targetPath) {
35
+ return extname(targetPath).toLowerCase() === ".md";
36
+ }
37
+ function looksLikeSkillsRoot(targetPath) {
38
+ return basename(targetPath) === "skills";
39
+ }
40
+ export function isReservedCursorDir(targetPath) {
41
+ return targetPath.split(sep).includes("skills-cursor");
42
+ }
43
+ function resolveCursorRoot(scope, cwd, homeDir) {
44
+ if (scope === "project") {
45
+ return resolve(cwd, ".cursor", "skills");
46
+ }
47
+ return resolve(homeDir, ".cursor", "skills");
48
+ }
49
+ export function resolveInstallTarget(options) {
50
+ const target = options.target ? resolve(options.cwd, options.target) : undefined;
51
+ if (options.cursor) {
52
+ const scope = options.scope ?? "user";
53
+ const root = target ?? resolveCursorRoot(scope, options.cwd, options.homeDir);
54
+ if (target && isMarkdownFile(target)) {
55
+ const destDir = dirname(target);
56
+ return {
57
+ layout: "file",
58
+ rootDir: destDir,
59
+ destDir,
60
+ destFile: target,
61
+ };
62
+ }
63
+ const destDir = target
64
+ ? looksLikeSkillsRoot(target)
65
+ ? join(target, options.name)
66
+ : target
67
+ : join(root, options.name);
68
+ return {
69
+ layout: "cursor",
70
+ rootDir: root,
71
+ destDir,
72
+ destFile: join(destDir, "SKILL.md"),
73
+ };
74
+ }
75
+ if (!target) {
76
+ throw new Error("Missing target path. Provide a directory or use --cursor.");
77
+ }
78
+ if (isMarkdownFile(target)) {
79
+ const destDir = dirname(target);
80
+ return {
81
+ layout: "file",
82
+ rootDir: destDir,
83
+ destDir,
84
+ destFile: target,
85
+ };
86
+ }
87
+ return {
88
+ layout: "flat",
89
+ rootDir: target,
90
+ destDir: target,
91
+ destFile: join(target, "SKILL.md"),
92
+ };
93
+ }
94
+ async function fileExists(path) {
95
+ try {
96
+ await access(path);
97
+ return true;
98
+ }
99
+ catch {
100
+ return false;
101
+ }
102
+ }
103
+ function getPackageRoot() {
104
+ return resolve(fileURLToPath(new URL("../../", import.meta.url)));
105
+ }
106
+ async function loadSkillSource() {
107
+ const packageRoot = getPackageRoot();
108
+ const skillPath = resolve(packageRoot, "SKILL.md");
109
+ const markdown = await readFile(skillPath, "utf-8");
110
+ const name = parseSkillFrontmatterName(markdown) ?? "perf-skill";
111
+ return { markdown, name, path: skillPath };
112
+ }
113
+ export async function runInit(options) {
114
+ const { markdown, name } = await loadSkillSource();
115
+ if (options.scope && !options.cursor) {
116
+ throw new Error("--scope is only supported with --cursor.");
117
+ }
118
+ const target = resolveInstallTarget({
119
+ target: options.target,
120
+ cursor: options.cursor,
121
+ scope: options.scope,
122
+ name,
123
+ cwd: process.cwd(),
124
+ homeDir: homedir(),
125
+ });
126
+ if (isReservedCursorDir(target.destDir) || isReservedCursorDir(target.destFile)) {
127
+ throw new Error("Refusing to install into Cursor's reserved skills-cursor directory.");
128
+ }
129
+ if (options.dryRun) {
130
+ return target;
131
+ }
132
+ await mkdir(target.destDir, { recursive: true });
133
+ if (!options.force && await fileExists(target.destFile)) {
134
+ throw new Error(`Skill already exists at ${target.destFile}. Use --force to overwrite.`);
135
+ }
136
+ await writeFile(target.destFile, markdown, "utf-8");
137
+ return target;
138
+ }
139
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE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AAO,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChF,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjD,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,MAAM,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,QAAQ,6BAA6B,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * perf-skill CLI - Analyze pprof profiles with AI assistance
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA;;GAEG"}
@@ -0,0 +1,389 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * perf-skill CLI - Analyze pprof profiles with AI assistance
4
+ */
5
+ import { Command } from "commander";
6
+ import { writeFile } from "node:fs/promises";
7
+ import { join, parse, resolve } from "node:path";
8
+ import { analyze, diff } from "../index.js";
9
+ import { parseDurationInput, runCpuProfile } from "../profile/runner.js";
10
+ import { setLogLevel } from "../utils/logger.js";
11
+ import { validateProfileExtension } from "../utils/limits.js";
12
+ import { runInit } from "./init.js";
13
+ import { buildAnalyzeOptions, buildConvertOptions, buildDiffOptions, } from "./options.js";
14
+ const program = new Command();
15
+ program
16
+ .name("perf-skill")
17
+ .description("Analyze pprof profiles with AI-powered recommendations")
18
+ .version("1.0.0");
19
+ function parseOptionalInt(value) {
20
+ if (value === undefined)
21
+ return undefined;
22
+ const parsed = Number.parseInt(value, 10);
23
+ return Number.isFinite(parsed) ? parsed : undefined;
24
+ }
25
+ function parseCursorScope(scope) {
26
+ if (!scope)
27
+ return undefined;
28
+ if (scope !== "user" && scope !== "project") {
29
+ throw new Error(`Invalid scope: ${scope}. Use 'user' or 'project'.`);
30
+ }
31
+ return scope;
32
+ }
33
+ function deriveSiblingPath(basePath, suffix, defaultExt) {
34
+ const parsed = parse(basePath);
35
+ const ext = parsed.ext || defaultExt;
36
+ const name = parsed.ext ? parsed.name : parsed.base;
37
+ const filename = `${name}.${suffix}${ext}`;
38
+ return parsed.dir ? join(parsed.dir, filename) : filename;
39
+ }
40
+ async function executeAnalyze(profilePath, opts) {
41
+ if (opts.verbose) {
42
+ setLogLevel("debug");
43
+ }
44
+ const resolvedPath = resolve(profilePath);
45
+ validateProfileExtension(resolvedPath);
46
+ const options = buildAnalyzeOptions(opts);
47
+ if (opts.llmProvider || opts.llmModel) {
48
+ options.llm = {
49
+ provider: opts.llmProvider ?? "openai",
50
+ model: opts.llmModel || "gpt-5.2",
51
+ };
52
+ }
53
+ console.log(`Analyzing ${profilePath}...`);
54
+ const result = await analyze(resolvedPath, options);
55
+ if (opts.output) {
56
+ await writeFile(opts.output, result.markdown, "utf-8");
57
+ console.log(`Markdown saved to ${opts.output}`);
58
+ }
59
+ else {
60
+ console.log("\n" + result.markdown);
61
+ }
62
+ if (opts.json) {
63
+ const jsonResult = {
64
+ profileMeta: result.profileMeta,
65
+ hotspots: result.hotspots,
66
+ recommendations: result.recommendations,
67
+ nextSteps: result.nextSteps,
68
+ metrics: result.metrics,
69
+ };
70
+ await writeFile(opts.json, JSON.stringify(jsonResult, null, 2), "utf-8");
71
+ console.log(`JSON saved to ${opts.json}`);
72
+ }
73
+ if (opts.output) {
74
+ console.log(`\nFound ${result.hotspots.length} hotspots`);
75
+ if (result.recommendations) {
76
+ console.log(`Generated ${result.recommendations.length} recommendations`);
77
+ }
78
+ if (result.metrics) {
79
+ console.log(`Processing time: ${result.metrics.totalMs.toFixed(0)}ms`);
80
+ }
81
+ }
82
+ }
83
+ // Init command (install SKILL.md)
84
+ program
85
+ .command("init")
86
+ .description("Install SKILL.md to a target directory")
87
+ .argument("[target]", "Target directory or file path")
88
+ .option("-c, --cursor", "Install into Cursor skills folder")
89
+ .option("--scope <scope>", "Cursor scope: user or project")
90
+ .option("-f, --force", "Overwrite existing SKILL.md")
91
+ .option("--dry-run", "Show destination without writing files")
92
+ .action(async (target, opts) => {
93
+ try {
94
+ const scope = parseCursorScope(opts.scope);
95
+ const result = await runInit({
96
+ target,
97
+ cursor: opts.cursor,
98
+ scope,
99
+ force: opts.force,
100
+ dryRun: opts.dryRun,
101
+ });
102
+ const prefix = opts.dryRun ? "Would install skill to" : "Installed skill to";
103
+ console.log(`${prefix} ${result.destFile}`);
104
+ }
105
+ catch (error) {
106
+ console.error("Error:", error instanceof Error ? error.message : error);
107
+ process.exit(1);
108
+ }
109
+ });
110
+ // Analyze command (default)
111
+ program
112
+ .command("analyze", { isDefault: true })
113
+ .description("Analyze a single pprof profile")
114
+ .argument("<profile>", "Path to pprof profile (.pb.gz)")
115
+ .option("-f, --format <format>", "Output format: summary, detailed, adaptive", "adaptive")
116
+ .option("-t, --type <type>", "Profile type: cpu, heap, auto", "auto")
117
+ .option("-o, --output <file>", "Output markdown file")
118
+ .option("-j, --json <file>", "Output JSON results file")
119
+ .option("-s, --source-dir <path>", "Source directory for code context")
120
+ .option("--no-source", "Disable source code inclusion")
121
+ .option("--max-hotspots <n>", "Maximum hotspots to show", "10")
122
+ .option("-m, --mode <mode>", "Mode: convert-only, analyze", "analyze")
123
+ .option("--llm-provider <provider>", "LLM provider: openai, azure-openai, anthropic, custom")
124
+ .option("--llm-model <model>", "LLM model name")
125
+ .option("--service <name>", "Service name for context")
126
+ .option("--scenario <desc>", "Scenario description")
127
+ .option("--slo <target>", "Target SLO")
128
+ .option("--no-redact", "Disable redaction of sensitive information")
129
+ .option("-v, --verbose", "Enable verbose logging")
130
+ .action(async (profilePath, opts) => {
131
+ try {
132
+ await executeAnalyze(profilePath, opts);
133
+ }
134
+ catch (error) {
135
+ console.error("Error:", error instanceof Error ? error.message : error);
136
+ process.exit(1);
137
+ }
138
+ });
139
+ // Run command (profile + analyze)
140
+ program
141
+ .command("run")
142
+ .description("Profile a Node entry file and analyze the resulting CPU profile")
143
+ .argument("<entry>", "Entry file to run (js/mjs/cjs)")
144
+ .argument("[entryArgs...]", "Arguments passed to the entry file")
145
+ .option("-d, --duration <duration>", "CPU profile duration (e.g. 10s, 5000ms)", "10s")
146
+ .option("--profile-out <file>", "Profile output file", "cpu.pb.gz")
147
+ .option("--heap", "Also capture a heap profile")
148
+ .option("--heap-profile-out <file>", "Heap profile output file", "heap.pb.gz")
149
+ .option("--heap-interval-bytes <n>", "Heap sampling interval in bytes")
150
+ .option("--heap-stack-depth <n>", "Heap sampling stack depth")
151
+ .option("--heap-output <file>", "Heap markdown output file")
152
+ .option("--heap-json <file>", "Heap JSON output file")
153
+ .option("-f, --format <format>", "Output format: summary, detailed, adaptive", "adaptive")
154
+ .option("-t, --type <type>", "Profile type: cpu, heap, auto", "auto")
155
+ .option("-o, --output <file>", "Output markdown file")
156
+ .option("-j, --json <file>", "Output JSON results file")
157
+ .option("-s, --source-dir <path>", "Source directory for code context")
158
+ .option("--no-source", "Disable source code inclusion")
159
+ .option("--max-hotspots <n>", "Maximum hotspots to show", "10")
160
+ .option("-m, --mode <mode>", "Mode: convert-only, analyze", "analyze")
161
+ .option("--llm-provider <provider>", "LLM provider: openai, azure-openai, anthropic, custom")
162
+ .option("--llm-model <model>", "LLM model name")
163
+ .option("--service <name>", "Service name for context")
164
+ .option("--scenario <desc>", "Scenario description")
165
+ .option("--slo <target>", "Target SLO")
166
+ .option("--no-redact", "Disable redaction of sensitive information")
167
+ .option("-v, --verbose", "Enable verbose logging")
168
+ .action(async (entryPath, entryArgs, opts) => {
169
+ try {
170
+ if (opts.verbose) {
171
+ setLogLevel("debug");
172
+ }
173
+ const durationMs = parseDurationInput(opts.duration);
174
+ const profilePath = resolve(opts.profileOut);
175
+ const heapEnabled = Boolean(opts.heap);
176
+ const heapIntervalBytes = parseOptionalInt(opts.heapIntervalBytes);
177
+ const heapStackDepth = parseOptionalInt(opts.heapStackDepth);
178
+ const cpuOutput = opts.output ?? (heapEnabled ? "cpu.md" : undefined);
179
+ const cpuJson = opts.json;
180
+ const heapOutput = heapEnabled
181
+ ? opts.heapOutput ?? (opts.output ? deriveSiblingPath(opts.output, "heap", ".md") : "heap.md")
182
+ : undefined;
183
+ const heapJson = heapEnabled
184
+ ? opts.heapJson ?? (cpuJson ? deriveSiblingPath(cpuJson, "heap", ".json") : undefined)
185
+ : undefined;
186
+ console.log(`Profiling ${entryPath} for ${opts.duration}...`);
187
+ const { heapProfilePath } = await runCpuProfile({
188
+ entryPath,
189
+ entryArgs,
190
+ durationMs,
191
+ outPath: profilePath,
192
+ enableHeap: heapEnabled,
193
+ heapOutPath: heapEnabled ? resolve(opts.heapProfileOut) : undefined,
194
+ heapIntervalBytes,
195
+ heapStackDepth,
196
+ });
197
+ await executeAnalyze(profilePath, { ...opts, output: cpuOutput, json: cpuJson, type: "cpu" });
198
+ if (heapEnabled && heapProfilePath) {
199
+ await executeAnalyze(heapProfilePath, { ...opts, output: heapOutput, json: heapJson, type: "heap" });
200
+ }
201
+ }
202
+ catch (error) {
203
+ console.error("Error:", error instanceof Error ? error.message : error);
204
+ process.exit(1);
205
+ }
206
+ });
207
+ // Profile-only command
208
+ program
209
+ .command("profile")
210
+ .description("Generate a CPU profile for a Node entry file")
211
+ .argument("<entry>", "Entry file to run (js/mjs/cjs)")
212
+ .argument("[entryArgs...]", "Arguments passed to the entry file")
213
+ .option("-d, --duration <duration>", "CPU profile duration (e.g. 10s, 5000ms)", "10s")
214
+ .option("-o, --output <file>", "Profile output file", "cpu.pb.gz")
215
+ .option("--heap", "Also capture a heap profile")
216
+ .option("--heap-profile-out <file>", "Heap profile output file", "heap.pb.gz")
217
+ .option("--heap-interval-bytes <n>", "Heap sampling interval in bytes")
218
+ .option("--heap-stack-depth <n>", "Heap sampling stack depth")
219
+ .option("-v, --verbose", "Enable verbose logging")
220
+ .action(async (entryPath, entryArgs, opts) => {
221
+ if (opts.verbose) {
222
+ setLogLevel("debug");
223
+ }
224
+ try {
225
+ const durationMs = parseDurationInput(opts.duration);
226
+ const profilePath = resolve(opts.output);
227
+ const heapEnabled = Boolean(opts.heap);
228
+ const heapIntervalBytes = parseOptionalInt(opts.heapIntervalBytes);
229
+ const heapStackDepth = parseOptionalInt(opts.heapStackDepth);
230
+ console.log(`Profiling ${entryPath} for ${opts.duration}...`);
231
+ const { heapProfilePath } = await runCpuProfile({
232
+ entryPath,
233
+ entryArgs,
234
+ durationMs,
235
+ outPath: profilePath,
236
+ enableHeap: heapEnabled,
237
+ heapOutPath: heapEnabled ? resolve(opts.heapProfileOut) : undefined,
238
+ heapIntervalBytes,
239
+ heapStackDepth,
240
+ });
241
+ console.log(`Profile saved to ${profilePath}`);
242
+ if (heapEnabled && heapProfilePath) {
243
+ console.log(`Heap profile saved to ${heapProfilePath}`);
244
+ }
245
+ }
246
+ catch (error) {
247
+ console.error("Error:", error instanceof Error ? error.message : error);
248
+ process.exit(1);
249
+ }
250
+ });
251
+ // Diff command
252
+ program
253
+ .command("diff")
254
+ .description("Compare two pprof profiles")
255
+ .argument("<base>", "Path to base profile (.pb.gz)")
256
+ .argument("<current>", "Path to current profile (.pb.gz)")
257
+ .option("-f, --format <format>", "Output format: diff-summary, diff-detailed, diff-adaptive", "diff-adaptive")
258
+ .option("-o, --output <file>", "Output markdown file")
259
+ .option("-j, --json <file>", "Output JSON results file")
260
+ .option("-n, --normalize <mode>", "Normalize mode: none, scale-to-base-total, per-second", "scale-to-base-total")
261
+ .option("--max-regressions <n>", "Maximum regressions to show", "10")
262
+ .option("--max-improvements <n>", "Maximum improvements to show", "5")
263
+ .option("--max-decompressed-bytes <n>", "Maximum decompressed profile size in bytes")
264
+ .option("-m, --mode <mode>", "Mode: convert-only, analyze", "convert-only")
265
+ .option("--llm-provider <provider>", "LLM provider for analysis")
266
+ .option("--llm-model <model>", "LLM model name")
267
+ .option("--service <name>", "Service name for context")
268
+ .option("--changes <desc>", "Recent changes description")
269
+ .option("-v, --verbose", "Enable verbose logging")
270
+ .action(async (basePath, currentPath, opts) => {
271
+ if (opts.verbose) {
272
+ setLogLevel("debug");
273
+ }
274
+ try {
275
+ const resolvedBase = resolve(basePath);
276
+ const resolvedCurrent = resolve(currentPath);
277
+ validateProfileExtension(resolvedBase);
278
+ validateProfileExtension(resolvedCurrent);
279
+ const options = buildDiffOptions(opts);
280
+ console.log(`Comparing ${basePath} vs ${currentPath}...`);
281
+ const result = await diff(resolvedBase, resolvedCurrent, options);
282
+ // Output markdown
283
+ if (opts.output) {
284
+ await writeFile(opts.output, result.markdown, "utf-8");
285
+ console.log(`Markdown saved to ${opts.output}`);
286
+ }
287
+ else {
288
+ console.log("\n" + result.markdown);
289
+ }
290
+ // Output JSON
291
+ if (opts.json) {
292
+ const jsonResult = {
293
+ baseMeta: result.baseMeta,
294
+ currentMeta: result.currentMeta,
295
+ regressions: result.regressions,
296
+ improvements: result.improvements,
297
+ summary: result.summary,
298
+ recommendations: result.recommendations,
299
+ metrics: result.metrics,
300
+ };
301
+ await writeFile(opts.json, JSON.stringify(jsonResult, null, 2), "utf-8");
302
+ console.log(`JSON saved to ${opts.json}`);
303
+ }
304
+ // Print summary to stderr if outputting to file
305
+ if (opts.output) {
306
+ console.log(`\nFound ${result.regressions.length} regressions, ${result.improvements.length} improvements`);
307
+ }
308
+ }
309
+ catch (error) {
310
+ console.error("Error:", error instanceof Error ? error.message : error);
311
+ process.exit(1);
312
+ }
313
+ });
314
+ // Convert command (no LLM)
315
+ program
316
+ .command("convert")
317
+ .description("Convert pprof profile to markdown (no AI analysis)")
318
+ .argument("<profile>", "Path to pprof profile (.pb.gz)")
319
+ .option("-f, --format <format>", "Output format: summary, detailed, adaptive", "adaptive")
320
+ .option("-t, --type <type>", "Profile type: cpu, heap, auto", "auto")
321
+ .option("-o, --output <file>", "Output markdown file")
322
+ .option("-s, --source-dir <path>", "Source directory for code context")
323
+ .option("--no-source", "Disable source code inclusion")
324
+ .option("--max-hotspots <n>", "Maximum hotspots to show", "10")
325
+ .option("--no-redact", "Disable redaction of sensitive information")
326
+ .option("-v, --verbose", "Enable verbose logging")
327
+ .action(async (profilePath, opts) => {
328
+ if (opts.verbose) {
329
+ setLogLevel("debug");
330
+ }
331
+ try {
332
+ const resolvedPath = resolve(profilePath);
333
+ validateProfileExtension(resolvedPath);
334
+ const options = buildConvertOptions(opts);
335
+ console.log(`Converting ${profilePath}...`);
336
+ const result = await analyze(resolvedPath, options);
337
+ if (opts.output) {
338
+ await writeFile(opts.output, result.markdown, "utf-8");
339
+ console.log(`Markdown saved to ${opts.output}`);
340
+ }
341
+ else {
342
+ console.log("\n" + result.markdown);
343
+ }
344
+ }
345
+ catch (error) {
346
+ console.error("Error:", error instanceof Error ? error.message : error);
347
+ process.exit(1);
348
+ }
349
+ });
350
+ // Server command
351
+ program
352
+ .command("server")
353
+ .description("Start HTTP API server")
354
+ .option("-p, --port <port>", "Port to listen on", "3000")
355
+ .option("-h, --host <host>", "Host to bind to", "0.0.0.0")
356
+ .option("--cors", "Enable CORS")
357
+ .option("--no-cors", "Disable CORS")
358
+ .option("--cors-origin <origin>", "CORS origin(s), comma-separated or '*'")
359
+ .option("--helmet", "Enable helmet security headers")
360
+ .option("--no-helmet", "Disable helmet security headers")
361
+ .option("--rate-limit", "Enable rate limiting")
362
+ .option("--no-rate-limit", "Disable rate limiting")
363
+ .option("--rate-limit-max <n>", "Rate limit max requests per window")
364
+ .option("--rate-limit-window-ms <ms>", "Rate limit window in ms")
365
+ .option("-v, --verbose", "Enable verbose logging")
366
+ .action(async (opts) => {
367
+ if (opts.verbose) {
368
+ setLogLevel("debug");
369
+ }
370
+ try {
371
+ const { startServer } = await import("../server/http.js");
372
+ await startServer({
373
+ port: parseInt(opts.port, 10),
374
+ host: opts.host,
375
+ enableCors: opts.cors,
376
+ corsOrigin: opts.corsOrigin,
377
+ enableHelmet: opts.helmet,
378
+ enableRateLimit: opts.rateLimit,
379
+ rateLimitMax: opts.rateLimitMax ? parseInt(opts.rateLimitMax, 10) : undefined,
380
+ rateLimitWindowMs: opts.rateLimitWindowMs ? parseInt(opts.rateLimitWindowMs, 10) : undefined,
381
+ });
382
+ }
383
+ catch (error) {
384
+ console.error("Error:", error instanceof Error ? error.message : error);
385
+ process.exit(1);
386
+ }
387
+ });
388
+ program.parse();
389
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAoB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAoB,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GAIjB,MAAM,cAAc,CAAC;AAEtB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,wDAAw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,MAAM,WAAW,CAAC;YAChB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,IAAI;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,MAAM;YACzB,eAAe,EAAE,IAAI,CAAC,SAAS;YAC/B,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;YAC7E,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;SAC7F,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * CLI option builders (pure helpers for testing)
3
+ */
4
+ import type { AnalyzeOptions, DiffOptions, LLMConfig } from "../types.js";
5
+ export interface AnalyzeCommandOptions {
6
+ format: AnalyzeOptions["format"];
7
+ type: AnalyzeOptions["profileType"];
8
+ maxHotspots: string;
9
+ sourceDir?: string;
10
+ source?: boolean;
11
+ mode: AnalyzeOptions["mode"];
12
+ redact: boolean;
13
+ service?: string;
14
+ scenario?: string;
15
+ slo?: string;
16
+ llmProvider?: LLMConfig["provider"];
17
+ llmModel?: string;
18
+ }
19
+ export interface ConvertCommandOptions {
20
+ format: AnalyzeOptions["format"];
21
+ type: AnalyzeOptions["profileType"];
22
+ maxHotspots: string;
23
+ sourceDir?: string;
24
+ source?: boolean;
25
+ redact: boolean;
26
+ }
27
+ export interface DiffCommandOptions {
28
+ format: DiffOptions["format"];
29
+ normalize: DiffOptions["normalize"];
30
+ maxRegressions: string;
31
+ maxImprovements: string;
32
+ maxDecompressedBytes?: string;
33
+ }
34
+ export declare function buildAnalyzeOptions(opts: AnalyzeCommandOptions): AnalyzeOptions;
35
+ export declare function buildConvertOptions(opts: ConvertCommandOptions): AnalyzeOptions;
36
+ export declare function buildDiffOptions(opts: DiffCommandOptions): DiffOptions;
37
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/cli/options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AAE1F,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,EAAE,cAAc,CAAC,a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