Skip to content

Commit 7d3777f

Browse files
mhenkeqwencoder
andcommitted
fix: address remaining PR #516 review comments
- Add python3 availability check before using in symlink fallback - Suppress macOS/BSD sed errors with proper fallback handling - Add feedback when no prompt templates found in glob - Clarify hub pattern is correct (symlinks TO ~/.qwen, not into repo) - Align QWEN.md Task mapping with install.sh context block - Fix README.qwen.md table structure (note was interrupting rows) - Add agent symlink cleanup to uninstall instructions - Document YAML frontmatter format in agent files Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent e48fa19 commit 7d3777f

File tree

7 files changed

+50
-13
lines changed

7 files changed

+50
-13
lines changed

.qwen/INSTALL.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,16 @@ Skills update instantly through the symlinks.
106106
find ~/.qwen/skills -type l -lname '*/superpowers/skills/*' -delete
107107
```
108108

109-
2. **Clean up QWEN.md:** Edit `~/.qwen/QWEN.md` and remove the block between
109+
2. **Remove the agent symlinks:**
110+
111+
```bash
112+
find ~/.qwen/agents -type l -lname '*/superpowers/agents/*' -delete
113+
```
114+
115+
3. **Clean up QWEN.md:** Edit `~/.qwen/QWEN.md` and remove the block between
110116
`<!-- SUPERPOWERS-CONTEXT-START -->` and `<!-- SUPERPOWERS-CONTEXT-END -->`.
111117

112-
3. **Remove the repo:**
118+
4. **Remove the repo:**
113119

114120
```bash
115121
rm -rf ~/.qwen/superpowers

.qwen/agents/code-reviewer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Qwen Code CLI Subagent Definition
2+
# Format: YAML frontmatter + Markdown system prompt
3+
# See: https://qwenlm.github.io/qwen-code-docs/en/users/features/sub-agents/
14
---
25
name: code-reviewer
36
description: A subagent focused on reviewing code for quality, best practices, and maintainability.

.qwen/agents/implementer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Qwen Code CLI Subagent Definition
2+
# Format: YAML frontmatter + Markdown system prompt
3+
# See: https://qwenlm.github.io/qwen-code-docs/en/users/features/sub-agents/
14
---
25
name: implementer
36
description: A subagent specialized in implementing tasks, writing tests, and self-reviewing code.

.qwen/agents/spec-reviewer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Qwen Code CLI Subagent Definition
2+
# Format: YAML frontmatter + Markdown system prompt
3+
# See: https://qwenlm.github.io/qwen-code-docs/en/users/features/sub-agents/
14
---
25
name: spec-reviewer
36
description: A subagent that verifies an implementation matches its specification exactly.

