@promptbook/cli 0.114.0-42 → 0.114.0-48
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.
- package/agents/default/copywriter.book +15 -0
- package/agents/default/developer.book +3 -0
- package/agents/default/lawyer.book +14 -0
- package/agents/default/planner.book +16 -0
- package/esm/index.es.js +4769 -809
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/find-fresh-emoji-tags/find-fresh-emoji-tags.d.ts +1 -1
- package/esm/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +2 -0
- package/esm/scripts/find-refactor-candidates/resolveRefactorCandidateProject.d.ts +3 -1
- package/esm/scripts/run-codex-prompts/common/CoderRunControlFeedback.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/buildCoderRunControlKeyBadge.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/listenForCoderRunControls.d.ts +3 -2
- package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +15 -5
- package/esm/scripts/run-codex-prompts/common/runGoScript/$spawnLoggedBashScript.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/common/runGoScript/captureLiveScriptOutput.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/common/runGoScript/createScriptOutputLineReader.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/common/runGoScript/resolveShellHereDocumentDelimiter.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/git/coderCommitScope.d.ts +4 -1
- package/esm/scripts/run-codex-prompts/git/coderGitSync.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/git/commitInitializedAgentBooks.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/git/ensureWorkingTreeClean.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/isolation/copyCoderIsolationEnvironment.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/isolation/createCoderIsolationWorktree.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/main/findUnwrittenPrompts.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/main/listCoderPrompts.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +11 -0
- package/esm/scripts/run-codex-prompts/prompts/loadPromptFiles.d.ts +10 -2
- package/esm/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/runners/cline/ClineRunner.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/runners/gemini/GeminiRunner.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/runners/github-copilot/GitHubCopilotRunner.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/runners/openai-codex/OpenAiCodexRunner.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/runners/opencode/OpencodeRunner.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/runners/qwen-code/QwenCodeRunner.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/server/runCoderHttpServer.d.ts +3 -0
- package/esm/scripts/run-codex-prompts/team/CoderTeamRuntime.d.ts +87 -0
- package/esm/scripts/run-codex-prompts/team/coderTeamProtocol.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/team/compileCoderTeamAgent.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/team/createCoderTeamPromptRunner.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/team/startCoderTeamBridge.d.ts +14 -0
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +16 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiViewport.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +4 -1
- package/esm/scripts/run-codex-prompts/ui/coderRunUiText.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/ui/output/CoderOutputEvent.d.ts +20 -0
- package/esm/scripts/run-codex-prompts/ui/output/CoderRunOutput.d.ts +48 -0
- package/esm/scripts/run-codex-prompts/ui/output/buildCoderOutputLines.d.ts +18 -0
- package/esm/scripts/run-codex-prompts/ui/output/normalizeCoderOutputRecord.d.ts +10 -0
- package/esm/scripts/utils/emojiTags/scanEmojiTagUsage.d.ts +2 -0
- package/esm/scripts/utils/prompts/isPromptDocumentationFile.d.ts +5 -0
- package/esm/scripts/utils/prompts/promptEmojiTags.d.ts +2 -0
- package/esm/scripts/verify-prompts/verify-prompts.d.ts +3 -0
- package/esm/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +2 -0
- package/esm/src/cli/cli-commands/coder/add.d.ts +16 -0
- package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +3 -2
- package/esm/src/cli/cli-commands/coder/augmentCoderAgentTeam.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/coderAgentRole.d.ts +16 -0
- package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +8 -7
- package/esm/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.d.ts +8 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.d.ts +12 -0
- package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.d.ts +9 -0
- package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +7 -5
- package/esm/src/cli/cli-commands/coder/plan.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/planning/createPlanningTerminal.d.ts +8 -0
- package/esm/src/cli/cli-commands/coder/planning/createPlanningTerminal.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/createPlanningWorkspace.d.ts +11 -0
- package/esm/src/cli/cli-commands/coder/planning/discussPlanningTurn.d.ts +15 -0
- package/esm/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.d.ts +5 -0
- package/esm/src/cli/cli-commands/coder/planning/planningGitSync.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/planningPackagedCli.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/planningProtocol.d.ts +152 -0
- package/esm/src/cli/cli-commands/coder/planning/planningTeam.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/preparePlanningChanges.d.ts +16 -0
- package/esm/src/cli/cli-commands/coder/planning/readPlanningContext.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/planning/resolvePlanningPath.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/planning/runPlanningHarness.d.ts +30 -0
- package/esm/src/cli/cli-commands/coder/planning/runPlanningHarness.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +21 -0
- package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/planning/savePlanningChanges.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +2 -1
- package/esm/src/cli/cli-commands/coder/promptsReadmeTemplate.d.ts +13 -0
- package/esm/src/cli/cli-commands/coder/promptsReadmeTemplate.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/readCoderAgentBook.d.ts +8 -0
- package/esm/src/cli/cli-commands/coder/workspacePreflight.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +4 -2
- package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +8 -1
- package/esm/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +6 -0
- package/esm/src/cli/cli-commands/common/workspaceRepository.d.ts +36 -0
- package/esm/src/cli/cli-commands/common/workspaceRepository.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/workspaceRepositoryCliOptions.d.ts +11 -0
- package/esm/src/commitments/TEAM/TEAM.test.d.ts +1 -0
- package/esm/src/conversion/archive/loadJsZipModule.d.ts +10 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +4 -3
- package/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.ts +2 -0
- package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments/applyCommitmentsToAgentModelRequirements.ts +8 -3
- package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.ts +6 -0
- package/src/cli/$initializePromptbookCliProgram.ts +2 -0
- package/src/cli/cli-commands/coder/add.ts +44 -14
- package/src/cli/cli-commands/coder/agentCliOptions.ts +9 -3
- package/src/cli/cli-commands/coder/augmentCoderAgentTeam.ts +152 -0
- package/src/cli/cli-commands/coder/coderAgentRole.ts +22 -0
- package/src/cli/cli-commands/coder/coderReferencedArtifacts.ts +9 -12
- package/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.ts +90 -0
- package/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.ts +2 -21
- package/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.ts +36 -0
- package/src/cli/cli-commands/coder/find-fresh-emoji-tags.ts +11 -2
- package/src/cli/cli-commands/coder/find-refactor-candidates.ts +10 -1
- package/src/cli/cli-commands/coder/find-unwritten.ts +10 -1
- package/src/cli/cli-commands/coder/generate-boilerplates.ts +12 -3
- package/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.ts +42 -0
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +7 -2
- package/src/cli/cli-commands/coder/init.ts +88 -26
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +67 -21
- package/src/cli/cli-commands/coder/list.ts +7 -1
- package/src/cli/cli-commands/coder/ping.ts +8 -1
- package/src/cli/cli-commands/coder/plan.ts +127 -0
- package/src/cli/cli-commands/coder/planning/README.md +37 -0
- package/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.ts +23 -0
- package/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.ts +57 -0
- package/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.ts +34 -0
- package/src/cli/cli-commands/coder/planning/createPlanningTerminal.ts +57 -0
- package/src/cli/cli-commands/coder/planning/createPlanningWorkspace.ts +36 -0
- package/src/cli/cli-commands/coder/planning/discussPlanningTurn.ts +61 -0
- package/src/cli/cli-commands/coder/planning/fixtures/codex.cjs +54 -0
- package/src/cli/cli-commands/coder/planning/fixtures/conversation.json +70 -0
- package/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.ts +17 -0
- package/src/cli/cli-commands/coder/planning/fixtures/terminal.cjs +26 -0
- package/src/cli/cli-commands/coder/planning/planningProtocol.ts +132 -0
- package/src/cli/cli-commands/coder/planning/preparePlanningChanges.ts +178 -0
- package/src/cli/cli-commands/coder/planning/readPlanningContext.ts +108 -0
- package/src/cli/cli-commands/coder/planning/resolvePlanningPath.ts +72 -0
- package/src/cli/cli-commands/coder/planning/runPlanningHarness.ts +249 -0
- package/src/cli/cli-commands/coder/planning/runPlanningSession.ts +243 -0
- package/src/cli/cli-commands/coder/planning/savePlanningChanges.ts +107 -0
- package/src/cli/cli-commands/coder/printInitializationSummary.ts +26 -3
- package/src/cli/cli-commands/coder/promptsReadmeTemplate.ts +358 -0
- package/src/cli/cli-commands/coder/readCoderAgentBook.ts +62 -0
- package/src/cli/cli-commands/coder/run.ts +37 -15
- package/src/cli/cli-commands/coder/server.ts +31 -10
- package/src/cli/cli-commands/coder/verify.ts +18 -1
- package/src/cli/cli-commands/coder.ts +7 -0
- package/src/cli/cli-commands/common/LocalAgentBookCollection.ts +56 -18
- package/src/cli/cli-commands/common/coderGitSyncCliOptions.ts +1 -1
- package/src/cli/cli-commands/common/createLocalAgentReferenceResolver.ts +7 -0
- package/src/cli/cli-commands/common/resolveLocalAgentSource.ts +39 -19
- package/src/cli/cli-commands/common/validateCoderRunOptions.ts +91 -0
- package/src/cli/cli-commands/common/workspaceRepository.md +46 -0
- package/src/cli/cli-commands/common/workspaceRepository.ts +265 -0
- package/src/cli/cli-commands/common/workspaceRepositoryCliOptions.ts +29 -0
- package/src/commitments/TEAM/TEAM.ts +26 -4
- package/src/conversion/archive/loadJsZipModule.ts +3 -1
- package/src/other/templates/getTemplatesPipelineCollection.ts +1104 -781
- package/src/version.ts +2 -2
- package/src/versions.txt +6 -0
- package/umd/index.umd.js +4767 -809
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/find-fresh-emoji-tags/find-fresh-emoji-tags.d.ts +1 -1
- package/umd/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +2 -0
- package/umd/scripts/find-refactor-candidates/resolveRefactorCandidateProject.d.ts +3 -1
- package/umd/scripts/run-codex-prompts/common/CoderRunControlFeedback.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/common/buildCoderRunControlKeyBadge.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/common/listenForCoderRunControls.d.ts +3 -2
- package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +15 -5
- package/umd/scripts/run-codex-prompts/common/runGoScript/$spawnLoggedBashScript.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/common/runGoScript/captureLiveScriptOutput.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/common/runGoScript/createScriptOutputLineReader.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/common/runGoScript/resolveShellHereDocumentDelimiter.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/git/coderCommitScope.d.ts +4 -1
- package/umd/scripts/run-codex-prompts/git/coderGitSync.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/git/commitInitializedAgentBooks.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/git/ensureWorkingTreeClean.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/isolation/copyCoderIsolationEnvironment.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/isolation/createCoderIsolationWorktree.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/main/findUnwrittenPrompts.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/main/listCoderPrompts.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +11 -0
- package/umd/scripts/run-codex-prompts/prompts/loadPromptFiles.d.ts +10 -2
- package/umd/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/runners/cline/ClineRunner.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/runners/gemini/GeminiRunner.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/runners/github-copilot/GitHubCopilotRunner.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/runners/openai-codex/OpenAiCodexRunner.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/runners/opencode/OpencodeRunner.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/runners/qwen-code/QwenCodeRunner.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/server/runCoderHttpServer.d.ts +3 -0
- package/umd/scripts/run-codex-prompts/team/CoderTeamRuntime.d.ts +87 -0
- package/umd/scripts/run-codex-prompts/team/coderTeamProtocol.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/team/compileCoderTeamAgent.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/team/createCoderTeamPromptRunner.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/team/startCoderTeamBridge.d.ts +14 -0
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +16 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiViewport.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +4 -1
- package/umd/scripts/run-codex-prompts/ui/coderRunUiText.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/ui/output/CoderOutputEvent.d.ts +20 -0
- package/umd/scripts/run-codex-prompts/ui/output/CoderRunOutput.d.ts +48 -0
- package/umd/scripts/run-codex-prompts/ui/output/buildCoderOutputLines.d.ts +18 -0
- package/umd/scripts/run-codex-prompts/ui/output/normalizeCoderOutputRecord.d.ts +10 -0
- package/umd/scripts/utils/emojiTags/scanEmojiTagUsage.d.ts +2 -0
- package/umd/scripts/utils/prompts/isPromptDocumentationFile.d.ts +5 -0
- package/umd/scripts/utils/prompts/promptEmojiTags.d.ts +2 -0
- package/umd/scripts/verify-prompts/verify-prompts.d.ts +3 -0
- package/umd/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +2 -0
- package/umd/src/cli/cli-commands/coder/add.d.ts +16 -0
- package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +3 -2
- package/umd/src/cli/cli-commands/coder/augmentCoderAgentTeam.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/coderAgentRole.d.ts +16 -0
- package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +8 -7
- package/umd/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.d.ts +8 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.d.ts +12 -0
- package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.d.ts +9 -0
- package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +7 -5
- package/umd/src/cli/cli-commands/coder/plan.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/planning/createPlanningTerminal.d.ts +8 -0
- package/umd/src/cli/cli-commands/coder/planning/createPlanningTerminal.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/createPlanningWorkspace.d.ts +11 -0
- package/umd/src/cli/cli-commands/coder/planning/discussPlanningTurn.d.ts +15 -0
- package/umd/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.d.ts +5 -0
- package/umd/src/cli/cli-commands/coder/planning/planningGitSync.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/planningPackagedCli.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/planningProtocol.d.ts +152 -0
- package/umd/src/cli/cli-commands/coder/planning/planningTeam.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/preparePlanningChanges.d.ts +16 -0
- package/umd/src/cli/cli-commands/coder/planning/readPlanningContext.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/planning/resolvePlanningPath.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/planning/runPlanningHarness.d.ts +30 -0
- package/umd/src/cli/cli-commands/coder/planning/runPlanningHarness.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +21 -0
- package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/planning/savePlanningChanges.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +2 -1
- package/umd/src/cli/cli-commands/coder/promptsReadmeTemplate.d.ts +13 -0
- package/umd/src/cli/cli-commands/coder/promptsReadmeTemplate.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/readCoderAgentBook.d.ts +8 -0
- package/umd/src/cli/cli-commands/coder/workspacePreflight.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +4 -2
- package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +8 -1
- package/umd/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +6 -0
- package/umd/src/cli/cli-commands/common/workspaceRepository.d.ts +36 -0
- package/umd/src/cli/cli-commands/common/workspaceRepository.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/workspaceRepositoryCliOptions.d.ts +11 -0
- package/umd/src/commitments/TEAM/TEAM.test.d.ts +1 -0
- package/umd/src/conversion/archive/loadJsZipModule.d.ts +10 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -2,6 +2,8 @@ import type {
|
|
|
2
2
|
Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
|
|
3
3
|
} from 'commander';
|
|
4
4
|
import { spaceTrim } from 'spacetrim';
|
|
5
|
+
import { ParseError } from '../../../errors/ParseError';
|
|
6
|
+
import { EnvironmentMismatchError } from '../../../errors/EnvironmentMismatchError';
|
|
5
7
|
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
6
8
|
import { ADAM_AGENT_BOOK_RELATIVE_PATH } from '../common/ensureAdamAgentBook';
|
|
7
9
|
import type { CoderGitSyncCliOptions } from '../common/coderGitSyncCliOptions';
|
|
@@ -10,6 +12,8 @@ import {
|
|
|
10
12
|
CODER_GIT_SYNC_DESCRIPTION,
|
|
11
13
|
normalizeCoderGitSyncCliOptions,
|
|
12
14
|
} from '../common/coderGitSyncCliOptions';
|
|
15
|
+
import { $preflightWorkspaceRepository } from '../common/workspaceRepository';
|
|
16
|
+
import { addWorkspaceRepositoryOptions } from '../common/workspaceRepositoryCliOptions';
|
|
13
17
|
import { handleActionErrors } from '../common/handleActionErrors';
|
|
14
18
|
import { $ensureHarnessInstallations } from '../common/harness/$ensureHarnessInstallations';
|
|
15
19
|
import { getHarnessDefinition } from '../common/harness/HarnessDefinition';
|
|
@@ -27,6 +31,7 @@ import { CODER_AGENTS_DIRECTORY_PATH, CODER_DEVELOPER_AGENT_FILE_PATH } from './
|
|
|
27
31
|
import { isDirectoryEmpty } from './ensureDirectory';
|
|
28
32
|
import { formatDisplayPath } from './formatDisplayPath';
|
|
29
33
|
import { generatePromptBoilerplate } from './generate-boilerplates';
|
|
34
|
+
import { getCoderInitializationCommitPaths } from './getCoderInitializationCommitPaths';
|
|
30
35
|
import { initializeCoderProjectConfiguration } from './initializeCoderProjectConfiguration';
|
|
31
36
|
import { printInitializationSummary } from './printInitializationSummary';
|
|
32
37
|
|
|
@@ -55,13 +60,22 @@ export function $initializeCoderInitCommand(program: Program): $side_effect {
|
|
|
55
60
|
command.description(
|
|
56
61
|
spaceTrim(
|
|
57
62
|
(block) => `
|
|
58
|
-
Initialize Promptbook coder configuration for current project
|
|
63
|
+
Initialize Git and Promptbook coder configuration for current project
|
|
64
|
+
|
|
65
|
+
Equivalent entrypoints: \`ptbk init\`, \`ptbk coder init\`, and \`ptbk coder initialize\`.
|
|
66
|
+
Creates a local Git working tree automatically when missing, including with \`--no-questions\`.
|
|
67
|
+
Reuses an enclosing repository without changing its history, configuration or index.
|
|
68
|
+
Does not stage existing files or create a first commit unless \`--commit\` is explicitly requested.
|
|
59
69
|
|
|
60
70
|
Creates or updates:
|
|
61
71
|
- prompts/
|
|
72
|
+
- prompts/README.md (offline PRD and workflow guide; existing README is preserved)
|
|
62
73
|
- prompts/done/
|
|
63
74
|
${block(listDefaultCoderProjectPromptTemplateDisplayPaths())}
|
|
64
75
|
- ${CODER_DEVELOPER_AGENT_FILE_PATH}
|
|
76
|
+
- agents/planner.book
|
|
77
|
+
- agents/lawyer.book
|
|
78
|
+
- agents/copywriter.book
|
|
65
79
|
- ${CODER_AGENTS_DIRECTORY_PATH}/${ADAM_AGENT_BOOK_RELATIVE_PATH}
|
|
66
80
|
- ${AGENTS_FILE_PATH}
|
|
67
81
|
- .gitignore with local artifacts from every supported harness
|
|
@@ -70,8 +84,11 @@ export function $initializeCoderInitCommand(program: Program): $side_effect {
|
|
|
70
84
|
|
|
71
85
|
Never overwrites what the project already owns:
|
|
72
86
|
- Existing package.json scripts and .vscode/settings.json settings are kept, only missing ones are added
|
|
73
|
-
-
|
|
74
|
-
|
|
87
|
+
- Missing Developer, Planner, Lawyer, Copywriter and Adam Books are initialized even when scripts already exist
|
|
88
|
+
- Adds missing local Lawyer and Copywriter TEAM references to Developer and Planner, preserving existing content
|
|
89
|
+
- Helpers advise on relevant tasks; declaring TEAM does not run them for every task
|
|
90
|
+
- Reports created, augmented, unchanged and unresolved Books; invalid or conflicting files are left untouched
|
|
91
|
+
- Other referenced files, like coder:run context, are created with their newly added scripts
|
|
75
92
|
|
|
76
93
|
Ensures required coding-agent environment variables in .env:
|
|
77
94
|
- CODING_AGENT_GIT_NAME
|
|
@@ -91,34 +108,79 @@ export function $initializeCoderInitCommand(program: Program): $side_effect {
|
|
|
91
108
|
addCoderGitSyncOptions(command);
|
|
92
109
|
addQuestionsOption(command);
|
|
93
110
|
|
|
111
|
+
addWorkspaceRepositoryOptions(command);
|
|
112
|
+
|
|
94
113
|
command.action(
|
|
95
114
|
handleActionErrors(async (cliOptions) => {
|
|
96
115
|
const gitSync = normalizeCoderGitSyncCliOptions(cliOptions as CoderGitSyncCliOptions);
|
|
97
116
|
const questionsOptions = normalizeQuestionsCliOptions(cliOptions as QuestionsCliOptions);
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
const workspace = await $preflightWorkspaceRepository({ policy: 'initialize', ...questionsOptions });
|
|
118
|
+
const { projectPath } = workspace;
|
|
119
|
+
|
|
120
|
+
const completedSteps = [`Git repository ${workspace.repositoryStatus}: ${workspace.repositoryRoot}`];
|
|
121
|
+
try {
|
|
122
|
+
// Note: Import the git synchronization dynamically to keep the CLI fast for runs without `--commit`
|
|
123
|
+
const { $commitCoderChanges, $startCoderGitSync } = await import(
|
|
124
|
+
'../../../../scripts/run-codex-prompts/git/coderGitSync'
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const commitScope = await $startCoderGitSync({ gitSync, workspace });
|
|
128
|
+
completedSteps.push('Requested Git synchronization and initial change scope');
|
|
129
|
+
// Check before initialization adds the README, templates and archive directory.
|
|
130
|
+
const isPromptsDirectoryEmpty = await isDirectoryEmpty(projectPath, PROMPTS_DIRECTORY_PATH);
|
|
131
|
+
|
|
132
|
+
const summary = await initializeCoderProjectConfiguration(projectPath, (step) =>
|
|
133
|
+
completedSteps.push(step),
|
|
134
|
+
);
|
|
135
|
+
printInitializationSummary(summary, workspace);
|
|
136
|
+
|
|
137
|
+
if (
|
|
138
|
+
summary.adamAgentFileStatus === 'unresolved' ||
|
|
139
|
+
summary.referencedArtifactStatuses.some(({ status }) => status === 'unresolved')
|
|
140
|
+
) {
|
|
141
|
+
throw new ParseError(
|
|
142
|
+
spaceTrim(
|
|
143
|
+
'Some default Books or TEAM references remain **unresolved**. Review the diagnostics above, fix the affected files, and run `ptbk coder init` again.',
|
|
144
|
+
),
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let boilerplatePaths: ReadonlyArray<string> = [];
|
|
149
|
+
if (isPromptsDirectoryEmpty) {
|
|
150
|
+
boilerplatePaths = await generatePromptBoilerplate({
|
|
151
|
+
projectPath,
|
|
152
|
+
boilerplateCount: DEFAULT_BOILERPLATE_COUNT,
|
|
153
|
+
});
|
|
154
|
+
completedSteps.push('Prompt boilerplates');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
await $commitCoderChanges({
|
|
158
|
+
gitSync,
|
|
159
|
+
commitScope,
|
|
160
|
+
commitMessage: 'Initialize Promptbook Coder',
|
|
161
|
+
relevantPaths: getCoderInitializationCommitPaths(workspace, summary, boilerplatePaths),
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (gitSync.isCommitEnabled) completedSteps.push('Scoped initialization commit');
|
|
165
|
+
await $ensureHarnessInstallations(CODER_INIT_CHECKED_HARNESS_NAMES, {
|
|
166
|
+
isAskingQuestionsEnabled: questionsOptions.isAskingQuestionsEnabled && Boolean(process.stdin.isTTY),
|
|
167
|
+
});
|
|
168
|
+
console.info('Promptbook project initialized.');
|
|
169
|
+
} catch (error) {
|
|
170
|
+
throw new EnvironmentMismatchError(
|
|
171
|
+
spaceTrim(
|
|
172
|
+
(block) => `
|
|
173
|
+
Promptbook project initialization is incomplete in \`${projectPath}\`.
|
|
174
|
+
|
|
175
|
+
Completed setup steps:
|
|
176
|
+
${block(completedSteps.map((step) => `- ${step}`).join('\n'))}
|
|
177
|
+
|
|
178
|
+
The failing step may have left partial files. Review them and rerun \`ptbk init\`.
|
|
179
|
+
${block(error instanceof Error ? error.message : String(error))}
|
|
180
|
+
`,
|
|
181
|
+
),
|
|
182
|
+
);
|
|
113
183
|
}
|
|
114
|
-
|
|
115
|
-
await $commitCoderChanges({
|
|
116
|
-
gitSync,
|
|
117
|
-
commitScope,
|
|
118
|
-
commitMessage: 'Initialize Promptbook Coder',
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
await $ensureHarnessInstallations(CODER_INIT_CHECKED_HARNESS_NAMES, questionsOptions);
|
|
122
184
|
}),
|
|
123
185
|
);
|
|
124
186
|
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ensureAdamAgentBook } from '../common/ensureAdamAgentBook';
|
|
1
|
+
import { ADAM_AGENT_BOOK_RELATIVE_PATH } from '../common/ensureAdamAgentBook';
|
|
3
2
|
import type { InitializationStatus } from './boilerplateTemplates';
|
|
4
3
|
import {
|
|
5
4
|
PROMPTS_DIRECTORY_PATH,
|
|
6
5
|
PROMPTS_DONE_DIRECTORY_PATH,
|
|
7
6
|
PROMPTS_TEMPLATES_DIRECTORY_PATH,
|
|
8
7
|
} from './boilerplateTemplates';
|
|
9
|
-
import type { EnsuredCoderReferencedArtifact } from './coderReferencedArtifacts';
|
|
8
|
+
import type { CoderReferencedArtifactStatus, EnsuredCoderReferencedArtifact } from './coderReferencedArtifacts';
|
|
10
9
|
import { ensureCoderReferencedArtifacts } from './coderReferencedArtifacts';
|
|
10
|
+
import { ensureCoderDefaultAgentFiles } from './ensureCoderDefaultAgentFiles';
|
|
11
11
|
import { CODER_AGENTS_DIRECTORY_PATH } from './ensureCoderDeveloperAgentFile';
|
|
12
12
|
import { ensureCoderEnvFile } from './ensureCoderEnvFile';
|
|
13
13
|
import { ensureCoderGitignoreFile } from './ensureCoderGitignoreFile';
|
|
14
|
+
import { ensureCoderMarkdownFile } from './ensureCoderMarkdownFile';
|
|
14
15
|
import { ensureCoderPackageJsonFile } from './ensureCoderPackageJsonFile';
|
|
15
16
|
import { ensureCoderVscodeSettingsFile } from './ensureCoderVscodeSettingsFile';
|
|
16
17
|
import { ensureDirectory } from './ensureDirectory';
|
|
17
18
|
import { resolveCoderPackageJsonScriptReferencedArtifactPaths } from './getDefaultCoderPackageJsonScripts';
|
|
19
|
+
import { PROMPTS_README_FILE_PATH, PROMPTS_README_TEMPLATE } from './promptsReadmeTemplate';
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* Result summary returned after coder configuration initialization.
|
|
@@ -23,10 +25,12 @@ import { resolveCoderPackageJsonScriptReferencedArtifactPaths } from './getDefau
|
|
|
23
25
|
*/
|
|
24
26
|
export type CoderInitializationSummary = {
|
|
25
27
|
readonly promptsDirectoryStatus: InitializationStatus;
|
|
28
|
+
readonly promptsReadmeFileStatus: InitializationStatus;
|
|
26
29
|
readonly promptsDoneDirectoryStatus: InitializationStatus;
|
|
27
30
|
readonly promptsTemplatesDirectoryStatus: InitializationStatus;
|
|
28
31
|
readonly agentsDirectoryStatus: InitializationStatus;
|
|
29
|
-
readonly adamAgentFileStatus:
|
|
32
|
+
readonly adamAgentFileStatus: CoderReferencedArtifactStatus;
|
|
33
|
+
readonly adamAgentFileDiagnostic?: string;
|
|
30
34
|
readonly envFileStatus: InitializationStatus;
|
|
31
35
|
readonly gitignoreFileStatus: InitializationStatus;
|
|
32
36
|
readonly packageJsonFileStatus: InitializationStatus;
|
|
@@ -39,33 +43,75 @@ export type CoderInitializationSummary = {
|
|
|
39
43
|
/**
|
|
40
44
|
* Creates or updates all coder configuration artifacts required in the current project.
|
|
41
45
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
46
|
+
* Existing scripts, settings and Books are preserved. Missing Books and helper TEAM declarations are added
|
|
47
|
+
* independently of package scripts, with unresolved artifacts reported without replacing project content.
|
|
44
48
|
*
|
|
45
49
|
* @private internal utility of `coder init` command
|
|
46
50
|
*/
|
|
47
|
-
export async function initializeCoderProjectConfiguration(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
export async function initializeCoderProjectConfiguration(
|
|
52
|
+
projectPath: string,
|
|
53
|
+
onStepCompleted?: (step: string) => void,
|
|
54
|
+
): Promise<CoderInitializationSummary> {
|
|
55
|
+
/** Records only completed setup steps so callers can explain partial failures. */
|
|
56
|
+
async function completeStep<Result>(step: string, operation: Promise<Result>): Promise<Result> {
|
|
57
|
+
const result = await operation;
|
|
58
|
+
onStepCompleted?.(step);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
const promptsDirectoryStatus = await completeStep('prompts/', ensureDirectory(projectPath, PROMPTS_DIRECTORY_PATH));
|
|
62
|
+
const promptsReadmeFileStatus = await completeStep(
|
|
63
|
+
'prompts/README.md',
|
|
64
|
+
ensureCoderMarkdownFile(projectPath, PROMPTS_README_FILE_PATH, PROMPTS_README_TEMPLATE),
|
|
61
65
|
);
|
|
66
|
+
const promptsDoneDirectoryStatus = await completeStep(
|
|
67
|
+
'prompts/done/',
|
|
68
|
+
ensureDirectory(projectPath, PROMPTS_DONE_DIRECTORY_PATH),
|
|
69
|
+
);
|
|
70
|
+
const promptsTemplatesDirectoryStatus = await completeStep(
|
|
71
|
+
'prompts/templates/',
|
|
72
|
+
ensureDirectory(projectPath, PROMPTS_TEMPLATES_DIRECTORY_PATH),
|
|
73
|
+
);
|
|
74
|
+
const agentsDirectoryStatus = await completeStep(
|
|
75
|
+
'agents/',
|
|
76
|
+
ensureDirectory(projectPath, CODER_AGENTS_DIRECTORY_PATH),
|
|
77
|
+
);
|
|
78
|
+
const defaultAgentArtifacts = await completeStep(
|
|
79
|
+
'Default Books and TEAM references checked',
|
|
80
|
+
ensureCoderDefaultAgentFiles(projectPath),
|
|
81
|
+
);
|
|
82
|
+
const adamRelativeFilePath = `${CODER_AGENTS_DIRECTORY_PATH}/${ADAM_AGENT_BOOK_RELATIVE_PATH}`;
|
|
83
|
+
const adamArtifact = defaultAgentArtifacts.find(
|
|
84
|
+
({ relativeFilePath }) => relativeFilePath === adamRelativeFilePath,
|
|
85
|
+
)!;
|
|
86
|
+
const { envFileStatus, initializedEnvVariableNames } = await completeStep('.env', ensureCoderEnvFile(projectPath));
|
|
87
|
+
const gitignoreFileStatus = await completeStep('.gitignore', ensureCoderGitignoreFile(projectPath));
|
|
88
|
+
const { status: packageJsonFileStatus, addedEntryKeys: addedPackageJsonScriptNames } = await completeStep(
|
|
89
|
+
'package.json',
|
|
90
|
+
ensureCoderPackageJsonFile(projectPath),
|
|
91
|
+
);
|
|
92
|
+
const vscodeSettingsFileStatus = await completeStep(
|
|
93
|
+
'.vscode/settings.json',
|
|
94
|
+
ensureCoderVscodeSettingsFile(projectPath),
|
|
95
|
+
);
|
|
96
|
+
const referencedArtifactStatuses = [
|
|
97
|
+
...defaultAgentArtifacts.filter(({ relativeFilePath }) => relativeFilePath !== adamRelativeFilePath),
|
|
98
|
+
...(await completeStep(
|
|
99
|
+
'Script-referenced artifacts checked',
|
|
100
|
+
ensureCoderReferencedArtifacts(
|
|
101
|
+
projectPath,
|
|
102
|
+
resolveCoderPackageJsonScriptReferencedArtifactPaths(addedPackageJsonScriptNames),
|
|
103
|
+
),
|
|
104
|
+
)),
|
|
105
|
+
];
|
|
62
106
|
|
|
63
107
|
return {
|
|
64
108
|
promptsDirectoryStatus,
|
|
109
|
+
promptsReadmeFileStatus,
|
|
65
110
|
promptsDoneDirectoryStatus,
|
|
66
111
|
promptsTemplatesDirectoryStatus,
|
|
67
112
|
agentsDirectoryStatus,
|
|
68
|
-
adamAgentFileStatus,
|
|
113
|
+
adamAgentFileStatus: adamArtifact.status,
|
|
114
|
+
adamAgentFileDiagnostic: adamArtifact.diagnostic,
|
|
69
115
|
envFileStatus,
|
|
70
116
|
gitignoreFileStatus,
|
|
71
117
|
packageJsonFileStatus,
|
|
@@ -3,6 +3,8 @@ import type {
|
|
|
3
3
|
} from 'commander';
|
|
4
4
|
import { spaceTrim } from 'spacetrim';
|
|
5
5
|
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
6
|
+
import { $preflightWorkspaceRepository } from '../common/workspaceRepository';
|
|
7
|
+
import { addWorkspaceRepositoryOptions } from '../common/workspaceRepositoryCliOptions';
|
|
6
8
|
import { handleActionErrors } from '../common/handleActionErrors';
|
|
7
9
|
import { addPromptPriorityOptions } from '../common/promptPriorityCliOptions';
|
|
8
10
|
import type { PromptRunnerSelectionCliOptions } from '../common/promptRunnerCliOptions';
|
|
@@ -40,6 +42,8 @@ export function $initializeCoderListCommand(program: Program): $side_effect {
|
|
|
40
42
|
addCoderAgentOption(command);
|
|
41
43
|
addPromptPriorityOptions(command);
|
|
42
44
|
|
|
45
|
+
addWorkspaceRepositoryOptions(command);
|
|
46
|
+
|
|
43
47
|
command.action(
|
|
44
48
|
handleActionErrors(async (cliOptions) => {
|
|
45
49
|
const {
|
|
@@ -58,12 +62,13 @@ export function $initializeCoderListCommand(program: Program): $side_effect {
|
|
|
58
62
|
cliOptions as PromptRunnerSelectionCliOptions,
|
|
59
63
|
{ isAgentRequired: false },
|
|
60
64
|
);
|
|
65
|
+
const workspace = await $preflightWorkspaceRepository({ policy: 'read-only' });
|
|
61
66
|
const resolvedCoderAgentBook =
|
|
62
67
|
agent === undefined
|
|
63
68
|
? undefined
|
|
64
69
|
: await (
|
|
65
70
|
await import('../../../../scripts/run-codex-prompts/common/resolveCoderAgent')
|
|
66
|
-
).resolveCoderAgentBook(agent,
|
|
71
|
+
).resolveCoderAgentBook(agent, workspace.projectPath);
|
|
67
72
|
const promptRunnerIdentity =
|
|
68
73
|
runnerOptions.agentName === undefined &&
|
|
69
74
|
runnerOptions.model === undefined &&
|
|
@@ -78,6 +83,7 @@ export function $initializeCoderListCommand(program: Program): $side_effect {
|
|
|
78
83
|
// Note: Import dynamically to avoid loading prompt parsing dependencies until this command is used.
|
|
79
84
|
const { listCoderPrompts } = await import('../../../../scripts/run-codex-prompts/main/listCoderPrompts');
|
|
80
85
|
await listCoderPrompts({
|
|
86
|
+
projectPath: workspace.projectPath,
|
|
81
87
|
priority,
|
|
82
88
|
minimumPriority,
|
|
83
89
|
maximumPriority,
|
|
@@ -3,6 +3,8 @@ import type {
|
|
|
3
3
|
} from 'commander';
|
|
4
4
|
import { spaceTrim } from 'spacetrim';
|
|
5
5
|
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
6
|
+
import { $preflightWorkspaceRepository } from '../common/workspaceRepository';
|
|
7
|
+
import { addWorkspaceRepositoryOptions } from '../common/workspaceRepositoryCliOptions';
|
|
6
8
|
import { handleActionErrors } from '../common/handleActionErrors';
|
|
7
9
|
import { $ensureHarnessInstallations } from '../common/harness/$ensureHarnessInstallations';
|
|
8
10
|
import {
|
|
@@ -62,6 +64,8 @@ export function $initializeCoderPingCommand(program: Program): $side_effect {
|
|
|
62
64
|
`),
|
|
63
65
|
);
|
|
64
66
|
|
|
67
|
+
addWorkspaceRepositoryOptions(command);
|
|
68
|
+
|
|
65
69
|
command.action(
|
|
66
70
|
handleActionErrors(async (cliOptions) => {
|
|
67
71
|
const { period: periodValue } = cliOptions as {
|
|
@@ -77,10 +81,13 @@ export function $initializeCoderPingCommand(program: Program): $side_effect {
|
|
|
77
81
|
// Note: The period is validated before the harness installation check, so a mistyped duration fails fast
|
|
78
82
|
const periodMs = parseOptionalPeriodDuration('--period', periodValue);
|
|
79
83
|
|
|
84
|
+
const workspace = await $preflightWorkspaceRepository({ policy: 'mutate', ...questionsOptions });
|
|
85
|
+
|
|
80
86
|
await $ensureHarnessInstallations([runnerOptions.agentName], questionsOptions);
|
|
81
|
-
await $ensureCoderHarnessGitignoreRules(
|
|
87
|
+
await $ensureCoderHarnessGitignoreRules(workspace.projectPath, runnerOptions.agentName, questionsOptions);
|
|
82
88
|
|
|
83
89
|
const pingOptions = {
|
|
90
|
+
projectPath: workspace.projectPath,
|
|
84
91
|
agentName: runnerOptions.agentName,
|
|
85
92
|
model: runnerOptions.model,
|
|
86
93
|
thinkingLevel: runnerOptions.thinkingLevel,
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { join, relative } from 'path';
|
|
2
|
+
import type { Command as Program } from 'commander';
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
import { NotAllowed } from '../../../errors/NotAllowed';
|
|
5
|
+
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
6
|
+
import { spaceTrim } from '../../../utils/organization/spaceTrim';
|
|
7
|
+
import { addCoderGitSyncOptions, normalizeCoderGitSyncCliOptions } from '../common/coderGitSyncCliOptions';
|
|
8
|
+
import { $preflightWorkspaceRepository } from '../common/workspaceRepository';
|
|
9
|
+
import { addWorkspaceRepositoryOptions } from '../common/workspaceRepositoryCliOptions';
|
|
10
|
+
import { handleActionErrors } from '../common/handleActionErrors';
|
|
11
|
+
import {
|
|
12
|
+
addPromptRunnerRuntimeOptions,
|
|
13
|
+
addPromptRunnerSelectionOptions,
|
|
14
|
+
normalizePromptRunnerSelectionCliOptions,
|
|
15
|
+
} from '../common/promptRunnerCliOptions';
|
|
16
|
+
import { addCoderAgentOption } from './agentCliOptions';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Registers the repository-aware, planning-only conversation under the existing coder command group.
|
|
20
|
+
* @private internal utility of `promptbookCli`
|
|
21
|
+
*/
|
|
22
|
+
export function $initializeCoderPlanCommand(program: Program): $side_effect {
|
|
23
|
+
const command = program.command('plan').description(
|
|
24
|
+
spaceTrim(`
|
|
25
|
+
Discuss features with the project's Planner and review PRDs before saving them.
|
|
26
|
+
|
|
27
|
+
Run ptbk coder init first. Default Book: agents/planner.book; --agent overrides the Book,
|
|
28
|
+
independently of --harness and --model. Currently supports openai-codex with restricted tools.
|
|
29
|
+
Requires an interactive terminal and a Codex version supporting --ignore-user-config and --ignore-rules.
|
|
30
|
+
Codex configuration, plugins, hooks and native tools are isolated; --model default uses Codex's built-in default.
|
|
31
|
+
/save applies reviewed proposals, /draft saves [-] drafts, /discard drops proposals, /exit ends.
|
|
32
|
+
Only PRD Markdown files under prompts/ can change. No implementation or queue launch occurs.
|
|
33
|
+
Git sync is opt-in: --auto-pull before planning, --commit for session PRDs, --auto-push only with --commit.
|
|
34
|
+
`),
|
|
35
|
+
);
|
|
36
|
+
addPromptRunnerSelectionOptions(command);
|
|
37
|
+
addPromptRunnerRuntimeOptions(command);
|
|
38
|
+
addCoderAgentOption(command, 'planner');
|
|
39
|
+
addCoderGitSyncOptions(command);
|
|
40
|
+
command.option(
|
|
41
|
+
'--template <path>',
|
|
42
|
+
'PRD template (defaults to the project-owned prompts/templates/common.md when present)',
|
|
43
|
+
);
|
|
44
|
+
addWorkspaceRepositoryOptions(command);
|
|
45
|
+
|
|
46
|
+
command.action(
|
|
47
|
+
handleActionErrors(async (cliOptions) => {
|
|
48
|
+
const { createPlanningTerminal } = await import('./planning/createPlanningTerminal');
|
|
49
|
+
const { runPlanningSession } = await import('./planning/runPlanningSession');
|
|
50
|
+
const { resolvePlanningPath } = await import('./planning/resolvePlanningPath');
|
|
51
|
+
const { assertPlanningHarnessSupported } = await import('./planning/runPlanningHarness');
|
|
52
|
+
const { assertPlanningCommitSafe } = await import('./planning/assertPlanningCommitSafe');
|
|
53
|
+
const { $startCoderGitSync, $commitCoderChanges } = await import(
|
|
54
|
+
'../../../../scripts/run-codex-prompts/git/coderGitSync'
|
|
55
|
+
);
|
|
56
|
+
const options = normalizePromptRunnerSelectionCliOptions(cliOptions, { isAgentRequired: true });
|
|
57
|
+
assertPlanningHarnessSupported(options.agentName);
|
|
58
|
+
const gitSync = normalizeCoderGitSyncCliOptions(cliOptions);
|
|
59
|
+
const workspace = await $preflightWorkspaceRepository({
|
|
60
|
+
policy: 'mutate',
|
|
61
|
+
isAskingQuestionsEnabled: cliOptions.questions,
|
|
62
|
+
});
|
|
63
|
+
if (cliOptions.questions === false) {
|
|
64
|
+
throw new NotAllowed(
|
|
65
|
+
spaceTrim(
|
|
66
|
+
'`ptbk coder plan` requires an interactive conversation and review. Run it without `--no-questions` in a terminal.',
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
const terminal = createPlanningTerminal();
|
|
71
|
+
try {
|
|
72
|
+
const { projectPath } = workspace;
|
|
73
|
+
if (gitSync.isCommitEnabled) {
|
|
74
|
+
assertPlanningCommitSafe(projectPath);
|
|
75
|
+
assertPlanningCommitSafe(workspace.repositoryRoot!);
|
|
76
|
+
}
|
|
77
|
+
const commitScope = await $startCoderGitSync({ workspace, gitSync });
|
|
78
|
+
const saved = await runPlanningSession(
|
|
79
|
+
{
|
|
80
|
+
...options,
|
|
81
|
+
projectPath,
|
|
82
|
+
agent: cliOptions.agent,
|
|
83
|
+
template: cliOptions.template,
|
|
84
|
+
preexistingChangedPaths: gitSync.isCommitEnabled
|
|
85
|
+
? new Set(
|
|
86
|
+
Array.from(commitScope.snapshotBeforeOperation.changedFileHashes.keys(), (path) =>
|
|
87
|
+
relative(projectPath, join(workspace.repositoryRoot!, path)).replace(/\\/gu, '/'),
|
|
88
|
+
),
|
|
89
|
+
)
|
|
90
|
+
: undefined,
|
|
91
|
+
},
|
|
92
|
+
terminal,
|
|
93
|
+
);
|
|
94
|
+
if (terminal.signal.aborted) return;
|
|
95
|
+
// A file edited by the user after saving must not be swept into a session commit either.
|
|
96
|
+
if (gitSync.isCommitEnabled) {
|
|
97
|
+
assertPlanningCommitSafe(projectPath);
|
|
98
|
+
for (const [path, content] of saved) {
|
|
99
|
+
if ((await readFile(resolvePlanningPath(projectPath, path, true), 'utf-8')) !== content) {
|
|
100
|
+
throw new NotAllowed(
|
|
101
|
+
spaceTrim(
|
|
102
|
+
`\`${path}\` changed after planning saved it. The planning commit was skipped; review the working tree.`,
|
|
103
|
+
),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
await $commitCoderChanges({
|
|
109
|
+
gitSync,
|
|
110
|
+
commitScope,
|
|
111
|
+
commitMessage: 'Plan project tasks',
|
|
112
|
+
relevantPaths: [...saved.keys()].map((path) =>
|
|
113
|
+
relative(workspace.repositoryRoot!, join(projectPath, path)).replace(/\\/gu, '/'),
|
|
114
|
+
),
|
|
115
|
+
});
|
|
116
|
+
} catch (error) {
|
|
117
|
+
if (!terminal.signal.aborted) throw error;
|
|
118
|
+
console.info('Planning cancelled. Saved PRDs remain intact.');
|
|
119
|
+
} finally {
|
|
120
|
+
terminal.close();
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Note: [🟡] CLI planning must never be published outside of `@promptbook/cli`.
|
|
127
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Coder planning
|
|
2
|
+
|
|
3
|
+
Run `ptbk coder init`, then `ptbk coder plan --harness openai-codex` in an interactive terminal.
|
|
4
|
+
The editable `agents/planner.book` uses the same implicit Adam inheritance as Developer. An explicit `--agent`
|
|
5
|
+
overrides the Book through the shared resolver; planning resolves Books without initializing missing ancestors.
|
|
6
|
+
|
|
7
|
+
The discussion retains messages, read results and saved paths across topics. Planner proposes changes as data.
|
|
8
|
+
The CLI shows exact paths and changed text, then accepts `/save`, `/draft`, `/discard`, or another discussion turn.
|
|
9
|
+
EOF and `/exit` discard unsaved proposals. Ctrl+C aborts inference. Saved files remain intact after failures.
|
|
10
|
+
|
|
11
|
+
New PRDs use the same numbering, emoji tags, priority and template builder as `coder add`. The project-owned common
|
|
12
|
+
template is selected when present; `--template` selects another. Drafts use `[-]`, pending tasks use `[ ]`.
|
|
13
|
+
Edits replace one unique passage in one pending/draft task body, preserving identity, routing, priority, line endings,
|
|
14
|
+
and other sections. Completed work requires a new follow-up task. Concurrent changes invalidate a preview.
|
|
15
|
+
|
|
16
|
+
The execution boundary belongs to the command. Codex runs in a separate ignored `.promptbook/coder-plan` workspace
|
|
17
|
+
with an empty repository root, ignored user configuration/rules, read-only sandboxing and disabled shell, delegation,
|
|
18
|
+
plugins, connectors and hooks. Host-mediated list/read/search and fixed read-only Git operations provide context.
|
|
19
|
+
No model-supplied command is executed. Older Codex versions lacking the required switches fail closed; unsupported
|
|
20
|
+
harnesses are rejected. Authentication uses the installed Codex login. `--model default` uses Codex's built-in default
|
|
21
|
+
because user configuration is isolated.
|
|
22
|
+
|
|
23
|
+
Only the host can save. Writes stay in the active top-level `prompts/` queue, matching the existing queue loader.
|
|
24
|
+
Archives, templates, reusable context, agent guidance and ignored Markdown remain available for inspection only.
|
|
25
|
+
The host validates every path, rejects links, devices and special Git/shell path characters, checks the
|
|
26
|
+
preview against current contents, stages outside the queue, and publishes each file atomically. Emoji previews disable
|
|
27
|
+
the shared scanner's cache writes. Staging and commit runtime directories also reject links. A requested Git commit
|
|
28
|
+
is restricted to the session's PRD write set; preexisting
|
|
29
|
+
dirty PRDs must be revised without `--commit`, and later external edits prevent the session commit. Git sync and push
|
|
30
|
+
are opt-in. Ending a conversation never launches the implementation queue.
|
|
31
|
+
|
|
32
|
+
The fixture tests cover conversations, boundaries, cancellation, Git isolation and local/packed CLI entrypoints.
|
|
33
|
+
The package test builds the production entrypoint and asset layout, runs `npm pack`, extracts the archive, supplies
|
|
34
|
+
installed dependencies, and runs the real CLI against a mocked Codex installation and terminal. No live model is used.
|
|
35
|
+
|
|
36
|
+
The Codex invocation uses the documented [configuration isolation switches](https://learn.chatgpt.com/docs/developer-commands?surface=cli)
|
|
37
|
+
and [tool configuration](https://learn.chatgpt.com/docs/config-file/config-reference). Required unsupported flags cause startup to fail.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NotAllowed } from '../../../../errors/NotAllowed';
|
|
2
|
+
import { resolvePromptbookTemporaryPath } from '../../../../utils/filesystem/promptbookTemporaryPath';
|
|
3
|
+
import { spaceTrim } from '../../../../utils/organization/spaceTrim';
|
|
4
|
+
import { assertPlanningRuntimePath } from './assertPlanningRuntimePath';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Protects the shared authoring Git helper's temporary directory and shell-quoted absolute message path.
|
|
8
|
+
* PRD paths themselves are checked separately by the write boundary before every save and commit.
|
|
9
|
+
* @private internal execution boundary of `coder plan`
|
|
10
|
+
*/
|
|
11
|
+
export function assertPlanningCommitSafe(projectPath: string): void {
|
|
12
|
+
if (/[$`%"\r\n]/u.test(projectPath)) {
|
|
13
|
+
throw new NotAllowed(
|
|
14
|
+
spaceTrim(
|
|
15
|
+
'The shared Git helper cannot safely quote this project path. Plan without `--commit` and commit the reviewed PRDs separately.',
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
assertPlanningRuntimePath(
|
|
20
|
+
projectPath,
|
|
21
|
+
resolvePromptbookTemporaryPath(projectPath, 'ptbk-coder', 'commit-messages'),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { execFile } from 'child_process';
|
|
2
|
+
// cspell:ignore fsmonitor pathspecs
|
|
3
|
+
import { promisify } from 'util';
|
|
4
|
+
import { NotAllowed } from '../../../../errors/NotAllowed';
|
|
5
|
+
import { spaceTrim } from '../../../../utils/organization/spaceTrim';
|
|
6
|
+
import type { PlanningChange } from './preparePlanningChanges';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Refuses to mix prior or concurrent user edits into a PRD that this session intends to commit.
|
|
10
|
+
* After the first save, the session's exact saved text is the baseline for subsequent revisions.
|
|
11
|
+
* @private internal execution boundary of `coder plan`
|
|
12
|
+
*/
|
|
13
|
+
export async function assertPlanningPrdCommitScope(
|
|
14
|
+
projectPath: string,
|
|
15
|
+
changes: ReadonlyArray<PlanningChange>,
|
|
16
|
+
savedContents: ReadonlyMap<string, string>,
|
|
17
|
+
preexistingChangedPaths: ReadonlySet<string>,
|
|
18
|
+
): Promise<void> {
|
|
19
|
+
for (const change of changes) {
|
|
20
|
+
if (preexistingChangedPaths.has(change.path)) {
|
|
21
|
+
throw new NotAllowed(
|
|
22
|
+
spaceTrim(
|
|
23
|
+
`\`${change.path}\` already had user changes before this --commit session. Restart without --commit to revise it without committing those changes.`,
|
|
24
|
+
),
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
if (change.before === null) continue;
|
|
28
|
+
let isChangedOutsideSession: boolean;
|
|
29
|
+
if (savedContents.has(change.path)) {
|
|
30
|
+
isChangedOutsideSession = savedContents.get(change.path) !== change.before;
|
|
31
|
+
} else {
|
|
32
|
+
const { stdout } = await promisify(execFile)(
|
|
33
|
+
'git',
|
|
34
|
+
[
|
|
35
|
+
'--no-optional-locks',
|
|
36
|
+
'--literal-pathspecs',
|
|
37
|
+
'-c',
|
|
38
|
+
'core.fsmonitor=false',
|
|
39
|
+
'status',
|
|
40
|
+
'--porcelain',
|
|
41
|
+
'--untracked-files=all',
|
|
42
|
+
'--',
|
|
43
|
+
change.path,
|
|
44
|
+
],
|
|
45
|
+
{ cwd: projectPath, windowsHide: true, timeout: 10000, maxBuffer: 65536 },
|
|
46
|
+
);
|
|
47
|
+
isChangedOutsideSession = stdout.trim() !== '';
|
|
48
|
+
}
|
|
49
|
+
if (isChangedOutsideSession) {
|
|
50
|
+
throw new NotAllowed(
|
|
51
|
+
spaceTrim(
|
|
52
|
+
`\`${change.path}\` has concurrent user changes outside this planning session. Restart without --commit to revise it without committing those changes.`,
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|