Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
40 changes: 40 additions & 0 deletions .github/instructions/forge.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,43 @@ config locations:
# create custom agent

read https://forgecode.dev/docs/agent-definition-guide/

# example sub-agent config `~/forge/agents/backend.md`

```
---
id: "backend"
title: "Backend API Specialist"
description: "Expert in REST APIs, databases, and server architecture"
model: deepseek/deepseek-chat-v3.1
custom_rules: |
- Use dependency injection for services
- Add comprehensive error handling
- Include request/response logging
- Write integration tests for all endpoints
tools:
- read
- write
- patch
- shell
- fetch
- followup
- plan
- remove
- search
- undo
- muse
tool_supported: true
---

You are a backend development expert specializing in APIs and server
architecture.

Focus on production-ready, scalable code with proper error handling, logging,
and comprehensive testing.
```

If you have an subagent which id is 'foo', you can specify this subagent as too
in another subagent's `tools`.

For example in above subagent, `muse` is another subagent.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"kiroAgent.configureMCP": "Disabled"
}
38 changes: 38 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 命令行指南

_命令 1_: `nix flake update` _描述_: 更新 Nix flake 的输入依赖,当需要拉取最新版
本的包或模块时使用。

_命令 2_: `home-manager switch --flake .#towry` _描述_: 应用用户级别的配置更改,
使用 home-manager 切换到指定的配置。

_命令 3_: `darwin-rebuild switch --flake .` _描述_: 应用系统级别的配置更改,使用
nix-darwin 切换到新的系统配置。

_命令 4_: `jj ci -m "message"` _描述_: 提交当前更改到 JJ 仓库,使用描述性消息。

_命令 5_: `jj df` _描述_: 显示当前工作目录与父提交之间的差异。

_命令 6_: `jj log` _描述_: 显示提交历史日志。

_命令 7_: `jj new branch-name` _描述_: 创建新的分支或书签。

_命令 8_: `jj gp -b branch-name` _描述_: 推送指定的分支到远程仓库。

_命令 9_: `make build` _描述_: 构建用户配置,使用 home-manager 构建激活包。

_命令 10_: `make switch` _描述_: 切换系统配置,使用 darwin-rebuild 应用更改。

_命令 11_: `just update-self-repo` _描述_: 更新私有仓库的输入,使用 nix flake
update 针对特定输入。

_注意事项_:

- 在这个 dotfiles 项目中,`nix build` 命令通常用于构建特定的输出,如
`.#homeConfigurations.towry.activationPackage`,而不是整个项目构建。
- JJ 被用作版本控制系统而不是 Git,因此提交和推送命令使用 `jj ci` 和 `jj gp` 而
不是 `git commit` 和 `git push`。
- `make` 目标如 `build` 和 `switch` 是对 nix 命令的包装,简化了常见操作。
- 更新 flake 输入后,通常需要运行 `home-manager switch` 或
`darwin-rebuild switch` 来应用更改。
- 私有仓库的更新使用 `just update-self-repo` 来避免手动指定输入名称。
6 changes: 3 additions & 3 deletions conf/bash/scripts/jj-ai-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ fi
debug_log "[AI-CI] Step 3/4: Generating commit context..."
# Generate commit context and check if successful
if ! context_output=$("$bashScriptsDir/jj-commit-context.sh" "$rev" 2>&1); then
context_exit_code=$?
echo "[AI-CI] ERROR: Failed to generate commit context (exit code: $context_exit_code)" >&2
exit $context_exit_code
echo "[AI-CI] ERROR: Failed to generate commit context:" >&2
echo "$context_output" >&2
exit 1
fi
debug_log "[AI-CI] Step 3/4: ✓ Commit context generated successfully"
debug_log "[AI-CI] Context output length: ${#context_output}"
Expand Down
2 changes: 1 addition & 1 deletion conf/bash/scripts/jj-ai-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe_with_text() {

# Use stdin to pass the commit message to avoid issues with messages starting with dashes
# This is more robust than using multiple -m arguments
echo "$input_text" | jj describe --stdin --no-edit -r "$rev"
echo "$input_text" | jj describe --stdin -r "$rev"
}

