@promptbook/javascript 0.112.0-35 → 0.112.0-38

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 (126) hide show
  1. package/README.md +119 -18
  2. package/esm/index.es.js +1 -1
  3. package/esm/src/_packages/components.index.d.ts +2 -0
  4. package/esm/src/_packages/types.index.d.ts +48 -46
  5. package/esm/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  6. package/esm/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  7. package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  8. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  9. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  10. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  11. package/esm/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  12. package/esm/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  13. package/esm/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  14. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  15. package/esm/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  16. package/esm/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  17. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  18. package/esm/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  19. package/esm/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  20. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +137 -0
  21. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.test.d.ts +1 -0
  22. package/esm/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  23. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  24. package/esm/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  25. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  26. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  27. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  28. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  29. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  30. package/esm/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  31. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +10 -0
  32. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  33. package/esm/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  34. package/esm/src/cli/cli-commands/coder/init.d.ts +3 -0
  35. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  36. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  37. package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  38. package/esm/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  39. package/esm/src/types/string_agent_url.d.ts +7 -0
  40. package/esm/src/types/string_agent_url_private.d.ts +9 -0
  41. package/esm/src/types/string_base64.d.ts +13 -0
  42. package/esm/src/types/string_base64_private.d.ts +2 -2
  43. package/esm/src/types/string_base_url.d.ts +7 -0
  44. package/esm/src/types/string_base_url_private.d.ts +9 -0
  45. package/esm/src/types/string_email.d.ts +13 -0
  46. package/esm/src/types/string_email_private.d.ts +2 -2
  47. package/esm/src/types/string_host.d.ts +42 -0
  48. package/esm/src/types/string_host_private.d.ts +7 -7
  49. package/esm/src/types/string_href.d.ts +19 -0
  50. package/esm/src/types/string_href_private.d.ts +24 -0
  51. package/esm/src/types/string_mime_type.d.ts +15 -0
  52. package/esm/src/types/string_mime_type_private.d.ts +2 -2
  53. package/esm/src/types/string_pipeline_root_url.d.ts +7 -0
  54. package/esm/src/types/string_pipeline_root_url_private.d.ts +9 -0
  55. package/esm/src/types/string_pipeline_url.d.ts +13 -0
  56. package/esm/src/types/string_pipeline_url_private.d.ts +17 -0
  57. package/esm/src/types/string_promptbook_server_url.d.ts +7 -0
  58. package/esm/src/types/string_promptbook_server_url_private.d.ts +9 -0
  59. package/esm/src/types/string_url.d.ts +14 -141
  60. package/esm/src/types/string_url_image.d.ts +7 -0
  61. package/esm/src/types/string_url_image_private.d.ts +9 -0
  62. package/esm/src/types/string_url_private.d.ts +0 -80
  63. package/esm/src/version.d.ts +1 -1
  64. package/package.json +2 -2
  65. package/umd/index.umd.js +1 -1
  66. package/umd/src/_packages/components.index.d.ts +2 -0
  67. package/umd/src/_packages/types.index.d.ts +48 -46
  68. package/umd/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  69. package/umd/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  70. package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  71. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  72. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  73. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  74. package/umd/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  75. package/umd/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  76. package/umd/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  77. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  78. package/umd/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  79. package/umd/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  80. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  81. package/umd/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  82. package/umd/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  83. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +137 -0
  84. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.test.d.ts +1 -0
  85. package/umd/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  86. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  87. package/umd/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  88. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  89. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  90. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  91. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  92. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  93. package/umd/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  94. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +10 -0
  95. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  96. package/umd/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  97. package/umd/src/cli/cli-commands/coder/init.d.ts +3 -0
  98. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  99. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  100. package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  101. package/umd/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  102. package/umd/src/types/string_agent_url.d.ts +7 -0
  103. package/umd/src/types/string_agent_url_private.d.ts +9 -0
  104. package/umd/src/types/string_base64.d.ts +13 -0
  105. package/umd/src/types/string_base64_private.d.ts +2 -2
  106. package/umd/src/types/string_base_url.d.ts +7 -0
  107. package/umd/src/types/string_base_url_private.d.ts +9 -0
  108. package/umd/src/types/string_email.d.ts +13 -0
  109. package/umd/src/types/string_email_private.d.ts +2 -2
  110. package/umd/src/types/string_host.d.ts +42 -0
  111. package/umd/src/types/string_host_private.d.ts +7 -7
  112. package/umd/src/types/string_href.d.ts +19 -0
  113. package/umd/src/types/string_href_private.d.ts +24 -0
  114. package/umd/src/types/string_mime_type.d.ts +15 -0
  115. package/umd/src/types/string_mime_type_private.d.ts +2 -2
  116. package/umd/src/types/string_pipeline_root_url.d.ts +7 -0
  117. package/umd/src/types/string_pipeline_root_url_private.d.ts +9 -0
  118. package/umd/src/types/string_pipeline_url.d.ts +13 -0
  119. package/umd/src/types/string_pipeline_url_private.d.ts +17 -0
  120. package/umd/src/types/string_promptbook_server_url.d.ts +7 -0
  121. package/umd/src/types/string_promptbook_server_url_private.d.ts +9 -0
  122. package/umd/src/types/string_url.d.ts +14 -141
  123. package/umd/src/types/string_url_image.d.ts +7 -0
  124. package/umd/src/types/string_url_image_private.d.ts +9 -0
  125. package/umd/src/types/string_url_private.d.ts +0 -80
  126. package/umd/src/version.d.ts +1 -1
