Skip to content

feat: integrate arkor versioning into scaffolding and configuration#29

Draft
k-taro56 wants to merge 1 commit intomainfrom
eng-426
Draft

feat: integrate arkor versioning into scaffolding and configuration#29
k-taro56 wants to merge 1 commit intomainfrom
eng-426

Conversation

@k-taro56
Copy link
Copy Markdown
Contributor

  • Replaced the hardcoded scaffold version ^0.0.1-alpha.0 with a shared PINNED_ARKOR_VERSION constant that uses __ARKOR_VERSION__ when injected at bundle time, and otherwise falls back to ^0.0.1-alpha.0.​

  • Applied that constant in both package.json write paths:

    1. new package.json creation
    2. existing package.json patching.​
  • Added version define injection in packages/arkor/tsdown.config.ts:
    define: { __ARKOR_VERSION__: JSON.stringify(pkg.version) }.​

  • Added the same version define injection in packages/create-arkor/tsdown.config.ts.​

  • Updated scaffold tests to compute expected pinned version dynamically from packages/arkor/package.json instead of using a hardcoded string

- Updated `tsdown.config.ts` in both `arkor` and `create-arkor` to define `__ARKOR_VERSION__` from `package.json`.
- Modified `scaffold.ts` to use the defined version for `arkor` in `devDependencies`, ensuring consistent versioning across scaffolding.
- Enhanced tests in `scaffold.test.ts` to dynamically reference the `arkor` version, improving maintainability and accuracy.
@k-taro56 k-taro56 self-assigned this Apr 28, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 28, 2026

Greptile Summary

This PR replaces the hardcoded ^0.0.1-alpha.0 scaffold version with a PINNED_ARKOR_VERSION constant that is injected at bundle time via __ARKOR_VERSION__ defines in both tsdown.config.ts files, and updates tests to read the expected version dynamically.

  • packages/create-arkor/tsdown.config.ts injects create-arkor's own package.json version as __ARKOR_VERSION__, but this constant is used to pin the arkor package in scaffolded projects. If the two packages publish different versions, npx create-arkor will write the wrong arkor version into new projects. The fix is to import from ../arkor/package.json instead of ./package.json.

Confidence Score: 4/5

Not safe to merge as-is — create-arkor will scaffold the wrong arkor version once the two packages diverge.

One P1 logic bug: packages/create-arkor/tsdown.config.ts uses create-arkor's own version to populate __ARKOR_VERSION__, but the constant is meant to pin the arkor package. Both are 0.0.1-alpha.0 today so it is latent, but the fix is a one-line import change and should land before the packages ever publish different versions.

packages/create-arkor/tsdown.config.ts — must import from ../arkor/package.json rather than ./package.json

Important Files Changed

Filename Overview
packages/arkor/tsdown.config.ts Correctly injects arkor's own package.json version as __ARKOR_VERSION__ at bundle time.
packages/create-arkor/tsdown.config.ts Injects create-arkor's own version as __ARKOR_VERSION__, but the constant is used to pin the arkor package — a different package. Will produce wrong dependency versions in scaffolded projects if the two packages diverge.
packages/cli-internal/src/scaffold.ts Cleanly uses declare const __ARKOR_VERSION__ with a runtime typeof guard and a sensible fallback; both package.json write paths updated correctly.
packages/cli-internal/src/scaffold.test.ts Reads arkor/package.json at test time to compute the expected pinned version, which is correct for the arkor build context but does not cover the create-arkor build path (where a different version is injected).

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["packages/arkor/package.json\n(version: X.Y.Z)"] -->|imported by| B["packages/arkor/tsdown.config.ts\ndefine: __ARKOR_VERSION__ = X.Y.Z ✅"]
    C["packages/create-arkor/package.json\n(version: A.B.C)"] -->|imported by| D["packages/create-arkor/tsdown.config.ts\ndefine: __ARKOR_VERSION__ = A.B.C ⚠️"]
    B --> E["@arkor/cli-internal bundle\n(via alwaysBundle)"]
    D --> F["@arkor/cli-internal bundle\n(via alwaysBundle)"]
    E --> G["scaffold.ts → PINNED_ARKOR_VERSION = '^X.Y.Z'\nscaffolded package.json: arkor@'^X.Y.Z' ✅"]
    F --> H["scaffold.ts → PINNED_ARKOR_VERSION = '^A.B.C'\nscaffolded package.json: arkor@'^A.B.C' ⚠️ wrong if A.B.C ≠ X.Y.Z"]
Loading

Fix All in Claude Code

Reviews (1): Last reviewed commit: "feat: integrate arkor versioning into sc..." | Re-trigger Greptile

Comment on lines 15 to +17
alwaysBundle: ["@arkor/cli-internal"],
},
define: {
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 Wrong version source for __ARKOR_VERSION__

create-arkor injects its own version field, but scaffold.ts uses __ARKOR_VERSION__ to pin the arkor package in the user's scaffolded package.json. If arkor and create-arkor ever publish different version numbers, npx create-arkor will write the wrong version of arkor into new projects. The test in scaffold.test.ts always reads from packages/arkor/package.json, which masks this mismatch — both are 0.0.1-alpha.0 today, so the bug is latent.

The define should reference arkor's package.json:

import pkg from "../arkor/package.json" with { type: "json" };
Suggested change
alwaysBundle: ["@arkor/cli-internal"],
},
define: {
import pkg from "../arkor/package.json" with { type: "json" };

Fix in Claude Code

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: d0392c89cb

ℹ️ 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".

alwaysBundle: ["@arkor/cli-internal"],
},
define: {
__ARKOR_VERSION__: JSON.stringify(pkg.version),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Inject arkor version into create-arkor bundle

This define currently injects create-arkor’s own package version, but scaffold.ts uses __ARKOR_VERSION__ to pin the generated project's devDependencies.arkor. If create-arkor is ever released without an identical arkor version, scaffolds will pin to a non-existent or wrong arkor semver and installs can fail; the pinned value should come from packages/arkor/package.json instead.

Useful? React with 👍 / 👎.

@k-taro56 k-taro56 marked this pull request as draft April 28, 2026 08:02
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