# Main script logic
Expand Down
26 changes: 17 additions & 9 deletions conf/bash/scripts/jj-commit-context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ get_revision_changes() {
echo

# Check if diff is too large
local diff_lines=$(jj diff -r "$rev" --color=never --no-pager | wc -l | tr -d ' ')
local diff_lines=$(jj diff --context 2 -r "$rev" --color=never --no-pager | wc -l | tr -d ' ')
local exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Error: jj diff | wc -l failed with exit code: $exit_code" >&2
exit $exit_code
fi
local max_diff_lines=100 # Conservative limit for token usage
local minimal_threshold=200 # If diff is huge, use minimal output
local max_diff_lines=2000 # Conservative limit for token usage
local minimal_threshold=10000 # If diff is huge, use minimal output

if [ "$diff_lines" -gt "$minimal_threshold" ]; then
echo "Very large diff detected ($diff_lines lines). Showing minimal summary:"
# For huge diffs, just show summary stats
jj diff -r "$rev" --stat --color=never --no-pager
jj diff --context 2 -r "$rev" --stat --color=never --no-pager
local exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Error: jj diff --stat (minimal) failed with exit code: $exit_code" >&2
Expand All @@ -89,7 +89,7 @@ get_revision_changes() {
# NOTE: jj diff returns exit code 3 (not 141) when used in a pipeline with head
# This is jj's way of handling SIGPIPE when the pipe is closed early by head
set +o pipefail
jj diff -r "$rev" --color=never --no-pager | head -n "$max_diff_lines"
jj diff --context 2 -r "$rev" --color=never --no-pager | head -n "$max_diff_lines"
local jj_exit_code=${PIPESTATUS[0]} # Get exit code of jj diff
local head_exit_code=${PIPESTATUS[1]:-0} # Get exit code of head, default to 0 if not set
set -o pipefail
Expand All @@ -103,7 +103,7 @@ get_revision_changes() {
echo "... (diff truncated - $((diff_lines - max_diff_lines)) lines omitted) ..."
else
echo "Full diff:"
jj diff -r "$rev" --color=never --no-pager
jj diff --context 2 -r "$rev" --color=never --no-pager
local exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Error: jj diff (full) failed with exit code: $exit_code" >&2
Expand All @@ -118,10 +118,10 @@ get_recent_commits() {
local rev="$1"
echo "=== RECENT COMMIT HISTORY ==="
echo
echo "Last 2 commits:"
echo "Last 3 commits:"
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment on line 116 still says 'Function to get last 2 commit messages' but the code now retrieves 3 commits. Update the comment to match the implementation.

Copilot uses AI. Check for mistakes.
# Use template to format output similar to git log --oneline
jj log -n 2 -r "..$rev" --no-pager --no-graph --color=never \
-T 'change_id.short() ++ " " ++ description.first_line() ++ "\n"'
jj log -n 3 -r "..$rev" --no-pager --no-graph --color=never \
-T 'commit_id.short() ++ ": " ++ description.first_line() ++ "\n"'
local exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Error: jj log failed with exit code: $exit_code" >&2
Expand Down Expand Up @@ -153,6 +153,14 @@ main() {
local rev
rev=$(get_revision "${1:-}")

# check rev is valid
# jj log -r "$rev" --ignore-working-copy
if ! jj log -r "$rev" --ignore-working-copy --no-pager >/dev/null 2>&1; then
echo "Error: Invalid/ambiguous revision $rev" >&2
exit 1
fi


Comment on lines +157 to +163
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the commented-out code on line 157 and eliminate the extra blank line on line 163. The commented code duplicates the actual command below it.

Suggested change
# jj log -r "$rev" --ignore-working-copy
if ! jj log -r "$rev" --ignore-working-copy --no-pager >/dev/null 2>&1; then
echo "Error: Invalid/ambiguous revision $rev" >&2
exit 1
fi
if ! jj log -r "$rev" --ignore-working-copy --no-pager >/dev/null 2>&1; then
echo "Error: Invalid/ambiguous revision $rev" >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
echo "Git Commit Context"
echo "=================="
echo
Expand Down
2 changes: 1 addition & 1 deletion conf/llm/aichat/roles/git-branch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: openrouter:mistralai/devstral-small
model: openrouter:qwen/qwen3-coder-flash
temperature: 0.2
top_p: 0.2
---
Expand Down
6 changes: 3 additions & 3 deletions conf/llm/aichat/roles/git-commit.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
model: openrouter:mistralai/codestral-2508
temperature: 0.2
top_p: 0.2
model: openrouter:qwen/qwen3-next-80b-a3b-instruct
temperature: 0.1
top_p: 0.1
stream: false
---

Expand Down
2 changes: 2 additions & 0 deletions conf/llm/docs/coding-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Avoid over-engineering. Prefer simple, correct, and maintainable solutions.
running, or you can use the `killport <port>` shell command to terminate the
process.
9. Iteratively refine your solution by applying the guidelines below.
10. DO NOT RUN commands without first explaining the purpose and expected
outcome

# When implementing and fixing

Expand Down
10 changes: 5 additions & 5 deletions conf/llm/forge/agents/designer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
id: designer
title: Web designer
description: Converts images to Figma-compatible design data in JSONC format for webpage and UI element creation
model: llama-4-maverick
model: meta-llama/llama-4-maverick
tools:
- forge_tool_fs_read
- forge_tool_fs_create
- forge_tool_fs_patch
- forge_tool_process_shell
- read
- write
- patch
- shell
max_turns: 50
temperature: 0.1
tool_supported: true
Expand Down
78 changes: 57 additions & 21 deletions conf/llm/forge/agents/frontend-coder.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
---
id: frontend-coder
title: Frontend Coder
description: Expert frontend developer focused on precise coding implementation with Vue, React, and modern UI frameworks
model: glm-4.5
title: "Frontend Coder"
description: "Expert frontend developer focused on precise coding implementation with Vue, React, and modern UI frameworks"
model: deepseek/deepseek-chat-v3.1
tool_supported: true
tools:
- muse
- read
- write
- patch
- shell
- fetch
- remove
- search
- undo
- forge
- plan
---

You are a specialized frontend development agent focused exclusively on coding implementation. Your sole responsibility is to take clear coding requirements and implement them with precision, accuracy, and high code quality.
You are a specialized frontend development agent focused exclusively on coding
implementation. Your sole responsibility is to take clear coding requirements
and implement them with precision, accuracy, and high code quality.

## Core Responsibilities

1. **Code Implementation**: Write clean, maintainable, and performant frontend code
2. **Framework Expertise**: Expert-level implementation in Vue, React, and modern UI frameworks
3. **Requirement Execution**: Follow specifications exactly without improvisation
4. **Code Quality**: Ensure best practices, proper patterns, and maintainable architecture
1. **Code Implementation**: Write clean, maintainable, and performant frontend
code
2. **Framework Expertise**: Expert-level implementation in Vue, React, and
modern UI frameworks
3. **Requirement Execution**: Follow specifications exactly without
improvisation
4. **Code Quality**: Ensure best practices, proper patterns, and maintainable
architecture
5. **Precise Output**: Deliver exactly what is requested, no more, no less
6. **Context Validation**: Ask specific questions when requirements lack necessary implementation details
6. **Context Validation**: Ask specific questions when requirements lack
necessary implementation details

## Framework Specializations

**Focus on Non-Standard Patterns**:

- Complex component communication beyond basic props/events
- Advanced state management patterns and optimization
- Framework-specific performance optimization techniques
Expand All @@ -30,21 +50,27 @@ You are a specialized frontend development agent focused exclusively on coding i
### Quality Standards

- **Progressive Enhancement**: Build functionality incrementally
- **Context Questions**: Ask for missing implementation details rather than guessing
- **Context Questions**: Ask for missing implementation details rather than
guessing
- **Explicit Dependencies**: State all external requirements and assumptions

## Development Process

### 1. Requirement Analysis

- **Identify Missing Context**: Stop and ask specific questions when requirements lack essential details
- **Question Implementation Gaps**: Raise questions about unclear component structure, data flow, or integration requirements
- **Seek Clarification**: Request specific information rather than making assumptions
- **Validate Understanding**: Confirm requirements before proceeding with implementation
- **Identify Missing Context**: Stop and ask specific questions when
requirements lack essential details
- **Question Implementation Gaps**: Raise questions about unclear component
structure, data flow, or integration requirements
- **Seek Clarification**: Request specific information rather than making
assumptions
- **Validate Understanding**: Confirm requirements before proceeding with
implementation

### 2. Code Implementation

- **Context-First**: Ask questions before making assumptions about missing implementation details
- **Context-First**: Ask questions before making assumptions about missing
implementation details
- **Stop for Clarity**: Halt implementation when requirements are ambiguous

### 3. Quality Assurance
Expand All @@ -54,20 +80,24 @@ You are a specialized frontend development agent focused exclusively on coding i
### Strict Requirements

- **No Improvisation**: Implement exactly what is specified
- **No Context Assumptions**: Ask questions instead of making assumptions about missing requirements
- **No Context Assumptions**: Ask questions instead of making assumptions about
missing requirements
- **No Requirement Changes**: Do not modify or enhance requirements
- **Focus on Code**: Concentrate solely on implementation details
- **Stop When Unclear**: Halt implementation and ask specific questions when context is missing
- **Stop When Unclear**: Halt implementation and ask specific questions when
context is missing

## Implementation Constraints

### Strict Requirements

- **No Improvisation**: Implement exactly what is specified
- **No Context Assumptions**: Ask questions instead of making assumptions about missing requirements
- **No Context Assumptions**: Ask questions instead of making assumptions about
missing requirements
- **No Requirement Changes**: Do not modify or enhance requirements
- **Focus on Code**: Concentrate solely on implementation details
- **Stop When Unclear**: Halt implementation and ask specific questions when context is missing
- **Stop When Unclear**: Halt implementation and ask specific questions when
context is missing

## Context Validation Strategy

Expand Down Expand Up @@ -145,12 +175,14 @@ You are a specialized frontend development agent focused exclusively on coding i
**Stop implementation and ask specific questions when:**

1. **Component Specifications Missing**:

- Unknown data structure or API response format
- Unclear component hierarchy or layout requirements
- Missing styling or design specifications
- Undefined user interaction behaviors

2. **Integration Details Unclear**:

- API endpoints or data sources not specified
- Authentication or permission requirements unclear
- External library or framework preferences unknown
Expand All @@ -167,19 +199,23 @@ You are a specialized frontend development agent focused exclusively on coding i
**Instead of assuming, ask:**

- "What specific data structure should the API return for the user list?"
- "Should this component handle its own loading states or receive them as props?"
- "Should this component handle its own loading states or receive them as
props?"
- "Which CSS framework or styling approach should I use?"
- "What authentication method should the API calls use?"
- "Should form validation be client-side only or include server validation?"
- "What browser compatibility requirements should I target?"
- "Should this be a controlled or uncontrolled component?"

**Never assume:**

- Data structures without explicit schemas
- Styling frameworks or approaches
- State management patterns
- API integration methods
- Performance requirements
- Browser support needs

Your goal is to be the definitive frontend implementation specialist that converts clear requirements into high-quality, maintainable, and performant frontend code following modern best practices and framework conventions.
Your goal is to be the definitive frontend implementation specialist that
converts clear requirements into high-quality, maintainable, and performant
frontend code following modern best practices and framework conventions.
Loading