Skip to content

Sync/codewiser.json - #7

Open
mostafamm44 wants to merge 19 commits into
yallma3:mainfrom
mostafamm44:sync/codewiser.json
Open

Sync/codewiser.json#7
mostafamm44 wants to merge 19 commits into
yallma3:mainfrom
mostafamm44:sync/codewiser.json

Conversation

@mostafamm44

@mostafamm44 mostafamm44 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added an interactive CLI for project setup, agent and workflow selection, downloads, configuration generation, and link creation.
    • Added commands to view, set, and reset repository and branch settings.
    • Added support for OpenCode, Claude, Antigravity, and Kilo configurations.
    • Added download, synchronization, overwrite confirmation, cancellation, and fallback copy flows.
  • Documentation

    • Updated setup, CLI usage, repository configuration, development, and architecture guidance.
  • Chores

    • Added project configuration, TypeScript settings, and ignore rules.
    • Replaced legacy setup scripts with the CLI workflow.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@mostafamm44, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b58b10ba-7139-422f-9522-a6d27c15ef19

📥 Commits

Reviewing files that changed from the base of the PR and between 26bcd8b and a1244ef.

📒 Files selected for processing (4)
  • README.md
  • codewiser.json
  • src/commands/init.ts
  • src/utils/config.ts
📝 Walkthrough

Walkthrough

The 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.

Changes

CLI migration

Layer / File(s) Summary
CLI foundations
package.json, tsconfig.json, src/utils/*
Adds the Bun CLI package, TypeScript settings, configuration and manifest utilities, prompts, terminal UI, and downloads.
Repository management CLI
src/commands/repo.ts, src/index.ts, src/utils/config.ts, codewiser.json
Adds repository and branch resolution, manifest overrides, reset and status commands, and the codewiser.json manifest identifier.
Interactive initialization flow
src/commands/init.ts, src/utils/prompts.ts
Adds target resolution, agent and mode selection, manifest retrieval, file synchronization, version checks, navigation, and completion reporting.
Agent configuration and compatibility
src/utils/generate-configs.ts, src/utils/symlinks.ts, README.md, .gitignore
Adds agent-specific configuration files, AGENTS.md protocol updates, symlink and copy fallbacks, CLI usage documentation, and ignore rules.

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
Loading

Possibly related PRs

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies a real manifest change, but the pull request mainly adds the new CLI and replaces the setup scripts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@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: 18

🧹 Nitpick comments (5)
src/utils/generate-configs.ts (1)

97-129: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy lift

Delimit the managed section instead of matching on the heading text.

The loop deletes every heading that starts with ## and contains Execution Protocol, together with its body. A user-authored section such as ## Legacy Execution Protocol Notes is 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 value

Update 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 win

Move typescript out of peerDependencies.

typescript is used only for type-checking ("noEmit": true in tsconfig.json). It is not required at runtime by consumers of this CLI. Declaring it as a peerDependency causes npm to warn about (or, under strict peer resolution, fail on) an unmet peer dependency for every user who installs codewiser without 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 value

Consider using the shared ui.ts error helper for consistent output.

This file uses raw console.error for error messages, while src/commands/repo.ts uses the shared error()/info() helpers from ui.ts for 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 win

Duplicate JSON read/write logic across src/utils/config.ts and src/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: replace readConfig/writeConfig's body with calls to a shared readJsonFile/writeJsonFile helper.
  • src/commands/repo.ts#L19-L31: replace readManifest/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

📥 Commits

Reviewing files that changed from the base of the PR and between 2d7b42d and 8205e05.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (18)
  • .gitignore
  • AGENTS.md
  • README.md
  • codewiser.json
  • codewiser.ps1
  • codewiser.sh
  • package.json
  • src/commands/init.ts
  • src/commands/repo.ts
  • src/index.ts
  • src/utils/config.ts
  • src/utils/download.ts
  • src/utils/generate-configs.ts
  • src/utils/manifest.ts
  • src/utils/prompts.ts
  • src/utils/symlinks.ts
  • src/utils/ui.ts
  • tsconfig.json
💤 Files with no reviewable changes (2)
  • codewiser.sh
  • codewiser.ps1

Comment thread AGENTS.md Outdated
Comment thread package.json Outdated
Comment thread README.md
Comment thread src/commands/init.ts
Comment thread src/commands/init.ts Outdated
Comment thread src/utils/symlinks.ts
Comment thread src/utils/symlinks.ts Outdated
Comment thread src/utils/symlinks.ts
Comment thread src/utils/symlinks.ts
Comment thread src/utils/ui.ts
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.

@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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between b53401d and 26bcd8b.

📒 Files selected for processing (6)
  • README.md
  • codewiser.json
  • src/commands/init.ts
  • src/commands/repo.ts
  • src/index.ts
  • src/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

Comment thread src/utils/config.ts
@coderabbitai coderabbitai Bot mentioned this pull request Aug 13, 2026
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