@@ -2,6 +2,7 @@ import type { CSSProperties, ReactNode } from 'react';
2
2
  import type { Promisable } from 'type-fest';
3
3
  import { Color } from '../../../_packages/color.index';
4
4
  import { SpeechRecognition } from '../../../types/SpeechRecognition';
5
+ import type { string_href } from '../../../types/typeAliases';
5
6
  import { string_color } from '../../../types/typeAliases';
6
7
  import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
7
8
  import type { ChatMessage } from '../types/ChatMessage';
@@ -124,6 +125,26 @@ export type ChatUiTranslations = {
124
125
  * @default "Write a message..."
125
126
  */
126
127
  readonly inputPlaceholder?: string;
128
+ /**
129
+ * Label shown above quoted reply previews in both composer and reply bubbles.
130
+ * @default "Replying to"
131
+ */
132
+ readonly replyingToLabel?: string;
133
+ /**
134
+ * Visible label for the explicit reply action on one message.
135
+ * @default "Reply"
136
+ */
137
+ readonly replyActionLabel?: string;
138
+ /**
139
+ * Accessible title for the explicit reply action on one message.
140
+ * @default "Reply to this message"
141
+ */
142
+ readonly replyActionTitle?: string;
143
+ /**
144
+ * Accessible label for the composer button that cancels reply mode.
145
+ * @default "Cancel reply"
146
+ */
147
+ readonly cancelReplyLabel?: string;
127
148
  /**
128
149
  * Label for the "Save" button in the chat actions bar.
129
150
  * @default "Save"
@@ -433,7 +454,11 @@ export type ChatProps = {
433
454
  * - When set, the send textarea and button will be shown
434
455
  * - When undefined, the chat has no input and is read-only showing only the messages
435
456
  */
436
- onMessage?(messageContent: string): Promisable<void>;
457
+ onMessage?(messageContent: string, attachments?: Array<{
458
+ name: string;
459
+ type: string;
460
+ url: string;
461
+ }>, replyingToMessage?: ChatMessage | null): Promisable<void>;
437
462
  /**
438
463
  * Called when user clicks a quick action button parsed from message markdown.
439
464
  *
@@ -447,6 +472,22 @@ export type ChatProps = {
447
472
  * When not provided, quick message buttons fall back to `onMessage`.
448
473
  */
449
474
  onQuickMessageButton?(messageContent: string): Promisable<void>;
475
+ /**
476
+ * Optional callback fired when the user starts replying to one existing message.
477
+ */
478
+ onReplyToMessage?(message: ChatMessage): void;
479
+ /**
480
+ * Optional callback fired when the user cancels the currently composed reply.
481
+ */
482
+ onCancelReply?(): void;
483
+ /**
484
+ * Optional callback that determines whether one message can be replied to.
485
+ */
486
+ canReplyToMessage?(message: ChatMessage): boolean;
487
+ /**
488
+ * Optional message currently being quoted by the composer.
489
+ */
490
+ readonly replyingToMessage?: ChatMessage | null;
450
491
  /**
451
492
  * Optional callback
452
493
  *
@@ -460,6 +501,14 @@ export type ChatProps = {
460
501
  * @default true
461
502
  */
462
503
  readonly resetRequiresConfirmation?: boolean;
504
+ /**
505
+ * Optional navigation target for the action-bar "New chat" control.
506
+ *
507
+ * When provided, the control is rendered as a plain link instead of invoking `onReset`.
508
+ * This allows host applications to rely on browser-native navigation affordances such as
509
+ * right-click "Open in new tab/window".
510
+ */
511
+ readonly newChatButtonHref?: string_href;
463
512
  /**
464
513
  * Determines whether the voice recognition button is rendered
465
514
  */
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Props for one faded quoted-message preview rendered inside the chat UI.
3
+ *
4
+ * @private component of `<Chat/>`
5
+ */
6
+ export type ChatReplyPreviewProps = {
7
+ readonly label: string;
8
+ readonly senderLabel: string;
9
+ readonly previewText: string;
10
+ readonly className?: string;
11
+ readonly dismissLabel?: string;
12
+ readonly onDismiss?: () => void;
13
+ };
14
+ /**
15
+ * Renders the common faded preview used for reply bubbles and composer reply mode.
16
+ *
17
+ * @private component of `<Chat/>`
18
+ */
19
+ export declare function ChatReplyPreview(props: ChatReplyPreviewProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import type { ChatMessage } from '../types/ChatMessage';
2
2
  /**
3
- * Converts one structured progress card payload into markdown checklist content.
3
+ * Converts one structured progress card payload into markdown content.
4
4
  *
5
5
  * @param progressCard Structured progress card payload.
6
- * @returns Markdown checklist rendered through the normal message markdown pipeline.
6
+ * @returns Markdown rendered through the normal message markdown pipeline.
7
7
  *
8
8
  * @private internal helper of `<ChatMessageItem/>`
9
9
  */
@@ -53,7 +53,7 @@ export type MockedChatDelayConfig = {
53
53
  *
54
54
  * @public exported from `@promptbook/components`
55
55
  */
56
- export type MockedChatProps = Omit<ChatProps, 'onReset' | /*'onMessage' | */ 'onUseTemplate' | 'isVoiceRecognitionButtonShown'> & {
56
+ export type MockedChatProps = Omit<ChatProps, 'onReset' | 'newChatButtonHref' | /*'onMessage' | */ 'onUseTemplate' | 'isVoiceRecognitionButtonShown'> & {
57
57
  /**
58
58
  * Whether the chat can be reset via the "New chat" button.
59
59
  *
@@ -58,6 +58,37 @@ export type ChatProgressCard = {
58
58
  */
59
59
  readonly isVisible?: boolean;
60
60
  };
61
+ /**
62
+ * Serialized reference to an earlier chat message quoted by a reply bubble.
63
+ *
64
+ * Stores the durable relationship (`threadId` + `messageId`) together with a
65
+ * lightweight snapshot of the original message so UIs and prompt builders can
66
+ * render reply context without performing extra fetches.
67
+ *
68
+ * @public exported from `@promptbook/components`
69
+ */
70
+ export type ChatMessageReplyingTo = {
71
+ /**
72
+ * Durable chat thread identifier that owns the replied-to message.
73
+ */
74
+ readonly threadId: string;
75
+ /**
76
+ * Durable identifier of the specific replied-to message inside the thread.
77
+ */
78
+ readonly messageId: string;
79
+ /**
80
+ * Sender of the original replied-to message.
81
+ */
82
+ readonly sender: string;
83
+ /**
84
+ * Original markdown content of the replied-to message.
85
+ */
86
+ readonly content: string_markdown;
87
+ /**
88
+ * Optional list of attachment names from the replied-to message.
89
+ */
90
+ readonly attachmentNames?: ReadonlyArray<string>;
91
+ };
61
92
  /**
62
93
  * Serializable prompt snapshot stored alongside one assistant message for debugging and inspection.
63
94
  */
@@ -243,5 +274,9 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
243
274
  * resolved parameters, tool availability, and provider payload associated with one turn.
244
275
  */
245
276
  readonly prompt?: ChatMessagePrompt;
277
+ /**
278
+ * Optional metadata describing which earlier message this one replies to.
279
+ */
280
+ readonly replyingTo?: ChatMessageReplyingTo;
246
281
  };
247
282
  export {};
@@ -0,0 +1,25 @@
1
+ import type { ChatMessage, ChatMessageReplyingTo } from '../types/ChatMessage';
2
+ /**
3
+ * Lightweight message-like shape accepted by reply-preview text helpers.
4
+ *
5
+ * @private helper contract for chat reply previews
6
+ */
7
+ type ChatMessageReplyPreviewSource = Pick<ChatMessage, 'content' | 'attachments'> & {
8
+ readonly attachmentNames?: ChatMessageReplyingTo['attachmentNames'];
9
+ };
10
+ /**
11
+ * Optional settings for reply-preview text generation.
12
+ *
13
+ * @private helper contract for chat reply previews
14
+ */
15
+ type ResolveChatMessageReplyPreviewTextOptions = {
16
+ readonly maxLength?: number;
17
+ readonly emptyLabel?: string;
18
+ };
19
+ /**
20
+ * Resolves one compact plain-text preview for reply UI surfaces and prompt context.
21
+ *
22
+ * @private helper for chat reply previews
23
+ */
24
+ export declare function resolveChatMessageReplyPreviewText(source: ChatMessageReplyPreviewSource, options?: ResolveChatMessageReplyPreviewTextOptions): string;
25
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import type { ChatParticipant } from '../types/ChatParticipant';
3
+ /**
4
+ * Resolves the human-readable sender label shown in reply previews.
5
+ *
6
+ * @private helper for chat reply previews
7
+ */
8
+ export declare function resolveChatMessageReplySenderLabel(options: {
9
+ sender: ChatMessage['sender'];
10
+ participants?: ReadonlyArray<ChatParticipant>;
11
+ fallbackLabel?: string;
12
+ }): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Relative path to the Promptbook Coder quick-reference file initialized in project roots.
3
+ *
4
+ * @private internal utility of `ptbk coder`
5
+ */
6
+ export declare const AGENT_CODING_FILE_PATH = "AGENT_CODING.md";
7
+ /**
8
+ * Returns the default coder `AGENT_CODING.md` quick-reference content.
9
+ *
10
+ * @private internal utility of `ptbk coder`
11
+ */
12
+ export declare function getDefaultCoderAgentCodingFileContent({ packageJsonScripts, }: {
13
+ readonly packageJsonScripts: Readonly<Record<string, string>>;
14
+ }): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Relative path to the shared coder context file initialized in project roots.
3
+ *
4
+ * @private internal utility of `ptbk coder`
5
+ */
6
+ export declare const AGENTS_FILE_PATH = "AGENTS.md";
7
+ /**
8
+ * Returns the default coder `AGENTS.md` boilerplate instructions.
9
+ *
10
+ * @private internal utility of `ptbk coder`
11
+ */
12
+ export declare function getDefaultCoderAgentsFileContent(): string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Appends one text block to existing file content while preserving readable newlines.
3
+ *
4
+ * @private function of `initializeCoderProjectConfiguration`
5
+ */
6
+ export declare function appendBlock(currentContent: string, blockToAppend: string): string;
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Relative path to the root prompts directory used by Promptbook coder utilities.
3
+ *
4
+ * @private internal utility of `ptbk coder`
5
+ */
6
+ export declare const PROMPTS_DIRECTORY_PATH = "prompts";
7
+ /**
8
+ * Relative path to the archive directory used by `coder verify`.
9
+ *
10
+ * @private internal utility of `ptbk coder`
11
+ */
12
+ export declare const PROMPTS_DONE_DIRECTORY_PATH: string;
13
+ /**
14
+ * Relative path to the project-owned boilerplate templates directory.
15
+ *
16
+ * @private internal utility of `ptbk coder`
17
+ */
18
+ export declare const PROMPTS_TEMPLATES_DIRECTORY_PATH: string;
19
+ /**
20
+ * Initialization statuses used when creating or updating coder configuration artifacts.
21
+ *
22
+ * @private internal utility of `ptbk coder`
23
+ */
24
+ export type InitializationStatus = 'created' | 'updated' | 'unchanged';
25
+ /**
26
+ * Identifiers of built-in coder boilerplate templates.
27
+ *
28
+ * @private internal utility of `ptbk coder`
29
+ */
30
+ export type BuiltInCoderPromptTemplate = 'common' | 'agents-server';
31
+ /**
32
+ * One built-in coder boilerplate template definition.
33
+ *
34
+ * @private internal utility of `ptbk coder`
35
+ */
36
+ export type CoderPromptTemplateDefinition = {
37
+ /**
38
+ * Stable built-in identifier that can also be used as a CLI shorthand.
39
+ */
40
+ readonly id: BuiltInCoderPromptTemplate;
41
+ /**
42
+ * Project-relative path where `ptbk coder init` materializes the template file.
43
+ */
44
+ readonly relativeFilePath: string;
45
+ /**
46
+ * Prefix inserted into generated prompt file slugs.
47
+ */
48
+ readonly slugPrefix: string | null;
49
+ /**
50
+ * Markdown content of the template.
51
+ */
52
+ readonly content: string;
53
+ /**
54
+ * Whether `ptbk coder init` should materialize this template into project-owned files.
55
+ */
56
+ readonly isDefaultProjectTemplate: boolean;
57
+ };
58
+ /**
59
+ * Result of ensuring one default coder template file exists inside a project.
60
+ *
61
+ * @private internal utility of `ptbk coder`
62
+ */
63
+ export type EnsuredCoderPromptTemplateFile = {
64
+ /**
65
+ * Stable built-in identifier of the template.
66
+ */
67
+ readonly id: BuiltInCoderPromptTemplate;
68
+ /**
69
+ * Project-relative path of the materialized template file.
70
+ */
71
+ readonly relativeFilePath: string;
72
+ /**
73
+ * Status describing whether the file had to be created.
74
+ */
75
+ readonly status: InitializationStatus;
76
+ };
77
+ /**
78
+ * Fully resolved boilerplate template used by `coder generate-boilerplates`.
79
+ *
80
+ * @private internal utility of `ptbk coder`
81
+ */
82
+ export type ResolvedCoderPromptTemplate = {
83
+ /**
84
+ * Identifier or relative file path that was resolved.
85
+ */
86
+ readonly identifier: string;
87
+ /**
88
+ * Project-relative path when the template corresponds to a project file.
89
+ */
90
+ readonly relativeFilePath?: string;
91
+ /**
92
+ * Markdown content of the resolved template.
93
+ */
94
+ readonly content: string;
95
+ /**
96
+ * Prefix inserted into generated prompt file slugs.
97
+ */
98
+ readonly slugPrefix: string | null;
99
+ };
100
+ /**
101
+ * Lists the built-in coder boilerplate templates.
102
+ *
103
+ * @private internal utility of `ptbk coder`
104
+ */
105
+ export declare function getDefaultCoderPromptTemplateDefinitions(): ReadonlyArray<CoderPromptTemplateDefinition>;
106
+ /**
107
+ * Lists the built-in coder prompt templates that are safe to initialize in any project.
108
+ *
109
+ * @private internal utility of `ptbk coder`
110
+ */
111
+ export declare function getDefaultCoderProjectPromptTemplateDefinitions(): ReadonlyArray<CoderPromptTemplateDefinition>;
112
+ /**
113
+ * Resolves one built-in coder boilerplate template definition by its stable identifier.
114
+ *
115
+ * @private internal utility of `ptbk coder`
116
+ */
117
+ export declare function getDefaultCoderPromptTemplateDefinition(template: BuiltInCoderPromptTemplate): CoderPromptTemplateDefinition;
118
+ /**
119
+ * Ensures the default project-owned coder template files exist without overwriting user customizations.
120
+ *
121
+ * @private internal utility of `ptbk coder`
122
+ */
123
+ export declare function ensureDefaultCoderPromptTemplateFiles(projectPath: string): Promise<ReadonlyArray<EnsuredCoderPromptTemplateFile>>;
124
+ /**
125
+ * Resolves the template requested by `coder generate-boilerplates`.
126
+ *
127
+ * Supports three modes:
128
+ * - omitted option => built-in `common`
129
+ * - built-in alias => one of the shared default templates
130
+ * - relative path => markdown template file resolved from the project root
131
+ *
132
+ * @private internal utility of `ptbk coder`
133
+ */
134
+ export declare function resolveCoderPromptTemplate({ projectPath, templateOption, }: {
135
+ readonly projectPath: string;
136
+ readonly templateOption?: string;
137
+ }): Promise<ResolvedCoderPromptTemplate>;
@@ -0,0 +1,15 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Result of ensuring coder environment variables inside `.env`.
4
+ */
5
+ type EnsureCoderEnvFileResult = {
6
+ readonly envFileStatus: InitializationStatus;
7
+ readonly initializedEnvVariableNames: ReadonlyArray<string>;
8
+ };
9
+ /**
10
+ * Ensures `.env` exists and contains all required coder environment variables.
11
+ *
12
+ * @private function of `initializeCoderProjectConfiguration`
13
+ */
14
+ export declare function ensureCoderEnvFile(projectPath: string): Promise<EnsureCoderEnvFileResult>;
15
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Ensures `.gitignore` contains the standalone Promptbook coder cache entry.
4
+ *
5
+ * @private function of `initializeCoderProjectConfiguration`
6
+ */
7
+ export declare function ensureCoderGitignoreFile(projectPath: string): Promise<InitializationStatus>;
@@ -0,0 +1,7 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Ensures one coder markdown file exists with the provided default boilerplate.
4
+ *
5
+ * @private function of `initializeCoderProjectConfiguration`
6
+ */
7
+ export declare function ensureCoderMarkdownFile(projectPath: string, relativeFilePath: string, fileContent: string): Promise<InitializationStatus>;
@@ -0,0 +1,7 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Ensures `package.json` contains the standalone Promptbook coder helper scripts.
4
+ *
5
+ * @private function of `initializeCoderProjectConfiguration`
6
+ */
7
+ export declare function ensureCoderPackageJsonFile(projectPath: string): Promise<InitializationStatus>;
@@ -0,0 +1,7 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Ensures VS Code routes pasted prompt images into `prompts/screenshots`.
4
+ *
5
+ * @private function of `initializeCoderProjectConfiguration`
6
+ */
7
+ export declare function ensureCoderVscodeSettingsFile(projectPath: string): Promise<InitializationStatus>;
@@ -0,0 +1,7 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Ensures a relative directory exists in the project root.
4
+ *
5
+ * @private function of `initializeCoderProjectConfiguration`
6
+ */
7
+ export declare function ensureDirectory(projectPath: string, relativeDirectoryPath: string): Promise<InitializationStatus>;
@@ -1,4 +1,4 @@
1
- import type { Command as Program } from 'commander';
1
+ import { Command as Program } from 'commander';
2
2
  import type { $side_effect } from '../../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `coder find-refactor-candidates` command for Promptbook CLI utilities
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Normalizes one project-relative path for human-readable CLI output and markdown.
3
+ *
4
+ * @private internal utility of `ptbk coder`
5
+ */
6
+ export declare function formatDisplayPath(relativePath: string): string;
@@ -8,3 +8,13 @@ import type { $side_effect } from '../../../utils/organization/$side_effect';
8
8
  * @private internal function of `promptbookCli`
9
9
  */
10
10
  export declare function $initializeCoderGenerateBoilerplatesCommand(program: Program): $side_effect;
11
+ /**
12
+ * Generates boilerplate prompt files with unique emoji tags.
13
+ *
14
+ * @private internal function of `generatePromptBoilerplate` command
15
+ */
16
+ export declare function generatePromptBoilerplate({ projectPath, filesCount, templateOption, }: {
17
+ readonly projectPath: string;
18
+ readonly filesCount: number;
19
+ readonly templateOption?: string;
20
+ }): Promise<void>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Lists the default npm scripts initialized by `ptbk coder init`.
3
+ *
4
+ * @private internal utility of `coder init` command
5
+ */
6
+ export declare function getDefaultCoderPackageJsonScripts(): Readonly<Record<string, string>>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Lists the default VS Code settings initialized by `ptbk coder init`.
3
+ *
4
+ * @private internal utility of `coder init` command
5
+ */
6
+ export declare function getDefaultCoderVscodeSettings(): Readonly<Record<string, Readonly<Record<string, string>>>>;
@@ -1,5 +1,8 @@
1
1
  import type { Command as Program } from 'commander';
2
2
  import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ export { getDefaultCoderPackageJsonScripts } from './getDefaultCoderPackageJsonScripts';
4
+ export { getDefaultCoderVscodeSettings } from './getDefaultCoderVscodeSettings';
5
+ export { initializeCoderProjectConfiguration } from './initializeCoderProjectConfiguration';
3
6
  /**
4
7
  * Initializes `coder init` command for Promptbook CLI utilities.
5
8
  *
@@ -0,0 +1,25 @@
1
+ import { type EnsuredCoderPromptTemplateFile, type InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Result summary returned after coder configuration initialization.
4
+ *
5
+ * @private internal utility of `coder init` command
6
+ */
7
+ export type CoderInitializationSummary = {
8
+ readonly promptsDirectoryStatus: InitializationStatus;
9
+ readonly promptsDoneDirectoryStatus: InitializationStatus;
10
+ readonly promptsTemplatesDirectoryStatus: InitializationStatus;
11
+ readonly promptTemplateFileStatuses: ReadonlyArray<EnsuredCoderPromptTemplateFile>;
12
+ readonly agentsFileStatus: InitializationStatus;
13
+ readonly agentCodingFileStatus: InitializationStatus;
14
+ readonly envFileStatus: InitializationStatus;
15
+ readonly gitignoreFileStatus: InitializationStatus;
16
+ readonly packageJsonFileStatus: InitializationStatus;
17
+ readonly vscodeSettingsFileStatus: InitializationStatus;
18
+ readonly initializedEnvVariableNames: ReadonlyArray<string>;
19
+ };
20
+ /**
21
+ * Creates or updates all coder configuration artifacts required in the current project.
22
+ *
23
+ * @private internal utility of `coder init` command
24
+ */
25
+ export declare function initializeCoderProjectConfiguration(projectPath: string): Promise<CoderInitializationSummary>;
@@ -0,0 +1,18 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Parameters controlling one string-record merge into a JSON file.
4
+ */
5
+ type MergeStringRecordJsonFileOptions = {
6
+ readonly projectPath: string;
7
+ readonly relativeFilePath: string;
8
+ readonly fieldPath: string;
9
+ readonly nextEntries: Readonly<Record<string, string>>;
10
+ readonly ensureParentDirectoryPath?: string;
11
+ };
12
+ /**
13
+ * Ensures one JSON object field contains the provided string-record entries.
14
+ *
15
+ * @private function of `initializeCoderProjectConfiguration`
16
+ */
17
+ export declare function mergeStringRecordJsonFile({ projectPath, relativeFilePath, fieldPath, nextEntries, ensureParentDirectoryPath, }: MergeStringRecordJsonFileOptions): Promise<InitializationStatus>;
18
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { CoderInitializationSummary } from './initializeCoderProjectConfiguration';
2
+ /**
3
+ * Prints a readable summary of what was initialized for the user.
4
+ *
5
+ * @private function of `coder init` command
6
+ */
7
+ export declare function printInitializationSummary(summary: CoderInitializationSummary): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Reads one text file when it exists, otherwise returns `undefined`.
3
+ *
4
+ * @private function of `initializeCoderProjectConfiguration`
5
+ */
6
+ export declare function readTextFileIfExists(path: string): Promise<string | undefined>;
@@ -0,0 +1,7 @@
1
+ import type { string_agent_url_private } from './string_agent_url_private';
2
+ /**
3
+ * Semantic helper
4
+ *
5
+ * For example `"https://s6.ptbk.io/agents/agent-007"`
6
+ */
7
+ export type string_agent_url = string_agent_url_private;
@@ -0,0 +1,9 @@
1
+ import type { string_url_private } from './string_url_private';
2
+ /**
3
+ * Semantic helper
4
+ *
5
+ * For example `"https://s6.ptbk.io/agents/agent-007"`
6
+ *
7
+ * @private internal utility of `string_agent_url.ts`
8
+ */
9
+ export type string_agent_url_private = string_url_private;
@@ -0,0 +1,13 @@
1
+ import type { string_base64_private, string_data_url_private } from './string_base64_private';
2
+ /**
3
+ * Semantic helper
4
+ *
5
+ * For example `"SGVsbG8sIFdvcmxkIQ=="`
6
+ */
7
+ export type string_base64 = string_base64_private;
8
+ /**
9
+ * Semantic helper
10
+ *
11
+ * For example `"data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="`
12
+ */
13
+ export type string_data_url = string_data_url_private;
@@ -4,7 +4,7 @@ import type { string_mime_type_private } from './string_mime_type_private';
4
4
  *
5
5
  * For example `"SGVsbG8sIFdvcmxkIQ=="`
6
6
  *
7
- * @private internal utility of `string_url.ts`
7
+ * @private internal utility of `string_base64.ts`
8
8
  */
9
9
  export type string_base64_private = string;
10
10
  /**
@@ -12,6 +12,6 @@ export type string_base64_private = string;
12
12
  *
13
13
  * For example `"data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="`
14
14
  *
15
- * @private internal utility of `string_url.ts`
15
+ * @private internal utility of `string_base64.ts`
16
16
  */
17
17
  export type string_data_url_private = `data:${string_mime_type_private};base64,${string_base64_private}`;
@@ -0,0 +1,7 @@
1
+ import type { string_base_url_private } from './string_base_url_private';
2
+ /**
3
+ * Semantic helper
4
+ *
5
+ * For example `"https://collboard.com"`
6
+ */
7
+ export type string_base_url = string_base_url_private;
@@ -0,0 +1,9 @@
1
+ import type { string_url_private } from './string_url_private';
2
+ /**
3
+ * Semantic helper
4
+ *
5
+ * For example `"https://collboard.com"`
6
+ *
7
+ * @private internal utility of `string_base_url.ts`
8
+ */
9
+ export type string_base_url_private = string_url_private;