deepspider 0.2.12 → 0.3.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.
Files changed (152) hide show
  1. package/README.md +53 -27
  2. package/bin/cli.js +45 -0
  3. package/package.json +10 -4
  4. package/src/agent/core/PanelBridge.js +2 -2
  5. package/src/agent/logger.js +1 -1
  6. package/src/agent/middleware/report.js +1 -1
  7. package/src/agent/run.js +54 -63
  8. package/src/agent/setup.js +14 -14
  9. package/src/agent/skills/evolve.js +0 -3
  10. package/src/agent/tools/captcha.js +1 -1
  11. package/src/agent/tools/evolve.js +1 -1
  12. package/src/agent/tools/file.js +2 -2
  13. package/src/agent/tools/python.js +4 -4
  14. package/src/agent/tools/report.js +2 -2
  15. package/src/agent/tools/runtime.js +1 -1
  16. package/src/analyzer/EncryptionAnalyzer.js +2 -2
  17. package/src/browser/collector.js +1 -1
  18. package/src/browser/interceptors/NetworkInterceptor.js +1 -1
  19. package/src/browser/interceptors/ScriptInterceptor.js +2 -2
  20. package/src/cli/commands/config.js +94 -0
  21. package/src/cli/commands/help.js +34 -0
  22. package/src/cli/commands/update.js +78 -0
  23. package/src/cli/commands/version.js +9 -0
  24. package/src/cli/config.js +15 -0
  25. package/src/config/settings.js +102 -0
  26. package/src/core/PatchGenerator.js +2 -2
  27. package/src/env/EnvCodeGenerator.js +1 -1
  28. package/src/store/DataStore.js +5 -5
  29. package/.claude/agents/check.md +0 -122
  30. package/.claude/agents/debug.md +0 -106
  31. package/.claude/agents/dispatch.md +0 -214
  32. package/.claude/agents/implement.md +0 -96
  33. package/.claude/agents/plan.md +0 -396
  34. package/.claude/agents/research.md +0 -120
  35. package/.claude/commands/evolve/merge.md +0 -80
  36. package/.claude/commands/trellis/before-backend-dev.md +0 -13
  37. package/.claude/commands/trellis/before-frontend-dev.md +0 -13
  38. package/.claude/commands/trellis/break-loop.md +0 -107
  39. package/.claude/commands/trellis/check-backend.md +0 -13
  40. package/.claude/commands/trellis/check-cross-layer.md +0 -153
  41. package/.claude/commands/trellis/check-frontend.md +0 -13
  42. package/.claude/commands/trellis/create-command.md +0 -154
  43. package/.claude/commands/trellis/finish-work.md +0 -129
  44. package/.claude/commands/trellis/integrate-skill.md +0 -219
  45. package/.claude/commands/trellis/onboard.md +0 -358
  46. package/.claude/commands/trellis/parallel.md +0 -193
  47. package/.claude/commands/trellis/record-session.md +0 -62
  48. package/.claude/commands/trellis/start.md +0 -280
  49. package/.claude/commands/trellis/update-spec.md +0 -213
  50. package/.claude/hooks/inject-subagent-context.py +0 -758
  51. package/.claude/hooks/ralph-loop.py +0 -374
  52. package/.claude/hooks/session-start.py +0 -126
  53. package/.claude/settings.json +0 -41
  54. package/.claude/skills/deepagents-guide/SKILL.md +0 -428
  55. package/.cursor/commands/trellis-before-backend-dev.md +0 -13
  56. package/.cursor/commands/trellis-before-frontend-dev.md +0 -13
  57. package/.cursor/commands/trellis-break-loop.md +0 -107
  58. package/.cursor/commands/trellis-check-backend.md +0 -13
  59. package/.cursor/commands/trellis-check-cross-layer.md +0 -153
  60. package/.cursor/commands/trellis-check-frontend.md +0 -13
  61. package/.cursor/commands/trellis-create-command.md +0 -154
  62. package/.cursor/commands/trellis-finish-work.md +0 -129
  63. package/.cursor/commands/trellis-integrate-skill.md +0 -219
  64. package/.cursor/commands/trellis-onboard.md +0 -358
  65. package/.cursor/commands/trellis-record-session.md +0 -62
  66. package/.cursor/commands/trellis-start.md +0 -156
  67. package/.cursor/commands/trellis-update-spec.md +0 -213
  68. package/.github/workflows/publish.yml +0 -63
  69. package/.husky/pre-commit +0 -1
  70. package/.mcp.json +0 -8
  71. package/.trellis/.template-hashes.json +0 -65
  72. package/.trellis/.version +0 -1
  73. package/.trellis/scripts/add-session.sh +0 -384
  74. package/.trellis/scripts/common/developer.sh +0 -129
  75. package/.trellis/scripts/common/git-context.sh +0 -263
  76. package/.trellis/scripts/common/paths.sh +0 -208
  77. package/.trellis/scripts/common/phase.sh +0 -150
  78. package/.trellis/scripts/common/registry.sh +0 -247
  79. package/.trellis/scripts/common/task-queue.sh +0 -142
  80. package/.trellis/scripts/common/task-utils.sh +0 -151
  81. package/.trellis/scripts/common/worktree.sh +0 -128
  82. package/.trellis/scripts/create-bootstrap.sh +0 -299
  83. package/.trellis/scripts/get-context.sh +0 -7
  84. package/.trellis/scripts/get-developer.sh +0 -15
  85. package/.trellis/scripts/init-developer.sh +0 -34
  86. package/.trellis/scripts/multi-agent/cleanup.sh +0 -396
  87. package/.trellis/scripts/multi-agent/create-pr.sh +0 -241
  88. package/.trellis/scripts/multi-agent/plan.sh +0 -207
  89. package/.trellis/scripts/multi-agent/start.sh +0 -310
  90. package/.trellis/scripts/multi-agent/status.sh +0 -828
  91. package/.trellis/scripts/task.sh +0 -1118
  92. package/.trellis/spec/backend/ci-cd-guidelines.md +0 -73
  93. package/.trellis/spec/backend/deepagents-guide.md +0 -380
  94. package/.trellis/spec/backend/directory-structure.md +0 -145
  95. package/.trellis/spec/backend/examples/skills/deepagents-guide/README.md +0 -11
  96. package/.trellis/spec/backend/examples/skills/deepagents-guide/agent.js.template +0 -20
  97. package/.trellis/spec/backend/examples/skills/deepagents-guide/skills-config.js.template +0 -13
  98. package/.trellis/spec/backend/examples/skills/deepagents-guide/subagent.js.template +0 -19
  99. package/.trellis/spec/backend/hook-guidelines.md +0 -218
  100. package/.trellis/spec/backend/index.md +0 -37
  101. package/.trellis/spec/backend/quality-guidelines.md +0 -377
  102. package/.trellis/spec/backend/state-management.md +0 -76
  103. package/.trellis/spec/backend/tool-guidelines.md +0 -144
  104. package/.trellis/spec/backend/type-safety.md +0 -71
  105. package/.trellis/spec/guides/code-reuse-thinking-guide.md +0 -92
  106. package/.trellis/spec/guides/cross-layer-thinking-guide.md +0 -94
  107. package/.trellis/spec/guides/index.md +0 -79
  108. package/.trellis/tasks/archive/02-02-evolving-skills/prd.md +0 -61
  109. package/.trellis/tasks/archive/02-02-evolving-skills/task.json +0 -29
  110. package/.trellis/tasks/archive/2026-02/00-bootstrap-guidelines/prd.md +0 -86
  111. package/.trellis/tasks/archive/2026-02/00-bootstrap-guidelines/task.json +0 -27
  112. package/.trellis/tasks/archive/2026-02/02-02-skills-system/check.jsonl +0 -3
  113. package/.trellis/tasks/archive/2026-02/02-02-skills-system/debug.jsonl +0 -2
  114. package/.trellis/tasks/archive/2026-02/02-02-skills-system/implement.jsonl +0 -5
  115. package/.trellis/tasks/archive/2026-02/02-02-skills-system/prd.md +0 -33
  116. package/.trellis/tasks/archive/2026-02/02-02-skills-system/task.json +0 -41
  117. package/.trellis/workflow.md +0 -407
  118. package/.trellis/workspace/index.md +0 -123
  119. package/.trellis/workspace/pony/index.md +0 -42
  120. package/.trellis/workspace/pony/journal-1.md +0 -125
  121. package/.trellis/worktree.yaml +0 -47
  122. package/AGENTS.md +0 -18
  123. package/CLAUDE.md +0 -315
  124. package/agents/deepspider.md +0 -142
  125. package/docs/DEBUG.md +0 -42
  126. package/docs/GUIDE.md +0 -338
  127. package/docs/PROMPT.md +0 -59
  128. package/docs/USAGE.md +0 -230
  129. package/eslint.config.js +0 -51
  130. package/test/analyze.test.js +0 -90
  131. package/test/envdump.test.js +0 -74
  132. package/test/flow.test.js +0 -90
  133. package/test/hooks.test.js +0 -138
  134. package/test/plugin.test.js +0 -35
  135. package/test/refactor-full.test.js +0 -30
  136. package/test/refactor.test.js +0 -21
  137. package/test/samples/obfuscated.js +0 -61
  138. package/test/samples/original.js +0 -66
  139. package/test/samples/v10_eval_chain.js +0 -52
  140. package/test/samples/v11_bytecode_vm.js +0 -81
  141. package/test/samples/v12_polymorphic.js +0 -69
  142. package/test/samples/v1_ob_basic.js +0 -98
  143. package/test/samples/v2_ob_advanced.js +0 -99
  144. package/test/samples/v3_jjencode.js +0 -77
  145. package/test/samples/v4_aaencode.js +0 -73
  146. package/test/samples/v5_control_flow.js +0 -86
  147. package/test/samples/v6_string_encryption.js +0 -71
  148. package/test/samples/v7_jsvmp.js +0 -83
  149. package/test/samples/v8_anti_debug.js +0 -79
  150. package/test/samples/v9_proxy_trap.js +0 -49
  151. package/test/samples.test.js +0 -96
  152. package/test/webcrack.test.js +0 -55
