@promptbook/cli 0.114.0-0 → 0.114.0-2

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 (113) hide show
  1. package/README.md +16 -15
  2. package/apps/agents-server/package.json +6 -4
  3. package/apps/agents-server/playwright.config.ts +28 -38
  4. package/apps/agents-server/scripts/build-agents-server.js +62 -0
  5. package/apps/agents-server/scripts/build-e2e.js +38 -0
  6. package/apps/agents-server/scripts/ensure-root-dependencies.js +86 -0
  7. package/apps/agents-server/scripts/prerender-homepage.js +1 -1
  8. package/apps/agents-server/scripts/run-e2e-tests.js +34 -0
  9. package/apps/agents-server/scripts/run-npm.js +42 -0
  10. package/apps/agents-server/src/app/admin/email-server/page.tsx +14 -6
  11. package/apps/agents-server/src/app/api/elevenlabs/tts/route.ts +3 -3
  12. package/apps/agents-server/src/app/api/onboarding/book/route.ts +7 -6
  13. package/apps/agents-server/src/app/superadmin/servers/ServersRegistryTable.tsx +105 -102
  14. package/apps/agents-server/src/app/superadmin/servers/useServersRegistryState.ts +15 -7
  15. package/apps/agents-server/src/components/AgentProjectDnsInstructions/AgentProjectDnsInstructions.tsx +11 -11
  16. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ManGoBookEditor.tsx +82 -0
  17. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/WizardShell.tsx +2 -2
  18. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/BookStep.tsx +13 -16
  19. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/ZadaniStep.tsx +4 -4
  20. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/bookSections.ts +23 -16
  21. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/bookSource.ts +54 -0
  22. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/bookService.ts +15 -8
  23. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoAgentSource.ts +3 -37
  24. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoOpenEditorRequest.ts +1 -1
  25. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/state/OnboardingProvider.tsx +2 -2
  26. package/apps/agents-server/src/components/UsersList/CreateUserDialog.tsx +13 -22
  27. package/apps/agents-server/src/components/UsersList/PasswordGeneratorDialog.tsx +216 -0
  28. package/apps/agents-server/src/components/UsersList/UsersList.tsx +16 -11
  29. package/apps/agents-server/src/components/UsersList/generateSecurePassword.ts +112 -24
  30. package/apps/agents-server/src/components/UsersList/userDialogClassNames.ts +11 -0
  31. package/apps/agents-server/src/languages/ServerTranslationKeys.ts +11 -0
  32. package/apps/agents-server/src/languages/translations/czech.yaml +11 -0
  33. package/apps/agents-server/src/languages/translations/english.yaml +11 -0
  34. package/apps/agents-server/src/utils/agentProjects/agentProjectHrefs.ts +11 -0
  35. package/apps/agents-server/src/utils/agentProjects/createAgentProjectDnsRecords.ts +53 -7
  36. package/apps/agents-server/src/utils/agentProjects/createAgentProjectMarkdownReferences.ts +37 -27
  37. package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentBooks.ts +2 -13
  38. package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentRuntime.ts +21 -73
  39. package/apps/agents-server/src/utils/stalwart/createEmailDnsInstructions.ts +9 -5
  40. package/apps/agents-server/src/utils/stalwart/readStalwartEmailSnapshot.ts +23 -5
  41. package/apps/agents-server/src/utils/stalwart/stalwartBootstrap.ts +2 -1
  42. package/apps/agents-server/src/utils/stalwart/stalwartMailBridge.ts +7 -0
  43. package/apps/agents-server/tests/e2e/e2eEnvironment.cjs +49 -0
  44. package/esm/index.es.js +523 -169
  45. package/esm/index.es.js.map +1 -1
  46. package/esm/scripts/run-agent-chat/runCoderPing.d.ts +48 -0
  47. package/esm/scripts/run-codex-prompts/prompts/findNextTodoPrompt.d.ts +2 -1
  48. package/esm/scripts/run-codex-prompts/prompts/isPromptCompatibleWithRunner.d.ts +27 -0
  49. package/esm/scripts/run-codex-prompts/prompts/listRunnablePrompts.d.ts +2 -1
  50. package/esm/scripts/run-codex-prompts/prompts/listUpcomingTasks.d.ts +2 -1
  51. package/esm/scripts/run-codex-prompts/prompts/replacePromptTodoStatusLine.d.ts +7 -0
  52. package/esm/scripts/run-codex-prompts/testing/TestBeforeMode.d.ts +16 -0
  53. package/esm/scripts/run-codex-prompts/testing/createTestBeforeRepairPrompt.d.ts +9 -0
  54. package/esm/scripts/run-codex-prompts/testing/limitTestOutput.d.ts +4 -0
  55. package/esm/scripts/run-codex-prompts/testing/runPromptTestCommand.d.ts +1 -2
  56. package/esm/scripts/run-codex-prompts/testing/runTestBefore.d.ts +24 -0
  57. package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -0
  58. package/esm/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +1 -15
  59. package/esm/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +1 -1
  60. package/esm/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +0 -4
  61. package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +7 -0
  62. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +2 -3
  63. package/esm/src/cli/cli-commands/coder/ping.d.ts +13 -0
  64. package/esm/src/cli/cli-commands/coder/ping.test.d.ts +1 -0
  65. package/esm/src/cli/cli-commands/coder.d.ts +1 -0
  66. package/package.json +1 -1
  67. package/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.ts +1 -15
  68. package/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.ts +1 -2
  69. package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +92 -32
  70. package/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.ts +16 -39
  71. package/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.ts +16 -36
  72. package/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.ts +9 -1
  73. package/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.ts +4 -51
  74. package/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.ts +291 -4
  75. package/src/book-components/Chat/utils/renderMarkdown.ts +133 -9
  76. package/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.ts +1 -0
  77. package/src/cli/cli-commands/coder/agentCodingFile.ts +6 -129
  78. package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +1 -1
  79. package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +1 -4
  80. package/src/cli/cli-commands/coder/ping.ts +94 -0
  81. package/src/cli/cli-commands/coder/run.ts +25 -2
  82. package/src/cli/cli-commands/coder.ts +4 -0
  83. package/src/other/templates/getTemplatesPipelineCollection.ts +805 -842
  84. package/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.ts +101 -0
  85. package/src/version.ts +1 -1
  86. package/src/versions.txt +1 -1
  87. package/umd/index.umd.js +525 -171
  88. package/umd/index.umd.js.map +1 -1
  89. package/umd/scripts/run-agent-chat/runCoderPing.d.ts +48 -0
  90. package/umd/scripts/run-codex-prompts/prompts/findNextTodoPrompt.d.ts +2 -1
  91. package/umd/scripts/run-codex-prompts/prompts/isPromptCompatibleWithRunner.d.ts +27 -0
  92. package/umd/scripts/run-codex-prompts/prompts/listRunnablePrompts.d.ts +2 -1
  93. package/umd/scripts/run-codex-prompts/prompts/listUpcomingTasks.d.ts +2 -1
  94. package/umd/scripts/run-codex-prompts/prompts/replacePromptTodoStatusLine.d.ts +7 -0
  95. package/umd/scripts/run-codex-prompts/testing/TestBeforeMode.d.ts +16 -0
  96. package/umd/scripts/run-codex-prompts/testing/createTestBeforeRepairPrompt.d.ts +9 -0
  97. package/umd/scripts/run-codex-prompts/testing/limitTestOutput.d.ts +4 -0
  98. package/umd/scripts/run-codex-prompts/testing/runPromptTestCommand.d.ts +1 -2
  99. package/umd/scripts/run-codex-prompts/testing/runTestBefore.d.ts +24 -0
  100. package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -0
  101. package/umd/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +1 -15
  102. package/umd/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +1 -1
  103. package/umd/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +0 -4
  104. package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +7 -0
  105. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +2 -3
  106. package/umd/src/cli/cli-commands/coder/ping.d.ts +13 -0
  107. package/umd/src/cli/cli-commands/coder/ping.test.d.ts +1 -0
  108. package/umd/src/cli/cli-commands/coder.d.ts +1 -0
  109. package/apps/agents-server/src/app/api/onboarding/draft/route.ts +0 -23
  110. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/BookLanguagePanel.tsx +0 -125
  111. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownBookEditor.tsx +0 -154
  112. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownPreview.tsx +0 -188
  113. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/draftService.ts +0 -32
