pwnkit-cli 0.1.7 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +43 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10429,21 +10429,56 @@ var init_process = __esm({
10429
10429
  return new Promise((resolve3) => {
10430
10430
  let stdout = "";
10431
10431
  let stderr = "";
10432
+ let resultText = "";
10432
10433
  let timedOut = false;
10434
+ const isStreamJson = args.includes("stream-json");
10433
10435
  const proc = spawn(this.command, args, {
10434
10436
  cwd: this.config.cwd ?? process.cwd(),
10435
10437
  env: { ...process.env, ...env2 },
10436
10438
  stdio: ["pipe", "pipe", "pipe"]
10437
10439
  });
10438
10440
  proc.stdout.on("data", (chunk) => {
10439
- stdout += chunk.toString();
10441
+ const text2 = chunk.toString();
10442
+ stdout += text2;
10443
+ if (isStreamJson) {
10444
+ for (const line of text2.split("\n")) {
10445
+ if (!line.trim())
10446
+ continue;
10447
+ try {
10448
+ const event = JSON.parse(line);
10449
+ if (event.type === "assistant" && event.message?.content) {
10450
+ for (const block of event.message.content) {
10451
+ if (block.type === "text") {
10452
+ resultText += block.text;
10453
+ } else if (block.type === "tool_use") {
10454
+ if (process.stderr.isTTY) {
10455
+ const name = block.name || "tool";
10456
+ const inp = block.input;
10457
+ let detail = "";
10458
+ if (inp?.file_path)
10459
+ detail = String(inp.file_path).split("/").slice(-2).join("/");
10460
+ else if (inp?.command)
10461
+ detail = String(inp.command).slice(0, 60);
10462
+ else if (inp?.pattern)
10463
+ detail = String(inp.pattern).slice(0, 40);
10464
+ else if (inp?.content)
10465
+ detail = "(writing file)";
10466
+ process.stderr.write(dim(` ${name}${detail ? ": " + detail : ""}
10467
+ `));
10468
+ }
10469
+ }
10470
+ }
10471
+ } else if (event.type === "result") {
10472
+ resultText = event.result || resultText;
10473
+ }
10474
+ } catch {
10475
+ }
10476
+ }
10477
+ }
10440
10478
  });
10441
10479
  proc.stderr.on("data", (chunk) => {
10442
10480
  const text2 = chunk.toString();
10443
10481
  stderr += text2;
10444
- if (process.stderr.isTTY) {
10445
- process.stderr.write(dim(text2));
10446
- }
10447
10482
  });
10448
10483
  const timer = setTimeout(() => {
10449
10484
  timedOut = true;
@@ -10452,8 +10487,9 @@ var init_process = __esm({
10452
10487
  }, this.config.timeout);
10453
10488
  proc.on("close", (code) => {
10454
10489
  clearTimeout(timer);
10490
+ const output = isStreamJson ? (resultText || stdout).trim() : stdout.trim();
10455
10491
  resolve3({
10456
- output: stdout.trim(),
10492
+ output,
10457
10493
  exitCode: code,
10458
10494
  timedOut,
10459
10495
  durationMs: Date.now() - start,
@@ -10488,7 +10524,7 @@ var init_process = __esm({
10488
10524
  buildArgs(prompt, context) {
10489
10525
  switch (this.type) {
10490
10526
  case "claude": {
10491
- const args = ["-p", prompt, "--output-format", "text"];
10527
+ const args = ["-p", prompt, "--verbose", "--output-format", "stream-json"];
10492
10528
  if (context?.systemPrompt) {
10493
10529
  args.push("--system-prompt", context.systemPrompt);
10494
10530
  }
@@ -14046,7 +14082,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
14046
14082
  var source_default = chalk;
14047
14083
 
14048
14084
  // packages/shared/dist/constants.js
14049
- var VERSION = "0.1.7";
14085
+ var VERSION = "0.1.9";
14050
14086
  var DEPTH_CONFIG = {
14051
14087
  quick: { maxTemplates: 5, maxPayloadsPerTemplate: 1, multiTurn: false },
14052
14088
  default: { maxTemplates: 20, maxPayloadsPerTemplate: 3, multiTurn: false },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pwnkit-cli",
3
3
  "type": "module",
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "description": "AI-powered agentic security scanner. Scan endpoints, audit packages, review source code. Autonomous agents discover, attack, verify, and report.",
6
6
  "bin": {
7
7
  "pwnkit": "dist/index.js"