Skip to content

feat: v1.0.0 revamp Turborepo, Bun bundler, unified output, CI automation#65

Merged
GiovaniGuizzo merged 18 commits into
KiiChain:mainfrom
isonnymichael:feat/v1-revamp
Apr 17, 2026
Merged

feat: v1.0.0 revamp Turborepo, Bun bundler, unified output, CI automation#65
GiovaniGuizzo merged 18 commits into
KiiChain:mainfrom
isonnymichael:feat/v1-revamp

Conversation

@isonnymichael

Copy link
Copy Markdown
Contributor

PR Description

Summary

Comprehensive overhaul of the SDK build infrastructure addressing all 7 items from #56:

  • Monorepo: Replaced Lerna with Turborepo for faster, cached task orchestration
  • Bundling: Adopted Bun as the bundler for all packages (ESM + CJS), with tsc for type declarations only
  • Output: Unified dist/esm, dist/cjs, dist/types structure with proper exports maps in every package
  • Linting: Enhanced ESLint config with import sorting and unused import detection
  • Formatting: Prettier enforcement via format:check in CI
  • Release: Consolidated 5 publish workflows into one tag-triggered publish.yml
  • Tests: Fixed jest module resolution (npxyarn), skipped unimplemented evidence test

Changes by commit

  1. build: replace Lerna with Turborepo for monorepo management
  2. build: adopt Bun bundler with unified CJS/ESM/types output structure
  3. build: enforce linting and formatting standards
  4. test: fix test runner and skip broken evidence test
  5. ci: consolidate release automation with tag-triggered publishing

Test results

Package Tests Status
rwa 37 All pass
utils 3 All pass
evm 30 28 pass, 2 skipped (evidence module not implemented)
proto 5 Fail — requires TEST_MNEMONIC env (integration tests, unchanged behavior)

Notes

  • Proto test failures are pre-existing — these are integration tests that require testnet secrets configured in CI
  • evidence.test.ts was skipped (not deleted) since src/ethers/evidencePrecompile.ts was never created
  • Bun is required as a global install or via oven-sh/setup-bun in CI

Test plan

  • Verify yarn build completes for all 5 packages
  • Verify yarn test passes for rwa, utils, evm
  • Verify CI lint workflow runs format:check correctly
  • Verify tag push triggers the unified publish workflow
  • Verify published packages resolve correctly with both import and require

Closes #56

isonnymichael and others added 5 commits April 14, 2026 13:52
Migrates from Lerna v6 to Turborepo v2 for faster, cached task
orchestration while keeping Yarn workspaces for dependency management.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces per-package tsc builds with a shared Bun build script that
produces dist/esm, dist/cjs, and dist/types for all packages. Adds
proper exports maps to each package.json for dual CJS/ESM resolution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds simple-import-sort and unused-imports plugins to ESLint config.
Standardizes lint scripts across all packages and updates root scripts
for format checking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Changes npx jest to yarn jest across all packages to fix module
resolution in Yarn workspaces. Skips evidence.test.ts since the
evidencePrecompile module was never implemented.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces 5 separate publish-*.yml workflows with a single publish.yml
that builds, tests, and publishes all packages on tag push. Updates
test and lint workflows to use Bun for building.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@isonnymichael isonnymichael requested a review from Thaleszh as a code owner April 14, 2026 07:47
@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@isonnymichael has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 28 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 52 minutes and 28 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5dc58f09-7499-4448-80eb-a4beb1d1a50a

📥 Commits

Reviewing files that changed from the base of the PR and between 6ad1de6 and b738bb7.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • .github/workflows/publish.yml
  • package.json
  • packages/rwa/tsconfig.json
  • scripts/tsconfig.json

Walkthrough

The pull request implements a comprehensive v1.0.0 restructuring of the monorepo. Key changes include: replacing Lerna with Turbo for orchestration, introducing Bun as the bundler via a new shared build script, consolidating five separate publish workflows into a single unified publish workflow, updating all package.json files with proper ESM/CJS exports and file whitelists, adding ESLint plugins for import sorting and unused import detection, updating CI/CD workflows to use immutable installs and Bun setup, and deleting the Lerna configuration. Numerous import reordering and spacing adjustments are applied across EVM precompile files for consistency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: moving to v1.0.0 with Turborepo, Bun bundler, unified output structure, and CI automation improvements.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, covering all major changes including Lerna→Turborepo migration, Bun bundling, unified output, linting/formatting, CI consolidation, and test fixes.
Linked Issues check ✅ Passed The PR addresses all seven objectives from issue #56: (1) Bun bundler integrated via scripts/build.ts [#56], (2) unified dist/esm, dist/cjs, dist/types structure with exports maps [#56], (3) Turborepo adopted with turbo.json [#56], (4) ESLint enhanced with import sorting and unused imports [#56], (5) Prettier enforcement via format:check [#56], (6) five publish workflows consolidated into single publish.yml [#56], (7) Jest fixed and evidence test skipped [#56].
Out of Scope Changes check ✅ Passed All changes align with the seven objectives from #56. Minor formatting changes (blank lines in import sections) and configuration adjustments (tsconfig updates, .npmrc, .yarnrc.yml) are in-scope infrastructure improvements supporting the main objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/utils/package.json (1)

64-68: ⚠️ Potential issue | 🟡 Minor

Remove npm and ts-node from dependencies in packages/utils/package.json.

npm should never be a runtime dependency—it's the package manager itself. ts-node is a development tool and has no purpose in production code. These appear to be in the wrong section. Move ts-node to devDependencies if needed for local development, or remove both entirely since they're not used in the package's build scripts, source code, or tests.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/utils/package.json` around lines 64 - 68, Remove "npm" and "ts-node"
from the "dependencies" object in package.json for the packages/utils package;
delete both entries and, if "ts-node" is needed for local development only, add
it to "devDependencies" instead (do not add "npm" anywhere), ensuring only
runtime deps like "@kiichain/kiijs-proto" remain in "dependencies".
packages/rwa/package.json (1)

33-37: ⚠️ Potential issue | 🟠 Major

publishConfig.directory configuration breaks package resolution.

The "directory": "dist" setting tells npm to publish the dist/ directory's contents as the package root. However, the exports paths reference ./dist/esm/index.js, which would resolve to dist/dist/esm/index.js after publishing—a path that doesn't exist.

This issue is not unique to this package; identical misconfigurations exist in packages/proto/package.json and packages/lcd/package.json.

Recommended fix: Remove "directory": "dist" to publish from the package root (aligns with packages/utils/ and packages/evm/ patterns).

Suggested fix
   "publishConfig": {
     "access": "public",
-    "registry": "https://registry.npmjs.org",
-    "directory": "dist"
+    "registry": "https://registry.npmjs.org"
   },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/rwa/package.json` around lines 33 - 37, Remove the incorrect
publishConfig.directory entry that points to "dist" so npm will publish from the
package root; specifically edit the publishConfig block in
packages/rwa/package.json to delete the "directory": "dist" key (and apply the
same fix to packages/proto/package.json and packages/lcd/package.json) so the
package exports (e.g., paths referencing ./dist/esm/index.js) resolve correctly
after publishing.
🧹 Nitpick comments (10)
packages/rwa/tsconfig.json (1)

9-11: Stale comment: output is for type declarations, not JavaScript.

The comment says "Output directory for compiled JavaScript" but with Bun handling JS bundling to dist/esm and dist/cjs, this outDir is only used for type declarations. Consider updating the comment:

📝 Suggested comment fix
     "declaration": true, // Generate declaration files
-    "outDir": "./dist/types", // Output directory for compiled JavaScript
+    "outDir": "./dist/types", // Output directory for declaration files
     "rootDir": "./src" // Root directory of TypeScript source files
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/rwa/tsconfig.json` around lines 9 - 11, Update the stale comment
next to the tsconfig.json "outDir" setting to accurately reflect its purpose for
emitting TypeScript declaration files rather than compiled JavaScript; locate
the "declaration" and "outDir" entries in tsconfig.json and change the comment
"Output directory for compiled JavaScript" to something like "Output directory
for generated .d.ts type declarations (JS bundling handled by Bun to dist/esm
and dist/cjs)" so it correctly documents the role of outDir and its relationship
to declaration: true.
scripts/build.ts (2)

36-55: Consider adding error handling for build commands.

If bun build or tsc fails, execSync throws an error that may not provide clear context. Wrapping in try-catch with explicit error messages would improve debugging:

🛡️ Proposed error handling
+function runCommand(command: string, label: string) {
+  try {
+    execSync(command, { cwd, stdio: 'inherit' });
+  } catch (error) {
+    console.error(`Failed during: ${label}`);
+    process.exit(1);
+  }
+}

 // Build ESM with Bun
 console.log('  → ESM bundle');
-execSync(
+runCommand(
   `bun build ./src/index.ts --outdir ./dist/esm --target=node --format=esm --splitting --sourcemap=external ${externalFlags}`,
-  { cwd, stdio: 'inherit' },
+  'ESM bundle',
 );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/build.ts` around lines 36 - 55, Wrap each execSync invocation in
try-catch blocks around the three build steps (the ESM/CJS/Type declarations
sections that log "→ ESM bundle", "→ CJS bundle", and "→ Type declarations") so
failures are caught; on catch, call console.error (or processLogger if
available) with a clear message including which step failed (e.g., "Failed to
build ESM bundle"), include the caught error details (error.message and any
error.output/stderr if present), and then exit with a non‑zero status
(process.exit(1)) or rethrow to ensure the script fails deterministically.

12-14: Using require() in an ESM context.

The root package.json has "type": "module", making this file ESM. While Bun supports require() in ESM, this is non-standard. Consider using ESM-compatible imports for broader compatibility:

♻️ ESM-compatible alternative
-const cwd = process.cwd();
-const pkg = require(resolve(cwd, 'package.json'));
-const entrypoint = resolve(cwd, 'src/index.ts');
+import { readFileSync } from 'fs';
+
+const cwd = process.cwd();
+const pkg = JSON.parse(readFileSync(resolve(cwd, 'package.json'), 'utf-8'));
+const entrypoint = resolve(cwd, 'src/index.ts');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/build.ts` around lines 12 - 14, The file is ESM but uses
require(resolve(...)) to load package.json (pkg), which is non-standard; replace
that with an ESM-compatible approach such as using top-level await import for
JSON modules (e.g. await import(resolve(cwd, 'package.json'), { assert: { type:
'json' } }) and assign to pkg) or read and parse the file with
fs.readFileSync/JSON.parse(resolve(cwd, 'package.json')) instead; update the
code that references pkg, keep cwd and entrypoint as-is, and remove the
require(...) call so the script no longer relies on CommonJS require in an ESM
module.
eslint.config.js (2)

69-70: Note: scripts/* is excluded from linting.

The new scripts/build.ts won't be linted. If you want the build script to follow the same code quality standards, consider removing this ignore pattern or adding a separate config for scripts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@eslint.config.js` around lines 69 - 70, The ESLint ignore pattern 'scripts/*'
currently excludes your new build script from linting; remove the 'scripts/*'
entry from the ignore array (or replace it with a narrower pattern) in
eslint.config.js or add a separate ESLint config for scripts so
'scripts/build.ts' is included and follows project lint rules; search for the
ignore array containing 'scripts/*' and update it or add an overrides block
targeting 'scripts/*.ts' to enable linting for that file.

30-43: Consider the implications of disabling TypeScript safety rules.

Disabling @typescript-eslint/no-unsafe-assignment and @typescript-eslint/no-unsafe-call reduces type safety checks. If this is intentional to accommodate existing code patterns, consider adding a comment explaining the rationale.

The unused imports and import sorting rules are well-configured.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@eslint.config.js` around lines 30 - 43, The config currently turns off
TypeScript safety rules '@typescript-eslint/no-unsafe-assignment' and
'@typescript-eslint/no-unsafe-call' without explanation; add a brief comment
above those rule entries explaining the intentional rationale (e.g., legacy JS
interop, staged migration to stricter checks) or, better, replace the blanket
'off' with a targeted override or gradual strategy (enable in new/TS files or
use eslint overrides for specific directories/files) so the intent is documented
and maintainers know why these rules are relaxed.
package.json (1)

64-64: Consider pinning Turbo to a more specific version range.

"turbo": "^2" allows any 2.x version. For reproducible builds, consider a narrower range like "^2.0.0" or the specific version tested.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 64, Update the turbo dependency version string in
package.json to a narrower pinned range (e.g., replace "turbo": "^2" with a
specific tested version or a tighter range such as "turbo": "^2.0.0" or "turbo":
"2.12.0") so that builds are reproducible; locate the "turbo" entry in
package.json and modify its value to the chosen exact or constrained version and
then run your package manager (npm/yarn/pnpm) to refresh lockfile.
packages/evm/tests/evidence.test.ts (1)

4-5: Orphaned ESLint disable comment and unused timeout.

The @typescript-eslint/no-require-imports disable comment has no corresponding require() call in this file (likely leftover from removed imports). Additionally, jest.setTimeout(60_000) is unused since the tests are skipped and contain only synchronous assertions.

Consider removing both to reduce noise.

Suggested cleanup
 // Skipped: evidencePrecompile module has not been implemented yet.
 // Re-enable this test suite once src/ethers/evidencePrecompile.ts exists.

-// eslint-disable-next-line `@typescript-eslint/no-require-imports`
-jest.setTimeout(60_000);
-
 describe.skip('Evidence Precompile Tests', () => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/evm/tests/evidence.test.ts` around lines 4 - 5, Remove the orphaned
ESLint disable comment and the unused jest.setTimeout call: delete the leading
"// eslint-disable-next-line `@typescript-eslint/no-require-imports`" comment and
the "jest.setTimeout(60_000);" statement from the test file (referencing the
jest.setTimeout usage) since there is no require() and the tests are
skipped/synchronous, so both are dead/noise.
packages/evm/package.json (1)

55-56: Consider whether dotenv should be a peerDependency.

dotenv is typically a devDependency since it's used for local development/testing, not at runtime by library consumers. Requiring consumers to install it as a peer may be unnecessary unless the library's public API depends on it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/evm/package.json` around lines 55 - 56, The package currently lists
"dotenv" under peerDependencies; change this so consumers aren't forced to
install it unless the library actually requires dotenv at runtime. If dotenv is
only used for local development or tests, move "dotenv" from peerDependencies to
devDependencies in packages/evm/package.json (update the "peerDependencies"
block to remove "dotenv" and add it under "devDependencies"); if the library
truly relies on dotenv at runtime, instead document that requirement and keep it
as a regular dependency in "dependencies" rather than a peerDependency.
.github/workflows/publish.yml (1)

47-70: Sequential publish steps with no error isolation.

If any package fails to publish (e.g., version already exists, network issue), subsequent packages won't be published. This may be intentional for atomicity, but consider:

  1. Adding continue-on-error: true if partial publishes are acceptable
  2. Adding a pre-check step to verify versions don't exist on npm before attempting publish

Also, the publish order (proto → lcd → utils → evm → rwa) appears correct based on likely dependency relationships.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/publish.yml around lines 47 - 70, The publish steps for
the workflow (steps named "Publish `@kiichain/kiijs-proto`", "Publish
`@kiichain/kiijs-lcd`", "Publish `@kiichain/kiijs-utils`", "Publish
`@kiichain/kiijs-evm`", "Publish `@kiichain/kiijs-rwa`") run sequentially and will
abort the remaining publishes if one fails; update the workflow to either add
continue-on-error: true to the individual publish steps if partial publishes are
acceptable, or insert a pre-check step (e.g., a script that queries npm for the
package@version for each package under packages/proto, packages/lcd,
packages/utils, packages/evm, packages/rwa) and bail with a clear error before
attempting publishes so failures are isolated and reported cleanly.
.github/workflows/test.yml (1)

30-31: Redundant build step—Turbo already handles the dependency.

Per turbo.json, test:ci declares "dependsOn": ["build"], so Turbo will automatically run the build task before tests. The explicit yarn build step duplicates this work unless Turbo caching kicks in.

You can either:

  1. Remove this step and rely on Turbo's dependency graph (simpler, leverages caching).
  2. Keep it for explicitness but be aware of the minor overhead on cache misses.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/test.yml around lines 30 - 31, The GitHub Actions workflow
includes an explicit "Build packages" step that runs `yarn build`, which is
redundant because your Turbo pipeline declares `test:ci` with `"dependsOn":
["build"]` in `turbo.json`; remove the `- name: Build packages` / `run: yarn
build` step from the workflow so Turbo's `test:ci` dependency handles the build
(or if you intentionally want the extra step, keep it knowingly as a duplicate
and accept the overhead).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/lint.yml:
- Line 27: CI currently runs "yarn install" without enforcing lockfile
immutability; update the workflow step that runs the install (the run: yarn
install step) to enforce the lockfile by adding the appropriate flag for your
Yarn version: add --frozen-lockfile for Yarn Classic (v1) or --immutable for
Yarn Berry/v4 (or detect the project’s yarn version and use the matching flag)
so CI fails if the lockfile would change and keeps builds reproducible.

In @.github/workflows/publish.yml:
- Around line 40-45: The publish workflow's "Run tests" step currently runs yarn
test and injects TEST_MNEMONIC/TEST_PRIVATE_KEY/TEST_HEX_ADDRESS which causes
proto integration tests to fail if those GitHub secrets are not configured;
either add those secrets to Actions (TEST_MNEMONIC, TEST_PRIVATE_KEY,
TEST_HEX_ADDRESS) or change the step command from yarn test to a unit-only test
target (e.g., yarn test:unit or your CI-specific test script) so proto
integration tests are not executed during publish, or modify the proto tests to
skip when the TEST_MNEMONIC secret is absent (use a conditional describe.skip
based on process.env.TEST_MNEMONIC).

In @.github/workflows/test.yml:
- Line 28: Replace the plain "yarn install" CI step with an immutable install
that enforces the lockfile (i.e., add the --immutable flag to the yarn install
invocation) so the test workflow fails if the lockfile is out of sync, matching
the behavior used in lint.yml; update the existing "yarn install" step
accordingly to use the immutable install option.

In `@package.json`:
- Line 42: package.json defines a "codegen" script that runs "turbo run codegen"
but turbo.json has no "codegen" pipeline task; add a "codegen" entry to
turbo.json's "pipeline" section named "codegen" that runs the repository-level
code generation command used by your packages (the same command invoked by the
package.json "codegen" script), and configure sensible fields like "outputs"
(for generated artifacts) and "dependsOn" if it should run before/after other
tasks (e.g., build). This will ensure running npm run codegen triggers the turbo
task defined for code generation.

In `@packages/evm/tests/evidence.test.ts`:
- Around line 7-10: The file has an extra blank line after the describe.skip
declaration causing a Prettier violation; remove the empty line between
describe.skip('Evidence Precompile Tests', () => { and the first it('should get
all evidence with pagination', () => { so the it block sits directly beneath the
describe block start, preserving existing indentation and test contents in the
same file where describe.skip and the it function are defined.

In `@packages/lcd/package.json`:
- Around line 7-21: The package.json currently points "main" and the "require"
export to ./dist/cjs/index.js but the repository root declares "type": "module",
so Node treats .js under dist/cjs as ESM; fix by updating the build or
packaging: either emit the CommonJS bundle with a .cjs extension (so change the
CJS output from dist/cjs/index.js to dist/cjs/index.cjs and update "main" and
the "require" export accordingly) or have the build emit a dist/cjs/package.json
containing {"type":"commonjs"} alongside the generated CJS files so Node will
load them as CommonJS; update the build script that produces the CJS artifact
and the package.json "main"/"exports" entries to match the chosen approach
(refer to "main", "exports", and the dist/cjs folder).

In `@turbo.json`:
- Around line 16-21: Add a "codegen" task to turbo.json tasks: create a
"codegen" entry that declares outputs for the generated source dirs from the
packages that run codegen (referencing the package names proto, lcd, rwa and
their src/ directories) so Turbo can cache and track those artifacts; ensure the
task name matches the root package.json "codegen" script and include appropriate
outputs arrays listing each package's generated src (e.g., proto src, lcd src,
rwa src) so turbo will recognize and cache the generated files.

---

Outside diff comments:
In `@packages/rwa/package.json`:
- Around line 33-37: Remove the incorrect publishConfig.directory entry that
points to "dist" so npm will publish from the package root; specifically edit
the publishConfig block in packages/rwa/package.json to delete the "directory":
"dist" key (and apply the same fix to packages/proto/package.json and
packages/lcd/package.json) so the package exports (e.g., paths referencing
./dist/esm/index.js) resolve correctly after publishing.

In `@packages/utils/package.json`:
- Around line 64-68: Remove "npm" and "ts-node" from the "dependencies" object
in package.json for the packages/utils package; delete both entries and, if
"ts-node" is needed for local development only, add it to "devDependencies"
instead (do not add "npm" anywhere), ensuring only runtime deps like
"@kiichain/kiijs-proto" remain in "dependencies".

---

Nitpick comments:
In @.github/workflows/publish.yml:
- Around line 47-70: The publish steps for the workflow (steps named "Publish
`@kiichain/kiijs-proto`", "Publish `@kiichain/kiijs-lcd`", "Publish
`@kiichain/kiijs-utils`", "Publish `@kiichain/kiijs-evm`", "Publish
`@kiichain/kiijs-rwa`") run sequentially and will abort the remaining publishes if
one fails; update the workflow to either add continue-on-error: true to the
individual publish steps if partial publishes are acceptable, or insert a
pre-check step (e.g., a script that queries npm for the package@version for each
package under packages/proto, packages/lcd, packages/utils, packages/evm,
packages/rwa) and bail with a clear error before attempting publishes so
failures are isolated and reported cleanly.

In @.github/workflows/test.yml:
- Around line 30-31: The GitHub Actions workflow includes an explicit "Build
packages" step that runs `yarn build`, which is redundant because your Turbo
pipeline declares `test:ci` with `"dependsOn": ["build"]` in `turbo.json`;
remove the `- name: Build packages` / `run: yarn build` step from the workflow
so Turbo's `test:ci` dependency handles the build (or if you intentionally want
the extra step, keep it knowingly as a duplicate and accept the overhead).

In `@eslint.config.js`:
- Around line 69-70: The ESLint ignore pattern 'scripts/*' currently excludes
your new build script from linting; remove the 'scripts/*' entry from the ignore
array (or replace it with a narrower pattern) in eslint.config.js or add a
separate ESLint config for scripts so 'scripts/build.ts' is included and follows
project lint rules; search for the ignore array containing 'scripts/*' and
update it or add an overrides block targeting 'scripts/*.ts' to enable linting
for that file.
- Around line 30-43: The config currently turns off TypeScript safety rules
'@typescript-eslint/no-unsafe-assignment' and
'@typescript-eslint/no-unsafe-call' without explanation; add a brief comment
above those rule entries explaining the intentional rationale (e.g., legacy JS
interop, staged migration to stricter checks) or, better, replace the blanket
'off' with a targeted override or gradual strategy (enable in new/TS files or
use eslint overrides for specific directories/files) so the intent is documented
and maintainers know why these rules are relaxed.

In `@package.json`:
- Line 64: Update the turbo dependency version string in package.json to a
narrower pinned range (e.g., replace "turbo": "^2" with a specific tested
version or a tighter range such as "turbo": "^2.0.0" or "turbo": "2.12.0") so
that builds are reproducible; locate the "turbo" entry in package.json and
modify its value to the chosen exact or constrained version and then run your
package manager (npm/yarn/pnpm) to refresh lockfile.

In `@packages/evm/package.json`:
- Around line 55-56: The package currently lists "dotenv" under
peerDependencies; change this so consumers aren't forced to install it unless
the library actually requires dotenv at runtime. If dotenv is only used for
local development or tests, move "dotenv" from peerDependencies to
devDependencies in packages/evm/package.json (update the "peerDependencies"
block to remove "dotenv" and add it under "devDependencies"); if the library
truly relies on dotenv at runtime, instead document that requirement and keep it
as a regular dependency in "dependencies" rather than a peerDependency.

In `@packages/evm/tests/evidence.test.ts`:
- Around line 4-5: Remove the orphaned ESLint disable comment and the unused
jest.setTimeout call: delete the leading "// eslint-disable-next-line
`@typescript-eslint/no-require-imports`" comment and the
"jest.setTimeout(60_000);" statement from the test file (referencing the
jest.setTimeout usage) since there is no require() and the tests are
skipped/synchronous, so both are dead/noise.

In `@packages/rwa/tsconfig.json`:
- Around line 9-11: Update the stale comment next to the tsconfig.json "outDir"
setting to accurately reflect its purpose for emitting TypeScript declaration
files rather than compiled JavaScript; locate the "declaration" and "outDir"
entries in tsconfig.json and change the comment "Output directory for compiled
JavaScript" to something like "Output directory for generated .d.ts type
declarations (JS bundling handled by Bun to dist/esm and dist/cjs)" so it
correctly documents the role of outDir and its relationship to declaration:
true.

In `@scripts/build.ts`:
- Around line 36-55: Wrap each execSync invocation in try-catch blocks around
the three build steps (the ESM/CJS/Type declarations sections that log "→ ESM
bundle", "→ CJS bundle", and "→ Type declarations") so failures are caught; on
catch, call console.error (or processLogger if available) with a clear message
including which step failed (e.g., "Failed to build ESM bundle"), include the
caught error details (error.message and any error.output/stderr if present), and
then exit with a non‑zero status (process.exit(1)) or rethrow to ensure the
script fails deterministically.
- Around line 12-14: The file is ESM but uses require(resolve(...)) to load
package.json (pkg), which is non-standard; replace that with an ESM-compatible
approach such as using top-level await import for JSON modules (e.g. await
import(resolve(cwd, 'package.json'), { assert: { type: 'json' } }) and assign to
pkg) or read and parse the file with fs.readFileSync/JSON.parse(resolve(cwd,
'package.json')) instead; update the code that references pkg, keep cwd and
entrypoint as-is, and remove the require(...) call so the script no longer
relies on CommonJS require in an ESM module.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b0f789dd-6c6a-4786-a329-f3ea70a3e40c

📥 Commits

Reviewing files that changed from the base of the PR and between df48af6 and bdaac30.

⛔ Files ignored due to path filters (2)
  • .yarn/install-state.gz is excluded by !**/.yarn/**, !**/*.gz
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (24)
  • .github/workflows/lint.yml
  • .github/workflows/publish-evm.yml
  • .github/workflows/publish-lcd.yml
  • .github/workflows/publish-proto.yml
  • .github/workflows/publish-rwa.yml
  • .github/workflows/publish-utils.yml
  • .github/workflows/publish.yml
  • .github/workflows/test.yml
  • .gitignore
  • eslint.config.js
  • lerna.json
  • package.json
  • packages/evm/package.json
  • packages/evm/tests/evidence.test.ts
  • packages/lcd/package.json
  • packages/lcd/tsconfig.declaration.json
  • packages/proto/package.json
  • packages/proto/tsconfig.declaration.json
  • packages/rwa/package.json
  • packages/rwa/tsconfig.declaration.json
  • packages/rwa/tsconfig.json
  • packages/utils/package.json
  • scripts/build.ts
  • turbo.json
💤 Files with no reviewable changes (6)
  • lerna.json
  • .github/workflows/publish-utils.yml
  • .github/workflows/publish-proto.yml
  • .github/workflows/publish-rwa.yml
  • .github/workflows/publish-evm.yml
  • .github/workflows/publish-lcd.yml

Comment thread .github/workflows/lint.yml Outdated
Comment thread .github/workflows/publish.yml
Comment thread .github/workflows/test.yml Outdated
Comment thread package.json
Comment thread packages/evm/tests/evidence.test.ts
Comment thread packages/lcd/package.json
Comment thread turbo.json
isonnymichael and others added 3 commits April 14, 2026 14:58
…ng proto lint

Proto package lint now skips since files are generated. Sorted imports/exports
across evm, rwa, and utils packages to satisfy simple-import-sort rules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix CJS resolution: build script now generates dist/cjs/package.json
  with {"type": "commonjs"} so Node resolves .js as CJS correctly
- Remove publishConfig.directory from proto, lcd, rwa to prevent
  double dist/ path resolution on npm publish
- Remove npm and ts-node from utils runtime dependencies
- Add codegen task to turbo.json
- Enforce lockfile in CI with yarn install --immutable
- Add continue-on-error to publish steps for error isolation
- Replace require() with fs.readFileSync in build script (ESM compat)
- Add try-catch error handling to build script
- Move dotenv from evm peerDependencies to devDependencies removal
- Clean up orphaned code in evidence.test.ts
- Fix stale comment in rwa/tsconfig.json
- Add explanatory comments for disabled ESLint rules
- Pin turbo version range to ^2.0.0
- Remove redundant build step from test.yml (turbo handles it)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Lockfile was stale after turbo version pin change, causing
yarn install --immutable to fail in CI. Also disable fail-fast
so individual test failures don't cancel other package tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@isonnymichael

Copy link
Copy Markdown
Contributor Author

Hi @GiovaniGuizzo ,

The remaining CI failure in the Test Packages workflow is due to missing repository secrets. The EVM and other integration tests require the following secrets to be configured in the repo's Settings > Secrets and variables > Actions:

  • TEST_MNEMONIC
  • TEST_PRIVATE_KEY
  • TEST_HEX_ADDRESS

These secrets are not available to PRs from forks by design (GitHub security policy), so the tests fail with:

Missing TEST_PRIVATE_KEY in .env

The Lint and Format and CodeQL checks are passing. Could a maintainer either:

  1. Add the required secrets to the repository so tests can run, or
  2. Manually trigger/approve the test workflow after review

Thanks!

@GiovaniGuizzo GiovaniGuizzo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall, the PR looks nice. I have a few comments to improve it a bit better.
The publish comment will take some joint effort. I will configure the NPM registry to run from publish.yml using OIDC, but I think there is some config to be done still in the workflow file.

Comment thread .github/workflows/publish.yml Outdated
Comment thread .yarn/install-state.gz Outdated
Comment thread packages/lcd/tsconfig.declaration.json
Comment thread scripts/build.ts
Comment thread scripts/build.ts
Comment thread eslint.config.js Outdated
@GiovaniGuizzo

Copy link
Copy Markdown
Collaborator

Hi @GiovaniGuizzo ,

The remaining CI failure in the Test Packages workflow is due to missing repository secrets. The EVM and other integration tests require the following secrets to be configured in the repo's Settings > Secrets and variables > Actions:

  • TEST_MNEMONIC
  • TEST_PRIVATE_KEY
  • TEST_HEX_ADDRESS

These secrets are not available to PRs from forks by design (GitHub security policy), so the tests fail with:

Missing TEST_PRIVATE_KEY in .env

The Lint and Format and CodeQL checks are passing. Could a maintainer either:

  1. Add the required secrets to the repository so tests can run, or
  2. Manually trigger/approve the test workflow after review

Thanks!

Sure. We will run tests once merged into our main. I will fix anything that fails.

isonnymichael and others added 8 commits April 17, 2026 13:42
Remove tracked install-state.gz and prevent it from being committed in the future.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add sourceMap: true to tsconfig.base.json (inherited by proto, lcd, utils, evm)
and directly to packages/rwa/tsconfig.json which has its own config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ensure optionalDependencies are also treated as external during bundling,
preventing them from being incorrectly inlined.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace execSync CLI calls with Bun.build() JS API for ESM and CJS bundling.
Use Bun.spawnSync for tsc which has no JS API equivalent. This gives better
error handling and avoids shell command string interpolation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove global disabling of @typescript-eslint/no-unsafe-assignment and
@typescript-eslint/no-unsafe-call. These were disabled for proto-generated
types but affected all packages. Proto files are already excluded via the
ignores pattern, so the global disable was unnecessary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move registry configuration from workflow inline commands to .yarnrc.yml
  and .npmrc files
- Add id-token: write permission for npm OIDC provenance
- Use npm publish --provenance instead of yarn npm publish
- Remove the inline "Configure registry" step
- Use NODE_AUTH_TOKEN (setup-node convention) with NPM_TOKEN secret

The workflow is now ready for OIDC once the npm token secret is replaced
with the OIDC trust policy on the npm side.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add scripts/tsconfig.json with ES2022 module/target to support top-level
await, and a minimal Bun type declaration file for the Bun.build() and
Bun.spawnSync() APIs used in the build script.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The root tsconfig uses module: commonjs which doesn't support top-level
await. Wrap the async Bun.build() calls in an async function with
.then()/.catch() to avoid the TS1378 error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/evm/package.json (1)

60-68: ⚠️ Potential issue | 🟡 Minor

dotenv removed from peerDependencies but still used by tests — add to devDependencies.

packages/evm imports 'dotenv/config' in 10 test files and jest.config.ts, but dotenv is not declared in this package's devDependencies or anywhere in the workspace root. Test execution will fail when resolving the dotenv import, particularly in CI with --immutable installs or strict package management.

Proposed fix
   "devDependencies": {
     "@types/jest": "^29.5.14",
     "@wagmi/cli": "^2.7.0",
+    "dotenv": "^16.4.5",
     "ethers": "^6.0.0",
     "jest": "^29.7.0",
     "ts-jest": "^29.3.1",
     "viem": "2.x",
     "wagmi": "^2.18.2"
   },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/evm/package.json` around lines 60 - 68, The package is missing
dotenv in its devDependencies but several test files and jest.config.ts import
'dotenv/config', causing test resolution failures; fix by adding "dotenv"
(appropriate version, e.g., latest or a pinned semver) to the "devDependencies"
section of packages/evm's package.json so the test runner and jest.config.ts can
resolve the import during CI/immutable installs, then run a local install/test
to verify imports in the test files and jest.config.ts resolve correctly.
🧹 Nitpick comments (2)
packages/evm/package.json (1)

32-40: Scripts update looks good; minor consistency nit.

build, test, test:ci, and lint all align with the shared pattern used across utils/lcd/proto/rwa. One small inconsistency: most scripts here use yarn (yarn jest) while lint/prebuild/docs still use npx. Not a blocker, but standardizing on yarn (e.g., yarn eslint src/, yarn rimraf dist) would better leverage workspace resolution and be consistent with the Jest invocation fix mentioned in the PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/evm/package.json` around lines 32 - 40, The package.json scripts are
inconsistent: replace npx usages with yarn to match other packages; update the
"prebuild" script to "yarn rimraf dist", the "lint" script to "yarn eslint
src/", and the "docs" script to "yarn typedoc --out docs" (leave "build",
"test", and "test:ci" as-is); locate and edit these script entries in
package.json to standardize on yarn.
packages/proto/package.json (1)

49-51: test and test:ci are identical — consider differentiating or dropping one.

Both invoke yarn jest with no extra flags. If CI is expected to produce JUnit/coverage output or run non-interactively with specific flags (e.g. --ci --coverage --reporters=default), test:ci should diverge; otherwise one of them is redundant.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/proto/package.json` around lines 49 - 51, The package.json currently
has duplicate scripts "test" and "test:ci" both running "yarn jest"; either
remove the redundant "test:ci" script or update it to a CI-oriented invocation
(e.g., add flags like --ci, --coverage, and a JUnit/coverage reporter) so it
differs from "test"; modify the "test:ci" script entry accordingly in
package.json to reflect the chosen approach.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/proto/package.json`:
- Around line 33-36: The package.json for packages/proto currently lacks a
"files" allowlist so publishing from the package root will include source/tests;
add a "files" array entry to package.json (same change applied to packages/lcd
and packages/rwa) listing only the intended published artifacts (e.g., built
dist folder, README.md, LICENSE, package.json and any typings) and remove or
ignore test/src assets; update the JSON key "files" at the top-level of the
manifest (near the existing "publishConfig") so npm will only include those
paths when running npm publish.

---

Outside diff comments:
In `@packages/evm/package.json`:
- Around line 60-68: The package is missing dotenv in its devDependencies but
several test files and jest.config.ts import 'dotenv/config', causing test
resolution failures; fix by adding "dotenv" (appropriate version, e.g., latest
or a pinned semver) to the "devDependencies" section of packages/evm's
package.json so the test runner and jest.config.ts can resolve the import during
CI/immutable installs, then run a local install/test to verify imports in the
test files and jest.config.ts resolve correctly.

