prompts.chat 0.0.6 → 0.0.8

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 (41) hide show
  1. package/bin/cli.js +2 -0
  2. package/dist/builder/{index.mjs → index.cjs} +255 -3
  3. package/dist/builder/index.cjs.map +1 -0
  4. package/dist/builder/{index.d.mts → index.d.cts} +83 -0
  5. package/dist/builder/index.d.ts +83 -0
  6. package/dist/builder/index.js +215 -41
  7. package/dist/builder/index.js.map +1 -1
  8. package/dist/cli/index.js +1132 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/{index.mjs → index.cjs} +285 -13
  11. package/dist/index.cjs.map +1 -0
  12. package/dist/{index.d.mts → index.d.cts} +5 -5
  13. package/dist/index.js +225 -71
  14. package/dist/index.js.map +1 -1
  15. package/dist/parser/{index.mjs → index.cjs} +32 -3
  16. package/dist/parser/{index.mjs.map → index.cjs.map} +1 -1
  17. package/dist/parser/{index.d.mts → index.d.cts} +1 -1
  18. package/dist/parser/index.js +2 -31
  19. package/dist/parser/index.js.map +1 -1
  20. package/dist/quality/{index.mjs → index.cjs} +31 -3
  21. package/dist/quality/{index.mjs.map → index.cjs.map} +1 -1
  22. package/dist/quality/{index.d.mts → index.d.cts} +1 -1
  23. package/dist/quality/index.js +2 -30
  24. package/dist/quality/index.js.map +1 -1
  25. package/dist/similarity/{index.mjs → index.cjs} +35 -3
  26. package/dist/similarity/{index.mjs.map → index.cjs.map} +1 -1
  27. package/dist/similarity/{index.d.mts → index.d.cts} +1 -1
  28. package/dist/similarity/index.js +2 -34
  29. package/dist/similarity/index.js.map +1 -1
  30. package/dist/variables/{index.mjs → index.cjs} +35 -3
  31. package/dist/variables/{index.mjs.map → index.cjs.map} +1 -1
  32. package/dist/variables/{index.d.mts → index.d.cts} +1 -1
  33. package/dist/variables/index.js +2 -34
  34. package/dist/variables/index.js.map +1 -1
  35. package/package.json +18 -1
  36. package/dist/builder/index.mjs.map +0 -1
  37. package/dist/index.mjs.map +0 -1
  38. /package/dist/{index-BEIO8LCd.d.mts → index-BEIO8LCd.d.cts} +0 -0
  39. /package/dist/{index-CSHEKYfQ.d.mts → index-CSHEKYfQ.d.cts} +0 -0
  40. /package/dist/{index-D41E6D9X.d.mts → index-D41E6D9X.d.cts} +0 -0
  41. /package/dist/{index-DOz8zcA0.d.mts → index-DOz8zcA0.d.cts} +0 -0
package/bin/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ await import('../dist/cli/index.js');
@@ -1,3 +1,41 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/builder/index.ts
21
+ var builder_exports = {};
22
+ __export(builder_exports, {
23
+ AudioPromptBuilder: () => AudioPromptBuilder,
24
+ ChatPromptBuilder: () => ChatPromptBuilder,
25
+ ImagePromptBuilder: () => ImagePromptBuilder,
26
+ PromptBuilder: () => PromptBuilder,
27
+ VideoPromptBuilder: () => VideoPromptBuilder,
28
+ audio: () => audio,
29
+ builder: () => builder,
30
+ chat: () => chat,
31
+ chatPresets: () => chatPresets,
32
+ fromPrompt: () => fromPrompt,
33
+ image: () => image,
34
+ templates: () => templates,
35
+ video: () => video
36
+ });
37
+ module.exports = __toCommonJS(builder_exports);
38
+
1
39
  // src/builder/media.ts
2
40
  var ImagePromptBuilder = class {
3
41
  constructor() {
@@ -2412,9 +2450,223 @@ var templates = {
2412
2450
  "If you don't know the answer, say so",
2413
2451
  "Cite relevant parts of the context if applicable"
2414
2452
  ]);
2453
+ },
2454
+ /**
2455
+ * Create a debugging prompt
2456
+ */
2457
+ debug: (options = {}) => {
2458
+ const b = builder().role("expert software debugger").task("Analyze the code and error, identify the root cause, and provide a fix.").variable("code", { required: true, description: "The code with the bug" }).variable("error", { required: false, description: "Error message or unexpected behavior" });
2459
+ if (options.language) {
2460
+ b.context(`Debugging ${options.language} code.`);
2461
+ }
2462
+ if (options.errorType) {
2463
+ b.context(`The error appears to be related to: ${options.errorType}`);
2464
+ }
2465
+ return b.constraints([
2466
+ "Identify the root cause, not just symptoms",
2467
+ "Explain why the bug occurs",
2468
+ "Provide a working fix with explanation"
2469
+ ]).output("1. Root cause analysis\n2. Explanation\n3. Fixed code\n4. Prevention tips");
2470
+ },
2471
+ /**
2472
+ * Create a writing assistant prompt
2473
+ */
2474
+ write: (options = {}) => {
2475
+ const typeDescriptions = {
2476
+ blog: "engaging blog post",
2477
+ email: "professional email",
2478
+ essay: "well-structured essay",
2479
+ story: "creative story",
2480
+ documentation: "clear technical documentation"
2481
+ };
2482
+ const b = builder().role("skilled writer").task(`Write a ${typeDescriptions[options.type || "blog"] || "piece of content"} based on the given topic or outline.`).variable("topic", { required: true, description: "Topic or outline to write about" });
2483
+ if (options.tone) {
2484
+ b.constraint(`Use a ${options.tone} tone throughout`);
2485
+ }
2486
+ return b.constraints([
2487
+ "Use clear and engaging language",
2488
+ "Structure content logically",
2489
+ "Maintain consistent voice and style"
2490
+ ]);
2491
+ },
2492
+ /**
2493
+ * Create an explanation/teaching prompt
2494
+ */
2495
+ explain: (options = {}) => {
2496
+ const levelDescriptions = {
2497
+ beginner: "someone new to the topic with no prior knowledge",
2498
+ intermediate: "someone with basic understanding who wants to go deeper",
2499
+ expert: "an expert who wants technical precision and nuance"
2500
+ };
2501
+ const b = builder().role("expert teacher and communicator").task("Explain the concept clearly and thoroughly.").variable("concept", { required: true, description: "The concept to explain" });
2502
+ if (options.level) {
2503
+ b.context(`Target audience: ${levelDescriptions[options.level]}`);
2504
+ }
2505
+ if (options.useAnalogies) {
2506
+ b.constraint("Use relatable analogies and real-world examples");
2507
+ }
2508
+ return b.constraints([
2509
+ "Break down complex ideas into digestible parts",
2510
+ "Build understanding progressively",
2511
+ "Anticipate and address common misconceptions"
2512
+ ]);
2513
+ },
2514
+ /**
2515
+ * Create a data extraction prompt
2516
+ */
2517
+ extract: (options = {}) => {
2518
+ const b = builder().role("data extraction specialist").task("Extract structured data from the provided text.").variable("text", { required: true, description: "Text to extract data from" });
2519
+ if (options.fields && options.fields.length > 0) {
2520
+ b.context(`Fields to extract: ${options.fields.join(", ")}`);
2521
+ }
2522
+ if (options.format) {
2523
+ b.output(`Return extracted data in ${options.format.toUpperCase()} format`);
2524
+ }
2525
+ return b.constraints([
2526
+ "Extract only factual information present in the text",
2527
+ "Use null or empty values for missing fields",
2528
+ "Maintain consistent formatting"
2529
+ ]);
2530
+ },
2531
+ /**
2532
+ * Create a brainstorming prompt
2533
+ */
2534
+ brainstorm: (options = {}) => {
2535
+ const b = builder().role("creative strategist and ideation expert").task("Generate diverse and innovative ideas based on the given topic or challenge.").variable("topic", { required: true, description: "Topic or challenge to brainstorm about" });
2536
+ if (options.count) {
2537
+ b.constraint(`Generate exactly ${options.count} ideas`);
2538
+ }
2539
+ if (options.creative) {
2540
+ b.constraint("Include unconventional and out-of-the-box ideas");
2541
+ }
2542
+ return b.constraints([
2543
+ "Ensure ideas are distinct and varied",
2544
+ "Consider different perspectives and approaches",
2545
+ "Make ideas actionable when possible"
2546
+ ]).output("List each idea with a brief description and potential benefits");
2547
+ },
2548
+ /**
2549
+ * Create a code refactoring prompt
2550
+ */
2551
+ refactor: (options = {}) => {
2552
+ const goalDescriptions = {
2553
+ readability: "improving code readability and clarity",
2554
+ performance: "optimizing performance and efficiency",
2555
+ maintainability: "enhancing maintainability and extensibility",
2556
+ all: "overall code quality improvement"
2557
+ };
2558
+ const b = builder().role("senior software engineer specializing in code quality").task(`Refactor the code with focus on ${goalDescriptions[options.goal || "all"]}.`).variable("code", { required: true, description: "Code to refactor" });
2559
+ if (options.language) {
2560
+ b.context(`The code is written in ${options.language}.`);
2561
+ }
2562
+ return b.constraints([
2563
+ "Preserve existing functionality",
2564
+ "Follow language best practices and idioms",
2565
+ "Explain each significant change"
2566
+ ]).output("1. Refactored code\n2. List of changes made\n3. Explanation of improvements");
2567
+ },
2568
+ /**
2569
+ * Create an API documentation prompt
2570
+ */
2571
+ apiDocs: (options = {}) => {
2572
+ const b = builder().role("technical documentation writer").task("Generate comprehensive API documentation for the provided code or endpoint.").variable("code", { required: true, description: "API code or endpoint definition" });
2573
+ if (options.style) {
2574
+ b.output(`Format documentation in ${options.style.toUpperCase()} style`);
2575
+ }
2576
+ if (options.includeExamples) {
2577
+ b.constraint("Include request/response examples for each endpoint");
2578
+ }
2579
+ return b.constraints([
2580
+ "Document all parameters with types and descriptions",
2581
+ "Include error responses and status codes",
2582
+ "Be precise and developer-friendly"
2583
+ ]);
2584
+ },
2585
+ /**
2586
+ * Create a unit test generation prompt
2587
+ */
2588
+ unitTest: (options = {}) => {
2589
+ const b = builder().role("test automation engineer").task("Generate unit tests for the provided code.").variable("code", { required: true, description: "Code to generate tests for" });
2590
+ if (options.framework) {
2591
+ b.context(`Use ${options.framework} testing framework.`);
2592
+ }
2593
+ const coverageConstraints = options.coverage === "comprehensive" ? ["Cover all code paths including edge cases", "Test error handling scenarios", "Include boundary value tests"] : ["Cover main functionality", "Include basic edge cases"];
2594
+ return b.constraints([
2595
+ ...coverageConstraints,
2596
+ "Write clear, descriptive test names",
2597
+ "Follow AAA pattern (Arrange, Act, Assert)"
2598
+ ]).output("Complete, runnable test file");
2599
+ },
2600
+ /**
2601
+ * Create a commit message prompt
2602
+ */
2603
+ commitMessage: (options = {}) => {
2604
+ const b = builder().role("developer with excellent communication skills").task("Generate a clear and descriptive commit message for the provided code changes.").variable("diff", { required: true, description: "Git diff or description of changes" });
2605
+ if (options.style === "conventional") {
2606
+ b.constraints([
2607
+ "Follow Conventional Commits format (type(scope): description)",
2608
+ "Use appropriate type: feat, fix, docs, style, refactor, test, chore"
2609
+ ]);
2610
+ }
2611
+ if (options.includeBody) {
2612
+ b.constraint("Include a detailed body explaining the why behind changes");
2613
+ }
2614
+ return b.constraints([
2615
+ "Keep subject line under 72 characters",
2616
+ "Use imperative mood (Add, Fix, Update, not Added, Fixed, Updated)"
2617
+ ]);
2618
+ },
2619
+ /**
2620
+ * Create a code review comment prompt
2621
+ */
2622
+ reviewComment: (options = {}) => {
2623
+ const b = builder().role("thoughtful code reviewer").task("Write a helpful code review comment for the provided code snippet.").variable("code", { required: true, description: "Code to comment on" }).variable("issue", { required: true, description: "The issue or improvement to address" });
2624
+ if (options.tone === "constructive") {
2625
+ b.constraint("Frame feedback positively and suggest improvements rather than just pointing out problems");
2626
+ }
2627
+ if (options.severity) {
2628
+ b.constraint("Indicate severity level: nitpick, suggestion, important, or blocker");
2629
+ }
2630
+ return b.constraints([
2631
+ "Be specific and actionable",
2632
+ "Explain the reasoning behind the suggestion",
2633
+ "Provide an example of the improved code when helpful"
2634
+ ]);
2635
+ },
2636
+ /**
2637
+ * Create a regex generator prompt
2638
+ */
2639
+ regex: (options = {}) => {
2640
+ const b = builder().role("regex expert").task("Create a regular expression that matches the described pattern.").variable("pattern", { required: true, description: "Description of the pattern to match" }).variable("examples", { required: false, description: "Example strings that should match" });
2641
+ if (options.flavor) {
2642
+ b.context(`Use ${options.flavor} regex flavor/syntax.`);
2643
+ }
2644
+ return b.constraints([
2645
+ "Provide the regex pattern",
2646
+ "Explain each part of the pattern",
2647
+ "Include test cases showing matches and non-matches"
2648
+ ]).output("1. Regex pattern\n2. Explanation\n3. Test cases");
2649
+ },
2650
+ /**
2651
+ * Create a SQL query prompt
2652
+ */
2653
+ sql: (options = {}) => {
2654
+ const b = builder().role("database expert").task("Write an SQL query based on the requirements.").variable("requirement", { required: true, description: "What the query should accomplish" }).variable("schema", { required: false, description: "Database schema or table definitions" });
2655
+ if (options.dialect) {
2656
+ b.context(`Use ${options.dialect.toUpperCase()} syntax.`);
2657
+ }
2658
+ if (options.optimize) {
2659
+ b.constraint("Optimize for performance and include index recommendations if applicable");
2660
+ }
2661
+ return b.constraints([
2662
+ "Write clean, readable SQL",
2663
+ "Use appropriate JOINs and avoid N+1 patterns",
2664
+ "Include comments explaining complex logic"
2665
+ ]);
2415
2666
  }
2416
2667
  };
2417
- export {
2668
+ // Annotate the CommonJS export names for ESM import in node:
2669
+ 0 && (module.exports = {
2418
2670
  AudioPromptBuilder,
2419
2671
  ChatPromptBuilder,
2420
2672
  ImagePromptBuilder,
@@ -2428,5 +2680,5 @@ export {
2428
2680
  image,
2429
2681
  templates,
2430
2682
  video
2431
- };
2432
- //# sourceMappingURL=index.mjs.map
2683
+ });
2684
+ //# sourceMappingURL=index.cjs.map