@@ -0,0 +1,48 @@
1
+ import type { ThinkingLevel } from '../../src/cli/cli-commands/coder/ThinkingLevel';
2
+ import type { PromptRunnerHarnessName } from '../../src/cli/cli-commands/common/promptRunnerCliOptions';
3
+ /**
4
+ * Options for one `ptbk coder ping` execution.
5
+ */
6
+ export type RunCoderPingOptions = {
7
+ /**
8
+ * Harness used for the disposable turn.
9
+ */
10
+ readonly agentName: PromptRunnerHarnessName;
11
+ /**
12
+ * Optional model passed to the harness.
13
+ */
14
+ readonly model?: string;
15
+ /**
16
+ * Optional reasoning effort passed to the harness.
17
+ */
18
+ readonly thinkingLevel?: ThinkingLevel;
19
+ /**
20
+ * Whether the harness should receive the shared no-UI option.
21
+ */
22
+ readonly isUiDisabled: boolean;
23
+ /**
24
+ * Whether the harness may spend credits when its quota is exhausted.
25
+ */
26
+ readonly isCreditsAllowed: boolean;
27
+ };
28
+ /**
29
+ * Result of one `ptbk coder ping` execution.
30
+ */
31
+ export type CoderPingResult = {
32
+ /**
33
+ * Text returned by the harness after the dummy task.
34
+ */
35
+ readonly result: string;
36
+ /**
37
+ * Time spent executing the disposable harness turn in milliseconds.
38
+ */
39
+ readonly elapsedTimeMs: number;
40
+ };
41
+ /**
42
+ * Runs one small harness/model turn in a disposable temporary project.
43
+ *
44
+ * The temporary project is outside the caller's repository, so even a harness
45
+ * that writes files cannot change the project from which `ptbk coder ping` was
46
+ * started.
47
+ */
48
+ export declare function runCoderPing(options: RunCoderPingOptions): Promise<CoderPingResult>;
@@ -1,7 +1,8 @@
1
1
  import type { PromptFile } from './types/PromptFile';
