feat(templates): generalize boot flow and add template picker UI#7
Open
Dhi13man wants to merge 5 commits intoopen-gitagent:mainfrom
Open
feat(templates): generalize boot flow and add template picker UI#7Dhi13man wants to merge 5 commits intoopen-gitagent:mainfrom
Dhi13man wants to merge 5 commits intoopen-gitagent:mainfrom
Conversation
Remove hardcoded GitClaw assumptions from workspace builder, container boot, and SDK launch flow. Templates now declare their own workspace files, dependencies, and config requirements. A picker overlay appears at startup when multiple templates are registered. Co-Authored-By: Dhiman's Agentic Suite <dhiman.seal@hotmail.com>
…ll assertion - Replace innerHTML with textContent in template picker (XSS fix) - Empty hardcoded base tree in buildWorkspaceFiles — defaults now come from GITCLAW_TEMPLATE.workspace via template resolution - Use local template variable instead of this._template! assertion - Add tests for undefined agent and package name Co-Authored-By: Dhiman's Agentic Suite <dhiman.seal@hotmail.com>
…, YAML parser Cover buildWorkspaceFiles (nested paths, merging), mergeTemplateWithOptions (per-key merge, tab dedup, agent override), and parseTemplateYaml (agent blocks, env blocks, block scalars, comments, validation). Co-Authored-By: Dhiman's Agentic Suite <dhiman.seal@hotmail.com>
Co-Authored-By: Dhiman's Agentic Suite <dhiman.seal@hotmail.com>
Co-Authored-By: Dhiman's Agentic Suite <dhiman.seal@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ClawLess hardcodes GitClaw as the only agent —
buildContainerPackageJsonpinsgitclaw: '1.1.4',buildWorkspaceFilesalways mounts GitClaw config files, andsdk.tsbranches onisGitclaw. This blocks #4 (OpenClaw support) because there's no way to register and boot a different agent.This PR makes the boot flow template-driven so any agent can be registered and selected at startup.
Before / After
Before: Direct boot to loading screen — no choice of agent.
After: Picker overlay appears when multiple templates are registered. User clicks a card to select their agent.
Design Context
flowchart TD A[main.ts] -->|registry.size > 1?| B{Template Picker} A -->|registry.size <= 1| C[Boot default template] B -->|user clicks card| C C --> D[resolveTemplate] D --> E[mergeTemplateWithOptions] E --> F[boot: mount workspace + package.json from template] F --> G{template.configRequired?} G -->|yes| H[Show config panel, wait for API key] G -->|no| I[Launch agent directly] H --> I I --> J[startAgent with AgentConfig]Trade-offs
buildWorkspaceFilesnow starts with empty tree instead of hardcoded defaults. Templates that don't declare workspace files get an empty workspace. Accepted because defaults now live inGITCLAW_TEMPLATE.workspaceand flow throughmergeTemplateWithOptions— GitClaw behavior is identical, new templates opt-in to exactly the files they need.startGitclaw()kept but deprecated rather than deleted. It has GitClaw-specific restart messaging thatstartAgent()doesn't replicate. Removing is safe but deferred to reduce risk.textContentinstead ofinnerHTMLfor template name/description. Prevents XSS if a malicious template is registered.How to review
src/workspace.tsbuildContainerPackageJsontakesAgentConfiginstead of hardcoding deps.buildWorkspaceFilesstarts empty.src/templates.tsContainerTemplategainsconfigRequired.GITCLAW_TEMPLATEdeclares its workspace files.src/container.tsboot()acceptsagentConfig, passes it to package.json builder.src/sdk.tsisGitclawbranch replaced withtemplate.configRequired. All agents usestartAgent().src/main.tsindex.html+src/style.csssrc/*.test.tsTest plan
npx vitest run— 43 tests covering:buildContainerPackageJson: agent config derivation, version defaulting, false/undefined, extraDeps mergebuildWorkspaceFiles: empty input, flat files, nested paths, multi-file mergemergeTemplateWithOptions: per-key merge, agent override, tab dedup, startupScript fallbackparseTemplateYaml: scalars, agent blocks, env blocks, block scalars, validationnpm run devboots GitClaw identically (picker skipped with 1 template)Closes #4 (partial — template infrastructure)
Generated with Dhiman's Agentic Suite