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
@@ -1062,6 +1062,89 @@ declare const templates: {
1062
1062
  * Create a Q&A prompt
1063
1063
  */
1064
1064
  qa: (context?: string) => PromptBuilder;
1065
+ /**
1066
+ * Create a debugging prompt
1067
+ */
1068
+ debug: (options?: {
1069
+ language?: string;
1070
+ errorType?: string;
1071
+ }) => PromptBuilder;
1072
+ /**
1073
+ * Create a writing assistant prompt
1074
+ */
1075
+ write: (options?: {
1076
+ type?: "blog" | "email" | "essay" | "story" | "documentation";
1077
+ tone?: string;
1078
+ }) => PromptBuilder;
1079
+ /**
1080
+ * Create an explanation/teaching prompt
1081
+ */
1082
+ explain: (options?: {
1083
+ level?: "beginner" | "intermediate" | "expert";
1084
+ useAnalogies?: boolean;
1085
+ }) => PromptBuilder;
1086
+ /**
1087
+ * Create a data extraction prompt
1088
+ */
1089
+ extract: (options?: {
1090
+ format?: "json" | "csv" | "table";
1091
+ fields?: string[];
1092
+ }) => PromptBuilder;
1093
+ /**
1094
+ * Create a brainstorming prompt
1095
+ */
1096
+ brainstorm: (options?: {
1097
+ count?: number;
1098
+ creative?: boolean;
1099
+ }) => PromptBuilder;
1100
+ /**
1101
+ * Create a code refactoring prompt
1102
+ */
1103
+ refactor: (options?: {
1104
+ goal?: "readability" | "performance" | "maintainability" | "all";
1105
+ language?: string;
1106
+ }) => PromptBuilder;
1107
+ /**
1108
+ * Create an API documentation prompt
1109
+ */
1110
+ apiDocs: (options?: {
1111
+ style?: "openapi" | "markdown" | "jsdoc";
1112
+ includeExamples?: boolean;
1113
+ }) => PromptBuilder;
1114
+ /**
1115
+ * Create a unit test generation prompt
1116
+ */
1117
+ unitTest: (options?: {
1118
+ framework?: string;
1119
+ coverage?: "basic" | "comprehensive";
1120
+ }) => PromptBuilder;
1121
+ /**
1122
+ * Create a commit message prompt
1123
+ */
1124
+ commitMessage: (options?: {
1125
+ style?: "conventional" | "simple";
1126
+ includeBody?: boolean;
1127
+ }) => PromptBuilder;
1128
+ /**
1129
+ * Create a code review comment prompt
1130
+ */
1131
+ reviewComment: (options?: {
1132
+ tone?: "constructive" | "direct";
1133
+ severity?: boolean;
1134
+ }) => PromptBuilder;
1135
+ /**
1136
+ * Create a regex generator prompt
1137
+ */
1138
+ regex: (options?: {
1139
+ flavor?: "javascript" | "python" | "pcre";
1140
+ }) => PromptBuilder;
1141
+ /**
1142
+ * Create a SQL query prompt
1143
+ */
1144
+ sql: (options?: {
1145
+ dialect?: "postgresql" | "mysql" | "sqlite" | "mssql";
1146
+ optimize?: boolean;
1147
+ }) => PromptBuilder;
1065
1148
  };
1066
1149
 
1067
1150
  export { type ArtStyle, type AspectRatio, type AudioGenre, type AudioInstrumentation, type AudioMood, type AudioProduction, AudioPromptBuilder, type AudioStructure, type AudioTechnical, type AudioTempo, type AudioVocals, type BuiltAudioPrompt, type BuiltChatPrompt, type BuiltImagePrompt, type BuiltPrompt, type BuiltVideoPrompt, type CameraAngle, type ChatContext, type ChatExample, type ChatMemory, type ChatMessage, type ChatOutput, type ChatPersona, ChatPromptBuilder, type ChatReasoning, type ChatTask, type ColorPalette, type ImageCamera, type ImageColor, type ImageComposition, type ImageEnvironment, type ImageLighting, ImagePromptBuilder, type ImageStyle, type ImageSubject, type ImageTechnical, type Instrument, type JsonSchema, type LensType, type LightingType, type MessageRole, type Mood, type MusicGenre, type MusicalKey, type OutputFormat, type OutputLength, type OutputStyle, type PersonaExpertise, type PersonaTone, type ProductionStyle, PromptBuilder, type PromptVariable, type ReasoningStyle, type ResponseFormat, type ResponseFormatType, type ShotType, type SongSection, type TempoMarking, type TimeOfDay, type TimeSignature, type VideoAction, type VideoAudio, type VideoCamera, type VideoColor, type VideoLighting, type VideoMotion, VideoPromptBuilder, type VideoScene, type VideoShot, type VideoStyle, type VideoSubject, type VideoTechnical, type VocalStyle, audio, builder, chat, chatPresets, fromPrompt, image, templates, video };
