ccg-ros2-workflow 2.2.2 → 3.0.0
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/README.md +211 -96
- package/README.zh-CN.md +256 -0
- package/dist/cli.mjs +15 -15
- package/dist/index.d.mts +59 -36
- package/dist/index.d.ts +59 -36
- package/dist/index.mjs +4 -4
- package/dist/shared/ccg-ros2-workflow.Bhm8c7P1.mjs +5154 -0
- package/package.json +31 -12
- package/templates/codex/AGENTS.md +348 -0
- package/templates/codex/agents/ccg-implement.toml +73 -0
- package/templates/codex/agents/ccg-research.toml +73 -0
- package/templates/codex/agents/ccg-review.toml +82 -0
- package/templates/codex/config.toml +21 -0
- package/templates/codex/hooks/ccg-workflow.py +253 -0
- package/templates/codex/hooks.json +15 -0
- package/templates/commands/agents/planner.md +97 -122
- package/templates/commands/agents/system-integrator.md +2 -2
- package/templates/commands/agents/team-architect.md +97 -0
- package/templates/commands/agents/team-qa.md +121 -0
- package/templates/commands/agents/team-reviewer.md +112 -0
- package/templates/commands/commit.md +30 -1
- package/templates/commands/context.md +332 -0
- package/templates/commands/go.md +206 -0
- package/templates/commands/init.md +1 -1
- package/templates/commands/spec-impl.md +41 -21
- package/templates/commands/spec-init.md +21 -27
- package/templates/commands/spec-plan.md +54 -21
- package/templates/commands/spec-research.md +78 -26
- package/templates/commands/spec-review.md +20 -16
- package/templates/{commands → commands-legacy}/analyze.md +1 -1
- package/templates/commands-legacy/backend.md +224 -0
- package/templates/commands-legacy/codex-exec.md +411 -0
- package/templates/{commands → commands-legacy}/debug.md +1 -1
- package/templates/commands-legacy/enhance.md +55 -0
- package/templates/{commands → commands-legacy}/feat.md +2 -2
- package/templates/commands-legacy/frontend.md +213 -0
- package/templates/{commands → commands-legacy}/optimize.md +1 -1
- package/templates/{commands → commands-legacy}/plan.md +1 -15
- package/templates/{commands → commands-legacy}/team-plan.md +1 -1
- package/templates/commands-legacy/team.md +475 -0
- package/templates/{commands → commands-legacy}/test.md +1 -1
- package/templates/commands-legacy/workflow.md +283 -0
- package/templates/engine/model-router.md +123 -0
- package/templates/engine/phase-guide.md +207 -0
- package/templates/engine/strategies/debug-investigate.md +169 -0
- package/templates/engine/strategies/deep-research.md +141 -0
- package/templates/engine/strategies/direct-fix.md +108 -0
- package/templates/engine/strategies/full-collaborate.md +389 -0
- package/templates/engine/strategies/git-action.md +43 -0
- package/templates/engine/strategies/guided-develop.md +282 -0
- package/templates/engine/strategies/optimize-measure.md +103 -0
- package/templates/engine/strategies/quick-implement.md +96 -0
- package/templates/engine/strategies/refactor-safely.md +180 -0
- package/templates/engine/strategies/review-audit.md +123 -0
- package/templates/hooks/session-start.js +100 -0
- package/templates/hooks/skill-router.js +144 -0
- package/templates/hooks/subagent-context.js +161 -0
- package/templates/hooks/task-utils.js +190 -0
- package/templates/hooks/workflow-state.js +55 -0
- package/templates/output-styles/abyss-command.md +56 -0
- package/templates/output-styles/abyss-concise.md +89 -0
- package/templates/output-styles/abyss-ritual.md +70 -0
- package/templates/output-styles/engineer-professional.md +20 -3
- package/templates/output-styles/laowang-engineer.md +2 -2
- package/templates/prompts/antigravity/analyzer.md +59 -0
- package/templates/prompts/antigravity/architect.md +55 -0
- package/templates/prompts/antigravity/builder.md +52 -0
- package/templates/prompts/antigravity/debugger.md +48 -0
- package/templates/prompts/antigravity/frontend.md +50 -0
- package/templates/prompts/antigravity/optimizer.md +40 -0
- package/templates/prompts/antigravity/reviewer.md +67 -0
- package/templates/prompts/antigravity/tester.md +39 -0
- package/templates/prompts/claude/debugger.md +1 -1
- package/templates/prompts/claude/reviewer.md +1 -1
- package/templates/prompts/codex/analyzer.md +8 -0
- package/templates/prompts/codex/architect.md +9 -1
- package/templates/prompts/codex/builder.md +61 -0
- package/templates/prompts/codex/debugger.md +9 -1
- package/templates/prompts/codex/optimizer.md +7 -0
- package/templates/prompts/codex/reviewer.md +7 -0
- package/templates/prompts/codex/tester.md +8 -1
- package/templates/prompts/gemini/analyzer.md +11 -3
- package/templates/prompts/gemini/architect.md +10 -2
- package/templates/prompts/gemini/debugger.md +8 -0
- package/templates/prompts/gemini/frontend.md +10 -2
- package/templates/prompts/gemini/optimizer.md +9 -2
- package/templates/prompts/gemini/reviewer.md +7 -0
- package/templates/prompts/gemini/tester.md +8 -1
- package/templates/rules/ccg-skill-routing.md +91 -0
- package/templates/rules/ccg-skills.md +65 -0
- package/templates/skills/SKILL.md +92 -0
- package/templates/skills/domains/ai/SKILL.md +34 -0
- package/templates/skills/domains/ai/agent-dev.md +242 -0
- package/templates/skills/domains/ai/llm-security.md +288 -0
- package/templates/skills/domains/ai/prompt-and-eval.md +279 -0
- package/templates/skills/domains/ai/rag-system.md +542 -0
- package/templates/skills/domains/architecture/SKILL.md +42 -0
- package/templates/skills/domains/architecture/api-design.md +225 -0
- package/templates/skills/domains/architecture/caching.md +299 -0
- package/templates/skills/domains/architecture/cloud-native.md +285 -0
- package/templates/skills/domains/architecture/message-queue.md +329 -0
- package/templates/skills/domains/architecture/security-arch.md +297 -0
- package/templates/skills/domains/data-engineering/SKILL.md +207 -0
- package/templates/skills/domains/development/SKILL.md +46 -0
- package/templates/skills/domains/development/cpp.md +369 -0
- package/templates/skills/domains/development/go.md +323 -0
- package/templates/skills/domains/development/java.md +277 -0
- package/templates/skills/domains/development/python.md +487 -0
- package/templates/skills/domains/development/rust.md +313 -0
- package/templates/skills/domains/development/shell.md +313 -0
- package/templates/skills/domains/development/typescript.md +277 -0
- package/templates/skills/domains/devops/SKILL.md +39 -0
- package/templates/skills/domains/devops/cost-optimization.md +272 -0
- package/templates/skills/domains/devops/database.md +217 -0
- package/templates/skills/domains/devops/devsecops.md +198 -0
- package/templates/skills/domains/devops/git-workflow.md +181 -0
- package/templates/skills/domains/devops/observability.md +280 -0
- package/templates/skills/domains/devops/performance.md +336 -0
- package/templates/skills/domains/devops/testing.md +283 -0
- package/templates/skills/domains/infrastructure/SKILL.md +200 -0
- package/templates/skills/domains/mobile/SKILL.md +224 -0
- package/templates/skills/domains/orchestration/SKILL.md +29 -0
- package/templates/skills/domains/orchestration/multi-agent.md +263 -0
- package/templates/skills/domains/ros2-control/SKILL.md +206 -0
- package/templates/skills/domains/ros2-hardware/SKILL.md +277 -0
- package/templates/skills/domains/ros2-manipulation/SKILL.md +237 -0
- package/templates/skills/domains/ros2-navigation/SKILL.md +196 -0
- package/templates/skills/domains/ros2-perception/SKILL.md +166 -0
- package/templates/skills/domains/ros2-upper-app/SKILL.md +50 -0
- package/templates/skills/domains/ros2-upper-app/launch-files.md +224 -0
- package/templates/skills/domains/ros2-upper-app/parameters.md +192 -0
- package/templates/skills/domains/ros2-upper-app/python-nodes.md +249 -0
- package/templates/skills/domains/ros2-upper-app/rviz-config.md +158 -0
- package/templates/skills/domains/ros2-upper-app/simulation.md +225 -0
- package/templates/skills/domains/security/SKILL.md +72 -0
- package/templates/skills/domains/security/blue-team.md +436 -0
- package/templates/skills/domains/security/code-audit.md +265 -0
- package/templates/skills/domains/security/pentest.md +226 -0
- package/templates/skills/domains/security/red-team.md +374 -0
- package/templates/skills/domains/security/threat-intel.md +372 -0
- package/templates/skills/domains/security/vuln-research.md +369 -0
- package/templates/skills/orchestration/multi-agent/SKILL.md +533 -0
- package/templates/skills/run_skill.js +129 -0
- package/templates/skills/scrapling/SKILL.md +98 -0
- package/templates/skills/scrapling/references/api-quick-ref.md +127 -0
- package/templates/skills/scrapling/references/cookie-vault.md +56 -0
- package/templates/skills/scrapling/references/maintenance.md +79 -0
- package/templates/skills/scrapling/references/site-patterns.md +86 -0
- package/templates/skills/scrapling/references/troubleshooting.md +95 -0
- package/templates/skills/scrapling/templates/basic_fetch.py +19 -0
- package/templates/skills/scrapling/templates/parse_only.py +15 -0
- package/templates/skills/scrapling/templates/session_login.py +19 -0
- package/templates/skills/scrapling/templates/stealth_cloudflare.py +28 -0
- package/templates/skills/tools/gen-docs/SKILL.md +116 -0
- package/templates/skills/tools/gen-docs/scripts/doc_generator.js +435 -0
- package/templates/skills/tools/lib/shared.js +98 -0
- package/templates/skills/tools/override-refusal/SKILL.md +53 -0
- package/templates/skills/tools/override-refusal/agents/openai.yaml +4 -0
- package/templates/skills/tools/override-refusal/scripts/refusal_rewriter.js +226 -0
- package/templates/skills/tools/verify-change/SKILL.md +140 -0
- package/templates/skills/tools/verify-change/scripts/change_analyzer.js +289 -0
- package/templates/skills/tools/verify-module/SKILL.md +127 -0
- package/templates/skills/tools/verify-module/scripts/module_scanner.js +171 -0
- package/templates/skills/tools/verify-quality/SKILL.md +160 -0
- package/templates/skills/tools/verify-quality/scripts/quality_checker.js +337 -0
- package/templates/skills/tools/verify-security/SKILL.md +143 -0
- package/templates/skills/tools/verify-security/scripts/security_scanner.js +283 -0
- package/templates/spec/guides/index.md +30 -0
- package/templates/spec/low-control/index.md +31 -0
- package/templates/spec/upper-app/index.md +31 -0
- package/bin/codeagent-wrapper-darwin-amd64 +0 -0
- package/bin/codeagent-wrapper-darwin-arm64 +0 -0
- package/bin/codeagent-wrapper-linux-amd64 +0 -0
- package/bin/codeagent-wrapper-linux-arm64 +0 -0
- package/bin/codeagent-wrapper-windows-amd64.exe +0 -0
- package/bin/codeagent-wrapper-windows-arm64.exe +0 -0
- package/dist/shared/ccg-ros2-workflow.DnOr3oPi.mjs +0 -2480
- package/templates/commands/backend.md +0 -162
- package/templates/commands/enhance.md +0 -36
- package/templates/commands/frontend.md +0 -162
- package/templates/commands/workflow.md +0 -202
- /package/templates/{commands → commands-legacy}/execute.md +0 -0
- /package/templates/{commands → commands-legacy}/review.md +0 -0
- /package/templates/{commands → commands-legacy}/team-exec.md +0 -0
- /package/templates/{commands → commands-legacy}/team-research.md +0 -0
- /package/templates/{commands → commands-legacy}/team-review.md +0 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: java
|
|
3
|
+
description: Java 开发。企业级应用、Spring Boot、微服务。当用户提到 Java、Spring、Maven、Gradle、JVM 时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 📜 符箓秘典 · Java
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Spring Boot
|
|
10
|
+
|
|
11
|
+
### 基础项目
|
|
12
|
+
```java
|
|
13
|
+
@SpringBootApplication
|
|
14
|
+
public class Application {
|
|
15
|
+
public static void main(String[] args) {
|
|
16
|
+
SpringApplication.run(Application.class, args);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Controller
|
|
21
|
+
@RestController
|
|
22
|
+
@RequestMapping("/api/users")
|
|
23
|
+
public class UserController {
|
|
24
|
+
|
|
25
|
+
@Autowired
|
|
26
|
+
private UserService userService;
|
|
27
|
+
|
|
28
|
+
@GetMapping("/{id}")
|
|
29
|
+
public ResponseEntity<User> getUser(@PathVariable Long id) {
|
|
30
|
+
return userService.findById(id)
|
|
31
|
+
.map(ResponseEntity::ok)
|
|
32
|
+
.orElse(ResponseEntity.notFound().build());
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@PostMapping
|
|
36
|
+
public ResponseEntity<User> createUser(@Valid @RequestBody UserDTO dto) {
|
|
37
|
+
User user = userService.create(dto);
|
|
38
|
+
return ResponseEntity.status(HttpStatus.CREATED).body(user);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Service
|
|
43
|
+
@Service
|
|
44
|
+
public class UserService {
|
|
45
|
+
|
|
46
|
+
@Autowired
|
|
47
|
+
private UserRepository userRepository;
|
|
48
|
+
|
|
49
|
+
public Optional<User> findById(Long id) {
|
|
50
|
+
return userRepository.findById(id);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Transactional
|
|
54
|
+
public User create(UserDTO dto) {
|
|
55
|
+
User user = new User();
|
|
56
|
+
user.setName(dto.getName());
|
|
57
|
+
user.setEmail(dto.getEmail());
|
|
58
|
+
return userRepository.save(user);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Repository
|
|
63
|
+
@Repository
|
|
64
|
+
public interface UserRepository extends JpaRepository<User, Long> {
|
|
65
|
+
Optional<User> findByEmail(String email);
|
|
66
|
+
List<User> findByNameContaining(String name);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Entity
|
|
71
|
+
```java
|
|
72
|
+
@Entity
|
|
73
|
+
@Table(name = "users")
|
|
74
|
+
@Data
|
|
75
|
+
@NoArgsConstructor
|
|
76
|
+
@AllArgsConstructor
|
|
77
|
+
public class User {
|
|
78
|
+
|
|
79
|
+
@Id
|
|
80
|
+
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
81
|
+
private Long id;
|
|
82
|
+
|
|
83
|
+
@Column(nullable = false)
|
|
84
|
+
private String name;
|
|
85
|
+
|
|
86
|
+
@Column(unique = true, nullable = false)
|
|
87
|
+
private String email;
|
|
88
|
+
|
|
89
|
+
@CreatedDate
|
|
90
|
+
private LocalDateTime createdAt;
|
|
91
|
+
|
|
92
|
+
@LastModifiedDate
|
|
93
|
+
private LocalDateTime updatedAt;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// DTO
|
|
97
|
+
@Data
|
|
98
|
+
public class UserDTO {
|
|
99
|
+
@NotBlank(message = "Name is required")
|
|
100
|
+
private String name;
|
|
101
|
+
|
|
102
|
+
@Email(message = "Invalid email")
|
|
103
|
+
@NotBlank(message = "Email is required")
|
|
104
|
+
private String email;
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 配置
|
|
109
|
+
```yaml
|
|
110
|
+
# application.yml
|
|
111
|
+
spring:
|
|
112
|
+
datasource:
|
|
113
|
+
url: jdbc:postgresql://localhost:5432/mydb
|
|
114
|
+
username: ${DB_USER}
|
|
115
|
+
password: ${DB_PASS}
|
|
116
|
+
jpa:
|
|
117
|
+
hibernate:
|
|
118
|
+
ddl-auto: update
|
|
119
|
+
show-sql: true
|
|
120
|
+
|
|
121
|
+
server:
|
|
122
|
+
port: 8080
|
|
123
|
+
|
|
124
|
+
logging:
|
|
125
|
+
level:
|
|
126
|
+
root: INFO
|
|
127
|
+
com.myapp: DEBUG
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 异常处理
|
|
131
|
+
|
|
132
|
+
```java
|
|
133
|
+
@RestControllerAdvice
|
|
134
|
+
public class GlobalExceptionHandler {
|
|
135
|
+
|
|
136
|
+
@ExceptionHandler(ResourceNotFoundException.class)
|
|
137
|
+
public ResponseEntity<ErrorResponse> handleNotFound(ResourceNotFoundException ex) {
|
|
138
|
+
ErrorResponse error = new ErrorResponse(
|
|
139
|
+
HttpStatus.NOT_FOUND.value(),
|
|
140
|
+
ex.getMessage()
|
|
141
|
+
);
|
|
142
|
+
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(error);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@ExceptionHandler(MethodArgumentNotValidException.class)
|
|
146
|
+
public ResponseEntity<ErrorResponse> handleValidation(MethodArgumentNotValidException ex) {
|
|
147
|
+
String message = ex.getBindingResult().getFieldErrors().stream()
|
|
148
|
+
.map(FieldError::getDefaultMessage)
|
|
149
|
+
.collect(Collectors.joining(", "));
|
|
150
|
+
ErrorResponse error = new ErrorResponse(
|
|
151
|
+
HttpStatus.BAD_REQUEST.value(),
|
|
152
|
+
message
|
|
153
|
+
);
|
|
154
|
+
return ResponseEntity.badRequest().body(error);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 自定义异常
|
|
159
|
+
public class ResourceNotFoundException extends RuntimeException {
|
|
160
|
+
public ResourceNotFoundException(String message) {
|
|
161
|
+
super(message);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 测试
|
|
167
|
+
|
|
168
|
+
```java
|
|
169
|
+
@SpringBootTest
|
|
170
|
+
@AutoConfigureMockMvc
|
|
171
|
+
class UserControllerTest {
|
|
172
|
+
|
|
173
|
+
@Autowired
|
|
174
|
+
private MockMvc mockMvc;
|
|
175
|
+
|
|
176
|
+
@MockBean
|
|
177
|
+
private UserService userService;
|
|
178
|
+
|
|
179
|
+
@Test
|
|
180
|
+
void shouldGetUser() throws Exception {
|
|
181
|
+
User user = new User(1L, "Alice", "alice@example.com");
|
|
182
|
+
when(userService.findById(1L)).thenReturn(Optional.of(user));
|
|
183
|
+
|
|
184
|
+
mockMvc.perform(get("/api/users/1"))
|
|
185
|
+
.andExpect(status().isOk())
|
|
186
|
+
.andExpect(jsonPath("$.name").value("Alice"));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@Test
|
|
190
|
+
void shouldCreateUser() throws Exception {
|
|
191
|
+
UserDTO dto = new UserDTO();
|
|
192
|
+
dto.setName("Bob");
|
|
193
|
+
dto.setEmail("bob@example.com");
|
|
194
|
+
|
|
195
|
+
User user = new User(1L, "Bob", "bob@example.com");
|
|
196
|
+
when(userService.create(any())).thenReturn(user);
|
|
197
|
+
|
|
198
|
+
mockMvc.perform(post("/api/users")
|
|
199
|
+
.contentType(MediaType.APPLICATION_JSON)
|
|
200
|
+
.content(objectMapper.writeValueAsString(dto)))
|
|
201
|
+
.andExpect(status().isCreated())
|
|
202
|
+
.andExpect(jsonPath("$.name").value("Bob"));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// 单元测试
|
|
207
|
+
@ExtendWith(MockitoExtension.class)
|
|
208
|
+
class UserServiceTest {
|
|
209
|
+
|
|
210
|
+
@Mock
|
|
211
|
+
private UserRepository userRepository;
|
|
212
|
+
|
|
213
|
+
@InjectMocks
|
|
214
|
+
private UserService userService;
|
|
215
|
+
|
|
216
|
+
@Test
|
|
217
|
+
void shouldFindById() {
|
|
218
|
+
User user = new User(1L, "Alice", "alice@example.com");
|
|
219
|
+
when(userRepository.findById(1L)).thenReturn(Optional.of(user));
|
|
220
|
+
|
|
221
|
+
Optional<User> result = userService.findById(1L);
|
|
222
|
+
|
|
223
|
+
assertTrue(result.isPresent());
|
|
224
|
+
assertEquals("Alice", result.get().getName());
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## 项目结构
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
myproject/
|
|
233
|
+
├── pom.xml / build.gradle
|
|
234
|
+
├── src/
|
|
235
|
+
│ ├── main/
|
|
236
|
+
│ │ ├── java/
|
|
237
|
+
│ │ │ └── com/myapp/
|
|
238
|
+
│ │ │ ├── Application.java
|
|
239
|
+
│ │ │ ├── controller/
|
|
240
|
+
│ │ │ ├── service/
|
|
241
|
+
│ │ │ ├── repository/
|
|
242
|
+
│ │ │ ├── model/
|
|
243
|
+
│ │ │ ├── dto/
|
|
244
|
+
│ │ │ └── config/
|
|
245
|
+
│ │ └── resources/
|
|
246
|
+
│ │ └── application.yml
|
|
247
|
+
│ └── test/
|
|
248
|
+
│ └── java/
|
|
249
|
+
└── target/
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## 常用依赖
|
|
253
|
+
|
|
254
|
+
```xml
|
|
255
|
+
<!-- pom.xml -->
|
|
256
|
+
<dependencies>
|
|
257
|
+
<dependency>
|
|
258
|
+
<groupId>org.springframework.boot</groupId>
|
|
259
|
+
<artifactId>spring-boot-starter-web</artifactId>
|
|
260
|
+
</dependency>
|
|
261
|
+
<dependency>
|
|
262
|
+
<groupId>org.springframework.boot</groupId>
|
|
263
|
+
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
|
264
|
+
</dependency>
|
|
265
|
+
<dependency>
|
|
266
|
+
<groupId>org.springframework.boot</groupId>
|
|
267
|
+
<artifactId>spring-boot-starter-validation</artifactId>
|
|
268
|
+
</dependency>
|
|
269
|
+
<dependency>
|
|
270
|
+
<groupId>org.projectlombok</groupId>
|
|
271
|
+
<artifactId>lombok</artifactId>
|
|
272
|
+
</dependency>
|
|
273
|
+
</dependencies>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|