@promptbook/cli 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 (138) hide show
  1. package/README.md +119 -18
  2. package/esm/index.es.js +1289 -323
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/scripts/find-refactor-candidates/RefactorCandidateLevel.d.ts +41 -0
  5. package/esm/scripts/find-refactor-candidates/analyzeSourceFileForRefactorCandidate.d.ts +5 -0
  6. package/esm/scripts/find-refactor-candidates/find-refactor-candidates.constants.d.ts +2 -14
  7. package/esm/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +13 -1
  8. package/esm/scripts/find-refactor-candidates/findRefactorCandidatesInProject.d.ts +18 -1
  9. package/esm/src/_packages/components.index.d.ts +2 -0
  10. package/esm/src/_packages/types.index.d.ts +48 -46
  11. package/esm/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  12. package/esm/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  13. package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  14. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  15. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  16. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  17. package/esm/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  18. package/esm/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  19. package/esm/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  20. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  21. package/esm/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  22. package/esm/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  23. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  24. package/esm/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  25. package/esm/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  26. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +137 -0
  27. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.test.d.ts +1 -0
  28. package/esm/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  29. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  30. package/esm/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  31. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  32. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  33. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  34. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  35. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  36. package/esm/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  37. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +10 -0
  38. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  39. package/esm/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  40. package/esm/src/cli/cli-commands/coder/init.d.ts +3 -0
  41. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  42. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  43. package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  44. package/esm/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  45. package/esm/src/types/string_agent_url.d.ts +7 -0
  46. package/esm/src/types/string_agent_url_private.d.ts +9 -0
  47. package/esm/src/types/string_base64.d.ts +13 -0
  48. package/esm/src/types/string_base64_private.d.ts +2 -2
  49. package/esm/src/types/string_base_url.d.ts +7 -0
  50. package/esm/src/types/string_base_url_private.d.ts +9 -0
  51. package/esm/src/types/string_email.d.ts +13 -0
  52. package/esm/src/types/string_email_private.d.ts +2 -2
  53. package/esm/src/types/string_host.d.ts +42 -0
  54. package/esm/src/types/string_host_private.d.ts +7 -7
  55. package/esm/src/types/string_href.d.ts +19 -0
  56. package/esm/src/types/string_href_private.d.ts +24 -0
  57. package/esm/src/types/string_mime_type.d.ts +15 -0
  58. package/esm/src/types/string_mime_type_private.d.ts +2 -2
  59. package/esm/src/types/string_pipeline_root_url.d.ts +7 -0
  60. package/esm/src/types/string_pipeline_root_url_private.d.ts +9 -0
  61. package/esm/src/types/string_pipeline_url.d.ts +13 -0
  62. package/esm/src/types/string_pipeline_url_private.d.ts +17 -0
  63. package/esm/src/types/string_promptbook_server_url.d.ts +7 -0
  64. package/esm/src/types/string_promptbook_server_url_private.d.ts +9 -0
  65. package/esm/src/types/string_url.d.ts +14 -141
  66. package/esm/src/types/string_url_image.d.ts +7 -0
  67. package/esm/src/types/string_url_image_private.d.ts +9 -0
  68. package/esm/src/types/string_url_private.d.ts +0 -80
  69. package/esm/src/version.d.ts +1 -1
  70. package/package.json +1 -1
  71. package/umd/index.umd.js +1287 -321
  72. package/umd/index.umd.js.map +1 -1
  73. package/umd/scripts/find-refactor-candidates/RefactorCandidateLevel.d.ts +41 -0
  74. package/umd/scripts/find-refactor-candidates/analyzeSourceFileForRefactorCandidate.d.ts +5 -0
  75. package/umd/scripts/find-refactor-candidates/find-refactor-candidates.constants.d.ts +2 -14
  76. package/umd/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +13 -1
  77. package/umd/scripts/find-refactor-candidates/findRefactorCandidatesInProject.d.ts +18 -1
  78. package/umd/src/_packages/components.index.d.ts +2 -0
  79. package/umd/src/_packages/types.index.d.ts +48 -46
  80. package/umd/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  81. package/umd/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  82. package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  83. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  84. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  85. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  86. package/umd/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  87. package/umd/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  88. package/umd/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  89. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  90. package/umd/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  91. package/umd/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  92. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  93. package/umd/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  94. package/umd/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  95. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +137 -0
  96. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.test.d.ts +1 -0
  97. package/umd/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  98. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  99. package/umd/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  100. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  101. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  102. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  103. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  104. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  105. package/umd/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  106. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +10 -0
  107. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  108. package/umd/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  109. package/umd/src/cli/cli-commands/coder/init.d.ts +3 -0
  110. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  111. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  112. package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  113. package/umd/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  114. package/umd/src/types/string_agent_url.d.ts +7 -0
  115. package/umd/src/types/string_agent_url_private.d.ts +9 -0
  116. package/umd/src/types/string_base64.d.ts +13 -0
  117. package/umd/src/types/string_base64_private.d.ts +2 -2
  118. package/umd/src/types/string_base_url.d.ts +7 -0
  119. package/umd/src/types/string_base_url_private.d.ts +9 -0
  120. package/umd/src/types/string_email.d.ts +13 -0
  121. package/umd/src/types/string_email_private.d.ts +2 -2
  122. package/umd/src/types/string_host.d.ts +42 -0
  123. package/umd/src/types/string_host_private.d.ts +7 -7
  124. package/umd/src/types/string_href.d.ts +19 -0
  125. package/umd/src/types/string_href_private.d.ts +24 -0
  126. package/umd/src/types/string_mime_type.d.ts +15 -0
  127. package/umd/src/types/string_mime_type_private.d.ts +2 -2
  128. package/umd/src/types/string_pipeline_root_url.d.ts +7 -0
  129. package/umd/src/types/string_pipeline_root_url_private.d.ts +9 -0
  130. package/umd/src/types/string_pipeline_url.d.ts +13 -0
  131. package/umd/src/types/string_pipeline_url_private.d.ts +17 -0
  132. package/umd/src/types/string_promptbook_server_url.d.ts +7 -0
  133. package/umd/src/types/string_promptbook_server_url_private.d.ts +9 -0
  134. package/umd/src/types/string_url.d.ts +14 -141
  135. package/umd/src/types/string_url_image.d.ts +7 -0
  136. package/umd/src/types/string_url_image_private.d.ts +9 -0
  137. package/umd/src/types/string_url_private.d.ts +0 -80
  138. package/umd/src/version.d.ts +1 -1
package/README.md CHANGED
@@ -472,24 +472,6 @@ You can install all of them at once:
472
472
  npm i ptbk
473
473
  ```
474
474
 
475
- Promptbook also ships coding-agent CLI utilities through `ptbk coder`.
476
- For full `coder run` options and runner-specific examples, see [`scripts/run-codex-prompts/README.md`](./scripts/run-codex-prompts/README.md).
477
-
478
- #### `ptbk coder`
479
-
480
- Locally in this repository:
481
-
482
- ```bash
483
- npx ts-node ./src/cli/test/ptbk.ts coder run --dry-run
484
- ```
485
-
486
- In another project with `ptbk` installed:
487
-
488
- ```bash
489
- npm install ptbk
490
- npx ptbk coder run --dry-run
491
- ```
492
-
493
475
  Or you can install them separately:
494
476
 
495
477
  > ⭐ Marked packages are worth to try first
@@ -527,6 +509,125 @@ Or you can install them separately:
527
509
 
528
510
 
529
511
 
512
+ ### 🤖 Promptbook Coder
513
+
514
+ `ptbk coder` is Promptbook's workflow layer for AI-assisted software changes. Instead of opening one chat and manually copy-pasting tasks, you keep a queue of coding prompts in `prompts/*.md`, let a coding agent execute the next ready task, and then verify the result before archiving the prompt.
515
+
516
+ Promptbook Coder is **not another standalone coding model**. It is an orchestration layer over coding agents such as **GitHub Copilot**, **OpenAI Codex**, **Claude Code**, **Opencode**, **Cline**, and **Gemini CLI**. The difference is that Promptbook Coder adds a repeatable repository workflow on top of them:
517
+
518
+ - prompt files with explicit statuses like `[ ]`, `[x]`, and `[-]`
519
+ - automatic selection of the next runnable task, including priority support
520
+ - optional shared repo context loaded from a file such as `AGENTS.md`
521
+ - automatic `git add`, commit, and push after each successful prompt
522
+ - dedicated coding-agent Git identity and optional GPG signing
523
+ - verification and repair flow for work that is done, partial, or broken
524
+ - helper commands for generating boilerplates and finding refactor prompts
525
+
526
+ In short: tools like Claude Code, Codex, or GitHub Copilot are the **engines**; Promptbook Coder is the **workflow** that keeps coding work structured, reviewable, and repeatable across many prompts.
527
+
528
+ #### How the workflow works
529
+
530
+ 1. `ptbk coder init` prepares the project for the coder workflow, seeds project-owned generic templates in `prompts/templates/`, creates a starter `AGENTS.md` context file, adds helper `npm run coder:*` scripts, ensures `.gitignore` ignores `/.tmp`, and configures VS Code prompt screenshots in `prompts/screenshots/`.
531
+ 2. `ptbk coder generate-boilerplates` creates prompt files in `prompts/`.
532
+ 3. You replace placeholder `@@@` sections with real coding tasks.
533
+ 4. `ptbk coder run` sends the next ready `[ ]` prompt to the selected coding agent.
534
+ 5. Promptbook Coder marks the prompt as done `[x]`, records runner metadata, then stages, commits, and pushes the resulting changes.
535
+ 6. `ptbk coder verify` reviews completed prompts, archives finished files to `prompts/done/`, and appends a repair prompt when more work is needed.
536
+
537
+ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treated as not fully written, and prompts with more `!` markers have higher priority.
538
+
539
+ #### Features
540
+
541
+ - **Multi-runner execution:** `openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`
542
+ - **Context injection:** `--context AGENTS.md` or inline extra instructions
543
+ - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
544
+ - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
545
+ - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
546
+ - **Prompt triage:** `--priority` to process only more important tasks first
547
+ - **Failure logging:** failed runs write a neighboring `.error.log`
548
+ - **Line-ending normalization:** changed files are normalized back to LF by default
549
+
550
+ #### Local usage in this repository
551
+
552
+ When working on Promptbook itself, the repository usually runs the CLI straight from source:
553
+
554
+ ```bash
555
+ npx ts-node ./src/cli/test/ptbk.ts coder init
556
+
557
+ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompts/templates/common.md
558
+
559
+ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompts/templates/agents-server.md
560
+
561
+ npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
562
+
563
+ npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
564
+
565
+ npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
566
+
567
+ npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates --level xhigh
568
+
569
+ npx ts-node ./src/cli/test/ptbk.ts coder verify
570
+ ```
571
+
572
+ #### Using `ptbk coder` in an external project
573
+
574
+ If you want to use the workflow in another repository, install the package and invoke the `ptbk` binary. After local installation, `npx ptbk ...` is the most portable form; plain `ptbk ...` also works when your environment exposes the local binary on `PATH`.
575
+
576
+ ```bash
577
+ npm install ptbk
578
+
579
+ ptbk coder init
580
+
581
+ npx ptbk coder generate-boilerplates
582
+
583
+ npx ptbk coder generate-boilerplates --template prompts/templates/common.md
584
+
585
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
586
+
587
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
588
+
589
+ npx ptbk coder find-refactor-candidates
590
+
591
+ npx ptbk coder find-refactor-candidates --level xhigh
592
+
593
+ npx ptbk coder verify
594
+ ```
595
+
596
+ `ptbk coder init` also bootstraps a starter `AGENTS.md`, adds `package.json` scripts for the four main coder commands, adds the coder temp ignore to `.gitignore`, and configures `.vscode/settings.json` so pasted images from `prompts/*.md` land in `prompts/screenshots/`.
597
+
598
+ #### What each command does
599
+
600
+ | Command | What it does |
601
+ | --- | --- |
602
+ | `ptbk coder init` | Creates `prompts/`, `prompts/done/`, the project-generic template files materialized in `prompts/templates/` (currently `common.md`), and a starter `AGENTS.md`; ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`; adds helper coder scripts to `package.json`; ensures `.gitignore` contains `/.tmp`; and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
603
+ | `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
604
+ | `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, marks success or failure, then commits and pushes the result. |
605
+ | `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <low|medium|high|xhigh>` makes the scan more or less aggressive. |
606
+ | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
607
+
608
+ #### Most useful `ptbk coder run` flags
609
+
610
+ | Flag | Purpose |
611
+ | --- | --- |
612
+ | `--agent <name>` | Selects the coding backend. |
613
+ | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
614
+ | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
615
+ | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
616
+ | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
617
+ | `--ignore-git-changes` | Disables the clean-working-tree guard. |
618
+ | `--priority <n>` | Runs only prompts at or above the given priority. |
619
+ | `--dry-run` | Prints which prompts are ready instead of executing them. |
620
+ | `--allow-credits` | Lets OpenAI Codex spend credits when required. |
621
+ | `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
622
+
623
+ #### Typical usage pattern
624
+
625
+ 1. Initialize once with `ptbk coder init`.
626
+ 2. Customize `prompts/templates/*.md` if needed, then create or write prompt files in `prompts/`.
627
+ 3. Customize the starter `AGENTS.md` with repository-specific instructions, then pass `--context AGENTS.md`.
628
+ 4. Run one prompt at a time interactively, or use `--no-wait` for unattended batches.
629
+ 5. Finish with `ptbk coder verify` so resolved prompts are archived and broken ones get explicit repair follow-ups.
630
+
530
631
 
531
632
 
532
633