@@ -1,41 +1,3 @@
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
-
39
1
  // src/builder/media.ts
40
2
  var ImagePromptBuilder = class {
41
3
  constructor() {
@@ -2450,10 +2412,222 @@ var templates = {
2450
2412
  "If you don't know the answer, say so",
2451
2413
  "Cite relevant parts of the context if applicable"
2452
2414
  ]);
2415
+ },
2416
+ /**
2417
+ * Create a debugging prompt
2418
+ */
2419
+ debug: (options = {}) => {
2420
+ 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" });
2421
+ if (options.language) {
2422
+ b.context(`Debugging ${options.language} code.`);
2423
+ }
2424
+ if (options.errorType) {
2425
+ b.context(`The error appears to be related to: ${options.errorType}`);
2426
+ }
2427
+ return b.constraints([
2428
+ "Identify the root cause, not just symptoms",
2429
+ "Explain why the bug occurs",
2430
+ "Provide a working fix with explanation"
2431
+ ]).output("1. Root cause analysis\n2. Explanation\n3. Fixed code\n4. Prevention tips");
2432
+ },
2433
+ /**
2434
+ * Create a writing assistant prompt
2435
+ */
2436
+ write: (options = {}) => {
2437
+ const typeDescriptions = {
2438
+ blog: "engaging blog post",
2439
+ email: "professional email",
2440
+ essay: "well-structured essay",
2441
+ story: "creative story",
2442
+ documentation: "clear technical documentation"
2443
+ };
2444
+ 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" });
2445
+ if (options.tone) {
2446
+ b.constraint(`Use a ${options.tone} tone throughout`);
2447
+ }
2448
+ return b.constraints([
2449
+ "Use clear and engaging language",
2450
+ "Structure content logically",
2451
+ "Maintain consistent voice and style"
2452
+ ]);
2453
+ },
2454
+ /**
2455
+ * Create an explanation/teaching prompt
2456
+ */
2457
+ explain: (options = {}) => {
2458
+ const levelDescriptions = {
2459
+ beginner: "someone new to the topic with no prior knowledge",
2460
+ intermediate: "someone with basic understanding who wants to go deeper",
2461
+ expert: "an expert who wants technical precision and nuance"
2462
+ };
2463
+ const b = builder().role("expert teacher and communicator").task("Explain the concept clearly and thoroughly.").variable("concept", { required: true, description: "The concept to explain" });
2464
+ if (options.level) {
2465
+ b.context(`Target audience: ${levelDescriptions[options.level]}`);
2466
+ }
2467
+ if (options.useAnalogies) {
2468
+ b.constraint("Use relatable analogies and real-world examples");
2469
+ }
2470
+ return b.constraints([
2471
+ "Break down complex ideas into digestible parts",
2472
+ "Build understanding progressively",
2473
+ "Anticipate and address common misconceptions"
2474
+ ]);
2475
+ },
2476
+ /**
2477
+ * Create a data extraction prompt
2478
+ */
2479
+ extract: (options = {}) => {
2480
+ 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" });
2481
+ if (options.fields && options.fields.length > 0) {
2482
+ b.context(`Fields to extract: ${options.fields.join(", ")}`);
2483
+ }
2484
+ if (options.format) {
2485
+ b.output(`Return extracted data in ${options.format.toUpperCase()} format`);
2486
+ }
2487
+ return b.constraints([
2488
+ "Extract only factual information present in the text",
2489
+ "Use null or empty values for missing fields",
2490
+ "Maintain consistent formatting"
2491
+ ]);
2492
+ },
2493
+ /**
2494
+ * Create a brainstorming prompt
2495
+ */
2496
+ brainstorm: (options = {}) => {
2497
+ 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" });
2498
+ if (options.count) {
2499
+ b.constraint(`Generate exactly ${options.count} ideas`);
2500
+ }
2501
+ if (options.creative) {
2502
+ b.constraint("Include unconventional and out-of-the-box ideas");
2503
+ }
2504
+ return b.constraints([
2505
+ "Ensure ideas are distinct and varied",
2506
+ "Consider different perspectives and approaches",
2507
+ "Make ideas actionable when possible"
2508
+ ]).output("List each idea with a brief description and potential benefits");
2509
+ },
2510
+ /**
2511
+ * Create a code refactoring prompt
2512
+ */
2513
+ refactor: (options = {}) => {
2514
+ const goalDescriptions = {
2515
+ readability: "improving code readability and clarity",
2516
+ performance: "optimizing performance and efficiency",
2517
+ maintainability: "enhancing maintainability and extensibility",
2518
+ all: "overall code quality improvement"
2519
+ };
2520
+ 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" });
2521
+ if (options.language) {
2522
+ b.context(`The code is written in ${options.language}.`);
2523
+ }
2524
+ return b.constraints([
2525
+ "Preserve existing functionality",
2526
+ "Follow language best practices and idioms",
2527
+ "Explain each significant change"
2528
+ ]).output("1. Refactored code\n2. List of changes made\n3. Explanation of improvements");
2529
+ },
2530
+ /**
2531
+ * Create an API documentation prompt
2532
+ */
2533
+ apiDocs: (options = {}) => {
2534
+ 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" });
2535
+ if (options.style) {
2536
+ b.output(`Format documentation in ${options.style.toUpperCase()} style`);
2537
+ }
2538
+ if (options.includeExamples) {
2539
+ b.constraint("Include request/response examples for each endpoint");
2540
+ }
2541
+ return b.constraints([
2542
+ "Document all parameters with types and descriptions",
2543
+ "Include error responses and status codes",
2544
+ "Be precise and developer-friendly"
2545
+ ]);
2546
+ },
2547
+ /**
2548
+ * Create a unit test generation prompt
2549
+ */
2550
+ unitTest: (options = {}) => {
2551
+ 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" });
2552
+ if (options.framework) {
2553
+ b.context(`Use ${options.framework} testing framework.`);
2554
+ }
2555
+ 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"];
2556
+ return b.constraints([
2557
+ ...coverageConstraints,
2558
+ "Write clear, descriptive test names",
2559
+ "Follow AAA pattern (Arrange, Act, Assert)"
2560
+ ]).output("Complete, runnable test file");
2561
+ },
2562
+ /**
2563
+ * Create a commit message prompt
2564
+ */
2565
+ commitMessage: (options = {}) => {
2566
+ 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" });
2567
+ if (options.style === "conventional") {
2568
+ b.constraints([
2569
+ "Follow Conventional Commits format (type(scope): description)",
2570
+ "Use appropriate type: feat, fix, docs, style, refactor, test, chore"
2571
+ ]);
2572
+ }
2573
+ if (options.includeBody) {
2574
+ b.constraint("Include a detailed body explaining the why behind changes");
2575
+ }
2576
+ return b.constraints([
2577
+ "Keep subject line under 72 characters",
2578
+ "Use imperative mood (Add, Fix, Update, not Added, Fixed, Updated)"
2579
+ ]);
2580
+ },
2581
+ /**
2582
+ * Create a code review comment prompt
2583
+ */
2584
+ reviewComment: (options = {}) => {
2585
+ 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" });
2586
+ if (options.tone === "constructive") {
2587
+ b.constraint("Frame feedback positively and suggest improvements rather than just pointing out problems");
2588
+ }
2589
+ if (options.severity) {
2590
+ b.constraint("Indicate severity level: nitpick, suggestion, important, or blocker");
2591
+ }
2592
+ return b.constraints([
2593
+ "Be specific and actionable",
2594
+ "Explain the reasoning behind the suggestion",
2595
+ "Provide an example of the improved code when helpful"
2596
+ ]);
2597
+ },
2598
+ /**
2599
+ * Create a regex generator prompt
2600
+ */
2601
+ regex: (options = {}) => {
2602
+ 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" });
2603
+ if (options.flavor) {
2604
+ b.context(`Use ${options.flavor} regex flavor/syntax.`);
2605
+ }
2606
+ return b.constraints([
2607
+ "Provide the regex pattern",
2608
+ "Explain each part of the pattern",
2609
+ "Include test cases showing matches and non-matches"
2610
+ ]).output("1. Regex pattern\n2. Explanation\n3. Test cases");
2611
+ },
2612
+ /**
2613
+ * Create a SQL query prompt
2614
+ */
2615
+ sql: (options = {}) => {
2616
+ 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" });
2617
+ if (options.dialect) {
2618
+ b.context(`Use ${options.dialect.toUpperCase()} syntax.`);
2619
+ }
2620
+ if (options.optimize) {
2621
+ b.constraint("Optimize for performance and include index recommendations if applicable");
2622
+ }
2623
+ return b.constraints([
2624
+ "Write clean, readable SQL",
2625
+ "Use appropriate JOINs and avoid N+1 patterns",
2626
+ "Include comments explaining complex logic"
2627
+ ]);
2453
2628
  }
2454
2629
  };
2455
- // Annotate the CommonJS export names for ESM import in node:
2456
- 0 && (module.exports = {
2630
+ export {
2457
2631
  AudioPromptBuilder,
2458
2632
  ChatPromptBuilder,
2459
2633
  ImagePromptBuilder,
@@ -2467,5 +2641,5 @@ var templates = {
2467
2641
  image,
2468
2642
  templates,
2469
2643
  video
2470
- });
2644
+ };
2471
2645
  //# sourceMappingURL=index.js.map