Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store
95 changes: 73 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Specs, plans, design options, architecture decisions — these are not paperwork

## How It Works

A centralized `.agents/` directory and a universal `AGENTS.md` instruction file that every agent reads. Agents follow a **mode-tailored execution protocol**: depending on the selected mode (Prototype, Spec Driven, Rigid), they read relevant specs, create plans, explore options, and update artifacts before and after every code change.
A centralized `.agents/` directory and a universal `AGENTS.md` instruction file that every agent reads. Agents follow a **mode-tailored execution protocol**: depending on the selected mode (Prototype, Spec Driven, or Rigid), they read relevant specs, create plans, explore options, and update artifacts before and after every code change.

```
.agents/
Expand Down Expand Up @@ -45,24 +45,49 @@ A centralized `.agents/` directory and a universal `AGENTS.md` instruction file
## Quick Start

```bash
# 1. Run the interactive setup script with a target directory
./codewiser.sh ./my-project
# Interactively set up codewiser in a target project directory
bunx codewiser my-project

# 2. Select your AI agents and development mode (Prototype, Spec Driven, or Rigid)
# The script downloads the relevant skills, spec templates, and creates
# agent-specific configs with symlinks to the shared `.agents/skills/` directory.
# Or via npm (after publishing)
npx codewiser my-project

# 3. Start coding — agents read shared context from AGENTS.md (customized with your
# mode's execution protocol), load skills from `.agents/skills/`, and follow the
# tailored workflow defined by the selected mode.
# Or if linked locally
codewiser my-project
```

On Windows (PowerShell):
The CLI guides you through an interactive session:

```powershell
.\codewiser.ps1 .\my-project
1. **Select AI agents** — Choose which coding agents to configure (OpenCode, Claude Code, Cursor, Antigravity, Kilo Code)
2. **Configure mode** — Pick a development mode (Prototype, Spec Driven, or Rigid) — or select workflows in legacy mode
3. **Download files** — Downloads shared skills, spec templates, and manifest from GitHub
4. **Generate configs** — Creates agent-specific configuration files
5. **Create symlinks** — Symlinks shared skills into each agent's private directory

Use `← Back` options to navigate between steps. Press `Esc` at any time to exit.

## Managing the Source Repo

Codewiser syncs skills and specs from a GitHub repo's `codewiser.json` manifest. The source repo/branch is resolved from three tiers only: the project's `./codewiser.json` (if it sets `repo`/`branch`), then your user-profile `~/.codewiser.json` (if set), and finally the bundled default (`yallma3/codewiser` @ `main`). The fetched manifest's own `repo`/`branch` fields are informational and never override the effective source.

From the root of a project that has a `codewiser.json`:

```bash
# Show the effective repo/branch and which source each value comes from
codewiser repo

# Point the manifest at a different repo/branch
codewiser repo set owner/repo --branch main

# Remove the overrides so the built-in defaults apply
codewiser repo reset

# Set a machine-wide (user profile) default instead of ./codewiser.json
codewiser repo set owner/repo --branch main -g
codewiser repo reset -g # clear the user-wide default
```

`--repo` and `--branch` flags on the main command act as one-off overrides for a single run; they do not persist. Repo/branch resolution order is: CLI flag → `./codewiser.json` in the current directory (what `codewiser repo set` edits) → `~/.codewiser.json` in your user profile (what `codewiser repo set -g` edits) → bundled default (`yallma3/codewiser` @ `main`). `<project>/.codewiser.json` only tracks downloaded file versions (for re-run comparisons); it never overrides the manifest.

## Supported Agents

| Agent | Config File | Integration |
Expand All @@ -85,23 +110,49 @@ The exact workflow depends on the selected mode (Prototype, Spec Driven, or Rigi

## Adding a New Skill

Skills are shared across all agents. Create a file at `.agents/skills/<skill-name>/SKILL.md` with instructions for what the skill does. Then add it to the relevant workflow stage's `files` section in `manifest.json` with an initial version. The setup script symlinks this directory into each agent's private config so every agent can load it.
Skills are shared across all agents. Create a file at `.agents/skills/<skill-name>/SKILL.md` with instructions for what the skill does. Then add it to the relevant workflow stage's `files` section in `codewiser.json` with an initial version. The setup script symlinks this directory into each agent's private config so every agent can load it.

Example: the [git-worktrees skill](.agents/skills/shared/git-worktrees/SKILL.md) was added to teach agents how to isolate feature work using branches and worktrees during concurrent multi-agent development.

## Setup Scripts
## Requirements

| Platform | Script | Source |
|---|---|---|
| Linux / macOS | `codewiser.sh` | Downloads `AGENTS.md`, skills, and specs from `https://github.com/yallma3/codewiser` |
| Windows | `codewiser.ps1` | Same logic via PowerShell with `Invoke-WebRequest` |
- **Bun** (recommended) or **Node.js 20.12+**
- Git
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Both scripts use `manifest.json` to track artifact versions organized by development modes. During setup, you select which AI agents and which mode (**Prototype**, **Spec Driven**, or **Rigid**) to use. The selected mode determines which skills are downloaded and customizes `AGENTS.md` with the appropriate execution protocol.
## Development

## Requirements
```bash
# Clone and install
git clone https://github.com/yallma3/codewiser.git
cd codewiser
bun install

- Bash **or** PowerShell 5+
- Git
# Link globally (optional)
bun link

# Run directly
bun start my-project

# Or after linking
codewiser my-project
```

## How the CLI Works

The CLI uses [@clack/prompts](https://github.com/natemoo-re/clack) for interactive prompts and [meow](https://github.com/sindresorhus/meow) for CLI argument parsing. It downloads skills and specs from the [codewiser](https://github.com/yallma3/codewiser) repository based on a `codewiser.json` that tracks artifact versions organized by development modes.

### Architecture

- `src/index.ts` — Entry point, parses CLI arguments, resolves target directory, dispatches subcommands
- `src/commands/init.ts` — State machine orchestrating the 5-step setup process
- `src/commands/repo.ts` — `repo` subcommand: get/set/reset `repo`/`branch` in the manifest or user-profile (`-g`)
- `src/utils/ui.ts` — Prompt wrappers with stdin resilience (@clack wrappers)
- `src/utils/prompts.ts` — Typed prompt functions for agent/mode/workflow selection
- `src/utils/download.ts` — HTTP download via `fetch()` + `Bun.write()`
- `src/utils/manifest.ts` — Manifest parsing, version comparison, file flattening
- `src/utils/config.ts` — `.codewiser.json` / `~/.codewiser.json` read/write, repo/branch resolution
- `src/utils/generate-configs.ts` — Agent config file generation
- `src/utils/symlinks.ts` — Symlink creation with admin retry and copy fallback

## License

Expand Down
47 changes: 47 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions .agents/manifest.json → codewiser.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "manifest.json",
"description": "Version manifest for downloadable framework artifacts. Organized by modes. Used by codewiser.sh to detect and prompt for updates.",
"$schema": "codewiser.json",
"description": "Version manifest for downloadable framework artifacts. Organized by modes. Used by codewiser CLI to detect and prompt for updates.",
"version": "3.0.0",
"modes": {
"prototype": {
Expand Down Expand Up @@ -143,5 +143,7 @@
".agents/specs/spec-index.json": "1.0.0"
}
}
}
}
},
"repo": "mostafamm44/codewiser",
"branch": "sync/codewiser.json"
}
Loading