@knid/agentx 0.1.6 → 0.1.7

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 +93 -17
  2. package/package.json +11 -9
package/dist/index.js CHANGED
@@ -315,6 +315,79 @@ function buildPromptWithPipe(prompt, pipedContent) {
315
315
  ${prompt}`;
316
316
  }
317
317
 
318
+ // src/ui/colors.ts
319
+ import chalk from "chalk";
320
+ var noColor = process.env.NO_COLOR !== void 0 || process.argv.includes("--no-color");
321
+ var identity = (s) => s;
322
+ var colors = {
323
+ success: noColor ? identity : chalk.green,
324
+ error: noColor ? identity : chalk.red,
325
+ warn: noColor ? identity : chalk.yellow,
326
+ info: noColor ? identity : chalk.blue,
327
+ dim: noColor ? identity : chalk.dim,
328
+ bold: noColor ? identity : chalk.bold,
329
+ cyan: noColor ? identity : chalk.cyan,
330
+ magenta: noColor ? identity : chalk.magenta
331
+ };
332
+
333
+ // src/ui/markdown.ts
334
+ import { marked } from "marked";
335
+ import { markedTerminal } from "marked-terminal";
336
+ import chalk2 from "chalk";
337
+ marked.use(
338
+ markedTerminal({
339
+ firstHeading: chalk2.magenta.bold,
340
+ heading: chalk2.magenta.bold,
341
+ strong: chalk2.bold,
342
+ em: chalk2.italic,
343
+ codespan: chalk2.yellow,
344
+ code: chalk2.yellow,
345
+ blockquote: chalk2.gray.italic,
346
+ link: chalk2.cyan,
347
+ href: chalk2.cyan.underline,
348
+ del: chalk2.dim.strikethrough,
349
+ reflowText: true,
350
+ width: Math.min(process.stdout.columns || 80, 100),
351
+ showSectionPrefix: false,
352
+ tab: 2
353
+ })
354
+ );
355
+ function renderMarkdown(text3) {
356
+ return marked.parse(text3);
357
+ }
358
+
359
+ // src/runtime/output-formatter.ts
360
+ var SEPARATOR = "\u2500".repeat(40);
361
+ function printRunHeader(opts) {
362
+ console.log();
363
+ console.log(` ${colors.magenta("\u25B6")} ${colors.bold(opts.agentName)} ${colors.dim(`v${opts.version}`)}`);
364
+ console.log(` ${colors.dim(SEPARATOR)}`);
365
+ console.log();
366
+ }
367
+ function printRunOutput(raw, opts) {
368
+ const trimmed = raw.trim();
369
+ if (!trimmed) return;
370
+ if (opts.format === "json") {
371
+ try {
372
+ const parsed = JSON.parse(trimmed);
373
+ console.log(JSON.stringify(parsed, null, 2));
374
+ } catch {
375
+ console.log(trimmed);
376
+ }
377
+ return;
378
+ }
379
+ const rendered = renderMarkdown(trimmed);
380
+ const indented = rendered.replace(/\n$/, "").split("\n").map((line) => ` ${line}`).join("\n");
381
+ console.log(indented);
382
+ }
383
+ function printRunFooter(opts) {
384
+ const seconds = (opts.durationMs / 1e3).toFixed(1);
385
+ console.log();
386
+ console.log(` ${colors.dim(SEPARATOR)}`);
387
+ console.log(` ${colors.success("\u2713")} ${colors.dim(`Completed in ${seconds}s`)}`);
388
+ console.log();
389
+ }
390
+
318
391
  // src/telemetry/reporter.ts
319
392
  function sendTelemetry(event) {
320
393
  try {
@@ -494,14 +567,32 @@ async function runAgent(agentName, options) {
494
567
  });
495
568
  return "";
496
569
  }
497
- await execa(claudePath, claudeArgs, { stdio: "inherit" });
570
+ const outputFormat = options.outputFormat ?? "text";
571
+ if (!options.quiet) {
572
+ printRunHeader({
573
+ agentName: agentFullName,
574
+ version: manifest.version
575
+ });
576
+ }
577
+ const result = await execa(claudePath, claudeArgs, {
578
+ stdout: "pipe",
579
+ stderr: "inherit",
580
+ stdin: "inherit"
581
+ });
582
+ const rawOutput = result.stdout ?? "";
583
+ if (!options.quiet) {
584
+ printRunOutput(rawOutput, { format: outputFormat });
585
+ printRunFooter({ durationMs: Date.now() - startTime });
586
+ } else if (rawOutput) {
587
+ console.log(rawOutput);
588
+ }
498
589
  sendTelemetry({
499
590
  agent: agentFullName,
500
591
  version: manifest.version,
501
592
  success: true,
502
593
  duration_ms: Date.now() - startTime
503
594
  });
504
- return "";
595
+ return rawOutput;
505
596
  } catch (error) {
506
597
  sendTelemetry({
507
598
  agent: agentFullName,
@@ -521,21 +612,6 @@ async function runAgent(agentName, options) {
521
612
  }
522
613
  }
523
614
 
524
- // src/ui/colors.ts
525
- import chalk from "chalk";
526
- var noColor = process.env.NO_COLOR !== void 0 || process.argv.includes("--no-color");
527
- var identity = (s) => s;
528
- var colors = {
529
- success: noColor ? identity : chalk.green,
530
- error: noColor ? identity : chalk.red,
531
- warn: noColor ? identity : chalk.yellow,
532
- info: noColor ? identity : chalk.blue,
533
- dim: noColor ? identity : chalk.dim,
534
- bold: noColor ? identity : chalk.bold,
535
- cyan: noColor ? identity : chalk.cyan,
536
- magenta: noColor ? identity : chalk.magenta
537
- };
538
-
539
615
  // src/commands/run.ts
540
616
  var runCommand = new Command("run").description("Run a local or installed agent").argument("<agent>", 'Agent name, path, or "." for current directory').argument("[prompt...]", "Prompt to send to the agent").option("-i, --interactive", "Run in interactive mode (stdin/stdout)").option("--file <path>", "Include file content in the prompt").option("--json", "Output in JSON format").option("--quiet", "Suppress output (useful for scripting)").option("--debug", "Show debug information").option("--output-format <format>", "Output format: text or json", "text").addHelpText("after", `
541
617
  Examples:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knid/agentx",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "The package manager for AI agents powered by Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,21 +25,23 @@
25
25
  "prepublishOnly": "npm run build"
26
26
  },
27
27
  "dependencies": {
28
+ "@clack/prompts": "^0.9.0",
29
+ "chalk": "^5.4.0",
28
30
  "commander": "^12.0.0",
29
31
  "execa": "^9.0.0",
30
- "@clack/prompts": "^0.9.0",
31
- "zod": "^3.23.0",
32
- "yaml": "^2.6.0",
32
+ "marked": "^15.0.12",
33
+ "marked-terminal": "^7.3.0",
33
34
  "ofetch": "^1.4.0",
34
- "chalk": "^5.4.0",
35
- "tar": "^7.0.0"
35
+ "tar": "^7.0.0",
36
+ "yaml": "^2.6.0",
37
+ "zod": "^3.23.0"
36
38
  },
37
39
  "devDependencies": {
40
+ "@types/node": "^22.0.0",
41
+ "@types/tar": "^6.1.0",
38
42
  "tsup": "^8.0.0",
39
- "vitest": "^3.0.0",
40
43
  "typescript": "^5.7.0",
41
- "@types/node": "^22.0.0",
42
- "@types/tar": "^6.1.0"
44
+ "vitest": "^3.0.0"
43
45
  },
44
46
  "keywords": [
45
47
  "ai",