Skip to content

refactor: extract bundled Jujutsu provider - #1002

Open
benvinegar wants to merge 1 commit into
refactor/package-first-phase-2-gitfrom
refactor/package-first-phase-2-jj
Open

refactor: extract bundled Jujutsu provider#1002
benvinegar wants to merge 1 commit into
refactor/package-first-phase-2-gitfrom
refactor/package-first-phase-2-jj

Conversation

@benvinegar

@benvinegar benvinegar commented Sep 6, 2026

Copy link
Copy Markdown
Member

Summary

  • move the bundled Jujutsu provider into private workspace packages/hunk-jj (@hunk/jj)
  • preserve JJ adapter operations, exact source loading, history, detection, and watch behavior
  • retain the existing bundled-provider order and activation semantics
  • add isolated package and boundary coverage

Validation

  • focused JJ and architecture tests
  • typecheck, Knip, dependency boundaries
  • npm build and pack validation

This is PR 3 of 4 and is stacked on the Git provider extraction.

This PR description was generated by Pi using GPT-5.6 Sol

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
hunk-web Ignored Ignored Preview Sep 6, 2026 5:12am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extracts the bundled Jujutsu VCS provider into the private @hunk/jj workspace package and updates build, dependency-boundary, lockfile, TypeScript, and test configuration accordingly. The production bundling arrangement follows the existing private @hunk/git package pattern, but the newly added isolated-consumer test cannot resolve the provider’s hunkdiff/extension host dependency.

  • Moves the unchanged Jujutsu implementation and colocated unit tests into packages/hunk-jj.
  • Imports the bundled provider through @hunk/jj.
  • Adds workspace, Nix, dependency-cruiser, Knip, and source-boundary configuration.
  • Adds a package-boundary smoke test that currently fails during module loading.

Confidence Score: 4/5

The PR is not safe to merge until the newly added Jujutsu package smoke test can load its isolated consumer successfully.

The extraction’s production bundling and workspace registration are consistent with the existing Git-provider pattern, but the new test deterministically launches an environment without hunkdiff/extension, causing the root test suite to fail.

Files Needing Attention: scripts/hunk-jj-package.test.ts

Important Files Changed

Filename Overview
packages/hunk-jj/src/index.ts Moves the unchanged Jujutsu adapter into a private package that consumes the public extension contract and shared VCS leaves.
packages/hunk/src/extensions/default/vcs/index.ts Replaces the local Jujutsu import with the new bundled workspace package.
packages/hunk-jj/package.json Defines the private source-exporting Jujutsu package and its explicit @hunk/vcs dependency.
scripts/hunk-jj-package.test.ts Adds package-boundary assertions, but its isolated consumer omits the required hunkdiff/extension host module and fails.
scripts/source-boundaries.test.ts Extends provider-boundary checks to the extracted Jujutsu package and permits its bundled import from Hunk.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    H[Hunk bundled VCS entry] --> JJ["@hunk/jj"]
    JJ --> VCS["@hunk/vcs leaves"]
    JJ --> API["hunkdiff/extension host contract"]
    Build[Production Bun build] -->|bundles| H
    Test[Isolated smoke-test consumer] --> JJ
    Test --> VCS
    Test -. missing .-> API
Loading
Prompt To Fix All With AI
### Issue 1
scripts/hunk-jj-package.test.ts:58-63
**Isolated Consumer Cannot Load**

This test installs only `@hunk/jj` and `@hunk/vcs`, but importing `@hunk/jj` also loads `hunkdiff/extension`. Because that module is absent from the isolated consumer, the spawned process exits with `Cannot find module 'hunkdiff/extension'`, causing the default test suite to fail. This violates the repository requirement that the test suite pass; the fixture must provide the host contract or exercise the package in its intended bundled environment.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "refactor: extract bundled Jujutsu provid..." | Re-trigger Greptile

Comment on lines +58 to +63
cpSync(PACKAGE_ROOT, join(consumerRoot, "node_modules", "@hunk", "jj"), {
recursive: true,
});
cpSync(VCS_PACKAGE_ROOT, join(consumerRoot, "node_modules", "@hunk", "vcs"), {
recursive: true,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Isolated Consumer Cannot Load

This test installs only @hunk/jj and @hunk/vcs, but importing @hunk/jj also loads hunkdiff/extension. Because that module is absent from the isolated consumer, the spawned process exits with Cannot find module 'hunkdiff/extension', causing the default test suite to fail. This violates the repository requirement that the test suite pass; the fixture must provide the host contract or exercise the package in its intended bundled environment.

Context Used: guidelines.mdc Cursor rule (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/hunk-jj-package.test.ts
Line: 58-63

Comment:
**Isolated Consumer Cannot Load**

This test installs only `@hunk/jj` and `@hunk/vcs`, but importing `@hunk/jj` also loads `hunkdiff/extension`. Because that module is absent from the isolated consumer, the spawned process exits with `Cannot find module 'hunkdiff/extension'`, causing the default test suite to fail. This violates the repository requirement that the test suite pass; the fixture must provide the host contract or exercise the package in its intended bundled environment.

**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@benvinegar
benvinegar force-pushed the refactor/package-first-phase-2-jj branch from 83e8424 to 362cb78 Compare September 6, 2026 05:12
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