Sync/codewiser.json - #7
Conversation
|
Warning Review limit reached
Next review available in: 26 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe pull request replaces shell setup scripts with a Bun-based CLI. It adds repository management, interactive initialization, manifest processing, file downloads, agent configuration generation, symlink handling, documentation, and project configuration. ChangesCLI migration
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant init
participant Manifest
participant download
participant ConfigGenerators
participant Symlinks
CLI->>init: start project initialization
init->>Manifest: resolve and interpret manifest
init->>download: download selected files
init->>ConfigGenerators: generate agent configurations
init->>Symlinks: create configured links
Symlinks-->>CLI: report completion
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 18
🧹 Nitpick comments (5)
src/utils/generate-configs.ts (1)
97-129: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy liftDelimit the managed section instead of matching on the heading text.
The loop deletes every heading that starts with
##and containsExecution Protocol, together with its body. A user-authored section such as## Legacy Execution Protocol Notesis removed silently.Wrap the generated block in explicit markers, for example
<!-- codewiser:protocol:start -->and<!-- codewiser:protocol:end -->, and replace only the text between them.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/utils/generate-configs.ts` around lines 97 - 129, Update the cleanup logic in the generate-configs flow to locate and replace only the protocol block between explicit start and end markers, such as codewiser:protocol:start and codewiser:protocol:end. Stop identifying managed content by headings containing “Execution Protocol,” preserve user-authored sections such as “Legacy Execution Protocol Notes,” and ensure the generated protocol body is written with both markers.README.md (1)
109-109: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUpdate stale "setup script" wording.
This line refers to "The setup script" symlinking the skill directory. The Architecture section further down (line 151) attributes symlinking to
src/utils/symlinks.ts, part of the new CLI. Update this line to refer to the CLI instead of the retired shell script, for consistency with the rest of the document.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` at line 109, Update the skill-sharing description in README.md to attribute symlink creation to the CLI rather than the retired setup script, while preserving the existing explanation of the .agents/skills path and codewiser.json workflow configuration.package.json (1)
15-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMove
typescriptout ofpeerDependencies.
typescriptis used only for type-checking ("noEmit": truein tsconfig.json). It is not required at runtime by consumers of this CLI. Declaring it as apeerDependencycauses npm to warn about (or, under strict peer resolution, fail on) an unmet peer dependency for every user who installscodewiserwithout already having TypeScript installed.♻️ Proposed fix
- "peerDependencies": { - "typescript": "^5" - }, "dependencies": { "`@clack/prompts`": "^1.7.0", "meow": "^14.1.0", "picocolors": "^1.1.1" + }, + "devDependencies": { + "`@types/bun`": "latest", + "typescript": "^5" }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@package.json` around lines 15 - 17, Remove typescript from the package.json peerDependencies declaration; keep it available only as a development dependency for the noEmit type-checking workflow, since CLI consumers should not be required to install it.src/index.ts (1)
34-38: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider using the shared
ui.tserror helper for consistent output.This file uses raw
console.errorfor error messages, whilesrc/commands/repo.tsuses the sharederror()/info()helpers fromui.tsfor consistent, colorized output. Using the same helpers here keeps CLI error styling consistent.Also applies to: 45-48, 50-54
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/index.ts` around lines 34 - 38, Update the error-reporting branches in the CLI entrypoint, including the checks around third, to use the shared error() and related ui.ts helpers instead of raw console.error calls. Preserve the existing messages, help output, and process.exit(1) behavior while matching the styling pattern used in src/commands/repo.ts.src/utils/config.ts (1)
21-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate JSON read/write logic across
src/utils/config.tsandsrc/commands/repo.ts. Both files implement the identical read-with-try/catch-return-null and write-with-JSON.stringify(..., null, 2)pattern for two different JSON files. Extract one shared helper to avoid the two implementations drifting apart over time.
src/utils/config.ts#L21-L34: replacereadConfig/writeConfig's body with calls to a sharedreadJsonFile/writeJsonFilehelper.src/commands/repo.ts#L19-L31: replacereadManifest/writeManifest's body with calls to the same shared helper.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/utils/config.ts` around lines 21 - 34, Extract the duplicated JSON parsing and serialization into shared readJsonFile and writeJsonFile helpers. In src/utils/config.ts lines 21-34, update readConfig and writeConfig to resolve the path and delegate to these helpers; in src/commands/repo.ts lines 19-31, update readManifest and writeManifest likewise. Preserve the existing null-on-read-failure behavior and two-space JSON formatting at both sites.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Line 3: Remove the stray “test” prefix from the opening line of AGENTS.md so
it begins directly with “Global instructions and behavioral constraints live in
this file.”
In `@package.json`:
- Around line 3-7: Update the package.json metadata to support the documented
npm publishing workflow: remove the private flag and add a valid version field
required by npm. Preserve the existing bin and module configuration so npx
codewiser remains available after publishing.
In `@README.md`:
- Around line 113-116: Update the Node.js version requirement in the README
Requirements section from 18+ to 20.12+ to match the minimum runtime required by
the listed dependencies, while leaving the Bun and Git requirements unchanged.
In `@src/commands/init.ts`:
- Around line 220-228: Replace hardcoded Windows separators throughout
src/commands/init.ts: at lines 220-228 use join for all .agents subdirectories
and optional agent directories; at lines 236-238 remove the slash-to-backslash
rewrite and build destinations with join(targetDir, ...filePath.split("/")); at
lines 282-285 set relativeSrc and relativeDest with join(".claude", "skills")
and join(".agents", "skills").
- Around line 106-121: Add an AbortSignal.timeout(...) to the fetch in the
runSpinner callback for manifestUrl so unresponsive hosts enter the existing
error path; remove the callback’s cachedManifest assignment and retain the outer
assignment from result.
- Around line 265-269: Update the init download flow to track versions only for
files successfully written by download(...). Record each file’s remote version
immediately after a successful download, exclude failed downloads and declined
overwrites, and remove the later Object.entries(remoteFiles) loop that records
every remote version before writeConfig.
In `@src/index.ts`:
- Around line 50-57: Update the targetDir calculation in the CLI entrypoint
before init so resolve uses the current working directory and first
project-directory argument directly, removing the parent-directory traversal.
Preserve the existing init call and argument handling.
- Line 1: Add the Bun executable shebang as the first line of the CLI entry
module before the meow import in src/index.ts, preserving the existing import
and runtime behavior.
In `@src/utils/download.ts`:
- Around line 4-17: The download function’s fetch request lacks a total timeout,
allowing stalled downloads to block indefinitely. Update download to pass a
request-level timeout using AbortSignal.timeout or Bun.fetch timeout options,
while preserving the existing success and failure handling.
In `@src/utils/generate-configs.ts`:
- Around line 49-58: Update the workflow generation in generateConfigs to avoid
writing the placeholder example workflow; build workflows from skillDirs with
valid steps and metadata, or skip writing workflows.json when no real workflow
content exists.
- Around line 23-38: Update src/utils/generate-configs.ts lines 23-38 in
generateClaudeMD to preserve an existing CLAUDE.md: skip generation when it
exists, or append only the missing `@AGENTS.md` reference. Update
src/utils/generate-configs.ts lines 4-21 in the opencode generator to read and
parse existing opencode.json, then merge only the skills and instructions keys
without overwriting other user configuration.
- Around line 74-78: Update the fallback assignment in generate-configs around
config.instructions so the no-skill-dirs pattern uses the recursive ** glob,
matching the fallback behavior used by the OpenCode generator and including
nested skill directories.
- Around line 4-21: Update generateOpenCodeConfig to read any existing
opencode.json before writing, parse it, and merge only the generated skills and
instructions keys while preserving all other user configuration; use the
generated defaults when the file does not exist or contains no existing
configuration, then write the merged object.
In `@src/utils/symlinks.ts`:
- Around line 45-51: Update the elevated symlink creation flow around spawnSync
to run only on Windows, and avoid interpolating srcPath or destPath into the
nested PowerShell command. Pass both paths through an argument-bound PowerShell
parameter block so quote-containing CLI paths cannot inject commands, while
preserving the existing elevated execution and symlink behavior.
- Around line 22-33: Update the cleanup logic around lstatSync, unlinkSync, and
rmSync so non-symbolic-link directories are not recursively deleted without
confirmation: prompt before removal, or skip the path and report that it was
preserved. Keep automatic deletion for symbolic links, and replace the empty
catch with appropriate failure reporting.
- Around line 42-44: Update the cancellation branch in the confirm flow around
isCancel(result) and cancel() to return immediately after invoking cancel,
preventing execution from reaching the result handling and admin PowerShell
prompt when the user cancels.
- Around line 59-73: Replace the hand-rolled synchronous recursion in
copyDirContents with fs.cpSync, preserving the source-existence guard and
destination copy behavior. Remove the Bun.file/Bun.write flow and recursive
entry traversal so handleSymlink only returns after the fallback copy completes
synchronously.
In `@src/utils/ui.ts`:
- Around line 106-119: Remove the redundant s.stop(label) call from the catch
branch of runSpinner, leaving the unconditional finally cleanup in place while
preserving the error logging and BACK return behavior.
---
Nitpick comments:
In `@package.json`:
- Around line 15-17: Remove typescript from the package.json peerDependencies
declaration; keep it available only as a development dependency for the noEmit
type-checking workflow, since CLI consumers should not be required to install
it.
In `@README.md`:
- Line 109: Update the skill-sharing description in README.md to attribute
symlink creation to the CLI rather than the retired setup script, while
preserving the existing explanation of the .agents/skills path and
codewiser.json workflow configuration.
In `@src/index.ts`:
- Around line 34-38: Update the error-reporting branches in the CLI entrypoint,
including the checks around third, to use the shared error() and related ui.ts
helpers instead of raw console.error calls. Preserve the existing messages, help
output, and process.exit(1) behavior while matching the styling pattern used in
src/commands/repo.ts.
In `@src/utils/config.ts`:
- Around line 21-34: Extract the duplicated JSON parsing and serialization into
shared readJsonFile and writeJsonFile helpers. In src/utils/config.ts lines
21-34, update readConfig and writeConfig to resolve the path and delegate to
these helpers; in src/commands/repo.ts lines 19-31, update readManifest and
writeManifest likewise. Preserve the existing null-on-read-failure behavior and
two-space JSON formatting at both sites.
In `@src/utils/generate-configs.ts`:
- Around line 97-129: Update the cleanup logic in the generate-configs flow to
locate and replace only the protocol block between explicit start and end
markers, such as codewiser:protocol:start and codewiser:protocol:end. Stop
identifying managed content by headings containing “Execution Protocol,”
preserve user-authored sections such as “Legacy Execution Protocol Notes,” and
ensure the generated protocol body is written with both markers.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e53cb029-5f5d-4cec-b606-92125f0f1175
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
.gitignoreAGENTS.mdREADME.mdcodewiser.jsoncodewiser.ps1codewiser.shpackage.jsonsrc/commands/init.tssrc/commands/repo.tssrc/index.tssrc/utils/config.tssrc/utils/download.tssrc/utils/generate-configs.tssrc/utils/manifest.tssrc/utils/prompts.tssrc/utils/symlinks.tssrc/utils/ui.tstsconfig.json
💤 Files with no reviewable changes (2)
- codewiser.sh
- codewiser.ps1
Encode the inner PowerShell command with paths embedded as single-quoted literals and pass it via -EncodedCommand with no user data on the command line. The previous version interpolated srcPath/destPath into the outer script, which could break on spaces/quotes and allowed injection.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/utils/config.ts`:
- Around line 25-32: Update readConfigFromPath to validate the parsed JSON
before casting it to CodewiserConfig: require a non-array object and ensure
optional repo and branch fields are strings when present. Treat invalid roots or
field types as absent (or use the existing configuration-error mechanism), and
add tests covering invalid JSON roots and field types.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a17930a7-7dad-4bb2-a9cb-31536e82af2e
📒 Files selected for processing (6)
README.mdcodewiser.jsonsrc/commands/init.tssrc/commands/repo.tssrc/index.tssrc/utils/config.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- src/index.ts
- codewiser.json
- src/commands/init.ts
- README.md
Summary by CodeRabbit
New Features
Documentation
Chores