@@ -1,120 +0,0 @@
1
- ---
2
- name: research
3
- description: |
4
- Code and tech search expert. Pure research, no code modifications. Finds files, patterns, and tech solutions.
5
- tools: Read, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa, Skill, mcp__chrome-devtools__*
6
- model: opus
7
- ---
8
- # Research Agent
9
-
10
- You are the Research Agent in the Trellis workflow.
11
-
12
- ## Core Principle
13
-
14
- **You do one thing: find and explain information.**
15
-
16
- You are a documenter, not a reviewer. Your job is to help get the information needed.
17
-
18
- ---
19
-
20
- ## Core Responsibilities
21
-
22
- ### 1. Internal Search (Project Code)
23
-
24
- | Search Type | Goal | Tools |
25
- |-------------|------|-------|
26
- | **WHERE** | Locate files/components | Glob, Grep |
27
- | **HOW** | Understand code logic | Read, Grep |
28
- | **PATTERN** | Discover existing patterns | Grep, Read |
29
-
30
- ### 2. External Search (Tech Solutions)
31
-
32
- Use web search for best practices and code examples.
33
-
34
- ---
35
-
36
- ## Strict Boundaries
37
-
38
- ### Only Allowed
39
-
40
- - Describe **what exists**
41
- - Describe **where it is**
42
- - Describe **how it works**
43
- - Describe **how components interact**
44
-
45
- ### Forbidden (unless explicitly asked)
46
-
47
- - Suggest improvements
48
- - Criticize implementation
49
- - Recommend refactoring
50
- - Modify any files
51
- - Execute git commands
52
-
53
- ---
54
-
55
- ## Workflow
56
-
57
- ### Step 1: Understand Search Request
58
-
59
- Analyze the query, determine:
60
-
61
- - Search type (internal/external/mixed)
62
- - Search scope (global/specific directory)
63
- - Expected output (file list/code patterns/tech solutions)
64
-
65
- ### Step 2: Execute Search
66
-
67
- Execute multiple independent searches in parallel for efficiency.
68
-
69
- ### Step 3: Organize Results
70
-
71
- Output structured results in report format.
72
-
73
- ---
74
-
75
- ## Report Format
76
-
77
- ```markdown
78
- ## Search Results
79
-
80
- ### Query
81
-
82
- {original query}
83
-
84
- ### Files Found
85
-
86
- | File Path | Description |
87
- |-----------|-------------|
88
- | `src/services/xxx.ts` | Main implementation |
89
- | `src/types/xxx.ts` | Type definitions |
90
-
91
- ### Code Pattern Analysis
92
-
93
- {Describe discovered patterns, cite specific files and line numbers}
94
-
95
- ### Related Spec Documents
96
-
97
- - `.trellis/spec/xxx.md` - {description}
98
-
99
- ### Not Found
100
-
101
- {If some content was not found, explain}
102
- ```
103
-
104
- ---
105
-
106
- ## Guidelines
107
-
108
- ### DO
109
-
110
- - Provide specific file paths and line numbers
111
- - Quote actual code snippets
112
- - Distinguish "definitely found" and "possibly related"
113
- - Explain search scope and limitations
114
-
115
- ### DON'T
116
-
117
- - Don't guess uncertain info
118
- - Don't omit important search results
119
- - Don't add improvement suggestions in report (unless explicitly asked)
120
- - Don't modify any files
@@ -1,80 +0,0 @@
1
- # Evolve Merge - 合并动态经验到静态 Skills
2
-
3
- 将 evolved.md 中的核心经验合并到 SKILL.md,并进行深度提炼。
4
-
5
- ## 用法
6
-
7
- ```
8
- /evolve:merge <skill-name>
9
- ```
10
-
11
- ## 执行步骤
12
-
13
- ### 1. 读取动态经验
14
-
15
- ```bash
16
- cat src/agent/skills/<skill-name>/evolved.md
17
- ```
18
-
19
- ### 2. 深度分析(核心步骤)
20
-
21
- 对每条经验进行第一性原理分析:
22
-
23
- **2.1 提炼本质**
24
- - 这条经验的根本原因是什么?
25
- - 背后的技术原理是什么?
26
-
27
- **2.2 举一反三**
28
- - 是否存在类似的场景?
29
- - 同类问题还有哪些表现形式?
30
-
31
- **2.3 通用化**
32
- - 能否提炼成更通用的规则?
33
- - 是否适用于其他加密库/算法?
34
-
35
- **示例:**
36
- ```
37
- 原始经验: CryptoJS CFB 用 segment_size=128,PyCryptodome 默认 CFB8
38
-
39
- 第一性原理: 不同库对同一算法的默认参数可能不同
40
-
41
- 举一反三:
42
- - CBC 模式的 IV 处理方式
43
- - PKCS7 vs PKCS5 填充
44
- - 密钥派生函数差异
45
-
46
- 通用规则: JS/Python 加密转换时,必须逐一核对:模式、填充、IV、密钥派生、输出编码
47
- ```
48
-
49
- ### 3. 合并到 SKILL.md
50
-
51
- 将提炼后的通用经验追加到 SKILL.md:
52
- - 优先写通用规则,而非具体案例
53
- - 用简洁的一句话总结
54
- - 必要时附带检查清单
55
-
56
- ### 4. 清理 evolved.md
57
-
58
- - 保留已合并的核心经验标记
59
- - 清空近期发现
60
- - 更新 last_merged 日期
61
- - 重置 total 计数
62
-
63
- ### 5. 提交变更
64
-
65
- ```bash
66
- git add src/agent/skills/<skill-name>/
67
- git commit -m "docs: merge evolved experiences to <skill-name>"
68
- ```
69
-
70
- ## 可用的 skill 名称
71
-
72
- - static-analysis
73
- - dynamic-analysis
74
- - sandbox
75
- - env
76
- - js2python
77
- - report
78
- - captcha
79
- - anti-detect
80
- - crawler
@@ -1,13 +0,0 @@
1
- Read the backend development guidelines before starting your development task.
2
-
3
- Execute these steps:
4
- 1. Read `.trellis/spec/backend/index.md` to understand available guidelines
5
- 2. Based on your task, read the relevant guideline files:
6
- - Database work → `.trellis/spec/backend/database-guidelines.md`
7
- - Error handling → `.trellis/spec/backend/error-handling.md`
8
- - Logging → `.trellis/spec/backend/logging-guidelines.md`
9
- - Type questions → `.trellis/spec/backend/type-safety.md`
10
- 3. Understand the coding standards and patterns you need to follow
11
- 4. Then proceed with your development plan
12
-
13
- This step is **mandatory** before writing any backend code.
@@ -1,13 +0,0 @@
1
- Read the frontend development guidelines before starting your development task.
2
-
3
- Execute these steps:
4
- 1. Read `.trellis/spec/frontend/index.md` to understand available guidelines
5
- 2. Based on your task, read the relevant guideline files:
6
- - Component work → `.trellis/spec/frontend/component-guidelines.md`
7
- - Hook work → `.trellis/spec/frontend/hook-guidelines.md`
8
- - State management → `.trellis/spec/frontend/state-management.md`
9
- - Type questions → `.trellis/spec/frontend/type-safety.md`
10
- 3. Understand the coding standards and patterns you need to follow
11
- 4. Then proceed with your development plan
12
-
13
- This step is **mandatory** before writing any frontend code.
@@ -1,107 +0,0 @@
1
- # Break the Loop - Deep Bug Analysis
2
-
3
- When debug is complete, use this command for deep analysis to break the "fix bug -> forget -> repeat" cycle.
4
-
5
- ---
6
-
7
- ## Analysis Framework
8
-
9
- Analyze the bug you just fixed from these 5 dimensions:
10
-
11
- ### 1. Root Cause Category
12
-
13
- Which category does this bug belong to?
14
-
15
- | Category | Characteristics | Example |
16
- |----------|-----------------|---------|
17
- | **A. Missing Spec** | No documentation on how to do it | New feature without checklist |
18
- | **B. Cross-Layer Contract** | Interface between layers unclear | API returns different format than expected |
19
- | **C. Change Propagation Failure** | Changed one place, missed others | Changed function signature, missed call sites |
20
- | **D. Test Coverage Gap** | Unit test passes, integration fails | Works alone, breaks when combined |
21
- | **E. Implicit Assumption** | Code relies on undocumented assumption | Timestamp seconds vs milliseconds |
22
-
23
- ### 2. Why Fixes Failed (if applicable)
24
-
25
- If you tried multiple fixes before succeeding, analyze each failure:
26
-
27
- - **Surface Fix**: Fixed symptom, not root cause
28
- - **Incomplete Scope**: Found root cause, didn't cover all cases
29
- - **Tool Limitation**: grep missed it, type check wasn't strict
30
- - **Mental Model**: Kept looking in same layer, didn't think cross-layer
31
-
32
- ### 3. Prevention Mechanisms
33
-
34
- What mechanisms would prevent this from happening again?
35
-
36
- | Type | Description | Example |
37
- |------|-------------|---------|
38
- | **Documentation** | Write it down so people know | Update thinking guide |
39
- | **Architecture** | Make the error impossible structurally | Type-safe wrappers |
40
- | **Compile-time** | TypeScript strict, no any | Signature change causes compile error |
41
- | **Runtime** | Monitoring, alerts, scans | Detect orphan entities |
42
- | **Test Coverage** | E2E tests, integration tests | Verify full flow |
43
- | **Code Review** | Checklist, PR template | "Did you check X?" |
44
-
45
- ### 4. Systematic Expansion
46
-
47
- What broader problems does this bug reveal?
48
-
49
- - **Similar Issues**: Where else might this problem exist?
50
- - **Design Flaw**: Is there a fundamental architecture issue?
51
- - **Process Flaw**: Is there a development process improvement?
52
- - **Knowledge Gap**: Is the team missing some understanding?
53
-
54
- ### 5. Knowledge Capture
55
-
56
- Solidify insights into the system:
57
-
58
- - [ ] Update `.trellis/spec/guides/` thinking guides
59
- - [ ] Update `.trellis/spec/backend/` or `frontend/` docs
60
- - [ ] Create issue record (if applicable)
61
- - [ ] Create feature ticket for root fix
62
- - [ ] Update check commands if needed
63
-
64
- ---
65
-
66
- ## Output Format
67
-
68
- Please output analysis in this format:
69
-
70
- ```markdown
71
- ## Bug Analysis: [Short Description]
72
-
73
- ### 1. Root Cause Category
74
- - **Category**: [A/B/C/D/E] - [Category Name]
75
- - **Specific Cause**: [Detailed description]
76
-
77
- ### 2. Why Fixes Failed (if applicable)
78
- 1. [First attempt]: [Why it failed]
79
- 2. [Second attempt]: [Why it failed]
80
- ...
81
-
82
- ### 3. Prevention Mechanisms
83
- | Priority | Mechanism | Specific Action | Status |
84
- |----------|-----------|-----------------|--------|
85
- | P0 | ... | ... | TODO/DONE |
86
-
87
- ### 4. Systematic Expansion
88
- - **Similar Issues**: [List places with similar problems]
89
- - **Design Improvement**: [Architecture-level suggestions]
90
- - **Process Improvement**: [Development process suggestions]
91
-
92
- ### 5. Knowledge Capture
93
- - [ ] [Documents to update / tickets to create]
94
- ```
95
-
96
- ---
97
-
98
- ## Core Philosophy
99
-
100
- > **The value of debugging is not in fixing the bug, but in making this class of bugs never happen again.**
101
-
102
- Three levels of insight:
103
- 1. **Tactical**: How to fix THIS bug
104
- 2. **Strategic**: How to prevent THIS CLASS of bugs
105
- 3. **Philosophical**: How to expand thinking patterns
106
-
107
- 30 minutes of analysis saves 30 hours of future debugging.
@@ -1,13 +0,0 @@
1
- Check if the code you just wrote follows the backend development guidelines.
2
-
3
- Execute these steps:
4
- 1. Run `git status` to see modified files
5
- 2. Read `.trellis/spec/backend/index.md` to understand which guidelines apply
6
- 3. Based on what you changed, read the relevant guideline files:
7
- - Database changes → `.trellis/spec/backend/database-guidelines.md`
8
- - Error handling → `.trellis/spec/backend/error-handling.md`
9
- - Logging changes → `.trellis/spec/backend/logging-guidelines.md`
10
- - Type changes → `.trellis/spec/backend/type-safety.md`
11
- - Any changes → `.trellis/spec/backend/quality-guidelines.md`
12
- 4. Review your code against the guidelines
13
- 5. Report any violations and fix them if found
@@ -1,153 +0,0 @@
1
- # Cross-Layer Check
2
-
3
- Check if your changes considered all dimensions. Most bugs come from "didn't think of it", not lack of technical skill.
4
-
5
- > **Note**: This is a **post-implementation** safety net. Ideally, read the [Pre-Implementation Checklist](.trellis/spec/guides/pre-implementation-checklist.md) **before** writing code.
6
-
7
- ---
8
-
9
- ## Related Documents
10
-
11
- | Document | Purpose | Timing |
12
- |----------|---------|--------|
13
- | [Pre-Implementation Checklist](.trellis/spec/guides/pre-implementation-checklist.md) | Questions before coding | **Before** writing code |
14
- | [Code Reuse Thinking Guide](.trellis/spec/guides/code-reuse-thinking-guide.md) | Pattern recognition | During implementation |
15
- | **`/trellis:check-cross-layer`** (this) | Verification check | **After** implementation |
16
-
17
- ---
18
-
19
- ## Execution Steps
20
-
21
- ### 1. Identify Change Scope
22
-
23
- ```bash
24
- git status
25
- git diff --name-only
26
- ```
27
-
28
- ### 2. Select Applicable Check Dimensions
29
-
30
- Based on your change type, execute relevant checks below:
31
-
32
- ---
33
-
34
- ## Dimension A: Cross-Layer Data Flow (Required when 3+ layers)
35
-
36
- **Trigger**: Changes involve 3 or more layers
37
-
38
- | Layer | Common Locations |
39
- |-------|------------------|
40
- | API/Routes | `routes/`, `api/`, `handlers/`, `controllers/` |
41
- | Service/Business Logic | `services/`, `lib/`, `core/`, `domain/` |
42
- | Database/Storage | `db/`, `models/`, `repositories/`, `schema/` |
43
- | UI/Presentation | `components/`, `views/`, `templates/`, `pages/` |
44
- | Utility | `utils/`, `helpers/`, `common/` |
45
-
46
- **Checklist**:
47
- - [ ] Read flow: Database -> Service -> API -> UI
48
- - [ ] Write flow: UI -> API -> Service -> Database
49
- - [ ] Types/schemas correctly passed between layers?
50
- - [ ] Errors properly propagated to caller?
51
- - [ ] Loading/pending states handled at each layer?
52
-
53
- **Detailed Guide**: `.trellis/spec/guides/cross-layer-thinking-guide.md`
54
-
55
- ---
56
-
57
- ## Dimension B: Code Reuse (Required when modifying constants/config)
58
-
59
- **Trigger**:
60
- - Modifying UI constants (label, icon, color)
61
- - Modifying any hardcoded value
62
- - Seeing similar code in multiple places
63
- - Creating a new utility/helper function
64
- - Just finished batch modifications across files
65
-
66
- **Checklist**:
67
- - [ ] Search first: How many places define this value?
68
- ```bash
69
- # Search in source files (adjust extensions for your project)
70
- grep -r "value-to-change" src/
71
- ```
72
- - [ ] If 2+ places define same value -> Should extract to shared constant
73
- - [ ] After modification, all usage sites updated?
74
- - [ ] If creating utility: Does similar utility already exist?
75
-
76
- **Detailed Guide**: `.trellis/spec/guides/code-reuse-thinking-guide.md`
77
-
78
- ---
79
-
80
- ## Dimension B2: New Utility Functions
81
-
82
- **Trigger**: About to create a new utility/helper function
83
-
84
- **Checklist**:
85
- - [ ] Search for existing similar utilities first
86
- ```bash
87
- grep -r "functionNamePattern" src/
88
- ```
89
- - [ ] If similar exists, can you extend it instead?
90
- - [ ] If creating new, is it in the right location (shared vs domain-specific)?
91
-
92
- ---
93
-
94
- ## Dimension B3: After Batch Modifications
95
-
96
- **Trigger**: Just modified similar patterns in multiple files
97
-
98
- **Checklist**:
99
- - [ ] Did you check ALL files with similar patterns?
100
- ```bash
101
- grep -r "patternYouChanged" src/
102
- ```
103
- - [ ] Any files missed that should also be updated?
104
- - [ ] Should this pattern be abstracted to prevent future duplication?
105
-
106
- ---
107
-
108
- ## Dimension C: Import/Dependency Paths (Required when creating new files)
109
-
110
- **Trigger**: Creating new source files
111
-
112
- **Checklist**:
113
- - [ ] Using correct import paths (relative vs absolute)?
114
- - [ ] No circular dependencies?
115
- - [ ] Consistent with project's module organization?
116
-
117
- ---
118
-
119
- ## Dimension D: Same-Layer Consistency
120
-
121
- **Trigger**:
122
- - Modifying display logic or formatting
123
- - Same domain concept used in multiple places
124
-
125
- **Checklist**:
126
- - [ ] Search for other places using same concept
127
- ```bash
128
- grep -r "ConceptName" src/
129
- ```
130
- - [ ] Are these usages consistent?
131
- - [ ] Should they share configuration/constants?
132
-
133
- ---
134
-
135
- ## Common Issues Quick Reference
136
-
137
- | Issue | Root Cause | Prevention |
138
- |-------|------------|------------|
139
- | Changed one place, missed others | Didn't search impact scope | `grep` before changing |
140
- | Data lost at some layer | Didn't check data flow | Trace data source to destination |
141
- | Type/schema mismatch | Cross-layer types inconsistent | Use shared type definitions |
142
- | UI/output inconsistent | Same concept in multiple places | Extract shared constants |
143
- | Similar utility exists | Didn't search first | Search before creating |
144
- | Batch fix incomplete | Didn't verify all occurrences | grep after fixing |
145
-
146
- ---
147
-
148
- ## Output
149
-
150
- Report:
151
- 1. Which dimensions your changes involve
152
- 2. Check results for each dimension
153
- 3. Issues found and fix suggestions
@@ -1,13 +0,0 @@
1
- Check if the code you just wrote follows the frontend development guidelines.
2
-
3
- Execute these steps:
4
- 1. Run `git status` to see modified files
5
- 2. Read `.trellis/spec/frontend/index.md` to understand which guidelines apply
6
- 3. Based on what you changed, read the relevant guideline files:
7
- - Component changes → `.trellis/spec/frontend/component-guidelines.md`
8
- - Hook changes → `.trellis/spec/frontend/hook-guidelines.md`
9
- - State changes → `.trellis/spec/frontend/state-management.md`
10
- - Type changes → `.trellis/spec/frontend/type-safety.md`
11
- - Any changes → `.trellis/spec/frontend/quality-guidelines.md`
12
- 4. Review your code against the guidelines
13
- 5. Report any violations and fix them if found
@@ -1,154 +0,0 @@
1
- # Create New Slash Command
2
-
3
- Create a new slash command in both `.cursor/commands/` (with `trellis-` prefix) and `.claude/commands/trellis/` directories based on user requirements.
4
-
5
- ## Usage
6
-
7
- ```
8
- /trellis:create-command <command-name> <description>
9
- ```
10
-
11
- **Example**:
12
- ```
13
- /trellis:create-command review-pr Check PR code changes against project guidelines
14
- ```
15
-
16
- ## Execution Steps
17
-
18
- ### 1. Parse Input
19
-
20
- Extract from user input:
21
- - **Command name**: Use kebab-case (e.g., `review-pr`)
22
- - **Description**: What the command should accomplish
23
-
24
- ### 2. Analyze Requirements
25
-
26
- Determine command type based on description:
27
- - **Initialization**: Read docs, establish context
28
- - **Pre-development**: Read guidelines, check dependencies
29
- - **Code check**: Validate code quality and guideline compliance
30
- - **Recording**: Record progress, questions, structure changes
31
- - **Generation**: Generate docs, code templates
32
-
33
- ### 3. Generate Command Content
34
-
35
- Based on command type, generate appropriate content:
36
-
37
- **Simple command** (1-3 lines):
38
- ```markdown
39
- Concise instruction describing what to do
40
- ```
41
-
42
- **Complex command** (with steps):
43
- ```markdown
44
- # Command Title
45
-
46
- Command description
47
-
48
- ## Steps
49
-
50
- ### 1. First Step
51
- Specific action
52
-
53
- ### 2. Second Step
54
- Specific action
55
-
56
- ## Output Format (if needed)
57
-
58
- Template
59
- ```
60
-
61
- ### 4. Create Files
62
-
63
- Create in both directories:
64
- - `.cursor/commands/trellis-<command-name>.md`
65
- - `.claude/commands/trellis/<command-name>.md`
66
-
67
- ### 5. Confirm Creation
68
-
69
- Output result:
70
- ```
71
- [OK] Created Slash Command: /<command-name>
72
-
73
- File paths:
74
- - .cursor/commands/trellis-<command-name>.md
75
- - .claude/commands/trellis/<command-name>.md
76
-
77
- Usage:
78
- /trellis:<command-name>
79
-
80
- Description:
81
- <description>
82
- ```
83
-
84
- ## Command Content Guidelines
85
-
86
- ### [OK] Good command content
87
-
88
- 1. **Clear and concise**: Immediately understandable
89
- 2. **Executable**: AI can follow steps directly
90
- 3. **Well-scoped**: Clear boundaries of what to do and not do
91
- 4. **Has output**: Specifies expected output format (if needed)
92
-
93
- ### [X] Avoid
94
-
95
- 1. **Too vague**: e.g., "optimize code"
96
- 2. **Too complex**: Single command should not exceed 100 lines
97
- 3. **Duplicate functionality**: Check if similar command exists first
98
-
99
- ## Naming Conventions
100
-
101
- | Command Type | Prefix | Example |
102
- |--------------|--------|---------|
103
- | Session Start | `start` | `start` |
104
- | Pre-development | `before-` | `before-frontend-dev` |
105
- | Check | `check-` | `check-frontend` |
106
- | Record | `record-` | `record-session` |
107
- | Generate | `generate-` | `generate-api-doc` |
108
- | Update | `update-` | `update-changelog` |
109
- | Other | Verb-first | `review-code`, `sync-data` |
110
-
111
- ## Example
112
-
113
- ### Input
114
- ```
115
- /trellis:create-command review-pr Check PR code changes against project guidelines
116
- ```
117
-
118
- ### Generated Command Content
119
- ```markdown
120
- # PR Code Review
121
-
122
- Check current PR code changes against project guidelines.
123
-
124
- ## Steps
125
-
126
- ### 1. Get Changed Files
127
- ```bash
128
- git diff main...HEAD --name-only
129
- ```
130
-
131
- ### 2. Categorized Review
132
-
133
- **Frontend files** (`apps/web/`):
134
- - Reference `.trellis/spec/frontend/index.md`
135
-
136
- **Backend files** (`packages/api/`):
137
- - Reference `.trellis/spec/backend/index.md`
138
-
139
- ### 3. Output Review Report
140
-
141
- Format:
142
-
143
- ## PR Review Report
144
-
145
- ### Changed Files
146
- - [file list]
147
-
148
- ### Check Results
149
- - [OK] Passed items
150
- - [X] Issues found
151
-
152
- ### Suggestions
153
- - [improvement suggestions]
154
- ```