Skip to content

Add dotbot package command for syncing .bot changes back to source repo#70

Closed
ap-cbilgin wants to merge 1 commit intoandresharpe:mainfrom
ap-cbilgin:feature/dotbot-package
Closed

Add dotbot package command for syncing .bot changes back to source repo#70
ap-cbilgin wants to merge 1 commit intoandresharpe:mainfrom
ap-cbilgin:feature/dotbot-package

Conversation

@ap-cbilgin
Copy link
Contributor

Problem

When developing dotbot, changes are made inside the .bot/ directory of a live project. However, dotbot init is a one-way operation — it copies from profiles/default/ into the project's .bot/, but there's no built-in way to copy changes back. This means after iterating on systems, prompts, workflows, or UI within a project, developers must manually identify and copy modified files back to the dotbot source repo's profiles/default/ directory. This is tedious, error-prone, and doesn't scale.

Solution

Introduces a new dotbot package command that reverses the init flow:

.bot/{path}  -->  {target}/profiles/default/{path}

New file: .bot/package.ps1

A PowerShell script that packages framework files from a project's .bot/ back to the dotbot source repo, with smart filtering to exclude project-specific state.

What gets packaged (framework files):

  • systems/ — MCP server, runtime engine, web UI
  • prompts/ — agents, skills, workflows, includes
  • hooks/ — dev, verify, scripts
  • defaults/ — settings, providers, theme
  • Root scripts — go.ps1, init.ps1, package.ps1
  • Workspace templates/samples only (e.g., TEMPLATE.json, sample tasks)

What gets excluded (project-specific state):

  • workspace/ content — tasks, ADRs, sessions, plans, product docs
  • .control/ — runtime state, process registry, logs
  • .worktrees/ — git worktrees for task isolation
  • *.log, *.jsonl, *.tmp files

Features:

  • MD5 diffing — only reports/copies files that actually changed ([NEW]/[UPDATE] labels)
  • -DryRun — preview all changes before applying
  • -SyncFromIDE — pulls agent/skill edits from .claude/ back into .bot/prompts/ before packaging (useful when agents are edited directly in IDE directories)
  • -Archive — creates a timestamped .zip for distribution instead of copying to a directory
  • -Force — skip hash checks and overwrite everything
  • Stale file detection — warns about files present in the target but missing from source, indicating potential cleanup needed
  • Target validation — verifies the target directory contains profiles/ before proceeding

CLI integration: install-global.ps1

  • Added dotbot package to the CLI wrapper's command switch and help text
  • The command delegates to the current project's .bot/package.ps1, so it always uses the version matching the project's dotbot installation

Usage

# Preview what would be synced
dotbot package -Target C:\dotbot-install -DryRun

# Package changes back to source repo
dotbot package -Target C:\dotbot-install

# Sync IDE-edited agents first, then package
dotbot package -Target C:\dotbot-install -SyncFromIDE

# Create a distributable zip archive
dotbot package -Archive

Example output (dry run)

  Found 211 framework files

    [UPDATE] profiles/default/systems/ui/server.ps1
    [UPDATE] profiles/default/systems/ui/static/modules/tasks.js
    [UPDATE] profiles/default/prompts/workflows/99-autonomous-task.md
    [NEW]    profiles/default/package.ps1

  SUMMARY
    New files:     1
    Updated:       22
    Unchanged:     188
    Total files:   211

Test plan

  • Run .bot\package.ps1 -Target C:\dotbot-install -DryRun — verify correct [NEW]/[UPDATE] labeling
  • Run .bot\package.ps1 -Target C:\dotbot-install — verify files are copied to profiles/default/
  • Run .bot\package.ps1 -Archive — verify zip is created with correct structure
  • Run .bot\package.ps1 -SyncFromIDE -DryRun — verify IDE agent changes are detected
  • Run with no -Target — verify helpful error message is shown
  • Run against a non-dotbot directory — verify target validation error
  • After packaging, run dotbot init -Force in a fresh project — verify round-trip works
  • Verify workspace content (tasks, ADRs, sessions) is NOT included in package

Added package.ps1 to .bot for packaging framework files back to the dotbot source repo. Updated install-global.ps1 to introduce a 'package' CLI command, help text, and Invoke-Package function to run the packaging script. Supports optional archive creation and IDE sync.
@andresharpe
Copy link
Owner

I do this differently and a bit safer.

Here is my workflow.

  1. I start claude code up in ~/repos/dotbot-v3
  2. I tell it that i am testing dotbot-v3 and my target folder that i installed dotbot into is ~/repos/
    2b. I optionally ask it to scan all *.jsonl logs in ~/repos//.bot/ and subfolders and find recurring problems
  3. That i must make all changes in ~/repos/dotbot-v3
  4. It must then at end "cycle" dotbot:
  • cd ~/repos/dotbot-v3 && pwsh tests/Run-Tests.ps1
  • cd ~/repos/dotbot-v3 && pwsh install.ps1
  • cd ~/repos/ && dotbot init -Profile -Force
  1. After the integration test I then do a pull request for changes in ~/repos/dotbot-v3/

this ensures no project specific edits corrupt the main dotbot-v3 repo and makes the changes one way from dotbot to any project..

@ap-cbilgin ap-cbilgin closed this Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants