Skip to content

refactor: use kebanaize of args-tokens - #151

Merged
kazupon merged 1 commit into
mainfrom
chore/use-args-tokens-utils
May 30, 2025
Merged

refactor: use kebanaize of args-tokens#151
kazupon merged 1 commit into
mainfrom
chore/use-args-tokens-utils

Conversation

@kazupon

@kazupon kazupon commented May 30, 2025

Copy link
Copy Markdown
Owner

Description

Linked Issues

Additional context

Summary by CodeRabbit

  • Chores
    • Updated a dependency to a newer version for improved compatibility.
  • Refactor
    • Switched to using an external utility for string conversion, removing the internal implementation. No changes to user-facing functionality.

@coderabbitai

coderabbitai Bot commented May 30, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the args-tokens dependency in package.json, remove the locally defined kebabnize function from src/utils.ts, and adjust imports in src/renderer/usage.ts to use kebabnize directly from the external args-tokens/utils module. No public APIs or logic are altered.

Changes

File(s) Change Summary
package.json Updated args-tokens dependency version from ^0.19.0 to ^0.20.1.
src/utils.ts Removed the local kebabnize function implementation and its export.
src/renderer/usage.ts Changed import of kebabnize from local utils to direct import from args-tokens/utils.

Possibly related PRs

Suggested labels

feature

Poem

A rabbit hopped with glee today,
As code grew lighter in a clever way.
No more kebabnize to maintain—
Now from a package, simple and plain!
Dependencies fresh, the imports neat,
This change is truly a coder's treat.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pkg-pr-new

pkg-pr-new Bot commented May 30, 2025

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/kazupon/gunshi@151

commit: 5df93af

@kazupon kazupon added refactoring A code change that neither fixes a bug nor adds a feature 🧹 p1-chore Priority 1: no change in change code behavior labels May 30, 2025
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying gunshi with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5df93af
Status: ✅  Deploy successful!
Preview URL: https://f1412936.gunshi.pages.dev
Branch Preview URL: https://chore-use-args-tokens-utils.gunshi.pages.dev

View logs

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fca05f0 and 5df93af.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • package.json (1 hunks)
  • src/renderer/usage.ts (1 hunks)
  • src/utils.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • src/utils.ts
🔇 Additional comments (1)
src/renderer/usage.ts (1)

6-6:

Details

✅ Verification successful

Verify all kebabnize usages have been updated consistently.

The import change from local utility to external package looks correct and aligns with the refactor objective.

Please verify that all usages of the local kebabnize function have been updated and that the local implementation has been removed:


🏁 Script executed:

#!/bin/bash
# Description: Verify that all kebabnize usages are now using the external import
# Expected: No remaining imports from local utils, local function removed

echo "Checking for any remaining local kebabnize imports..."
rg -n "kebabnize.*utils" --type ts

echo -e "\nChecking if local kebabnize function still exists in utils.ts..."
rg -n "function kebabnize|const kebabnize|export.*kebabnize" src/utils.ts

echo -e "\nChecking all kebabnize usages in the codebase..."
rg -n "kebabnize" --type ts

echo -e "\nVerifying imports from args-tokens/utils..."
rg -n "from ['\"]args-tokens/utils['\"]" --type ts

Length of output: 1262


All kebabnize imports and usages have been verified.

No remaining local kebabnize definition or imports were found; all references now use the external args-tokens/utils. Ready to merge.

Comment thread package.json
},
"dependencies": {
"args-tokens": "^0.19.0"
"args-tokens": "^0.20.1"

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.

💡 Verification agent

🧩 Analysis chain

Verify that the kebabnize function is available in this version.

The dependency update looks appropriate for accessing the external kebabnize function. Since this is a minor version bump, it should maintain backward compatibility.

Please verify that the kebabnize function is properly exported from args-tokens/utils in version 0.20.1:


🏁 Script executed:

#!/bin/bash
# Description: Check if kebabnize function is available in the specified args-tokens version
# Expected: Function should be exported from args-tokens/utils

# Install the specific version and check exports
npm view args-tokens@0.20.1 
echo "Checking if kebabnize is exported from args-tokens/utils..."

# Check if the function exists in the package
node -e "
try {
  const { kebabnize } = require('args-tokens/utils');
  console.log('✓ kebabnize function found');
  console.log('Function type:', typeof kebabnize);
  if (typeof kebabnize === 'function') {
    console.log('Test conversion:', kebabnize('testCamelCase'));
  }
} catch (err) {
  console.error('✗ Failed to import kebabnize:', err.message);
}
"

Length of output: 1280


Let’s inspect the published 0.20.1 package to locate the kebabnize export path:


🏁 Script executed:

#!/bin/bash
# Fetch and unpack the package
npm pack args-tokens@0.20.1
mkdir -p pkg
tar -xzf args-tokens-0.20.1.tgz -C pkg

# Search for kebabnize within unpacked files
echo "Finding kebabnize definition/location:"
grep -R "kebabnize" -n pkg

Length of output: 1770


To determine the correct import path for kebabnize, let’s inspect the package’s entry points and re-exports:


🏁 Script executed:

#!/bin/bash
# Show main/exports fields in package.json
grep -nE '"main"|"exports"' pkg/package/package.json || true

echo
# Preview how utils are re-exported in lib/index.js
echo "----- lib/index.js (first 50 lines) -----"
sed -n '1,50p' pkg/package/lib/index.js

echo
# Check if kebabnize is surfaced in index.js
grep -n "kebabnize" pkg/package/lib/index.js || true

Length of output: 1524


Fix import path for kebabnize after bump to args-tokens@0.20.1

The v0.20.1 release no longer exposes a top-level utils subpath. The kebabnize function is defined in lib/utils.js but isn’t re-exported through the package root, so your current import will fail.

Please update your code accordingly:

  • Change your import:
    - import { kebabnize } from 'args-tokens/utils';
    + import { kebabnize } from 'args-tokens/lib/utils.js';
  • Or, if possible, refactor to use the public API only (parse, parseArgs, resolveArgs) to avoid reliance on internal paths.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In package.json at line 114, after updating args-tokens to version 0.20.1, the
kebabnize function import path from 'args-tokens/utils' is no longer valid
because this subpath is not exposed in the new version. To fix this, update your
code to import kebabnize directly from its new location if necessary, or better,
refactor your code to use only the public API functions like parse, parseArgs,
or resolveArgs provided by args-tokens to avoid relying on internal module paths
that are not guaranteed to be stable.

@kazupon
kazupon merged commit ddb8343 into main May 30, 2025
@kazupon
kazupon deleted the chore/use-args-tokens-utils branch May 30, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧹 p1-chore Priority 1: no change in change code behavior refactoring A code change that neither fixes a bug nor adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant