Skip to content

[PF-25] Fix planforge model when installed via npm and remove @planforge/core dependency - #39

Merged
chucoding merged 3 commits into
developfrom
bugfix/PF-25_core
Mar 15, 2026
Merged

[PF-25] Fix planforge model when installed via npm and remove @planforge/core dependency#39
chucoding merged 3 commits into
developfrom
bugfix/PF-25_core

Conversation

@chucoding

Copy link
Copy Markdown
Owner

Purpose

Fix planforge model (and plan/implement prompts) failing after global npm install because core assets were missing, and remove the @planforge/core dependency so the CLI relies only on the bundled copy.

Description

  • Problem: After npm install -g planforge, planforge model failed with Cannot find module '@planforge/core/package.json'. Prompts for plan/implement also depend on core; the CLI resolved them via require.resolve('@planforge/core/package.json'), and @planforge/core is not installed in the global install (it was "file:../core").

  • Fix (core bundle)

    • packages/cli-js/scripts/copy-core.js (new): At build time, copies packages/core/prompts and packages/core/models.json into packages/cli-js/core/.
    • packages/cli-js/src/utils/paths.ts: Added getCoreRoot() returning resolve(__dirname, "..", "..", "core") so prompts and models.json are always read from the package’s bundled core/.
    • packages/cli-js/package.json: Added "core" to files and added copy-core.js to the build script so the published package includes core assets.
  • Dependency cleanup

    • Removed "@planforge/core": "file:../core" from packages/cli-js/package.json. The CLI no longer depends on the core package; it only uses the bundled copy under packages/cli-js/core/ (filled by copy-core.js at build).
    • paths.ts: Removed createRequire and require; getCoreRoot() no longer uses require.resolve, only the path above.
    • model.ts: Error message when models.json is missing updated to: "Run pnpm run build in cli-js or reinstall planforge."
  • Docs

    • Notion “프로젝트 구조” page: Section 6 updated to describe core bundle, copy script, and that cli-js does not depend on @planforge/core.

How to test

  1. In repo: cd packages/cli-js && pnpm run build. Confirm packages/cli-js/core/ exists with prompts/ and models.json.
  2. From another directory: npm install -g <path-to-repo>/packages/cli-js (or publish and npm i -g planforge). Run planforge model and confirm it runs without "Cannot find module" and shows the model catalog.
  3. Run planforge plan "test" or planforge implement "test" (with providers set up) and confirm prompts load (no core resolution errors).
  4. After removing the dependency, pnpm install in the repo and run planforge model from packages/cli-js after build; behavior should be unchanged.

Review Requirement

  • Confirm that no code or script still assumes @planforge/core is in node_modules (only paths.ts and package.json were changed for this).
  • Confirm build order: copy-core.js runs after tsc so core/ exists before pack/publish.

Additional Info

  • Related Notion: 프로젝트 구조 (Section 6: core bundle and dependency removal).
  • Publish a new version after merge so global installs get the fix.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@chucoding chucoding self-assigned this Mar 15, 2026
@chucoding chucoding added the bug Something isn't working label Mar 15, 2026
@chucoding
chucoding merged commit a59da2b into develop Mar 15, 2026
2 checks passed
@chucoding
chucoding deleted the bugfix/PF-25_core branch March 15, 2026 05:46
chucoding added a commit that referenced this pull request Mar 15, 2026
* [PF-25] Fix planforge model when installed via npm and remove @planforge/core dependency (#39)

* fix : add copy core script (no more use monorepo)

* refactor : remove dependency @planforge/core

* refactor : remove dependency @planforge/core

* [PF-25] Fix planforge model when installed via npm and remove @planforge/core dependency (#40)

* fix : add copy core script (no more use monorepo)

* refactor : remove dependency @planforge/core

* refactor : remove dependency @planforge/core

* release : v0.1.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant