Skip to content

Generalize ccc-dev/ into multi-repo fork management tool#20

Merged
phroi merged 5 commits intomasterfrom
fork-management
Feb 25, 2026
Merged

Generalize ccc-dev/ into multi-repo fork management tool#20
phroi merged 5 commits intomasterfrom
fork-management

Conversation

@phroi
Copy link
Member

@phroi phroi commented Feb 24, 2026

Why

The ccc-dev/ directory hardcoded CCC-specific logic into the fork management scripts, making it impossible to fork additional external repos without duplicating the entire setup. This extracts generic fork management into fork-scripts/ so any external repo can be forked using the same deterministic record/replay mechanism.

Changes

  • fork-scripts/: generic framework with shared lib.sh, record/replay/save/status/clean/reset/push/patch/tsgo-filter scripts
  • ccc-fork/: CCC-specific config.json and pins (manifest + counted conflict resolutions)
  • .pnpmfile.cjs: auto-detects *-fork/config.json for workspace dependency rewiring
  • pnpm-workspace.yaml: dynamic fork workspace inclusion
  • Root package.json: fork:* scripts accept any fork directory as argument
  • Per-package build scripts updated to use fork-scripts/tsgo-filter.sh
  • Deleted old ccc-dev/ directory

@gemini-code-assist
Copy link

Summary of Changes

Hello @phroi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's ability to manage external repository forks by generalizing the previously hardcoded CCC-specific logic. It introduces a flexible, multi-repository fork management system, allowing for easier integration and development with various external projects. The changes streamline the development workflow by providing a unified set of tools and configurations for handling cloned repositories, their dependencies, and local modifications.

Highlights

  • Generalized Fork Management: The previous ccc-dev/ directory, which hardcoded CCC-specific logic, has been refactored into a generic fork-scripts/ system and a *-fork/ directory structure, enabling management of multiple external repositories.
  • New fork-scripts/ Utility: A new fork-scripts/ directory was introduced, containing generic shell scripts for managing forks, including record, replay, save, status, clean, reset, push, patch, and tsgo-filter operations.
  • Dynamic Workspace Integration: The .pnpmfile.cjs and pnpm-workspace.yaml files were updated to dynamically discover and include *-fork/ directories, allowing for automatic dependency rewiring and workspace inclusion for any configured fork.
  • CCC-Specific Configuration: A new ccc-fork/ directory was created, containing config.json and pins/ files to manage the CCC repository specifically, leveraging the new generic fork-scripts/.
  • Updated Build and Linting Scripts: All package-level build scripts and root-level pnpm commands were updated to utilize the new generic fork-scripts/tsgo-filter.sh and fork: prefixed commands, replacing the old ccc: specific commands.