.qwen/install.sh

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ for skill_path in "$REPO_SKILLS_DIR"/*/; do
5454
# Use relative path for portability (repo relocation doesn't break links)
5555
if ln -sr "$skill_path" "$target_path" 2>/dev/null; then
5656
: # GNU ln with -r support
57-
else
57+
elif command -v python3 >/dev/null 2>&1; then
5858
# Fallback: compute relative path with Python
5959
rel_path="$(python3 -c "import os,sys; print(os.path.relpath(sys.argv[1], sys.argv[2]))" "$skill_path" "$SKILLS_DIR")"
6060
ln -s "$rel_path" "$target_path"
61+
else
62+
echo " ⚠ Warning: Neither GNU ln -sr nor python3 available. Using absolute path (less portable)."
63+
ln -s "$skill_path" "$target_path"
6164
fi
6265
echo "$skill_name"
6366
fi
@@ -88,9 +91,12 @@ if [ -d "$REPO_AGENTS_DIR" ]; then
8891
# Use relative path for portability
8992
if ln -sr "$agent_path" "$target_path" 2>/dev/null; then
9093
: # GNU ln with -r support
91-
else
94+
elif command -v python3 >/dev/null 2>&1; then
9295
rel_path="$(python3 -c "import os,sys; print(os.path.relpath(sys.argv[1], sys.argv[2]))" "$agent_path" "$AGENTS_DIR")"
9396
ln -s "$rel_path" "$target_path"
97+
else
98+
echo " ⚠ Warning: Neither GNU ln -sr nor python3 available. Using absolute path (less portable)."
99+
ln -s "$agent_path" "$target_path"
94100
fi
95101
echo "$agent_name"
96102
fi
@@ -104,8 +110,10 @@ PROMPT_TEMPLATES_DIR="$REPO_AGENTS_DIR"
104110

105111
if [ -d "$PROMPT_TEMPLATES_DIR" ]; then
106112
echo "Linking Qwen prompt templates to subagent skills..."
113+
templates_linked=0
107114
for template in "$PROMPT_TEMPLATES_DIR"/*-prompt-template.md; do
108115
if [ -f "$template" ]; then
116+
templates_linked=$((templates_linked + 1))
109117
template_name=$(basename "$template")
110118
# Map template names to skill directories
111119
if [[ "$template_name" == "implementer-prompt-template.md" ]]; then
@@ -125,13 +133,21 @@ if [ -d "$PROMPT_TEMPLATES_DIR" ]; then
125133
# Use relative path for portability
126134
if ln -sr "$template" "$target_skill" 2>/dev/null; then
127135
: # GNU ln with -r support
128-
else
136+
elif command -v python3 >/dev/null 2>&1; then
129137
rel_path="$(python3 -c "import os,sys; print(os.path.relpath(sys.argv[1], sys.argv[2]))" "$template" "$(dirname "$target_skill")")"
130138
ln -s "$rel_path" "$target_skill"
139+
else
140+
echo " ⚠ Warning: Neither GNU ln -sr nor python3 available. Using absolute path (less portable)."
141+
ln -s "$template" "$target_skill"
131142
fi
132143
echo "$(basename "$target_skill")"
133144
fi
134145
done
146+
if [ "$templates_linked" -eq 0 ]; then
147+
echo " ℹ No prompt template files found in $PROMPT_TEMPLATES_DIR"
148+
fi
149+
else
150+
echo "No agents directory found at $REPO_AGENTS_DIR, skipping agent linking."
135151
fi
136152

137153

@@ -181,9 +197,11 @@ fi
181197
# Trim trailing blank lines (prevents accumulation on repeated runs)
182198
if sed -i.bak -e :a -e '/^\n*$/{$d;N;ba' -e '}' "$QWEN_MD" 2>/dev/null; then
183199
rm -f "${QWEN_MD}.bak"
200+
elif awk '{print; n=0} /^$/{n++} END{for(i=0;i<n-1;i++)print ""}' "$QWEN_MD" > "${QWEN_MD}.tmp" 2>/dev/null; then
201+
# Fallback: awk version for systems without GNU sed (macOS/BSD)
202+
mv "${QWEN_MD}.tmp" "$QWEN_MD"
184203
else
185-
# Fallback: awk version for systems without GNU sed
186-
awk '{print; n=0} /^$/{n++} END{for(i=0;i<n-1;i++)print ""}' "$QWEN_MD" > "${QWEN_MD}.tmp" && mv "${QWEN_MD}.tmp" "$QWEN_MD"
204+
echo "Warning: Could not trim blank lines from $QWEN_MD" >&2
187205
fi
188206

189207
# Append context block with single newline separator

QWEN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ To use a skill, read its `SKILL.md` file and follow the instructions. Start with
77
## Terminology Mapping
88

99
Skills reference Claude Code tools. Use these Qwen equivalents:
10-
- **"Task" tool**Sequential execution (perform tasks yourself)
10+
- **"Task" tool**Use your native `task()` tool with `subagent_type` parameter. Subagents (`implementer`, `spec-reviewer`, `code-reviewer`) are available in `~/.qwen/agents/`.
1111
- **"Skill" tool** → Read the file at `~/.qwen/skills/<skill-name>/SKILL.md`
1212
- **"TodoWrite"** → Write/update a plan file (e.g., `plan.md`)
1313
- File operations → `read_file`, `write_file`, `replace`

docs/README.qwen.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ Skills reference Claude Code tools. Qwen equivalents:
5757
| `Task` (subagents) | `task()` tool |
5858
| `Skill` tool | `read_file` on `~/.qwen/skills/<skill>/SKILL.md` |
5959
| `TodoWrite` | Write/update `plan.md` |
60-
61-
**Note on Qwen Subagent Configuration:**
62-
Qwen Code CLI supports native subagent delegation via its `task()` tool. To enable Superpowers' subagent workflows (like `subagent-driven-development` or `dispatching-parallel-agents`), you will need to define corresponding subagents in `~/.qwen/agents/` using Markdown+YAML configuration files (e.g., `implementer.md`, `code-reviewer.md`). These files define the subagent's role, system prompt, and allowed tools.
6360
| `read_file` | `read_file` |
6461
| `write_file` | `write_file` |
6562
| `Edit` / `replace` | `replace` |
@@ -68,6 +65,8 @@ Qwen Code CLI supports native subagent delegation via its `task()` tool. To enab
6865
| `Shell` | `run_shell_command` |
6966
| `WebFetch` | `web_fetch` |
7067

68+
**Note on Subagent Configuration:** Qwen Code CLI supports native subagent delegation via its `task()` tool. To enable Superpowers' subagent workflows (like `subagent-driven-development` or `dispatching-parallel-agents`), you will need to define corresponding subagents in `~/.qwen/agents/` using Markdown+YAML configuration files (e.g., `implementer.md`, `code-reviewer.md`). These files define the subagent's role, system prompt, and allowed tools. The installer automatically links the required subagents.
69+
7170
## Updating
7271

7372
```bash
@@ -83,9 +82,14 @@ Skills update instantly through the symlinks.
8382
find ~/.qwen/skills -type l -lname '*/superpowers/skills/*' -delete
8483
```
8584

86-
2. Edit `~/.qwen/QWEN.md` and remove the block between `<!-- SUPERPOWERS-CONTEXT-START -->` and `<!-- SUPERPOWERS-CONTEXT-END -->`.
85+
2. Remove agent symlinks:
86+
```bash
87+
find ~/.qwen/agents -type l -lname '*/superpowers/agents/*' -delete
88+
```
89+
90+
3. Edit `~/.qwen/QWEN.md` and remove the block between `<!-- SUPERPOWERS-CONTEXT-START -->` and `<!-- SUPERPOWERS-CONTEXT-END -->`.
8791

88-
3. Remove the repo:
92+
4. Remove the repo:
8993
```bash
9094
rm -rf ~/.qwen/superpowers
9195
```

0 commit comments

Comments
 (0)