2
2
  import type { PromptSelection } from './types/PromptSelection';
3
+ import type { PromptRunnerIdentity } from './isPromptCompatibleWithRunner';
3
4
  import type { PriorityFilter } from './priorityFilter';
4
5
  /**
5
6
  * Selects the next runnable prompt based on priority.
6
7
  */
7
- export declare function findNextTodoPrompt(files: PromptFile[], priorityFilter?: PriorityFilter): PromptSelection | undefined;
8
+ export declare function findNextTodoPrompt(files: PromptFile[], priorityFilter?: PriorityFilter, promptRunnerIdentity?: PromptRunnerIdentity): PromptSelection | undefined;
@@ -0,0 +1,27 @@
1
+ import type { PromptFile } from './types/PromptFile';
2
+ import type { PromptSection } from './types/PromptSection';
3
+ /**
4
+ * Names of the harness and model currently selected for a coder run.
5
+ */
6
+ export type PromptRunnerIdentity = {
7
+ /**
8
+ * Stable harness identifier, for example `github-copilot`.
9
+ */
10
+ readonly harnessName?: string;
11
+ /**
12
+ * Effective model identifier, for example `gpt-5.5`.
13
+ */
14
+ readonly modelName?: string;
15
+ };
16
+ /**
17
+ * Checks whether a prompt is unrestricted or matches the selected harness/model.
18
+ *
19
+ * A prompt status line can contain one or more backtick-delimited model or harness
20
+ * names. Matching is intentionally based on normalized substrings so a token such as
21
+ * `gpt` selects any `gpt-*` model and `opus` selects a `claude-opus-*` model.
22
+ */
23
+ export declare function isPromptCompatibleWithRunner(file: PromptFile, section: PromptSection, promptRunnerIdentity?: PromptRunnerIdentity): boolean;
24
+ /**
25
+ * Extracts model and harness tokens from a prompt status line.
26
+ */
27
+ export declare function extractPromptRunnerTokens(statusLine: string): string[];
@@ -1,7 +1,8 @@
1
1
  import type { PromptFile } from './types/PromptFile';
2
2
  import type { PromptSelection } from './types/PromptSelection';
3
+ import { type PromptRunnerIdentity } from './isPromptCompatibleWithRunner';
3
4
  import type { PriorityFilter } from './priorityFilter';
4
5
  /**
5
6
  * Lists todo prompts that are ready to run (no authoring placeholders).
6
7
  */
7
- export declare function listRunnablePrompts(files: PromptFile[], priorityFilter?: PriorityFilter): PromptSelection[];
8
+ export declare function listRunnablePrompts(files: PromptFile[], priorityFilter?: PriorityFilter, promptRunnerIdentity?: PromptRunnerIdentity): PromptSelection[];
@@ -1,7 +1,8 @@
1
1
  import type { PromptFile } from './types/PromptFile';
2
2
  import type { UpcomingTask } from './types/UpcomingTask';
3
+ import type { PromptRunnerIdentity } from './isPromptCompatibleWithRunner';
3
4
  import type { PriorityFilter } from './priorityFilter';
4
5
  /**
5
6
  * Lists upcoming tasks that are ready to run (no authoring placeholders).
6
7
  */
7
- export declare function listUpcomingTasks(files: PromptFile[], priorityFilter?: PriorityFilter): UpcomingTask[];
8
+ export declare function listUpcomingTasks(files: PromptFile[], priorityFilter?: PriorityFilter, promptRunnerIdentity?: PromptRunnerIdentity): UpcomingTask[];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Replaces the complete todo status line while preserving its indentation.
3
+ *
4
+ * The complete line is replaced because a todo status can contain a required
5
+ * model/harness token in addition to priority markers.
6
+ */
7
+ export declare function replacePromptTodoStatusLine(line: string, replacementStatusLine: string): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Modes supported by `ptbk coder run --test-before`.
3
+ */
4
+ export declare const TEST_BEFORE_MODE_VALUES: readonly ["no", "yes-and-fail", "yes-and-fix"];
5
+ /**
6
+ * Behavior requested for the pre-coding verification run.
7
+ */
8
+ export type TestBeforeMode = (typeof TEST_BEFORE_MODE_VALUES)[number];
9
+ /**
10
+ * Default verification command used when a pre-coding mode is enabled without an explicit `--test` command.
11
+ */
12
+ export declare const DEFAULT_CODER_TEST_COMMAND = "npm test";
13
+ /**
14
+ * Checks whether a value is a supported `--test-before` mode.
15
+ */
16
+ export declare function isTestBeforeMode(value: string): value is TestBeforeMode;
@@ -0,0 +1,9 @@
1
+ import type { PromptSelection } from '../prompts/types/PromptSelection';
2
+ /**
3
+ * Creates the one queue prompt used to repair a pre-existing test failure.
4
+ */
5
+ export declare function createTestBeforeRepairPrompt(options: {
6
+ readonly projectPath: string;
7
+ readonly testCommand: string;
8
+ readonly testOutput: string;
9
+ }): Promise<PromptSelection>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Limits test output while keeping the end of the output, where test runners usually print the failure summary.
3
+ */
4
+ export declare function limitTestOutput(testOutput: string): string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Options for running one verification command after a coding attempt.
3
3
  */
4
- type RunPromptTestCommandOptions = {
4
+ export type RunPromptTestCommandOptions = {
5
5
  command: string;
6
6
  projectPath: string;
7
7
  scriptPath: string;
@@ -12,4 +12,3 @@ type RunPromptTestCommandOptions = {
12
12
  * Runs the configured verification command inside the project root and returns its output.
13
13
  */
14
14
  export declare function runPromptTestCommand(options: RunPromptTestCommandOptions): Promise<string>;
15
- export {};
@@ -0,0 +1,24 @@
1
+ import type { WaitForCoderRunPauseCheckpoint } from '../common/CoderRunPauseCheckpoint';
2
+ import { runPromptTestCommand } from './runPromptTestCommand';
3
+ /**
4
+ * Result of the verification command executed before coding starts.
5
+ */
6
+ export type TestBeforeResult = {
7
+ /**
8
+ * Whether the verification command completed successfully.
9
+ */
10
+ readonly isPassed: boolean;
11
+ /**
12
+ * Combined output produced by the verification command.
13
+ */
14
+ readonly testOutput: string;
15
+ };
16
+ /**
17
+ * Runs the configured verification command before the first coding prompt.
18
+ */
19
+ export declare function runTestBefore(options: {
20
+ readonly testCommand: string;
21
+ readonly projectPath: string;
22
+ readonly waitForPauseCheckpoint?: WaitForCoderRunPauseCheckpoint;
23
+ readonly runPromptTestCommandExecutor?: typeof runPromptTestCommand;
24
+ }): Promise<TestBeforeResult>;
@@ -67,6 +67,7 @@ export declare function buildControlPills(options: {
67
67
  * Builds the coder-run control pills shown in the footer box.
68
68
  */
69
69
  export declare function buildCoderRunControlPills(options: {
70
+ readonly phase: CoderRunPhase;
70
71
  readonly pauseControl: string;
71
72
  readonly pendingEnterLabel: string | undefined;
72
73
  readonly isEndAfterCurrentPromptRequested: boolean;
@@ -86,9 +86,7 @@ export type BookLanguageManualDictionary = {
86
86
  readonly metadataLabels: {
87
87
  readonly bookLanguageVersion: string;
88
88
  readonly generatedAt: string;
89
- readonly commitmentGroups: string;
90
- readonly implementedCommitments: string;
91
- readonly placeholderCommitments: string;
89
+ readonly commitmentCount: string;
92
90
  };
93
91
  /**
94
92
  * Heading of the table of contents.
@@ -128,7 +126,6 @@ export type BookLanguageManualDictionary = {
128
126
  readonly primitivesSections: {
129
127
  readonly coreSyntax: BookLanguageManualChapter;
130
128
  readonly references: BookLanguageManualChapter;
131
- readonly keywordsTitle: string;
132
129
  };
133
130
  /**
134
131
  * Suffixes distinguishing a server-specific catalog from the portable one.
@@ -141,18 +138,7 @@ export type BookLanguageManualDictionary = {
141
138
  * Labels used in every commitment catalog entry.
142
139
  */
143
140
  readonly commitmentLabels: {
144
- readonly status: string;
145
141
  readonly aliases: string;
146
- readonly semantics: string;
147
- readonly typeSchema: string;
148
- readonly blockSchema: string;
149
- readonly lowLevelNotice: string;
150
- readonly usage: string;
151
- readonly usageOccurrence: string;
152
- readonly usageOccurrences: string;
153
- readonly statusImplemented: string;
154
- readonly statusPlaceholder: string;
155
- readonly noAliases: string;
156
142
  };
157
143
  /**
158
144
  * Labels used by end-to-end example sections.
@@ -16,7 +16,7 @@ export type BookLanguageManualCommitmentGroups = {
16
16
  */
17
17
  readonly documented: ReadonlyArray<BookLanguageManualCommitmentGroup>;
18
18
  /**
19
- * Low-level and unfinished commitments documented in their own closing chapter.
19
+ * Low-level commitments documented in their own closing chapter.
20
20
  */
21
21
  readonly lowLevel: ReadonlyArray<BookLanguageManualCommitmentGroup>;
22
22
  };
@@ -10,10 +10,6 @@ export type RenderCommitmentCatalogSectionOptions = {
10
10
  * Grouped commitment definition with aliases.
11
11
  */
12
12
  readonly groupedCommitment: BookLanguageManualCommitmentGroup;
13
- /**
14
- * Number of uses across the selected server agents.
15
- */
16
- readonly usageCount: number;
17
13
  /**
18
14
  * Translated labels of the manual.
19
15
  */
@@ -25,6 +25,13 @@ export type MarkdownInlineReference = {
25
25
  * Link target for the rendered reference.
26
26
  */
27
27
  readonly href: string;
28
+ /**
29
+ * Markdown link destination prefixes that should render as this reference as well.
30
+ *
31
+ * This supports legacy links such as an Agents Server project file URL while keeping
32
+ * `reference` as the canonical `[[project]]` token.
33
+ */
34
+ readonly sourceHrefPrefixes?: ReadonlyArray<string>;
28
35
  /**
29
36
  * Optional hover title for the rendered reference.
30
37
  */
@@ -1,3 +1,4 @@
1
+ import { string_markdown } from '../../../types/typeAliases';
1
2
  /**
2
3
  * Relative path to the Promptbook Coder quick-reference file initialized in project roots.
3
4
  *
@@ -9,6 +10,4 @@ export declare const AGENT_CODING_FILE_PATH = "AGENT_CODING.md";
9
10
  *
10
11
  * @private internal utility of `ptbk coder`
11
12
  */
12
- export declare function getDefaultCoderAgentCodingFileContent({ packageJsonScripts, }: {
13
- readonly packageJsonScripts: Readonly<Record<string, string>>;
14
- }): string;
13
+ export declare function getDefaultCoderAgentCodingFileContent(): string_markdown;
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `coder ping` command for Promptbook CLI utilities.
5
+ *
6
+ * The command makes one small, isolated harness/model call, prints its result
7
+ * and reports how long the harness/model turn took.
8
+ *
9
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
10
+ *
11
+ * @private internal function of `promptbookCli`
12
+ */
13
+ export declare function $initializeCoderPingCommand(program: Program): $side_effect;
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,7 @@ import type { $side_effect } from '../../utils/organization/$side_effect';
8
8
  * - add: Add one ready-to-run prompt file to the queue
9
9
  * - generate-boilerplates: Generate prompt boilerplate files
10
10
  * - find-refactor-candidates: Find files that need refactoring
11
+ * - ping: Test one harness and model connection with a disposable task
11
12
  * - run: Run coding prompts with AI agents
12
13
  * - verify: Verify completed prompts
13
14
  * - find-fresh-emoji-tags: Find unused emoji tags
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.114.0-0",
3
+ "version": "0.114.0-2",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -98,9 +98,7 @@ export type BookLanguageManualDictionary = {
98
98
  readonly metadataLabels: {
99
99
  readonly bookLanguageVersion: string;
100
100
  readonly generatedAt: string;
101
- readonly commitmentGroups: string;
102
- readonly implementedCommitments: string;
103
- readonly placeholderCommitments: string;
101
+ readonly commitmentCount: string;
104
102
  };
105
103
 
106
104
  /**
@@ -144,7 +142,6 @@ export type BookLanguageManualDictionary = {
144
142
  readonly primitivesSections: {
145
143
  readonly coreSyntax: BookLanguageManualChapter;
146
144
  readonly references: BookLanguageManualChapter;
147
- readonly keywordsTitle: string;
148
145
  };
149
146
 
150
147
  /**
@@ -159,18 +156,7 @@ export type BookLanguageManualDictionary = {
159
156
  * Labels used in every commitment catalog entry.
160
157
  */
161
158
  readonly commitmentLabels: {
162
- readonly status: string;
163
159
  readonly aliases: string;
164
- readonly semantics: string;
165
- readonly typeSchema: string;
166
- readonly blockSchema: string;
167
- readonly lowLevelNotice: string;
168
- readonly usage: string;
169
- readonly usageOccurrence: string;
170
- readonly usageOccurrences: string;
171
- readonly statusImplemented: string;
172
- readonly statusPlaceholder: string;
173
- readonly noAliases: string;
174
160
  };
175
161
 
176
162
  /**
@@ -60,13 +60,12 @@ export const bookLanguageDocumentationExamples: ReadonlyArray<BookLanguageDocume
60
60
  `),
61
61
  },
62
62
  {
63
- id: 'use-project-and-wallet-integration-agent',
63
+ id: 'use-project-integration-agent',
64
64
  source: spaceTrim(`
65
65
  Repository Maintainer
66
66
 
67
67
  GOAL Maintain a GitHub repository and prepare safe pull requests.
68
68
  USE PROJECT https://github.com/acme/website
69
- WALLET Store credentials for repository operations.
70
69
  RULE Before editing files, explain the planned change and impacted paths.
71
70
  RULE Never reveal raw credentials in chat output.
72
71
  INITIAL MESSAGE I can inspect the repository and help you prepare PR-ready changes.
@@ -1,5 +1,4 @@
1
1
  import { spaceTrim } from 'spacetrim';
2
- import { NotYetImplementedCommitmentDefinition } from '../../commitments/_base/NotYetImplementedCommitmentDefinition';
3
2
  import { getGroupedCommitmentDefinitions } from '../../commitments/_common/getGroupedCommitmentDefinitions';
4
3
  import { parseAgentSourceWithCommitments } from '../agent-source/parseAgentSourceWithCommitments';
5
4
  import type { string_book } from '../agent-source/string_book';
@@ -172,14 +171,10 @@ export function createStandaloneBookLanguageMarkdown(
172
171
  : [];
173
172
  const manualCommitments = [...catalogCommitments, ...lowLevelCommitments];
174
173
  const generatedAtIso = new Date().toISOString();
175
- const placeholderCommitmentCount = manualCommitments.filter(
176
- ({ primary }) => primary instanceof NotYetImplementedCommitmentDefinition,
177
- ).length;
178
174
  const catalogTitleSuffix = isServerSpecificManual
179
175
  ? dictionary.commitmentCatalogTitleSuffixes.usedFirst
180
176
  : dictionary.commitmentCatalogTitleSuffixes.all;
181
-
182
- const allCommitmentKeywords = manualCommitments.flatMap(({ primary, aliases }) => [primary.type, ...aliases]);
177
+ const commitmentSectionAnchorByType = createCommitmentSectionAnchorByType(manualCommitments);
183
178
 
184
179
  return spaceTrim(
185
180
  // [✨]
@@ -190,11 +185,7 @@ export function createStandaloneBookLanguageMarkdown(
190
185
 
191
186
  - ${dictionary.metadataLabels.bookLanguageVersion}: \`${BOOK_LANGUAGE_VERSION}\`
192
187
  - ${dictionary.metadataLabels.generatedAt}: \`${generatedAtIso}\`
193
- - ${dictionary.metadataLabels.commitmentGroups}: \`${manualCommitments.length}\`
194
- - ${dictionary.metadataLabels.implementedCommitments}: \`${
195
- manualCommitments.length - placeholderCommitmentCount
196
- }\`
197
- - ${dictionary.metadataLabels.placeholderCommitments}: \`${placeholderCommitmentCount}\`
188
+ - ${dictionary.metadataLabels.commitmentCount}: \`${manualCommitments.length}\`
198
189
 
199
190
  ## <a id="table-of-contents"></a>${dictionary.tableOfContentsTitle}
200
191
 
@@ -203,14 +194,18 @@ export function createStandaloneBookLanguageMarkdown(
203
194
  - [${dictionary.chapters.howToStructure.title}](#how-to-structure-good-agents)
204
195
  - [${dictionary.chapters.primitives.title}](#primitives-and-constructs-reference)
205
196
  - [${dictionary.chapters.commitmentCatalog.title}${catalogTitleSuffix}](#commitment-catalog)
197
+ ${block(renderCommitmentCatalogTableOfContents(catalogCommitments))}
206
198
  - [${dictionary.chapters.examples.title}](#end-to-end-examples)
207
199
  - [${dictionary.chapters.pitfalls.title}](#do-nots-and-common-pitfalls)
208
200
  - [${dictionary.chapters.tutorial.title}](#build-an-agent-from-scratch-offline-tutorial)
209
- ${
201
+ ${block(
210
202
  isLowLevelCommitmentsIncluded
211
- ? `- [${dictionary.chapters.lowLevelCommitments.title}](#low-level-commitments)`
212
- : ''
213
- }
203
+ ? spaceTrim(`
204
+ - [${dictionary.chapters.lowLevelCommitments.title}](#low-level-commitments)
205
+ ${renderCommitmentCatalogTableOfContents(lowLevelCommitments)}
206
+ `)
207
+ : '',
208
+ )}
214
209
 
215
210
  ## <a id="what-book-language-is"></a>${dictionary.chapters.whatIs.title}
216
211
 
@@ -254,25 +249,23 @@ export function createStandaloneBookLanguageMarkdown(
254
249
 
255
250
  ${block(dictionary.primitivesSections.references.body)}
256
251
 
257
- ### ${dictionary.primitivesSections.keywordsTitle}
258
-
259
- ${block(getSafeCodeBlock(allCommitmentKeywords.join(', '), 'text'))}
260
-
261
- <a id="commitment-catalog-all-commitments"></a>
262
-
263
252
  ## <a id="commitment-catalog"></a>${dictionary.chapters.commitmentCatalog.title}${catalogTitleSuffix}
264
253
 
265
254
  ${block(dictionary.chapters.commitmentCatalog.body)}
266
255
 
267
- ${block(renderCommitmentCatalogSections(catalogCommitments, commitmentUsageByType, dictionary))}
256
+ ${block(renderCommitmentCatalogSections(catalogCommitments, dictionary))}
268
257
 
269
258
  ## <a id="end-to-end-examples"></a>${dictionary.chapters.examples.title}
270
259
 
271
260
  ${block(
272
261
  isServerSpecificManual
273
- ? selectedAgents.map((agent) => renderBakedAgentExampleSection(agent, dictionary)).join('\n\n')
262
+ ? selectedAgents
263
+ .map((agent) =>
264
+ renderBakedAgentExampleSection(agent, dictionary, commitmentSectionAnchorByType),
265
+ )
266
+ .join('\n\n')
274
267
  : bookLanguageDocumentationExamples
275
- .map((example) => renderExampleSection(example, dictionary))
268
+ .map((example) => renderExampleSection(example, dictionary, commitmentSectionAnchorByType))
276
269
  .join('\n\n'),
277
270
  )}
278
271
 
@@ -296,7 +289,7 @@ export function createStandaloneBookLanguageMarkdown(
296
289
 
297
290
  ${block(
298
291
  isLowLevelCommitmentsIncluded
299
- ? renderLowLevelCommitmentsChapter(lowLevelCommitments, commitmentUsageByType, dictionary)
292
+ ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary)
300
293
  : '',
301
294
  )}
302
295
 
@@ -345,7 +338,6 @@ function renderDetectedCommitmentList(
345
338
  * Renders every commitment section of one catalog chapter.
346
339
  *
347
340
  * @param commitmentGroups - Commitment groups to render, in final order.
348
- * @param commitmentUsageByType - Selected-agent occurrence counts by primary type.
349
341
  * @param dictionary - Translated labels of the manual.
350
342
  * @returns Markdown sections joined by blank lines.
351
343
  *
@@ -353,14 +345,12 @@ function renderDetectedCommitmentList(
353
345
  */
354
346
  function renderCommitmentCatalogSections(
355
347
  commitmentGroups: ReadonlyArray<BookLanguageManualCommitmentGroup>,
356
- commitmentUsageByType: ReadonlyMap<string, number>,
357
348
  dictionary: BookLanguageManualDictionary,
358
349
  ): string {
359
350
  return commitmentGroups
360
351
  .map((groupedCommitment) =>
361
352
  renderCommitmentCatalogSection({
362
353
  groupedCommitment,
363
- usageCount: commitmentUsageByType.get(groupedCommitment.primary.type) || 0,
364
354
  dictionary,
365
355
  }),
366
356
  )
@@ -371,7 +361,6 @@ function renderCommitmentCatalogSections(
371
361
  * Renders the closing chapter documenting low-level commitments.
372
362
  *
373
363
  * @param commitmentGroups - Low-level commitment groups, in final order.
374
- * @param commitmentUsageByType - Selected-agent occurrence counts by primary type.
375
364
  * @param dictionary - Translated labels of the manual.
376
365
  * @returns Markdown chapter for low-level commitments.
377
366
  *
@@ -379,7 +368,6 @@ function renderCommitmentCatalogSections(
379
368
  */
380
369
  function renderLowLevelCommitmentsChapter(
381
370
  commitmentGroups: ReadonlyArray<BookLanguageManualCommitmentGroup>,
382
- commitmentUsageByType: ReadonlyMap<string, number>,
383
371
  dictionary: BookLanguageManualDictionary,
384
372
  ): string {
385
373
  return spaceTrim(
@@ -388,11 +376,55 @@ function renderLowLevelCommitmentsChapter(
388
376
 
389
377
  ${block(dictionary.chapters.lowLevelCommitments.body)}
390
378
 
391
- ${block(renderCommitmentCatalogSections(commitmentGroups, commitmentUsageByType, dictionary))}
379
+ ${block(renderCommitmentCatalogSections(commitmentGroups, dictionary))}
392
380
  `,
393
381
  );
394
382
  }
395
383
 
384
+ /**
385
+ * Renders links from the manual table of contents to the commitment sections.
386
+ *
387
+ * @param commitmentGroups - Commitment sections included in the manual.
388
+ * @returns Indented markdown links ordered like the catalog.
389
+ *
390
+ * @private internal utility of `createStandaloneBookLanguageMarkdown`
391
+ */
392
+ function renderCommitmentCatalogTableOfContents(
393
+ commitmentGroups: ReadonlyArray<BookLanguageManualCommitmentGroup>,
394
+ ): string {
395
+ return commitmentGroups
396
+ .map(
397
+ ({ primary }) =>
398
+ ` - [${primary.icon} \`${primary.type}\`](#commitment-${toStableAnchorId(primary.type)})`,
399
+ )
400
+ .join('\n');
401
+ }
402
+
403
+ /**
404
+ * Maps every recognized spelling of a documented commitment to its stable section anchor.
405
+ *
406
+ * @param commitmentGroups - Commitment sections included in the manual.
407
+ * @returns Canonical anchor id by parsed commitment type.
408
+ *
409
+ * @private internal utility of `createStandaloneBookLanguageMarkdown`
410
+ */
411
+ function createCommitmentSectionAnchorByType(
412
+ commitmentGroups: ReadonlyArray<BookLanguageManualCommitmentGroup>,
413
+ ): ReadonlyMap<string, string> {
414
+ const anchorByType = new Map<string, string>();
415
+
416
+ for (const { primary, aliases } of commitmentGroups) {
417
+ const anchorId = `commitment-${toStableAnchorId(primary.type)}`;
418
+ anchorByType.set(primary.type, anchorId);
419
+
420
+ for (const alias of aliases) {
421
+ anchorByType.set(alias, anchorId);
422
+ }
423
+ }
424
+
425
+ return anchorByType;
426
+ }
427
+
396
428
  /**
397
429
  * Renders the "don't vs do" list of common authoring pitfalls.
398
430
  *
@@ -523,11 +555,12 @@ function prioritizeGroupedCommitments(
523
555
  function renderBakedAgentExampleSection(
524
556
  agent: BookLanguageDocumentationAgent,
525
557
  dictionary: BookLanguageManualDictionary,
558
+ commitmentSectionAnchorByType: ReadonlyMap<string, string>,
526
559
  ): string {
527
560
  const usedCommitmentTypes = Array.from(
528
561
  new Set(parseAgentSourceWithCommitments(agent.agentSource).commitments.map((commitment) => commitment.type)),
529
562
  );
530
- const usedCommitmentsMarkdown = usedCommitmentTypes.map((type) => `\`${type}\``).join(', ');
563
+ const usedCommitmentsMarkdown = renderCommitmentSectionLinks(usedCommitmentTypes, commitmentSectionAnchorByType);
531
564
 
532
565
  return spaceTrim(
533
566
  (block) => `
@@ -556,6 +589,7 @@ function renderBakedAgentExampleSection(
556
589
  function renderExampleSection(
557
590
  example: BookLanguageDocumentationExample,
558
591
  dictionary: BookLanguageManualDictionary,
592
+ commitmentSectionAnchorByType: ReadonlyMap<string, string>,
559
593
  ): string {
560
594
  const exampleText = dictionary.exampleTexts[example.id];
561
595
 
@@ -569,6 +603,11 @@ function renderExampleSection(
569
603
 
570
604
  **${dictionary.exampleLabels.goal}:** ${exampleText.goal}
571
605
 
606
+ **${dictionary.exampleLabels.commitmentsUsed}:** ${renderCommitmentSectionLinks(
607
+ parseAgentSourceWithCommitments(example.source as string_book).commitments.map((commitment) => commitment.type),
608
+ commitmentSectionAnchorByType,
609
+ )}
610
+
572
611
  **${dictionary.exampleLabels.fullSource}**
573
612
 
574
613
  ${block(getSafeCodeBlock(example.source, 'book'))}
@@ -579,3 +618,24 @@ function renderExampleSection(
579
618
  `,
580
619
  );
581
620
  }
621
+
622
+ /**
623
+ * Renders unique commitment links used by an end-to-end example.
624
+ *
625
+ * @param commitmentTypes - Commitment types in their source order.
626
+ * @param commitmentSectionAnchorByType - Documented commitment anchors by parsed type.
627
+ * @returns Comma-separated markdown links, or an empty string when none are documented.
628
+ *
629
+ * @private internal utility of `createStandaloneBookLanguageMarkdown`
630
+ */
631
+ function renderCommitmentSectionLinks(
632
+ commitmentTypes: ReadonlyArray<string>,
633
+ commitmentSectionAnchorByType: ReadonlyMap<string, string>,
634
+ ): string {
635
+ return Array.from(new Set(commitmentTypes))
636
+ .flatMap((type) => {
637
+ const anchorId = commitmentSectionAnchorByType.get(type);
638
+ return anchorId ? [`[\`${type}\`](#${anchorId})`] : [];
639
+ })
640
+ .join(', ');
641
+ }