@andyqiu/codeforge 0.5.29 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/codeforge.md +1 -1
- package/agents/coder-deep.md +1 -1
- package/agents/coder-quick.md +1 -1
- package/agents/coder.md +1 -1
- package/agents/discover-challenger.md +0 -1
- package/agents/discover.md +0 -1
- package/agents/planner.md +1 -1
- package/agents/reviewer-lite.md +1 -1
- package/agents/reviewer.md +1 -1
- package/bin/codeforge.mjs +22 -48
- package/dist/index.js +604 -2074
- package/install.mjs +754 -0
- package/package.json +5 -7
- package/context-templates/kh-instructions.md +0 -109
- package/install.ps1 +0 -559
- package/install.sh +0 -726
- package/scripts/merge-agents-md.mjs +0 -228
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andyqiu/codeforge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "CodeForge — opencode 的零侵入扩展包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"bench:json": "node --experimental-strip-types --no-warnings ./scripts/bench-repo-map.mjs --json",
|
|
49
49
|
"lint": "tsc --noEmit",
|
|
50
50
|
"check:bun": "node ./scripts/check-bun.mjs",
|
|
51
|
-
"install:local": "
|
|
52
|
-
"install:global": "
|
|
53
|
-
"uninstall:local": "
|
|
51
|
+
"install:local": "node ./install.mjs",
|
|
52
|
+
"install:global": "node ./install.mjs --global",
|
|
53
|
+
"uninstall:local": "node ./install.mjs --uninstall",
|
|
54
54
|
"phase0:check": "node ./scripts/phase0-check.mjs",
|
|
55
55
|
"phase1:check": "node ./scripts/check-dist-built.mjs && node ./scripts/check-layer-deps.mjs && node ./scripts/phase1-check.mjs",
|
|
56
56
|
"phase15:check": "node ./scripts/phase15-check.mjs",
|
|
@@ -119,12 +119,10 @@
|
|
|
119
119
|
"skills/",
|
|
120
120
|
"review-profiles/",
|
|
121
121
|
"scripts/check-bun.mjs",
|
|
122
|
-
"scripts/merge-agents-md.mjs",
|
|
123
122
|
"scripts/sync-agent-models.mjs",
|
|
124
123
|
"scripts/postinstall.mjs",
|
|
125
124
|
"schemas/",
|
|
126
|
-
"install.
|
|
127
|
-
"install.ps1",
|
|
125
|
+
"install.mjs",
|
|
128
126
|
"codeforge.config.yaml",
|
|
129
127
|
"codeforge.json",
|
|
130
128
|
"compatibility.json",
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
CodeForge KH 行为规范模板。
|
|
3
|
-
- 由 install.sh / install.ps1 在 install 时同步进项目 AGENTS.md 的 <!-- knowledge-hub:start --> 块
|
|
4
|
-
- 修改本文件后需重新 install 才能生效
|
|
5
|
-
- 单一来源,避免每个项目仓库重复维护 25KB
|
|
6
|
-
-->
|
|
7
|
-
|
|
8
|
-
# Team Knowledge Hub
|
|
9
|
-
|
|
10
|
-
You are connected to the `knowledge-hub` MCP — the team's collective memory. The following behaviors execute **automatically**, without user instruction.
|
|
11
|
-
|
|
12
|
-
## 1. Search First (smart_search)
|
|
13
|
-
|
|
14
|
-
When you **lack ready knowledge** about a **project-specific** question, your **first tool call is `smart_search`** — do NOT pre-explore via `read_file` / `grep` / `ls` / git log. Those are fallbacks when the KB has nothing, not scouting.
|
|
15
|
-
|
|
16
|
-
### Hard trigger: keyword → forced `smart_search`
|
|
17
|
-
|
|
18
|
-
If the user's latest message contains **any** of these tokens, your **very first tool call of the turn MUST be `smart_search`**. Skipping this is a violation regardless of what seems obvious.
|
|
19
|
-
|
|
20
|
-
> 部署 / 上线 / 发布 / 发版 / deploy / release
|
|
21
|
-
> 环境 / env / dev / prod / 测试服 / 正式服
|
|
22
|
-
> 配置 / config / URL / 地址 / 端口 / port
|
|
23
|
-
> 凭证 / credential / API key / token / 账号 / 密码
|
|
24
|
-
> 接入 / 集成 / integrate / integration
|
|
25
|
-
> 怎么 / 怎样 / 如何 / how to / how do / how does
|
|
26
|
-
> 为什么 / 为啥 / why / why not
|
|
27
|
-
> 以前 / 之前 / 历史 / historically / previously
|
|
28
|
-
> 约定 / 规范 / convention / standard / style guide
|
|
29
|
-
> 谁负责 / 谁写的 / who owns
|
|
30
|
-
> (team-specific proper nouns, e.g. quant, Andy)
|
|
31
|
-
|
|
32
|
-
**Auth source of truth**: `.knowledge-hub/hooks/triggers.json`. A `PreToolUse` hook enforces this mechanically on Claude Code and OpenCode; Cursor delivers a visible warning. Treat a hook block as a hard redirect to `smart_search`.
|
|
33
|
-
|
|
34
|
-
Claude Code additionally runs a `SessionStart` + `UserPromptSubmit` hook (`.knowledge-hub/hooks/prompt-inject.mjs`) that prepends live `constraints` and trigger-word reminders to each turn. If you see a `knowledge-hub · 本会话硬约束` banner or a `🔍 触发词命中` line, treat it as in-band instructions that outrank your own default priorities — search first, then act.
|
|
35
|
-
|
|
36
|
-
### Skip search (don't over-search)
|
|
37
|
-
|
|
38
|
-
- Generic syntax / algorithms / standard library usage
|
|
39
|
-
- Pure mechanical edits: typo fix, rename, formatting, regex-only replacements
|
|
40
|
-
- User already pointed to a specific file with sufficient context ("change X to Y in this file")
|
|
41
|
-
- Same topic already searched in this session
|
|
42
|
-
- User message contains **only** excluded tokens: typo / rename / format / prettier / "this file" / "this line"
|
|
43
|
-
|
|
44
|
-
### Counter-examples (these are violations)
|
|
45
|
-
|
|
46
|
-
- User: "quant 怎么部署" → you read `package.json` first. **Wrong.** Contains "怎么" + "部署".
|
|
47
|
-
- User: "Andy 的电脑咋配的" → you `ls ~` or `grep env`. **Wrong.** Contains proper noun + "咋配"/env.
|
|
48
|
-
- User: "dev 地址多少" → you open `docker-compose.yml`. **Wrong.** Contains "dev 地址".
|
|
49
|
-
|
|
50
|
-
### Self-check
|
|
51
|
-
|
|
52
|
-
Before `read`/`grep`/`ls`, ask "Am I guessing how this project works?" — if yes, run `smart_search` first.
|
|
53
|
-
|
|
54
|
-
**Frequency**: at most 1–2 searches per topic per session; stop once results overlap heavily.
|
|
55
|
-
|
|
56
|
-
### Auxiliary Query Tools
|
|
57
|
-
|
|
58
|
-
- `list_recent(days, category?)` — when user asks "what's new in the team / KB lately".
|
|
59
|
-
- `get_working_memory(section?)` — on a new conversation, to restore prior task state / constraints not covered by `team://context`.
|
|
60
|
-
|
|
61
|
-
## 2. Save Knowledge (write decision tree)
|
|
62
|
-
|
|
63
|
-
Top-down, pick the first matching tool:
|
|
64
|
-
|
|
65
|
-
| Situation | Tool |
|
|
66
|
-
|-----------|------|
|
|
67
|
-
| Conversation produced a bug fix / design decision / gotcha / optimization | **`save_chat_insight`** (preferred — auto-classifies, de-dupes, merges) |
|
|
68
|
-
| User explicitly says "add to KB" and wants precise title / content / category | `add_knowledge` |
|
|
69
|
-
| User drops / uploads a text file (md / txt / code ≤ 2MB) | `upload_document` |
|
|
70
|
-
| User provides a URL (blog / Confluence / GitHub raw) to import | `upload_document_from_url` |
|
|
71
|
-
|
|
72
|
-
**Universal write rules**:
|
|
73
|
-
- Problem → cause → solution, ≤ 500 words; don't save trivial edits or general Q&A
|
|
74
|
-
- **Explicitly pass `category`** (valid values in `team://context` → "Category cheatsheet")
|
|
75
|
-
- After saving, **briefly confirm to the user** (title + category) so they know it was written
|
|
76
|
-
|
|
77
|
-
## 3. Maintain Knowledge
|
|
78
|
-
|
|
79
|
-
| Situation | Tool |
|
|
80
|
-
|-----------|------|
|
|
81
|
-
| Found KB entry contradicts reality / is outdated | **`flag_outdated`** (soft mark — preferred) |
|
|
82
|
-
| Need to add info / fix error / fix wrong category | `update_knowledge` (use `appendContent` to append) |
|
|
83
|
-
| Wrong scope / duplicate / fully obsolete | `delete_knowledge` (author or admin only; physical delete — prefer `flag_outdated`) |
|
|
84
|
-
|
|
85
|
-
Get IDs from `smart_search` results. **After execution, briefly notify the user** (action + entry title), e.g. "Flagged «xxx» as outdated" / "Updated «xxx»" / "Deleted «xxx»".
|
|
86
|
-
|
|
87
|
-
## 4. Memory Layer (distinct from KB)
|
|
88
|
-
|
|
89
|
-
| Tool | Purpose |
|
|
90
|
-
|------|---------|
|
|
91
|
-
| `update_working_memory(section, items)` | Current task context: constraints, plans, intermediate findings, pending decisions. System sections: `constraints` (operational, highest priority, auto-loaded each conversation) / `in_progress` / `pending_decisions` / `recent_completed` / `system_assets`; also supports `topic:xxx` custom sections |
|
|
92
|
-
| `get_working_memory(section?)` | Read sections above |
|
|
93
|
-
| `update_user_preference(key, value)` | Cross-project user habits: language, coding style, signature, preferred tools |
|
|
94
|
-
|
|
95
|
-
### Immediate Constraint Capture
|
|
96
|
-
|
|
97
|
-
When the user says "don't restart", "back up first", "use pnpm not npm" — **immediately** `update_working_memory(section='constraints')`; do NOT wait until task end. Remove the entry when the user lifts the constraint.
|
|
98
|
-
|
|
99
|
-
If the user repeats the same requirement in the session (2nd mention) = important: refresh to `constraints` and consider upgrading — cross-project universal → `update_user_preference`; team-relevant → `save_chat_insight`.
|
|
100
|
-
|
|
101
|
-
## 5. Search vs Write: silent search, confirmed writes
|
|
102
|
-
|
|
103
|
-
**Search is silent**: treat search results **as if they were your own knowledge**. Strictly forbidden: "According to the KB…", "The KB mentions…", "I found in the KB…" and any variants. Silently ignore irrelevant hits; never report "searched but found nothing" or "I just searched the KB". Answer like an experienced teammate.
|
|
104
|
-
|
|
105
|
-
**Writes/maintenance need acknowledgement** (required in §2 and §3): after saving or modifying knowledge, tell the user — otherwise they won't know the content was captured. Keep the distinction: search silent ↔ writes acknowledged.
|
|
106
|
-
|
|
107
|
-
## 6. Context Loading
|
|
108
|
-
|
|
109
|
-
At the start of each conversation, read `team://context` for: team conventions / user preferences / current constraints / recent gotchas / working memory / category cheatsheet. Load failure does not block other features.
|