---

Nitpick comments:
In `@packages/evm/package.json`:
- Around line 32-40: The package.json scripts are inconsistent: replace npx
usages with yarn to match other packages; update the "prebuild" script to "yarn
rimraf dist", the "lint" script to "yarn eslint src/", and the "docs" script to
"yarn typedoc --out docs" (leave "build", "test", and "test:ci" as-is); locate
and edit these script entries in package.json to standardize on yarn.

In `@packages/proto/package.json`:
- Around line 49-51: The package.json currently has duplicate scripts "test" and
"test:ci" both running "yarn jest"; either remove the redundant "test:ci" script
or update it to a CI-oriented invocation (e.g., add flags like --ci, --coverage,
and a JUnit/coverage reporter) so it differs from "test"; modify the "test:ci"
script entry accordingly in package.json to reflect the chosen approach.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4b3b647f-e7d5-45c7-a4b0-92e818d4e62e

📥 Commits

Reviewing files that changed from the base of the PR and between bdaac30 and 8b9d67a.

⛔ Files ignored due to path filters (2)
  • .yarn/install-state.gz is excluded by !**/.yarn/**, !**/*.gz
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (51)
  • .github/workflows/lint.yml
  • .github/workflows/publish.yml
  • .github/workflows/test.yml
  • .gitignore
  • .npmrc
  • .yarnrc.yml
  • eslint.config.js
  • package.json
  • packages/evm/package.json
  • packages/evm/src/ethers/bankPrecompile.ts
  • packages/evm/src/ethers/bech32Precompile.ts
  • packages/evm/src/ethers/distributionPrecompile.ts
  • packages/evm/src/ethers/governancePrecompile.ts
  • packages/evm/src/ethers/ibcPrecompile.ts
  • packages/evm/src/ethers/ics20Precompile.ts
  • packages/evm/src/ethers/slashingPrecompile.ts
  • packages/evm/src/ethers/stakingPrecompile.ts
  • packages/evm/src/ethers/wasmPrecompile.ts
  • packages/evm/src/viem/bankPrecompile.ts
  • packages/evm/src/viem/bech32Precompile.ts
  • packages/evm/src/viem/distributionPrecompile.ts
  • packages/evm/src/viem/governancePrecompile.ts
  • packages/evm/src/viem/ibcPrecompile.ts
  • packages/evm/src/viem/ics20Precompile.ts
  • packages/evm/src/viem/index.ts
  • packages/evm/src/viem/slashingPrecompile.ts
  • packages/evm/src/viem/stakingPrecompile.ts
  • packages/evm/src/viem/wasmPrecompile.ts
  • packages/evm/src/wagmi/bank.ts
  • packages/evm/src/wagmi/bech32.ts
  • packages/evm/src/wagmi/distribution.ts
  • packages/evm/src/wagmi/governance.ts
  • packages/evm/src/wagmi/ibc.ts
  • packages/evm/src/wagmi/ics20.ts
  • packages/evm/src/wagmi/slashing.ts
  • packages/evm/src/wagmi/staking.ts
  • packages/evm/src/wagmi/wasm.ts
  • packages/evm/tests/evidence.test.ts
  • packages/lcd/package.json
  • packages/proto/package.json
  • packages/rwa/package.json
  • packages/rwa/src/index.ts
  • packages/rwa/tsconfig.json
  • packages/utils/package.json
  • packages/utils/src/cosmjs/signer.ts
  • packages/utils/src/index.ts
  • scripts/build.ts
  • scripts/bun.d.ts
  • scripts/tsconfig.json
  • tsconfig.base.json
  • turbo.json