Changelog
  • .changeset/generalize-fork-management.md
    • Added a new changeset file for the generalization of fork management.
  • .pnpmfile.cjs
    • Updated the pnpmfile to discover multiple fork directories and generalize dependency overrides, replacing CCC-specific logic with a dynamic fork detection mechanism.
  • AGENTS.md
    • Updated documentation to reflect the new generic fork management system, including fork-scripts/ and *-fork/ structures, and new pnpm commands.
  • README.md
    • Updated development instructions and pnpm commands to refer to the new generic fork management system and ccc-fork/README.md.
  • apps/faucet/package.json
    • Updated the build script to use the generic fork-scripts/tsgo-filter.sh.
  • apps/interface/package.json
    • Updated the build script to use the generic fork-scripts/tsgo-filter.sh.
  • apps/interface/vite.config.ts
    • Updated Vite configuration to dynamically detect and exclude generic fork source paths for Babel and Rollup, replacing the hardcoded ccc-dev/ccc path.
  • apps/sampler/package.json
    • Updated the build script to use the generic fork-scripts/tsgo-filter.sh.
  • ccc-dev/README.md
    • Removed the old CCC local development README file.
  • ccc-dev/pins/HEAD
    • Removed the old CCC pins HEAD file.
  • ccc-dev/pins/REFS
    • Removed the old CCC pins REFS file.
  • ccc-dev/pins/resolutions/3/packages/core/src/ckb/transactionErrors.ts
    • Removed the old CCC conflict resolution file.
  • ccc-dev/pins/resolutions/3/vitest.config.mts
    • Removed the old CCC conflict resolution file.
  • ccc-dev/record.sh
    • Removed the old CCC-specific record script.
  • ccc-dev/replay.sh
    • Removed the old CCC-specific replay script.
  • ccc-dev/status.sh
    • Removed the old CCC-specific status script.
  • ccc-dev/tsgo-filter.sh
    • Removed the old CCC-specific tsgo filter script.
  • ccc-fork/.gitignore
    • Renamed ccc-dev/.gitignore to ccc-fork/.gitignore and adapted its content.
  • ccc-fork/README.md
    • Added ccc-fork/README.md providing documentation for the CCC-specific fork within the new generic system.
  • ccc-fork/config.json
    • Added ccc-fork/config.json to configure the CCC fork, including upstream URL, fork URL, refs, clone directory, and workspace settings.
  • ccc-fork/pins/HEAD
    • Added ccc-fork/pins/HEAD to store the expected final SHA after full replay for the CCC fork.
  • ccc-fork/pins/manifest
    • Added ccc-fork/pins/manifest to store base SHA and merge refs for the CCC fork.
  • ccc-fork/pins/res-2.resolution
    • Added ccc-fork/pins/res-2.resolution containing conflict resolutions for merge step 2 of the CCC fork.
  • ccc-fork/pins/res-4.resolution
    • Added ccc-fork/pins/res-4.resolution containing conflict resolutions for merge step 4 of the CCC fork.
  • fork-scripts/clean-all.sh
    • Added fork-scripts/clean-all.sh to remove all managed fork clones.
  • fork-scripts/clean.sh
    • Added fork-scripts/clean.sh to remove a specific fork clone after verification.
  • fork-scripts/lib.sh
    • Added fork-scripts/lib.sh containing shared helper functions for fork management scripts.
  • fork-scripts/patch.sh
    • Renamed ccc-dev/patch.sh to fork-scripts/patch.sh and generalized it to patch any cloned repository for source-level type resolution.
  • fork-scripts/push.sh
    • Renamed ccc-dev/push.sh to fork-scripts/push.sh and generalized it to cherry-pick commits for any fork.
  • fork-scripts/record.sh
    • Added fork-scripts/record.sh to record pins for any managed fork, including AI-assisted conflict resolution.
  • fork-scripts/replay-all.sh
    • Added fork-scripts/replay-all.sh to replay all managed fork directories from their pins.
  • fork-scripts/replay.sh
    • Added fork-scripts/replay.sh to deterministically replay a fork from its manifest, resolutions, and local patches.
  • fork-scripts/reset.sh
    • Added fork-scripts/reset.sh to remove a fork clone and its pins.
  • fork-scripts/save.sh
    • Added fork-scripts/save.sh to capture local work in a fork clone as a patch file.
  • fork-scripts/status-all.sh
    • Added fork-scripts/status-all.sh to check the status of all managed fork directories.
  • fork-scripts/status.sh
    • Added fork-scripts/status.sh to check whether a fork clone is safe to wipe.
  • fork-scripts/tsgo-filter.sh
    • Added fork-scripts/tsgo-filter.sh to filter diagnostics from managed fork source files during tsgo checks.
  • package.json
    • Updated pnpm scripts to use the new fork-scripts and removed ccc: specific commands, and updated the packageManager version.
  • packages/core/package.json
    • Updated the build script to use the generic fork-scripts/tsgo-filter.sh.
  • packages/dao/package.json
    • Updated the build script to use the generic fork-scripts/tsgo-filter.sh.
  • packages/order/package.json
    • Updated the build script to use the generic fork-scripts/tsgo-filter.sh.
  • packages/sdk/package.json
    • Updated the build script to use the generic fork-scripts/tsgo-filter.sh.
  • packages/utils/package.json
    • Updated the build script to use the generic fork-scripts/tsgo-filter.sh.
  • pnpm-lock.yaml
    • Updated the pnpm-lock.yaml checksum and adjusted dependency paths from ccc-dev/ccc to ccc-fork/ccc.
  • pnpm-workspace.yaml
    • Updated workspace paths from ccc-dev/ccc/packages/* to ccc-fork/ccc/packages/* for dynamic fork inclusion.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully generalizes the fork management system from a single-repo setup (ccc-dev/) to a more flexible multi-repo one (fork-scripts/ and *-fork/). The changes are extensive, touching configuration files, build scripts, and documentation. The new shell scripts in fork-scripts/ are well-structured and robust, especially the deterministic replay and conflict resolution mechanisms. However, I've identified a few areas for improvement: a potential for silent failures in the Vite configuration, inconsistencies in the README.md documentation regarding the new script commands, and a discrepancy between the stated goal of dynamic workspace inclusion and the hardcoded implementation in pnpm-workspace.yaml.

@phroi
Copy link
Member Author

phroi commented Feb 24, 2026

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is an excellent and significant refactoring that successfully generalizes the CCC-specific fork management into a generic, multi-repo tool. The new fork-scripts/ and *-fork/ structure is well-designed. The shell scripts are robust, with great attention to detail for ensuring deterministic builds, especially in the record.sh and replay.sh scripts. The dynamic discovery of forks in .pnpmfile.cjs and the centralized logic in tsgo-filter.sh are major improvements that simplify package configurations. My main feedback is a suggestion to further improve maintainability by automating the updates to pnpm-workspace.yaml.

Introduce fork-scripts/ with shared tooling for managing external repo
forks via a deterministic record/replay mechanism:

- lib.sh: shared functions (config parsing, safety checks, git helpers)
- record.sh / replay.sh: capture and reproduce merge + resolution state
- save.sh: persist local work as patches in pins/
- status.sh / status-all.sh: check fork clone state against pins
- clean.sh / clean-all.sh: remove fork clones safely
- reset.sh: wipe and rebuild a fork clone from pins
- push.sh: cherry-pick local commits onto a PR branch
- patch.sh: rewrite fork package exports to .ts source
- tsgo-filter.sh: suppress fork diagnostics from tsgo output
Set up ccc-fork/ as the first consumer of the fork-scripts/ framework:

- config.json: upstream/fork URLs, merge refs (PR #316, #328), clone dir
- pins/manifest: base SHA + merge refs for deterministic replay
- pins/HEAD: expected final SHA after full replay
- pins/res-{2,4}.resolution: counted conflict resolutions for merge steps
- .gitignore: exclude the ccc/ clone directory
- README.md: usage documentation for the CCC fork workflow
Update .pnpmfile.cjs to scan all *-fork/config.json directories and
silently rewrite matching dependencies to workspace:* when clones exist.
Update pnpm-workspace.yaml with fork workspace entries derived from
ccc-fork/config.json (cloneDir + workspace include/exclude).
- Root package.json: add fork:* scripts that accept any fork directory
- Per-package build scripts: use fork-scripts/tsgo-filter.sh
- apps/interface/vite.config.ts: update fork path references
- Regenerate pnpm-lock.yaml
- AGENTS.md: document fork-scripts/ workflow and per-fork structure
- README.md: update developer script examples for fork:* format
- Delete ccc-dev/: replaced by fork-scripts/ + ccc-fork/
@phroi
Copy link
Member Author

phroi commented Feb 25, 2026

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully generalizes the ccc-dev/ directory into a multi-repo fork management tool. The new fork-scripts/ and *-fork/ structure is well-designed and allows managing multiple external repositories with the same deterministic record/replay mechanism. The changes are extensive, touching configuration, scripts, and documentation, and they are all consistent with the goal of generalization. The new shell scripts are robust, with features like tiered AI-assisted conflict resolution, deterministic builds, and dynamic workspace configuration. I have one suggestion to improve maintainability by reducing code duplication.

@phroi
Copy link
Member Author

phroi commented Feb 25, 2026

LGTM

Phroi %393

@phroi phroi merged commit 14e1c87 into master Feb 25, 2026
2 checks passed
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.

1 participant