Skip to content

Commit 2dffb2d

Browse files
committed
docs(readme): 补充 Codewiki 命令行安装与初始化说明
1 parent 8ec1926 commit 2dffb2d

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,24 @@ CodeWiki-Plus 是一个由 AI IDE(CodeBuddy、Qoder、Trae 等)自身模型
111111
pip install codewiki-plus
112112
```
113113

114+
如果 `pip` 不在 PATH 中,改用:
115+
116+
```bash
117+
python -m pip install --upgrade codewiki-plus
118+
```
119+
114120
验证安装:
115121

116122
```bash
117123
codewiki --version
118124
```
119125

126+
如果命令行入口脚本未进入 PATH,改用:
127+
128+
```bash
129+
python -m codewiki --version
130+
```
131+
120132
> **开发者选项**:如需从源码开发(获取最新未发布改动),推荐使用 [uv](https://docs.astral.sh/uv/) 按 `uv.lock` 精确复现开发环境(`pyproject.toml:106` `tool.uv.default-groups = ["dev"]` 已包含 dev 工具):
121133
> ```bash
122134
> git clone https://github.com/mambo-wang/CodeWiki-Plus.git
@@ -136,6 +148,35 @@ codewiki --version
136148
>
137149
> 已有克隆默认只校验 `origin`;`--update` 仅对干净工作区执行 `fetch origin` + `merge --ff-only @{upstream}`。`--force` 只覆盖被修改的托管 AGENTS/MCP/hook/skill 内容,不删目录、不重置 Git、不切换布局、不 commit/push。不在克隆 URL/登记配置中保存 token,日志脱敏;setup/bootstrap 不自动分析代码或生成 Wiki。`--lang zh|en` 设置技能与 MCP 语言,`--dry-run` 仅预览。生成的 MCP 解释器按平台选择(Windows `python`,macOS/Linux `python3`)。以下为手工等价步骤。
138150
151+
**命令行安装与初始化**
152+
153+
安装完成后,可直接用 CLI 完成首次接线:
154+
155+
```bash
156+
# 当前项目作为单仓工作区
157+
codewiki setup --mode single
158+
159+
# 指定项目目录(适合脚本或 CI 调用)
160+
codewiki setup --repo-path /path/to/project --mode single
161+
162+
# 多仓工作区:初始化根目录并登记、克隆业务仓
163+
codewiki setup --repo-path /path/to/workspace --mode multi \
164+
--repo https://github.com/org/repo-a.git \
165+
--repo https://github.com/org/repo-b.git
166+
167+
# 多仓工作区:只初始化,不登记业务仓
168+
codewiki setup --repo-path /path/to/workspace --mode multi
169+
170+
# 只预览计划,不写盘、不克隆、不初始化 Git
171+
codewiki setup --repo-path /path/to/workspace --mode multi --dry-run
172+
```
173+
174+
如果 `codewiki` 命令不在 PATH 中,把上面的 `codewiki setup` 替换为 `python -m codewiki setup`。
175+
176+
- `--repo` 不是必填项,可重复传入;首次可以只初始化工作区,后续再通过 `codewiki setup --repo <URL>` 或 `add_workspace_repo` 追加登记。
177+
- `--layout` 不是必填项;新多仓工作区默认 `centralized`,存量无配置多仓默认 `colocated`,已经保存过布局的工作区不能原地切换。
178+
- setup 只负责安装后的工作区确认、hook/采集接线、`.mcp.json` 合并和技能快照刷新,不会自动分析代码或生成 Wiki。
179+
139180
在 CodeBuddy 的 MCP 设置中添加以下配置(通常在设置界面的"工具"或"MCP"板块):
140181

141182
```json
@@ -237,6 +278,13 @@ pip install --upgrade codewiki-plus
237278
codewiki setup
238279
```
239280

281+
如果 `pip` 或 `codewiki` 不在 PATH 中,改用:
282+
283+
```bash
284+
python -m pip install --upgrade codewiki-plus
285+
python -m codewiki setup
286+
```
287+
240288
重跑 `codewiki setup` 是幂等的:它会自动刷新 `codewiki-*` 技能快照、AGENTS.md 中由 CodeWiki 托管的标记块(任务记忆引导段与「CodeWiki LLM Wiki」使用段)以及 hook 接线,使这些内容与安装的包版本对齐。被手工修改过的托管内容会被拦下并提示——确认放弃手工改动请加 `--force` 覆盖。多仓工作区的 AGENTS.md 由 `init_workspace` 在 setup 的 multi 流程中刷新。
241289

242290
生成的文档结构:
@@ -993,12 +1041,24 @@ After:
9931041
pip install codewiki-plus
9941042
```
9951043

1044+
If `pip` is not on PATH, use:
1045+
1046+
```bash
1047+
python -m pip install --upgrade codewiki-plus
1048+
```
1049+
9961050
Verify:
9971051

9981052
```bash
9991053
codewiki --version
10001054
```
10011055

1056+
If the installed CLI entry point is not on PATH, use:
1057+
1058+
```bash
1059+
python -m codewiki --version
1060+
```
1061+
10021062
> **For developers** (latest unreleased changes) — [uv](https://docs.astral.sh/uv/) is recommended to reproduce the dev environment exactly as locked by `uv.lock` (`tool.uv.default-groups = ["dev"]` includes dev tools):
10031063
> ```bash
10041064
> git clone https://github.com/mambo-wang/CodeWiki-Plus.git
@@ -1018,6 +1078,35 @@ codewiki --version
10181078
>
10191079
> Existing clones are origin-validated only by default; `--update` runs `fetch origin` + `merge --ff-only @{upstream}` only for clean working trees. `--force` overwrites only modified CodeWiki-managed AGENTS/MCP/hook/skill content; it never deletes directories, resets Git, switches layout, commits, or pushes. Do not store tokens in clone URLs or registration config, and logs redact sensitive URL fields. setup/bootstrap never analyze code or generate Wiki automatically. `--lang zh|en` sets skill/MCP language and `--dry-run` previews only. The generated MCP interpreter is platform-specific (`python` on Windows, `python3` on macOS/Linux). The steps below are the manual equivalent.
10201080
1081+
**CLI install and initialization**
1082+
1083+
After installation, complete first-time wiring from the command line:
1084+
1085+
```bash
1086+
# Wire the current project as a single-repo workspace
1087+
codewiki setup --mode single
1088+
1089+
# Target a specific project directory (useful for scripts or CI)
1090+
codewiki setup --repo-path /path/to/project --mode single
1091+
1092+
# Initialize a multi-repo workspace and register/clone business repos
1093+
codewiki setup --repo-path /path/to/workspace --mode multi \
1094+
--repo https://github.com/org/repo-a.git \
1095+
--repo https://github.com/org/repo-b.git
1096+
1097+
# Initialize a multi-repo workspace without registering business repos
1098+
codewiki setup --repo-path /path/to/workspace --mode multi
1099+
1100+
# Preview without writing files, cloning, or initializing Git
1101+
codewiki setup --repo-path /path/to/workspace --mode multi --dry-run
1102+
```
1103+
1104+
If `codewiki` is not on PATH, replace `codewiki setup` with `python -m codewiki setup`.
1105+
1106+
- `--repo` is optional and repeatable. The first run can initialize the workspace without any repo, and repos can be registered later with `codewiki setup --repo <URL>` or `add_workspace_repo`.
1107+
- `--layout` is optional. New multi-repo workspaces default to `centralized`; existing unconfigured multi-repo workspaces default to `colocated`; once a layout is saved, it cannot be switched in place.
1108+
- setup only confirms workspace mode, wires hooks/session capture, merges `.mcp.json`, and refreshes skill snapshots. It does not analyze code or generate Wiki content.
1109+
10211110
Add the following to your CodeBuddy MCP settings:
10221111
10231112
```json
@@ -1066,6 +1155,13 @@ pip install --upgrade codewiki-plus
10661155
codewiki setup
10671156
```
10681157
1158+
If `pip` or `codewiki` is not on PATH, use:
1159+
1160+
```bash
1161+
python -m pip install --upgrade codewiki-plus
1162+
python -m codewiki setup
1163+
```
1164+
10691165
Re-running `codewiki setup` is idempotent: it refreshes the `codewiki-*` skill snapshots, the CodeWiki-managed marked blocks in AGENTS.md (task-memory guidance block and the "CodeWiki LLM Wiki" usage block), and hook wiring, keeping them aligned with the installed package version. Manually modified managed content is blocked with a hint — pass `--force` to overwrite if you accept losing your edits. For multi-repo workspaces, AGENTS.md is refreshed by `init_workspace` during setup's multi flow.
10701166
10711167
### MCP Tools

0 commit comments

Comments
 (0)