✅ Files skipped from review due to trivial changes (38)
  • .gitignore
  • packages/evm/src/viem/slashingPrecompile.ts
  • packages/evm/src/viem/bech32Precompile.ts
  • .npmrc
  • tsconfig.base.json
  • packages/evm/src/viem/bankPrecompile.ts
  • packages/evm/src/viem/governancePrecompile.ts
  • packages/evm/src/wagmi/slashing.ts
  • packages/evm/src/viem/distributionPrecompile.ts
  • packages/evm/src/wagmi/bech32.ts
  • packages/evm/src/ethers/governancePrecompile.ts
  • packages/evm/src/wagmi/distribution.ts
  • packages/evm/src/viem/stakingPrecompile.ts
  • packages/evm/src/wagmi/bank.ts
  • packages/evm/src/ethers/stakingPrecompile.ts
  • packages/evm/src/wagmi/ics20.ts
  • packages/evm/src/ethers/slashingPrecompile.ts
  • packages/evm/src/viem/ics20Precompile.ts
  • packages/rwa/src/index.ts
  • packages/evm/src/ethers/bankPrecompile.ts
  • packages/rwa/tsconfig.json
  • packages/evm/src/ethers/ics20Precompile.ts
  • packages/evm/src/viem/index.ts
  • packages/evm/src/ethers/bech32Precompile.ts
  • packages/evm/src/wagmi/wasm.ts
  • packages/evm/src/ethers/distributionPrecompile.ts
  • packages/evm/src/ethers/wasmPrecompile.ts
  • packages/evm/src/wagmi/ibc.ts
  • packages/evm/src/viem/wasmPrecompile.ts
  • packages/evm/src/wagmi/governance.ts
  • packages/evm/src/viem/ibcPrecompile.ts
  • .yarnrc.yml
  • scripts/tsconfig.json
  • packages/utils/src/cosmjs/signer.ts
  • packages/evm/src/wagmi/staking.ts
  • packages/evm/src/ethers/ibcPrecompile.ts
  • packages/utils/src/index.ts
  • scripts/bun.d.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • .github/workflows/test.yml
  • .github/workflows/lint.yml
  • .github/workflows/publish.yml
  • packages/utils/package.json
  • eslint.config.js
  • packages/lcd/package.json
  • turbo.json
  • packages/rwa/package.json
  • scripts/build.ts
  • package.json

Comment thread packages/proto/package.json
- Add Bun setup step to lint workflow (required for build)
- Remove npmAlwaysAuth from .yarnrc.yml and .npmrc to avoid auth
  errors when reading public packages in CI
- Add "files": ["dist"] to all 5 packages to limit npm publish scope
- Regenerate yarn.lock to match updated .yarnrc.yml

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@GiovaniGuizzo GiovaniGuizzo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Much better. I have a few other minor comments. We are almost there :)

Comment thread .github/workflows/publish.yml Outdated
Comment thread packages/rwa/tsconfig.json Outdated
Comment thread scripts/bun.d.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/lcd/package.json (2)

10-21: Exports map looks good — CJS resolution concern from earlier review is resolved.

The previous concern about ./dist/cjs/index.js being parsed as ESM (due to root "type": "module") is addressed in scripts/build.ts, which now writes dist/cjs/package.json with {"type": "commonjs"} alongside the CJS bundle. Since "files": ["dist"] publishes the entire dist tree, this override file will be included in the published tarball and Node will correctly resolve require("@kiichain/kiijs-lcd") as CommonJS.

One small optional enhancement: consider adding a "./package.json" subpath to the exports map, since some tooling (bundlers, resolvers, postinstall scripts) still reads the manifest directly:

♻️ Optional: expose package.json via exports
   "exports": {
     ".": {
       "import": {
         "types": "./dist/types/index.d.ts",
         "default": "./dist/esm/index.js"
       },
       "require": {
         "types": "./dist/types/index.d.ts",
         "default": "./dist/cjs/index.js"
       }
-    }
+    },
+    "./package.json": "./package.json"
   },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/lcd/package.json` around lines 10 - 21, Add an explicit
"./package.json" subpath to the package's "exports" map so tooling that reads
the manifest via imports/resolution can access package metadata; update the
exports object in packages/lcd/package.json (the "exports" entry where "." maps
to import/require) to include a "./package.json": "./package.json" entry
alongside the existing mappings, ensuring it coexists with the current
import/require keys.

47-52: Consider adding a prepack/prepublishOnly hook to guard against publishing stale dist.

With "files": ["dist"] and no lifecycle script that builds before publish, a manual npm publish / yarn npm publish run without a preceding yarn build will either fail (no dist) or publish stale artifacts. The unified CI publish workflow likely builds explicitly, but adding a local safeguard makes the package publishable independently and prevents accidents:

♻️ Suggested addition
   "scripts": {
     "clean": "npx rimraf dist",
     "build": "bun run ../../scripts/build.ts",
     "codegen": "npx tsx scripts/codegen.ts",
-    "lint": "npx eslint src/"
+    "lint": "npx eslint src/",
+    "prepack": "yarn build"
   },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/lcd/package.json` around lines 47 - 52, Add a lifecycle hook to
