Skip to content

Unify host app home to ~/sciclaw and add migrate --unify#118

Draft
drpedapati wants to merge 1 commit intomainfrom
codex/migrate-config-from-.picoclaw-to-sciclaw
Draft

Unify host app home to ~/sciclaw and add migrate --unify#118
drpedapati wants to merge 1 commit intomainfrom
codex/migrate-config-from-.picoclaw-to-sciclaw

Conversation

@drpedapati
Copy link
Copy Markdown
Owner

Motivation

  • Replace the split legacy layout (~/.picoclaw + ~/sciclaw) with a single, visible host root ~/sciclaw to simplify user mental model and backups.
  • Eliminate many ad-hoc home-path computations and TOCTOU races by centralizing resolution and caching the result.
  • Provide a safe, explicit migration path for existing installs that preserves data and avoids skill-name collisions.

Description

  • Add a new package pkg/paths that exposes a cached AppHome() and helpers: ConfigPath(), AuthPath(), BackupsDir(), TemplatesDir(), and GlobalSkillsDir(); it respects SCICLAW_HOME, falls back to legacy ~/.picoclaw only when appropriate, and includes ResetForTest().
  • Rewire host-side call sites to use pkg/paths (gateway, local executor, auth store, models, snapshot, doctor, launchd service, backup, env/docker helpers, templates, venv candidates, etc.).
  • Implement migrate --unify in pkg/migrate and CLI wiring to plan and execute moving files/dirs from ~/.picoclaw into ~/sciclaw, rename skills/global-skills/, rewrite legacy workspace entries in the migrated config, remove the old directory, and create a symlink ~/.picoclaw -> ~/sciclaw (supports --dry-run and --force).
  • Update doctor checks to detect split/symlinked state and warn when both configs exist or legacy dir is present but not symlinked.
  • Adjust onboarding/defaults, infra, and docs to reference ~/sciclaw (Dockerfile, docker-compose.yml, Makefile, README, docs, skill docs).
  • Add unit tests for pkg/paths and small helpers used by migration and update code to preserve VM-local /home/ubuntu/.picoclaw behavior where applicable.

Testing

  • Ran go test ./pkg/paths -v and all pkg/paths tests passed.
  • Ran go test ./pkg/migrate and pkg/migrate tests passed.
  • Ran go build ./... successfully to verify the whole repository compiles after changes.

Codex Task

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 27, 2026

Deploying sciclaw with  Cloudflare Pages  Cloudflare Pages

Latest commit: e106d88
Status: ✅  Deploy successful!
Preview URL: https://f9d5ecbd.sciclaw.pages.dev
Branch Preview URL: https://codex-migrate-config-from--p.sciclaw.pages.dev

View logs

@drpedapati
Copy link
Copy Markdown
Owner Author

@codex please review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e106d88cce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/migrate/migrate.go
Comment on lines +203 to +205
case ActionRemoveDir:
if err := os.RemoveAll(action.Source); err != nil {
result.Errors = append(result.Errors, err)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop unify cleanup after any migration error

The --unify executor continues into ActionRemoveDir even after earlier ActionMoveFile/ActionMoveDir failures are recorded, so a partial-copy failure (e.g., permission denied or disk-full) can still trigger os.RemoveAll(~/.picoclaw) and destroy the only intact source data. This should short-circuit cleanup/symlink creation when any prior action has failed to prevent irreversible data loss in failed migrations.

Useful? React with 👍 / 👎.

Comment thread pkg/migrate/migrate.go
Comment on lines +139 to +143
dirs := []struct{ from, to string }{
{"backups", "backups"},
{"templates", "templates"},
{"skills", "global-skills"},
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Migrate legacy workspace directory during --unify

The unify plan only moves backups, templates, and skills, but the same flow rewrites configs containing ~/.picoclaw/workspace to ~/sciclaw (rewriteUnifiedConfigPath) and then deletes the entire legacy directory. On installs where the real workspace is still under ~/.picoclaw/workspace, this drops workspace files and repoints users to an empty path. Add workspace migration (or skip rewrite/removal when legacy workspace exists) before removing the old root.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant