ccgx-workflow 1.0.0 → 1.0.2

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.
Files changed (60) hide show
  1. package/README.md +37 -5
  2. package/README.zh-CN.md +35 -5
  3. package/dist/cli.mjs +1 -1
  4. package/dist/index.mjs +2 -2
  5. package/dist/shared/{ccgx-workflow.WgUzkiC3.mjs → ccgx-workflow.Bq9vAaEw.mjs} +17 -110
  6. package/package.json +2 -1
  7. package/templates/commands/agents/phase-runner.md +321 -321
  8. package/templates/commands/autonomous.md +792 -792
  9. package/templates/commands/cancel.md +132 -132
  10. package/templates/commands/debug.md +226 -226
  11. package/templates/commands/status.md +206 -206
  12. package/templates/commands/team.md +484 -0
  13. package/templates/hooks/ccg-session-state.cjs +566 -510
  14. package/templates/scripts/ccg-phase-runner-launcher.mjs +467 -467
  15. package/templates/scripts/invoke-model.mjs +64 -0
  16. package/templates/skills/domains/ai/SKILL.md +35 -35
  17. package/templates/skills/domains/ai/agent-dev.md +242 -242
  18. package/templates/skills/domains/ai/llm-security.md +288 -288
  19. package/templates/skills/domains/ai/rag-system.md +542 -542
  20. package/templates/skills/domains/architecture/SKILL.md +43 -43
  21. package/templates/skills/domains/architecture/api-design.md +225 -225
  22. package/templates/skills/domains/architecture/cloud-native.md +285 -285
  23. package/templates/skills/domains/architecture/security-arch.md +297 -297
  24. package/templates/skills/domains/data-engineering/SKILL.md +208 -208
  25. package/templates/skills/domains/development/SKILL.md +47 -47
  26. package/templates/skills/domains/development/cpp.md +246 -246
  27. package/templates/skills/domains/development/go.md +323 -323
  28. package/templates/skills/domains/development/java.md +277 -277
  29. package/templates/skills/domains/development/python.md +288 -288
  30. package/templates/skills/domains/development/rust.md +313 -313
  31. package/templates/skills/domains/development/shell.md +313 -313
  32. package/templates/skills/domains/development/typescript.md +277 -277
  33. package/templates/skills/domains/devops/SKILL.md +40 -40
  34. package/templates/skills/domains/devops/database.md +217 -217
  35. package/templates/skills/domains/devops/devsecops.md +198 -198
  36. package/templates/skills/domains/devops/git-workflow.md +181 -181
  37. package/templates/skills/domains/devops/testing.md +283 -283
  38. package/templates/skills/domains/frontend-design/SKILL.md +244 -244
  39. package/templates/skills/domains/frontend-design/claymorphism/SKILL.md +121 -121
  40. package/templates/skills/domains/frontend-design/component-patterns.md +202 -202
  41. package/templates/skills/domains/frontend-design/glassmorphism/SKILL.md +142 -142
  42. package/templates/skills/domains/frontend-design/liquid-glass/SKILL.md +139 -139
  43. package/templates/skills/domains/frontend-design/neubrutalism/SKILL.md +145 -145
  44. package/templates/skills/domains/frontend-design/state-management.md +680 -680
  45. package/templates/skills/domains/frontend-design/ui-aesthetics.md +110 -110
  46. package/templates/skills/domains/frontend-design/ux-principles.md +156 -156
  47. package/templates/skills/domains/infrastructure/SKILL.md +201 -201
  48. package/templates/skills/domains/mobile/SKILL.md +225 -225
  49. package/templates/skills/domains/orchestration/SKILL.md +30 -30
  50. package/templates/skills/domains/orchestration/multi-agent.md +228 -228
  51. package/templates/skills/domains/security/SKILL.md +73 -73
  52. package/templates/skills/domains/security/blue-team.md +436 -436
  53. package/templates/skills/domains/security/code-audit.md +265 -265
  54. package/templates/skills/domains/security/pentest.md +226 -226
  55. package/templates/skills/domains/security/red-team.md +374 -374
  56. package/templates/skills/domains/security/threat-intel.md +372 -372
  57. package/templates/skills/domains/security/vuln-research.md +369 -369
  58. package/templates/skills/tools/lib/shared.js +98 -98
  59. package/templates/skills/tools/override-refusal/SKILL.md +53 -53
  60. package/templates/skills/tools/override-refusal/scripts/refusal_rewriter.js +226 -226
@@ -1,288 +1,288 @@
1
- ---
2
- name: python
3
- description: Python 开发。Web框架、数据处理、自动化脚本、测试。当用户提到 Python、Django、Flask、FastAPI、pytest、pandas 时使用。
4
- ---
5
-
6
- # 📜 符箓秘典 · Python
7
-
8
-
9
- ## Web 框架
10
-
11
- ### FastAPI (推荐)
12
- ```python
13
- from fastapi import FastAPI, HTTPException, Depends
14
- from pydantic import BaseModel
15
- from typing import Optional
16
-
17
- app = FastAPI()
18
-
19
- class User(BaseModel):
20
- name: str
21
- email: str
22
- age: Optional[int] = None
23
-
24
- @app.get("/users/{user_id}")
25
- async def get_user(user_id: int):
26
- return {"user_id": user_id}
27
-
28
- @app.post("/users")
29
- async def create_user(user: User):
30
- return user
31
-
32
- # 依赖注入
33
- async def get_db():
34
- db = Database()
35
- try:
36
- yield db
37
- finally:
38
- await db.close()
39
-
40
- @app.get("/items")
41
- async def get_items(db = Depends(get_db)):
42
- return await db.fetch_all("SELECT * FROM items")
43
- ```
44
-
45
- ### Flask
46
- ```python
47
- from flask import Flask, request, jsonify
48
-
49
- app = Flask(__name__)
50
-
51
- @app.route('/api/users', methods=['GET', 'POST'])
52
- def users():
53
- if request.method == 'POST':
54
- data = request.json
55
- return jsonify(data), 201
56
- return jsonify([])
57
-
58
- @app.errorhandler(404)
59
- def not_found(e):
60
- return jsonify(error="Not found"), 404
61
- ```
62
-
63
- ### Django
64
- ```python
65
- # models.py
66
- from django.db import models
67
-
68
- class User(models.Model):
69
- name = models.CharField(max_length=100)
70
- email = models.EmailField(unique=True)
71
- created_at = models.DateTimeField(auto_now_add=True)
72
-
73
- # views.py
74
- from django.http import JsonResponse
75
- from django.views import View
76
-
77
- class UserView(View):
78
- def get(self, request, user_id):
79
- user = User.objects.get(id=user_id)
80
- return JsonResponse({'name': user.name})
81
-
82
- # urls.py
83
- urlpatterns = [
84
- path('users/<int:user_id>/', UserView.as_view()),
85
- ]
86
- ```
87
-
88
- ## 异步编程
89
-
90
- ```python
91
- import asyncio
92
- import aiohttp
93
-
94
- async def fetch(url: str) -> str:
95
- async with aiohttp.ClientSession() as session:
96
- async with session.get(url) as response:
97
- return await response.text()
98
-
99
- async def fetch_all(urls: list[str]) -> list[str]:
100
- tasks = [fetch(url) for url in urls]
101
- return await asyncio.gather(*tasks)
102
-
103
- # 运行
104
- asyncio.run(fetch_all(['http://example.com', 'http://example.org']))
105
- ```
106
-
107
- ## 数据处理
108
-
109
- ### Pandas
110
- ```python
111
- import pandas as pd
112
-
113
- # 读取数据
114
- df = pd.read_csv('data.csv')
115
- df = pd.read_json('data.json')
116
-
117
- # 数据清洗
118
- df = df.dropna()
119
- df = df.drop_duplicates()
120
- df['column'] = df['column'].str.strip()
121
-
122
- # 数据转换
123
- df['date'] = pd.to_datetime(df['date'])
124
- df['category'] = df['category'].astype('category')
125
-
126
- # 聚合分析
127
- result = df.groupby('category').agg({
128
- 'value': ['sum', 'mean', 'count']
129
- })
130
-
131
- # 导出
132
- df.to_csv('output.csv', index=False)
133
- df.to_json('output.json', orient='records')
134
- ```
135
-
136
- ## 测试
137
-
138
- ### pytest
139
- ```python
140
- import pytest
141
- from myapp import calculate, UserService
142
-
143
- # 基础测试
144
- def test_add():
145
- assert calculate.add(1, 2) == 3
146
-
147
- # 参数化
148
- @pytest.mark.parametrize("a,b,expected", [
149
- (1, 2, 3),
150
- (0, 0, 0),
151
- (-1, 1, 0),
152
- ])
153
- def test_add_params(a, b, expected):
154
- assert calculate.add(a, b) == expected
155
-
156
- # Fixture
157
- @pytest.fixture
158
- def user_service():
159
- service = UserService()
160
- yield service
161
- service.cleanup()
162
-
163
- def test_create_user(user_service):
164
- user = user_service.create("test")
165
- assert user.name == "test"
166
-
167
- # Mock
168
- from unittest.mock import Mock, patch
169
-
170
- @patch('myapp.requests.get')
171
- def test_fetch(mock_get):
172
- mock_get.return_value.json.return_value = {"id": 1}
173
- result = fetch_user(1)
174
- assert result["id"] == 1
175
-
176
- # 异步测试
177
- @pytest.mark.asyncio
178
- async def test_async_fetch():
179
- result = await async_fetch()
180
- assert result is not None
181
- ```
182
-
183
- ### 运行测试
184
- ```bash
185
- pytest # 运行所有
186
- pytest test_file.py # 指定文件
187
- pytest -k "test_add" # 匹配名称
188
- pytest -v # 详细输出
189
- pytest --cov=myapp # 覆盖率
190
- pytest -x # 失败即停
191
- ```
192
-
193
- ## CLI 工具
194
-
195
- ### Typer (推荐)
196
- ```python
197
- import typer
198
-
199
- app = typer.Typer()
200
-
201
- @app.command()
202
- def hello(name: str, count: int = 1):
203
- """Say hello NAME, COUNT times."""
204
- for _ in range(count):
205
- typer.echo(f"Hello {name}!")
206
-
207
- @app.command()
208
- def goodbye(name: str, formal: bool = False):
209
- if formal:
210
- typer.echo(f"Goodbye Ms. {name}. Have a good day.")
211
- else:
212
- typer.echo(f"Bye {name}!")
213
-
214
- if __name__ == "__main__":
215
- app()
216
- ```
217
-
218
- ### argparse
219
- ```python
220
- import argparse
221
-
222
- parser = argparse.ArgumentParser(description='My CLI tool')
223
- parser.add_argument('input', help='Input file')
224
- parser.add_argument('-o', '--output', default='output.txt')
225
- parser.add_argument('-v', '--verbose', action='store_true')
226
-
227
- args = parser.parse_args()
228
- ```
229
-
230
- ## 项目结构
231
-
232
- ```
233
- myproject/
234
- ├── pyproject.toml # 项目配置
235
- ├── README.md
236
- ├── src/
237
- │ └── myproject/
238
- │ ├── __init__.py
239
- │ ├── main.py
240
- │ ├── models.py
241
- │ └── utils.py
242
- ├── tests/
243
- │ ├── __init__.py
244
- │ ├── conftest.py
245
- │ └── test_main.py
246
- └── scripts/
247
- └── run.py
248
- ```
249
-
250
- ### pyproject.toml
251
- ```toml
252
- [project]
253
- name = "myproject"
254
- version = "0.1.0"
255
- dependencies = [
256
- "fastapi>=0.100.0",
257
- "uvicorn>=0.23.0",
258
- ]
259
-
260
- [project.optional-dependencies]
261
- dev = [
262
- "pytest>=7.0.0",
263
- "pytest-cov>=4.0.0",
264
- ]
265
-
266
- [tool.pytest.ini_options]
267
- testpaths = ["tests"]
268
-
269
- [tool.ruff]
270
- line-length = 120
271
- select = ["E", "F", "I"]
272
- ```
273
-
274
- ## 常用库
275
-
276
- | 库 | 用途 |
277
- |---|------|
278
- | requests/httpx | HTTP 客户端 |
279
- | aiohttp | 异步 HTTP |
280
- | SQLAlchemy | ORM |
281
- | Pydantic | 数据验证 |
282
- | Click/Typer | CLI |
283
- | pytest | 测试 |
284
- | pandas | 数据处理 |
285
- | loguru | 日志 |
286
-
287
- ---
288
-
1
+ ---
2
+ name: python
3
+ description: Python 开发。Web框架、数据处理、自动化脚本、测试。当用户提到 Python、Django、Flask、FastAPI、pytest、pandas 时使用。
4
+ ---
5
+
6
+ # 📜 符箓秘典 · Python
7
+
8
+
9
+ ## Web 框架
10
+
11
+ ### FastAPI (推荐)
12
+ ```python
13
+ from fastapi import FastAPI, HTTPException, Depends
14
+ from pydantic import BaseModel
15
+ from typing import Optional
16
+
17
+ app = FastAPI()
18
+
19
+ class User(BaseModel):
20
+ name: str
21
+ email: str
22
+ age: Optional[int] = None
23
+
24
+ @app.get("/users/{user_id}")
25
+ async def get_user(user_id: int):
26
+ return {"user_id": user_id}
27
+
28
+ @app.post("/users")
29
+ async def create_user(user: User):
30
+ return user
31
+
32
+ # 依赖注入
33
+ async def get_db():
34
+ db = Database()
35
+ try:
36
+ yield db
37
+ finally:
38
+ await db.close()
39
+
40
+ @app.get("/items")
41
+ async def get_items(db = Depends(get_db)):
42
+ return await db.fetch_all("SELECT * FROM items")
43
+ ```
44
+
45
+ ### Flask
46
+ ```python
47
+ from flask import Flask, request, jsonify
48
+
49
+ app = Flask(__name__)
50
+
51
+ @app.route('/api/users', methods=['GET', 'POST'])
52
+ def users():
53
+ if request.method == 'POST':
54
+ data = request.json
55
+ return jsonify(data), 201
56
+ return jsonify([])
57
+
58
+ @app.errorhandler(404)
59
+ def not_found(e):
60
+ return jsonify(error="Not found"), 404
61
+ ```
62
+
63
+ ### Django
64
+ ```python
65
+ # models.py
66
+ from django.db import models
67
+
68
+ class User(models.Model):
69
+ name = models.CharField(max_length=100)
70
+ email = models.EmailField(unique=True)
71
+ created_at = models.DateTimeField(auto_now_add=True)
72
+
73
+ # views.py
74
+ from django.http import JsonResponse
75
+ from django.views import View
76
+
77
+ class UserView(View):
78
+ def get(self, request, user_id):
79
+ user = User.objects.get(id=user_id)
80
+ return JsonResponse({'name': user.name})
81
+
82
+ # urls.py
83
+ urlpatterns = [
84
+ path('users/<int:user_id>/', UserView.as_view()),
85
+ ]
86
+ ```
87
+
88
+ ## 异步编程
89
+
90
+ ```python
91
+ import asyncio
92
+ import aiohttp
93
+
94
+ async def fetch(url: str) -> str:
95
+ async with aiohttp.ClientSession() as session:
96
+ async with session.get(url) as response:
97
+ return await response.text()
98
+
99
+ async def fetch_all(urls: list[str]) -> list[str]:
100
+ tasks = [fetch(url) for url in urls]
101
+ return await asyncio.gather(*tasks)
102
+
103
+ # 运行
104
+ asyncio.run(fetch_all(['http://example.com', 'http://example.org']))
105
+ ```
106
+
107
+ ## 数据处理
108
+
109
+ ### Pandas
110
+ ```python
111
+ import pandas as pd
112
+
113
+ # 读取数据
114
+ df = pd.read_csv('data.csv')
115
+ df = pd.read_json('data.json')
116
+
117
+ # 数据清洗
118
+ df = df.dropna()
119
+ df = df.drop_duplicates()
120
+ df['column'] = df['column'].str.strip()
121
+
122
+ # 数据转换
123
+ df['date'] = pd.to_datetime(df['date'])
124
+ df['category'] = df['category'].astype('category')
125
+
126
+ # 聚合分析
127
+ result = df.groupby('category').agg({
128
+ 'value': ['sum', 'mean', 'count']
129
+ })
130
+
131
+ # 导出
132
+ df.to_csv('output.csv', index=False)
133
+ df.to_json('output.json', orient='records')
134
+ ```
135
+
136
+ ## 测试
137
+
138
+ ### pytest
139
+ ```python
140
+ import pytest
141
+ from myapp import calculate, UserService
142
+
143
+ # 基础测试
144
+ def test_add():
145
+ assert calculate.add(1, 2) == 3
146
+
147
+ # 参数化
148
+ @pytest.mark.parametrize("a,b,expected", [
149
+ (1, 2, 3),
150
+ (0, 0, 0),
151
+ (-1, 1, 0),
152
+ ])
153
+ def test_add_params(a, b, expected):
154
+ assert calculate.add(a, b) == expected
155
+
156
+ # Fixture
157
+ @pytest.fixture
158
+ def user_service():
159
+ service = UserService()
160
+ yield service
161
+ service.cleanup()
162
+
163
+ def test_create_user(user_service):
164
+ user = user_service.create("test")
165
+ assert user.name == "test"
166
+
167
+ # Mock
168
+ from unittest.mock import Mock, patch
169
+
170
+ @patch('myapp.requests.get')
171
+ def test_fetch(mock_get):
172
+ mock_get.return_value.json.return_value = {"id": 1}
173
+ result = fetch_user(1)
174
+ assert result["id"] == 1
175
+
176
+ # 异步测试
177
+ @pytest.mark.asyncio
178
+ async def test_async_fetch():
179
+ result = await async_fetch()
180
+ assert result is not None
181
+ ```
182
+
183
+ ### 运行测试
184
+ ```bash
185
+ pytest # 运行所有
186
+ pytest test_file.py # 指定文件
187
+ pytest -k "test_add" # 匹配名称
188
+ pytest -v # 详细输出
189
+ pytest --cov=myapp # 覆盖率
190
+ pytest -x # 失败即停
191
+ ```
192
+
193
+ ## CLI 工具
194
+
195
+ ### Typer (推荐)
196
+ ```python
197
+ import typer
198
+
199
+ app = typer.Typer()
200
+
201
+ @app.command()
202
+ def hello(name: str, count: int = 1):
203
+ """Say hello NAME, COUNT times."""
204
+ for _ in range(count):
205
+ typer.echo(f"Hello {name}!")
206
+
207
+ @app.command()
208
+ def goodbye(name: str, formal: bool = False):
209
+ if formal:
210
+ typer.echo(f"Goodbye Ms. {name}. Have a good day.")
211
+ else:
212
+ typer.echo(f"Bye {name}!")
213
+
214
+ if __name__ == "__main__":
215
+ app()
216
+ ```
217
+
218
+ ### argparse
219
+ ```python
220
+ import argparse
221
+
222
+ parser = argparse.ArgumentParser(description='My CLI tool')
223
+ parser.add_argument('input', help='Input file')
224
+ parser.add_argument('-o', '--output', default='output.txt')
225
+ parser.add_argument('-v', '--verbose', action='store_true')
226
+
227
+ args = parser.parse_args()
228
+ ```
229
+
230
+ ## 项目结构
231
+
232
+ ```
233
+ myproject/
234
+ ├── pyproject.toml # 项目配置
235
+ ├── README.md
236
+ ├── src/
237
+ │ └── myproject/
238
+ │ ├── __init__.py
239
+ │ ├── main.py
240
+ │ ├── models.py
241
+ │ └── utils.py
242
+ ├── tests/
243
+ │ ├── __init__.py
244
+ │ ├── conftest.py
245
+ │ └── test_main.py
246
+ └── scripts/
247
+ └── run.py
248
+ ```
249
+
250
+ ### pyproject.toml
251
+ ```toml
252
+ [project]
253
+ name = "myproject"
254
+ version = "0.1.0"
255
+ dependencies = [
256
+ "fastapi>=0.100.0",
257
+ "uvicorn>=0.23.0",
258
+ ]
259
+
260
+ [project.optional-dependencies]
261
+ dev = [
262
+ "pytest>=7.0.0",
263
+ "pytest-cov>=4.0.0",
264
+ ]
265
+
266
+ [tool.pytest.ini_options]
267
+ testpaths = ["tests"]
268
+
269
+ [tool.ruff]
270
+ line-length = 120
271
+ select = ["E", "F", "I"]
272
+ ```
273
+
274
+ ## 常用库
275
+
276
+ | 库 | 用途 |
277
+ |---|------|
278
+ | requests/httpx | HTTP 客户端 |
279
+ | aiohttp | 异步 HTTP |
280
+ | SQLAlchemy | ORM |
281
+ | Pydantic | 数据验证 |
282
+ | Click/Typer | CLI |
283
+ | pytest | 测试 |
284
+ | pandas | 数据处理 |
285
+ | loguru | 日志 |
286
+
287
+ ---
288
+