package.json to ensure dist is built before a local publish: create either a
"prepack" or "prepublishOnly" entry under the scripts object that runs the
existing "build" script (the one named "build": "bun run
../../scripts/build.ts") so publishing cannot proceed with missing or stale dist
artifacts; update the scripts block to include "prepack" (or "prepublishOnly")
referencing the "build" command.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/rwa/package.json`:
- Line 50: The package's "codegen" script currently invokes "npx ts-node
scripts/codegen.ts" but ts-node is not in devDependencies and other packages use
"tsx"; update the "codegen" script to use "tsx" (e.g., "tsx scripts/codegen.ts")
and add "tsx" to this package's devDependencies so the runner is declared and
consistent with packages/lcd; ensure you remove or stop referencing "ts-node" in
this package to avoid ambiguity.

---

Nitpick comments:
In `@packages/lcd/package.json`:
- Around line 10-21: Add an explicit "./package.json" subpath to the package's
"exports" map so tooling that reads the manifest via imports/resolution can
access package metadata; update the exports object in packages/lcd/package.json
(the "exports" entry where "." maps to import/require) to include a
"./package.json": "./package.json" entry alongside the existing mappings,
ensuring it coexists with the current import/require keys.
- Around line 47-52: Add a lifecycle hook to package.json to ensure dist is
built before a local publish: create either a "prepack" or "prepublishOnly"
entry under the scripts object that runs the existing "build" script (the one
named "build": "bun run ../../scripts/build.ts") so publishing cannot proceed
with missing or stale dist artifacts; update the scripts block to include
"prepack" (or "prepublishOnly") referencing the "build" command.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 38440285-2d48-46a8-8200-a686477b876f

📥 Commits

Reviewing files that changed from the base of the PR and between 8b9d67a and 6ad1de6.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (12)
  • .github/workflows/lint.yml
  • .github/workflows/publish.yml
  • .npmrc
  • .yarnrc.yml
  • package.json
  • packages/evm/package.json
  • packages/lcd/package.json
  • packages/proto/package.json
  • packages/rwa/package.json
  • packages/rwa/tsconfig.json
  • packages/utils/package.json
  • scripts/tsconfig.json
✅ Files skipped from review due to trivial changes (4)
  • .npmrc
  • .yarnrc.yml
  • scripts/tsconfig.json
  • packages/rwa/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • .github/workflows/lint.yml
  • .github/workflows/publish.yml
  • package.json
  • packages/utils/package.json
  • packages/evm/package.json
  • packages/proto/package.json

Comment thread packages/rwa/package.json
@GiovaniGuizzo

Copy link
Copy Markdown
Collaborator

Approved! Nice work. Thanks for the contribution.

@GiovaniGuizzo GiovaniGuizzo merged commit 50d31be into KiiChain:main Apr 17, 2026
5 of 8 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.

v1.0.0

2 participants