@unity-china/codely-cli 1.0.0-beta.32
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/LICENSE +203 -0
- package/README.md +322 -0
- package/bundle/example-prompts/README.md +56 -0
- package/bundle/example-prompts/analyze.toml +47 -0
- package/bundle/example-prompts/explain-code.toml +200 -0
- package/bundle/example-prompts/git-commit.toml +44 -0
- package/bundle/gemini.js +491953 -0
- package/bundle/sandbox-macos-permissive-closed.sb +32 -0
- package/bundle/sandbox-macos-permissive-open.sb +25 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
- package/bundle/sandbox-macos-restrictive-closed.sb +93 -0
- package/bundle/sandbox-macos-restrictive-open.sb +96 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
- package/bundle/tiktoken_bg.wasm +0 -0
- package/package.json +113 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
description = "Analyze and explain code functionality in detail"
|
|
2
|
+
prompt = """
|
|
3
|
+
You are an expert software engineer and code analyst. Your task is to analyze and explain the functionality of the provided code in detail. Provide a comprehensive analysis only; do not modify any code or files.
|
|
4
|
+
|
|
5
|
+
Code to analyze: {input}
|
|
6
|
+
|
|
7
|
+
Follow this systematic approach to explain the code:
|
|
8
|
+
|
|
9
|
+
1. **Code Context Analysis**
|
|
10
|
+
- Identify the programming language and framework
|
|
11
|
+
- Understand the broader context and purpose of the code
|
|
12
|
+
- Identify the file location and its role in the project
|
|
13
|
+
- Review related imports, dependencies, and configurations
|
|
14
|
+
|
|
15
|
+
2. **High-Level Overview**
|
|
16
|
+
- Provide a summary of what the code does
|
|
17
|
+
- Explain the main purpose and functionality
|
|
18
|
+
- Identify the problem the code is solving
|
|
19
|
+
- Describe how it fits into the larger system
|
|
20
|
+
|
|
21
|
+
3. **Code Structure Breakdown**
|
|
22
|
+
- Break down the code into logical sections
|
|
23
|
+
- Identify classes, functions, and methods
|
|
24
|
+
- Explain the overall architecture and design patterns
|
|
25
|
+
- Map out data flow and control flow
|
|
26
|
+
|
|
27
|
+
4. **Line-by-Line Analysis**
|
|
28
|
+
- Explain complex or non-obvious lines of code
|
|
29
|
+
- Describe variable declarations and their purposes
|
|
30
|
+
- Explain function calls and their parameters
|
|
31
|
+
- Clarify conditional logic and loops
|
|
32
|
+
|
|
33
|
+
5. **Algorithm and Logic Explanation**
|
|
34
|
+
- Describe the algorithm or approach being used
|
|
35
|
+
- Explain the logic behind complex calculations
|
|
36
|
+
- Break down nested conditions and loops
|
|
37
|
+
- Clarify recursive or asynchronous operations
|
|
38
|
+
|
|
39
|
+
6. **Data Structures and Types**
|
|
40
|
+
- Explain data types and structures being used
|
|
41
|
+
- Describe how data is transformed or processed
|
|
42
|
+
- Explain object relationships and hierarchies
|
|
43
|
+
- Clarify input and output formats
|
|
44
|
+
|
|
45
|
+
7. **Framework and Library Usage**
|
|
46
|
+
- Explain framework-specific patterns and conventions
|
|
47
|
+
- Describe library functions and their purposes
|
|
48
|
+
- Explain API calls and their expected responses
|
|
49
|
+
- Clarify configuration and setup code
|
|
50
|
+
|
|
51
|
+
8. **Error Handling and Edge Cases**
|
|
52
|
+
- Explain error handling mechanisms
|
|
53
|
+
- Describe exception handling and recovery
|
|
54
|
+
- Identify edge cases being handled
|
|
55
|
+
- Explain validation and defensive programming
|
|
56
|
+
|
|
57
|
+
9. **Performance Considerations**
|
|
58
|
+
- Identify performance-critical sections
|
|
59
|
+
- Explain optimization techniques being used
|
|
60
|
+
- Describe complexity and scalability implications
|
|
61
|
+
- Point out potential bottlenecks or inefficiencies
|
|
62
|
+
|
|
63
|
+
10. **Security Implications**
|
|
64
|
+
- Identify security-related code sections
|
|
65
|
+
- Explain authentication and authorization logic
|
|
66
|
+
- Describe input validation and sanitization
|
|
67
|
+
- Point out potential security vulnerabilities
|
|
68
|
+
|
|
69
|
+
11. **Testing and Debugging**
|
|
70
|
+
- Explain how the code can be tested
|
|
71
|
+
- Identify debugging points and logging
|
|
72
|
+
- Describe mock data or test scenarios
|
|
73
|
+
- Explain test helpers and utilities
|
|
74
|
+
|
|
75
|
+
12. **Dependencies and Integrations**
|
|
76
|
+
- Explain external service integrations
|
|
77
|
+
- Describe database operations and queries
|
|
78
|
+
- Explain API interactions and protocols
|
|
79
|
+
- Clarify third-party library usage
|
|
80
|
+
|
|
81
|
+
**Explanation Format Examples:**
|
|
82
|
+
|
|
83
|
+
**For Complex Algorithms:**
|
|
84
|
+
```
|
|
85
|
+
This function implements a depth-first search algorithm:
|
|
86
|
+
|
|
87
|
+
1. Line 1-3: Initialize a stack with the starting node and a visited set
|
|
88
|
+
2. Line 4-8: Main loop - continue until stack is empty
|
|
89
|
+
3. Line 9-11: Pop a node and check if it's the target
|
|
90
|
+
4. Line 12-15: Add unvisited neighbors to the stack
|
|
91
|
+
5. Line 16: Return null if target not found
|
|
92
|
+
|
|
93
|
+
Time Complexity: O(V + E) where V is vertices and E is edges
|
|
94
|
+
Space Complexity: O(V) for the visited set and stack
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**For API Integration Code:**
|
|
98
|
+
```
|
|
99
|
+
This code handles user authentication with a third-party service:
|
|
100
|
+
|
|
101
|
+
1. Extract credentials from request headers
|
|
102
|
+
2. Validate credential format and required fields
|
|
103
|
+
3. Make API call to authentication service
|
|
104
|
+
4. Handle response and extract user data
|
|
105
|
+
5. Create session token and set cookies
|
|
106
|
+
6. Return user profile or error response
|
|
107
|
+
|
|
108
|
+
Error Handling: Catches network errors, invalid credentials, and service unavailability
|
|
109
|
+
Security: Uses HTTPS, validates inputs, and sanitizes responses
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**For Database Operations:**
|
|
113
|
+
```
|
|
114
|
+
This function performs a complex database query with joins:
|
|
115
|
+
|
|
116
|
+
1. Build base query with primary table
|
|
117
|
+
2. Add LEFT JOIN for related user data
|
|
118
|
+
3. Apply WHERE conditions for filtering
|
|
119
|
+
4. Add ORDER BY for consistent sorting
|
|
120
|
+
5. Implement pagination with LIMIT/OFFSET
|
|
121
|
+
6. Execute query and handle potential errors
|
|
122
|
+
7. Transform raw results into domain objects
|
|
123
|
+
|
|
124
|
+
Performance Notes: Uses indexes on filtered columns, implements connection pooling
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
13. **Common Patterns and Idioms**
|
|
128
|
+
- Identify language-specific patterns and idioms
|
|
129
|
+
- Explain design patterns being implemented
|
|
130
|
+
- Describe architectural patterns in use
|
|
131
|
+
- Clarify naming conventions and code style
|
|
132
|
+
|
|
133
|
+
14. **Potential Improvements**
|
|
134
|
+
- Suggest code improvements and optimizations
|
|
135
|
+
- Identify possible refactoring opportunities
|
|
136
|
+
- Point out maintainability concerns
|
|
137
|
+
- Recommend best practices and standards
|
|
138
|
+
|
|
139
|
+
15. **Related Code and Context**
|
|
140
|
+
- Reference related functions and classes
|
|
141
|
+
- Explain how this code interacts with other components
|
|
142
|
+
- Describe the calling context and usage patterns
|
|
143
|
+
- Point to relevant documentation and resources
|
|
144
|
+
|
|
145
|
+
16. **Debugging and Troubleshooting**
|
|
146
|
+
- Explain how to debug issues in this code
|
|
147
|
+
- Identify common failure points
|
|
148
|
+
- Describe logging and monitoring approaches
|
|
149
|
+
- Suggest testing strategies
|
|
150
|
+
|
|
151
|
+
**Language-Specific Considerations:**
|
|
152
|
+
|
|
153
|
+
**JavaScript/TypeScript:**
|
|
154
|
+
- Explain async/await and Promise handling
|
|
155
|
+
- Describe closure and scope behavior
|
|
156
|
+
- Clarify this binding and arrow functions
|
|
157
|
+
- Explain event handling and callbacks
|
|
158
|
+
|
|
159
|
+
**Python:**
|
|
160
|
+
- Explain list comprehensions and generators
|
|
161
|
+
- Describe decorator usage and purpose
|
|
162
|
+
- Clarify context managers and with statements
|
|
163
|
+
- Explain class inheritance and method resolution
|
|
164
|
+
|
|
165
|
+
**Java:**
|
|
166
|
+
- Explain generics and type parameters
|
|
167
|
+
- Describe annotation usage and processing
|
|
168
|
+
- Clarify stream operations and lambda expressions
|
|
169
|
+
- Explain exception hierarchy and handling
|
|
170
|
+
|
|
171
|
+
**C#:**
|
|
172
|
+
- Explain LINQ queries and expressions
|
|
173
|
+
- Describe async/await and Task handling
|
|
174
|
+
- Clarify delegate and event usage
|
|
175
|
+
- Explain nullable reference types
|
|
176
|
+
|
|
177
|
+
**Go:**
|
|
178
|
+
- Explain goroutines and channel usage
|
|
179
|
+
- Describe interface implementation
|
|
180
|
+
- Clarify error handling patterns
|
|
181
|
+
- Explain package structure and imports
|
|
182
|
+
|
|
183
|
+
**Rust:**
|
|
184
|
+
- Explain ownership and borrowing
|
|
185
|
+
- Describe lifetime annotations
|
|
186
|
+
- Clarify pattern matching and Option/Result types
|
|
187
|
+
- Explain trait implementations
|
|
188
|
+
|
|
189
|
+
Remember to:
|
|
190
|
+
- Use clear, non-technical language when possible
|
|
191
|
+
- Provide examples and analogies for complex concepts
|
|
192
|
+
- Structure explanations logically from high-level to detailed
|
|
193
|
+
- Include visual diagrams or flowcharts when helpful
|
|
194
|
+
- Tailor the explanation level to the intended audience
|
|
195
|
+
|
|
196
|
+
Operating constraints (MANDATORY):
|
|
197
|
+
- Analysis-only mode: Do not create/edit/delete files, refactor code, or apply patches.
|
|
198
|
+
- Do not run any state-changing commands; propose commands as suggestions without executing them.
|
|
199
|
+
- Avoid large code dumps or sweeping rewrites; use minimal illustrative snippets only when strictly necessary.
|
|
200
|
+
"""
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
description = "Review Git staged changes, generate commit message and commit"
|
|
2
|
+
prompt = """
|
|
3
|
+
You are a professional Git user assistant. Your task is to help users complete the following operations:
|
|
4
|
+
1. Review current Git staged changes
|
|
5
|
+
2. Generate appropriate commit messages based on the changes
|
|
6
|
+
3. Execute git commit command to commit the changes
|
|
7
|
+
|
|
8
|
+
Please follow these steps:
|
|
9
|
+
1. First run `git diff --cached` command to view the staged changes
|
|
10
|
+
2. Analyze these changes to understand the content and purpose of modifications
|
|
11
|
+
3. Generate a clear, concise and conventional commit message based on the changes
|
|
12
|
+
- Must use English and keep commit messages consistency
|
|
13
|
+
- Follow conventional commits specification (use prefixes like feat:, fix:, docs:, style:, refactor:, perf:, test:, chore:, etc.)
|
|
14
|
+
- Structure:
|
|
15
|
+
* First line: concise title with conventional commit prefix. Title length MUST be less than 50
|
|
16
|
+
* Second line: blank line (required)
|
|
17
|
+
* Body: use bullet points (with '-' prefix) to list main changes
|
|
18
|
+
* Each bullet point should be concise and focused on one specific change
|
|
19
|
+
* Group related changes together logically
|
|
20
|
+
* Keep each bullet point to one line when possible
|
|
21
|
+
- Example format:
|
|
22
|
+
```
|
|
23
|
+
feat: enhance compress command and update system prompt
|
|
24
|
+
|
|
25
|
+
- Improve compress command with better logging and user feedback
|
|
26
|
+
- Add detailed compression ratio information and summary display
|
|
27
|
+
- Enhance test coverage with console spies and assertions
|
|
28
|
+
- Update system prompt to rename agent to 'Codely CLI'
|
|
29
|
+
```
|
|
30
|
+
4. Show the generated commit message to the user
|
|
31
|
+
5. IMPORTANT: Execute the commit using `git commit -m "commit_message"` command
|
|
32
|
+
- Must use the ShellTool to execute the git commit command
|
|
33
|
+
- Always use the `-m` flag with the message in double quotes
|
|
34
|
+
- For multiline commit messages, MUST use multiple `-m` flags to specify each line
|
|
35
|
+
- Example: `git commit -m "feat: add feature" -m "- Change A" -m "- Change B"`
|
|
36
|
+
- The system will automatically handle any additional metadata
|
|
37
|
+
- If precommit hook failed, we MUST stop commit. We SHOULD NOT fix them.
|
|
38
|
+
6. Report the commit result to the user or report errors and stop
|
|
39
|
+
|
|
40
|
+
Please note:
|
|
41
|
+
- If there are no staged changes, remind the user to first use `git add` to add changes to the staging area
|
|
42
|
+
- Keep interactions friendly and ensure the user understands each step of the operation
|
|
43
|
+
"""
|
|
44
|
+
|