@ahumandev/autocode 0.0.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.
- package/LICENSE.md +21 -0
- package/README.md +379 -0
- package/dist/agents/index.d.ts +25 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.test.d.ts +2 -0
- package/dist/agents/index.test.d.ts.map +1 -0
- package/dist/agents/prompts/assist.d.ts +2 -0
- package/dist/agents/prompts/assist.d.ts.map +1 -0
- package/dist/agents/prompts/assist_git_conflict.d.ts +2 -0
- package/dist/agents/prompts/assist_git_conflict.d.ts.map +1 -0
- package/dist/agents/prompts/assist_troubleshoot.d.ts +2 -0
- package/dist/agents/prompts/assist_troubleshoot.d.ts.map +1 -0
- package/dist/agents/prompts/auto.d.ts +2 -0
- package/dist/agents/prompts/auto.d.ts.map +1 -0
- package/dist/agents/prompts/auto_feature.d.ts +2 -0
- package/dist/agents/prompts/auto_feature.d.ts.map +1 -0
- package/dist/agents/prompts/auto_general.d.ts +2 -0
- package/dist/agents/prompts/auto_general.d.ts.map +1 -0
- package/dist/agents/prompts/auto_refactor.d.ts +2 -0
- package/dist/agents/prompts/auto_refactor.d.ts.map +1 -0
- package/dist/agents/prompts/auto_research.d.ts +2 -0
- package/dist/agents/prompts/auto_research.d.ts.map +1 -0
- package/dist/agents/prompts/auto_review_api.d.ts +2 -0
- package/dist/agents/prompts/auto_review_api.d.ts.map +1 -0
- package/dist/agents/prompts/auto_review_ui.d.ts +2 -0
- package/dist/agents/prompts/auto_review_ui.d.ts.map +1 -0
- package/dist/agents/prompts/auto_test.d.ts +2 -0
- package/dist/agents/prompts/auto_test.d.ts.map +1 -0
- package/dist/agents/prompts/auto_troubleshoot.d.ts +2 -0
- package/dist/agents/prompts/auto_troubleshoot.d.ts.map +1 -0
- package/dist/agents/prompts/design.d.ts +2 -0
- package/dist/agents/prompts/design.d.ts.map +1 -0
- package/dist/agents/prompts/document_agents.d.ts +2 -0
- package/dist/agents/prompts/document_agents.d.ts.map +1 -0
- package/dist/agents/prompts/document_code.d.ts +2 -0
- package/dist/agents/prompts/document_code.d.ts.map +1 -0
- package/dist/agents/prompts/document_conventions.d.ts +2 -0
- package/dist/agents/prompts/document_conventions.d.ts.map +1 -0
- package/dist/agents/prompts/document_install.d.ts +2 -0
- package/dist/agents/prompts/document_install.d.ts.map +1 -0
- package/dist/agents/prompts/document_prd.d.ts +2 -0
- package/dist/agents/prompts/document_prd.d.ts.map +1 -0
- package/dist/agents/prompts/document_ux.d.ts +2 -0
- package/dist/agents/prompts/document_ux.d.ts.map +1 -0
- package/dist/agents/prompts/execute_author.d.ts +2 -0
- package/dist/agents/prompts/execute_author.d.ts.map +1 -0
- package/dist/agents/prompts/execute_code.d.ts +2 -0
- package/dist/agents/prompts/execute_code.d.ts.map +1 -0
- package/dist/agents/prompts/execute_debug.d.ts +2 -0
- package/dist/agents/prompts/execute_debug.d.ts.map +1 -0
- package/dist/agents/prompts/execute_document.d.ts +2 -0
- package/dist/agents/prompts/execute_document.d.ts.map +1 -0
- package/dist/agents/prompts/execute_excel.d.ts +2 -0
- package/dist/agents/prompts/execute_excel.d.ts.map +1 -0
- package/dist/agents/prompts/execute_git_commit.d.ts +2 -0
- package/dist/agents/prompts/execute_git_commit.d.ts.map +1 -0
- package/dist/agents/prompts/execute_os.d.ts +2 -0
- package/dist/agents/prompts/execute_os.d.ts.map +1 -0
- package/dist/agents/prompts/execute_script.d.ts +2 -0
- package/dist/agents/prompts/execute_script.d.ts.map +1 -0
- package/dist/agents/prompts/query_architect.d.ts +2 -0
- package/dist/agents/prompts/query_architect.d.ts.map +1 -0
- package/dist/agents/prompts/query_browser.d.ts +2 -0
- package/dist/agents/prompts/query_browser.d.ts.map +1 -0
- package/dist/agents/prompts/query_code.d.ts +2 -0
- package/dist/agents/prompts/query_code.d.ts.map +1 -0
- package/dist/agents/prompts/query_db.d.ts +2 -0
- package/dist/agents/prompts/query_db.d.ts.map +1 -0
- package/dist/agents/prompts/query_excel.d.ts +2 -0
- package/dist/agents/prompts/query_excel.d.ts.map +1 -0
- package/dist/agents/prompts/query_git.d.ts +2 -0
- package/dist/agents/prompts/query_git.d.ts.map +1 -0
- package/dist/agents/prompts/query_os.d.ts +2 -0
- package/dist/agents/prompts/query_os.d.ts.map +1 -0
- package/dist/agents/prompts/query_text.d.ts +2 -0
- package/dist/agents/prompts/query_text.d.ts.map +1 -0
- package/dist/agents/prompts/query_web.d.ts +2 -0
- package/dist/agents/prompts/query_web.d.ts.map +1 -0
- package/dist/agents/prompts/research.d.ts +2 -0
- package/dist/agents/prompts/research.d.ts.map +1 -0
- package/dist/agents/prompts/temp_concept.d.ts +2 -0
- package/dist/agents/prompts/temp_concept.d.ts.map +1 -0
- package/dist/agents/prompts/temp_manual.d.ts +4 -0
- package/dist/agents/prompts/temp_manual.d.ts.map +1 -0
- package/dist/agents/prompts/temp_report.d.ts +2 -0
- package/dist/agents/prompts/temp_report.d.ts.map +1 -0
- package/dist/agents/rules/caveman.d.ts +2 -0
- package/dist/agents/rules/caveman.d.ts.map +1 -0
- package/dist/agents/rules/definitions.d.ts +2 -0
- package/dist/agents/rules/definitions.d.ts.map +1 -0
- package/dist/agents/rules/error.d.ts +2 -0
- package/dist/agents/rules/error.d.ts.map +1 -0
- package/dist/agents/rules/markdown.d.ts +2 -0
- package/dist/agents/rules/markdown.d.ts.map +1 -0
- package/dist/agents/rules/planner.d.ts +2 -0
- package/dist/agents/rules/planner.d.ts.map +1 -0
- package/dist/agents/rules/question.d.ts +2 -0
- package/dist/agents/rules/question.d.ts.map +1 -0
- package/dist/agents/rules/response.d.ts +2 -0
- package/dist/agents/rules/response.d.ts.map +1 -0
- package/dist/agents/rules/swap2assist.d.ts +2 -0
- package/dist/agents/rules/swap2assist.d.ts.map +1 -0
- package/dist/agents/rules/task.d.ts +2 -0
- package/dist/agents/rules/task.d.ts.map +1 -0
- package/dist/commands/index.d.ts +19 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.test.d.ts +2 -0
- package/dist/commands/index.test.d.ts.map +1 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.test.d.ts +2 -0
- package/dist/config.test.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +30676 -0
- package/dist/plugin.test.d.ts +2 -0
- package/dist/plugin.test.d.ts.map +1 -0
- package/dist/skills/author-article/SKILL.md +116 -0
- package/dist/skills/author-caveman/SKILL.md +18 -0
- package/dist/skills/author-readme/SKILL.md +199 -0
- package/dist/skills/author-rules/SKILL.md +182 -0
- package/dist/skills/author-skill/SKILL.md +78 -0
- package/dist/skills/author-tutorial/SKILL.md +24 -0
- package/dist/skills/code-java/SKILL.md +345 -0
- package/dist/skills/code-rest/SKILL.md +82 -0
- package/dist/skills/code-typescript/SKILL.md +453 -0
- package/dist/skills/execute-sandbox/SKILL.md +42 -0
- package/dist/skills/test-jest/SKILL.md +211 -0
- package/dist/skills/test-junit/SKILL.md +206 -0
- package/dist/skills/test-mockito/SKILL.md +209 -0
- package/dist/skills/test-vitest/SKILL.md +159 -0
- package/dist/tools/autocode_agent_swap.d.ts +13 -0
- package/dist/tools/autocode_agent_swap.d.ts.map +1 -0
- package/dist/tools/autocode_agent_swap.test.d.ts +2 -0
- package/dist/tools/autocode_agent_swap.test.d.ts.map +1 -0
- package/dist/tools/autocode_concept_create.d.ts +23 -0
- package/dist/tools/autocode_concept_create.d.ts.map +1 -0
- package/dist/tools/autocode_concept_list.d.ts +14 -0
- package/dist/tools/autocode_concept_list.d.ts.map +1 -0
- package/dist/tools/autocode_concept_read.d.ts +20 -0
- package/dist/tools/autocode_concept_read.d.ts.map +1 -0
- package/dist/tools/autocode_criteria.d.ts +52 -0
- package/dist/tools/autocode_criteria.d.ts.map +1 -0
- package/dist/tools/autocode_criteria.test.d.ts +2 -0
- package/dist/tools/autocode_criteria.test.d.ts.map +1 -0
- package/dist/tools/autocode_db.d.ts +80 -0
- package/dist/tools/autocode_db.d.ts.map +1 -0
- package/dist/tools/autocode_db.test.d.ts +2 -0
- package/dist/tools/autocode_db.test.d.ts.map +1 -0
- package/dist/tools/autocode_dependencies.d.ts +4 -0
- package/dist/tools/autocode_dependencies.d.ts.map +1 -0
- package/dist/tools/autocode_dependencies.test.d.ts +2 -0
- package/dist/tools/autocode_dependencies.test.d.ts.map +1 -0
- package/dist/tools/autocode_job_execute.d.ts +14 -0
- package/dist/tools/autocode_job_execute.d.ts.map +1 -0
- package/dist/tools/autocode_job_execute.test.d.ts +2 -0
- package/dist/tools/autocode_job_execute.test.d.ts.map +1 -0
- package/dist/tools/autocode_job_list.d.ts +23 -0
- package/dist/tools/autocode_job_list.d.ts.map +1 -0
- package/dist/tools/autocode_job_list.test.d.ts +3 -0
- package/dist/tools/autocode_job_list.test.d.ts.map +1 -0
- package/dist/tools/autocode_job_status.d.ts +5 -0
- package/dist/tools/autocode_job_status.d.ts.map +1 -0
- package/dist/tools/autocode_job_status.test.d.ts +2 -0
- package/dist/tools/autocode_job_status.test.d.ts.map +1 -0
- package/dist/tools/autocode_logo_find.d.ts +10 -0
- package/dist/tools/autocode_logo_find.d.ts.map +1 -0
- package/dist/tools/autocode_plan_read.d.ts +12 -0
- package/dist/tools/autocode_plan_read.d.ts.map +1 -0
- package/dist/tools/autocode_plan_save.d.ts +48 -0
- package/dist/tools/autocode_plan_save.d.ts.map +1 -0
- package/dist/tools/autocode_sandbox_cli.d.ts +23 -0
- package/dist/tools/autocode_sandbox_cli.d.ts.map +1 -0
- package/dist/tools/autocode_sandbox_create.d.ts +16 -0
- package/dist/tools/autocode_sandbox_create.d.ts.map +1 -0
- package/dist/tools/autocode_sandbox_delete.d.ts +12 -0
- package/dist/tools/autocode_sandbox_delete.d.ts.map +1 -0
- package/dist/tools/autocode_sandbox_file_tools.d.ts +9 -0
- package/dist/tools/autocode_sandbox_file_tools.d.ts.map +1 -0
- package/dist/tools/autocode_sandbox_tools.test.d.ts +2 -0
- package/dist/tools/autocode_sandbox_tools.test.d.ts.map +1 -0
- package/dist/tools/autocode_session_create.d.ts +13 -0
- package/dist/tools/autocode_session_create.d.ts.map +1 -0
- package/dist/tools/autocode_session_create.test.d.ts +2 -0
- package/dist/tools/autocode_session_create.test.d.ts.map +1 -0
- package/dist/tools/autocode_shelve.d.ts +5 -0
- package/dist/tools/autocode_shelve.d.ts.map +1 -0
- package/dist/tools/autocode_shelve.test.d.ts +2 -0
- package/dist/tools/autocode_shelve.test.d.ts.map +1 -0
- package/dist/tools/index.d.ts +324 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.test.d.ts +2 -0
- package/dist/tools/index.test.d.ts.map +1 -0
- package/dist/tools/task_external.d.ts +35 -0
- package/dist/tools/task_external.d.ts.map +1 -0
- package/dist/tools/task_external.test.d.ts +2 -0
- package/dist/tools/task_external.test.d.ts.map +1 -0
- package/dist/tools/task_resume.d.ts +12 -0
- package/dist/tools/task_resume.d.ts.map +1 -0
- package/dist/tools/task_resume.test.d.ts +2 -0
- package/dist/tools/task_resume.test.d.ts.map +1 -0
- package/dist/tools/test_context.d.ts +5 -0
- package/dist/tools/test_context.d.ts.map +1 -0
- package/dist/utils/agent_swap.d.ts +56 -0
- package/dist/utils/agent_swap.d.ts.map +1 -0
- package/dist/utils/agent_swap.test.d.ts +2 -0
- package/dist/utils/agent_swap.test.d.ts.map +1 -0
- package/dist/utils/autocode_dependencies.d.ts +44 -0
- package/dist/utils/autocode_dependencies.d.ts.map +1 -0
- package/dist/utils/autocode_sandbox_helpers.d.ts +12 -0
- package/dist/utils/autocode_sandbox_helpers.d.ts.map +1 -0
- package/dist/utils/db.d.ts +82 -0
- package/dist/utils/db.d.ts.map +1 -0
- package/dist/utils/delegate.d.ts +3 -0
- package/dist/utils/delegate.d.ts.map +1 -0
- package/dist/utils/frontmatter.d.ts +3 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/jobs.d.ts +210 -0
- package/dist/utils/jobs.d.ts.map +1 -0
- package/dist/utils/jobs.test.d.ts +2 -0
- package/dist/utils/jobs.test.d.ts.map +1 -0
- package/dist/utils/sandbox.d.ts +233 -0
- package/dist/utils/sandbox.d.ts.map +1 -0
- package/dist/utils/sandbox.test.d.ts +2 -0
- package/dist/utils/sandbox.test.d.ts.map +1 -0
- package/dist/utils/sandbox_file_tools.d.ts +34 -0
- package/dist/utils/sandbox_file_tools.d.ts.map +1 -0
- package/dist/utils/shelve.d.ts +33 -0
- package/dist/utils/shelve.d.ts.map +1 -0
- package/dist/utils/solution.d.ts +28 -0
- package/dist/utils/solution.d.ts.map +1 -0
- package/dist/utils/solution.test.d.ts +2 -0
- package/dist/utils/solution.test.d.ts.map +1 -0
- package/dist/utils/tool_permission.d.ts +2 -0
- package/dist/utils/tool_permission.d.ts.map +1 -0
- package/dist/utils/tools.d.ts +7 -0
- package/dist/utils/tools.d.ts.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-junit
|
|
3
|
+
description: Use this skill when writing or fixing unit tests with JUnit 5 (Java).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# JUnit 5 Testing Skill
|
|
7
|
+
|
|
8
|
+
JUnit 5 (Jupiter) is the standard Java testing framework. It is composed of three modules: JUnit Platform, JUnit Jupiter (the API), and JUnit Vintage (for legacy JUnit 4 tests).
|
|
9
|
+
|
|
10
|
+
## Detection
|
|
11
|
+
|
|
12
|
+
JUnit 5 is in use when:
|
|
13
|
+
- `pom.xml` includes `junit-jupiter` or `junit-jupiter-api` dependency
|
|
14
|
+
- `build.gradle` includes `testImplementation 'org.junit.jupiter:junit-jupiter'`
|
|
15
|
+
- Test files use `@Test` from `org.junit.jupiter.api`
|
|
16
|
+
- Test files follow `*Test.java` or `*Tests.java` naming convention
|
|
17
|
+
|
|
18
|
+
## File Structure
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
src/
|
|
22
|
+
main/java/com/example/
|
|
23
|
+
Foo.java # production file
|
|
24
|
+
test/java/com/example/
|
|
25
|
+
FooTest.java # test file (mirrors main structure)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Basic Test Structure
|
|
29
|
+
|
|
30
|
+
```java
|
|
31
|
+
package com.example;
|
|
32
|
+
|
|
33
|
+
import org.junit.jupiter.api.*;
|
|
34
|
+
import static org.junit.jupiter.api.Assertions.*;
|
|
35
|
+
|
|
36
|
+
class FooTest {
|
|
37
|
+
|
|
38
|
+
private Foo foo;
|
|
39
|
+
|
|
40
|
+
@BeforeEach
|
|
41
|
+
void setUp() {
|
|
42
|
+
foo = new Foo();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@AfterEach
|
|
46
|
+
void tearDown() {
|
|
47
|
+
// cleanup if needed
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Test
|
|
51
|
+
void methodName_shouldReturnExpectedValue_whenGivenValidInput() {
|
|
52
|
+
// Arrange
|
|
53
|
+
String input = "hello";
|
|
54
|
+
|
|
55
|
+
// Build
|
|
56
|
+
String result = foo.process(input);
|
|
57
|
+
|
|
58
|
+
// Assert
|
|
59
|
+
assertEquals("HELLO", result);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@Test
|
|
63
|
+
void methodName_shouldThrow_whenInputIsNull() {
|
|
64
|
+
assertThrows(IllegalArgumentException.class, () -> foo.process(null));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Naming Conventions
|
|
70
|
+
|
|
71
|
+
Use the pattern: `methodName_shouldExpectedBehavior_whenCondition`
|
|
72
|
+
|
|
73
|
+
Examples:
|
|
74
|
+
- `processInput_shouldReturnUpperCase_whenGivenLowerCaseString`
|
|
75
|
+
- `connect_shouldThrowException_whenHostIsUnreachable`
|
|
76
|
+
- `calculate_shouldReturnZero_whenListIsEmpty`
|
|
77
|
+
|
|
78
|
+
## Annotations
|
|
79
|
+
|
|
80
|
+
| Annotation | Purpose |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `@Test` | Marks a method as a test |
|
|
83
|
+
| `@BeforeEach` | Run before each test method |
|
|
84
|
+
| `@AfterEach` | Run after each test method |
|
|
85
|
+
| `@BeforeAll` | Run once before all tests (must be `static`) |
|
|
86
|
+
| `@AfterAll` | Run once after all tests (must be `static`) |
|
|
87
|
+
| `@Disabled` | Skip a test (add reason as value) |
|
|
88
|
+
| `@DisplayName` | Human-readable test name |
|
|
89
|
+
| `@Nested` | Nested test class for grouping |
|
|
90
|
+
| `@ParameterizedTest` | Run test with multiple inputs |
|
|
91
|
+
|
|
92
|
+
## Common Assertions
|
|
93
|
+
|
|
94
|
+
```java
|
|
95
|
+
assertEquals(expected, actual)
|
|
96
|
+
assertEquals(expected, actual, "message on failure")
|
|
97
|
+
assertNotEquals(unexpected, actual)
|
|
98
|
+
assertNull(value)
|
|
99
|
+
assertNotNull(value)
|
|
100
|
+
assertTrue(condition)
|
|
101
|
+
assertFalse(condition)
|
|
102
|
+
assertThrows(ExpectedException.class, () -> { code(); })
|
|
103
|
+
assertDoesNotThrow(() -> { code(); })
|
|
104
|
+
assertAll(
|
|
105
|
+
() -> assertEquals(1, a),
|
|
106
|
+
() -> assertEquals(2, b)
|
|
107
|
+
)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Parameterized Tests
|
|
111
|
+
|
|
112
|
+
```java
|
|
113
|
+
@ParameterizedTest
|
|
114
|
+
@ValueSource(strings = { "hello", "world", "foo" })
|
|
115
|
+
void isNonEmpty_shouldReturnTrue_whenGivenNonEmptyString(String input) {
|
|
116
|
+
assertTrue(StringUtil.isNonEmpty(input));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@ParameterizedTest
|
|
120
|
+
@CsvSource({ "1, 1, 2", "2, 3, 5", "0, 0, 0" })
|
|
121
|
+
void add_shouldReturnSum(int a, int b, int expected) {
|
|
122
|
+
assertEquals(expected, calculator.add(a, b));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@ParameterizedTest
|
|
126
|
+
@MethodSource("provideInputs")
|
|
127
|
+
void process_shouldHandleAllCases(String input, String expected) {
|
|
128
|
+
assertEquals(expected, foo.process(input));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static Stream<Arguments> provideInputs() {
|
|
132
|
+
return Stream.of(
|
|
133
|
+
Arguments.of("hello", "HELLO"),
|
|
134
|
+
Arguments.of("", "")
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Nested Tests
|
|
140
|
+
|
|
141
|
+
```java
|
|
142
|
+
@Nested
|
|
143
|
+
@DisplayName("when input is valid")
|
|
144
|
+
class WhenInputIsValid {
|
|
145
|
+
|
|
146
|
+
@Test
|
|
147
|
+
void shouldReturnResult() { ... }
|
|
148
|
+
|
|
149
|
+
@Test
|
|
150
|
+
void shouldNotThrow() { ... }
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@Nested
|
|
154
|
+
@DisplayName("when input is null")
|
|
155
|
+
class WhenInputIsNull {
|
|
156
|
+
|
|
157
|
+
@Test
|
|
158
|
+
void shouldThrowIllegalArgument() { ... }
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Running Tests
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Maven
|
|
166
|
+
mvn test
|
|
167
|
+
|
|
168
|
+
# Run a specific test class
|
|
169
|
+
mvn test -Dtest=FooTest
|
|
170
|
+
|
|
171
|
+
# Run a specific method
|
|
172
|
+
mvn test -Dtest=FooTest#methodName
|
|
173
|
+
|
|
174
|
+
# Gradle
|
|
175
|
+
./gradlew test
|
|
176
|
+
|
|
177
|
+
# Run specific test
|
|
178
|
+
./gradlew test --tests "com.example.FooTest"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## pom.xml Dependency
|
|
182
|
+
|
|
183
|
+
```xml
|
|
184
|
+
<dependency>
|
|
185
|
+
<groupId>org.junit.jupiter</groupId>
|
|
186
|
+
<artifactId>junit-jupiter</artifactId>
|
|
187
|
+
<version>5.10.0</version>
|
|
188
|
+
<scope>test</scope>
|
|
189
|
+
</dependency>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Also ensure the Surefire plugin version supports JUnit 5:
|
|
193
|
+
```xml
|
|
194
|
+
<plugin>
|
|
195
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
196
|
+
<artifactId>maven-surefire-plugin</artifactId>
|
|
197
|
+
<version>3.1.2</version>
|
|
198
|
+
</plugin>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Common Pitfalls
|
|
202
|
+
|
|
203
|
+
- `@BeforeAll` / `@AfterAll` methods must be `static` unless `@TestInstance(Lifecycle.PER_CLASS)` is used
|
|
204
|
+
- JUnit 5 test classes and methods do NOT need to be `public` — package-private is preferred
|
|
205
|
+
- `assertThrows` returns the thrown exception — use it to assert the exception message too: `assertEquals("msg", ex.getMessage())`
|
|
206
|
+
- Do not mix JUnit 4 (`org.junit.*`) and JUnit 5 (`org.junit.jupiter.*`) imports in the same file
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-mockito
|
|
3
|
+
description: Use this skill when writing or fixing unit tests that use Mockito for mocking in Java.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Mockito Testing Skill
|
|
7
|
+
|
|
8
|
+
Mockito is the standard Java mocking framework, used alongside JUnit 5 to isolate the unit under test by replacing dependencies with controlled test doubles.
|
|
9
|
+
|
|
10
|
+
## Detection
|
|
11
|
+
|
|
12
|
+
Mockito is in use when:
|
|
13
|
+
- `pom.xml` includes `mockito-core` or `mockito-junit-jupiter`
|
|
14
|
+
- `build.gradle` includes `testImplementation 'org.mockito:mockito-core'`
|
|
15
|
+
- Test files import from `org.mockito.*`
|
|
16
|
+
|
|
17
|
+
## Setup with JUnit 5
|
|
18
|
+
|
|
19
|
+
Use `@ExtendWith(MockitoExtension.class)` to automatically initialize mocks and verify interactions after each test:
|
|
20
|
+
|
|
21
|
+
```java
|
|
22
|
+
import org.junit.jupiter.api.Test;
|
|
23
|
+
import org.junit.jupiter.api.extension.ExtendWith;
|
|
24
|
+
import org.mockito.InjectMocks;
|
|
25
|
+
import org.mockito.Mock;
|
|
26
|
+
import org.mockito.junit.jupiter.MockitoExtension;
|
|
27
|
+
import static org.mockito.Mockito.*;
|
|
28
|
+
import static org.junit.jupiter.api.Assertions.*;
|
|
29
|
+
|
|
30
|
+
@ExtendWith(MockitoExtension.class)
|
|
31
|
+
class OrderServiceTest {
|
|
32
|
+
|
|
33
|
+
@Mock
|
|
34
|
+
private PaymentGateway paymentGateway;
|
|
35
|
+
|
|
36
|
+
@Mock
|
|
37
|
+
private InventoryRepository inventoryRepository;
|
|
38
|
+
|
|
39
|
+
@InjectMocks
|
|
40
|
+
private OrderService orderService; // Mockito injects the mocks above
|
|
41
|
+
|
|
42
|
+
@Test
|
|
43
|
+
void processOrder_shouldChargePayment_whenItemsAreInStock() {
|
|
44
|
+
// Arrange
|
|
45
|
+
when(inventoryRepository.isInStock("ITEM-1")).thenReturn(true);
|
|
46
|
+
when(paymentGateway.charge(100.0)).thenReturn(new PaymentResult(true));
|
|
47
|
+
|
|
48
|
+
// Build
|
|
49
|
+
boolean result = orderService.processOrder("ITEM-1", 100.0);
|
|
50
|
+
|
|
51
|
+
// Assert
|
|
52
|
+
assertTrue(result);
|
|
53
|
+
verify(paymentGateway).charge(100.0);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Annotations
|
|
59
|
+
|
|
60
|
+
| Annotation | Purpose |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `@Mock` | Creates a mock of the type |
|
|
63
|
+
| `@InjectMocks` | Creates instance and injects `@Mock` fields |
|
|
64
|
+
| `@Spy` | Wraps a real object, allows partial mocking |
|
|
65
|
+
| `@Captor` | Captures argument passed to a mock |
|
|
66
|
+
| `@ExtendWith(MockitoExtension.class)` | Enables annotation-based mock init |
|
|
67
|
+
|
|
68
|
+
## Stubbing (when/thenReturn)
|
|
69
|
+
|
|
70
|
+
```java
|
|
71
|
+
// Return a value
|
|
72
|
+
when(mock.method()).thenReturn("value")
|
|
73
|
+
|
|
74
|
+
// Return different values on consecutive calls
|
|
75
|
+
when(mock.method())
|
|
76
|
+
.thenReturn("first")
|
|
77
|
+
.thenReturn("second")
|
|
78
|
+
.thenReturn("third")
|
|
79
|
+
|
|
80
|
+
// Throw an exception
|
|
81
|
+
when(mock.method()).thenThrow(new RuntimeException("error"))
|
|
82
|
+
|
|
83
|
+
// Return void method throwing
|
|
84
|
+
doThrow(new RuntimeException()).when(mock).voidMethod()
|
|
85
|
+
|
|
86
|
+
// Execute custom logic
|
|
87
|
+
when(mock.method(any())).thenAnswer(invocation -> {
|
|
88
|
+
String arg = invocation.getArgument(0);
|
|
89
|
+
return arg.toUpperCase();
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Argument Matchers
|
|
94
|
+
|
|
95
|
+
```java
|
|
96
|
+
when(mock.method(any())) // any non-null object
|
|
97
|
+
when(mock.method(anyString())) // any String
|
|
98
|
+
when(mock.method(anyInt())) // any int
|
|
99
|
+
when(mock.method(eq("exact"))) // exact value
|
|
100
|
+
when(mock.method(isNull())) // null
|
|
101
|
+
when(mock.method(argThat(s -> s.length() > 3))) // custom predicate
|
|
102
|
+
|
|
103
|
+
// IMPORTANT: if using matchers, ALL arguments must use matchers
|
|
104
|
+
when(mock.method(eq("key"), anyInt())) // correct
|
|
105
|
+
when(mock.method("key", anyInt())) // WRONG — mix not allowed
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Verification
|
|
109
|
+
|
|
110
|
+
```java
|
|
111
|
+
// Verify called once
|
|
112
|
+
verify(mock).method("arg")
|
|
113
|
+
|
|
114
|
+
// Verify exact number of calls
|
|
115
|
+
verify(mock, times(3)).method()
|
|
116
|
+
|
|
117
|
+
// Verify never called
|
|
118
|
+
verify(mock, never()).method()
|
|
119
|
+
|
|
120
|
+
// Verify at least / at most
|
|
121
|
+
verify(mock, atLeast(1)).method()
|
|
122
|
+
verify(mock, atMost(2)).method()
|
|
123
|
+
|
|
124
|
+
// Verify no other interactions after verified ones
|
|
125
|
+
verifyNoMoreInteractions(mock)
|
|
126
|
+
|
|
127
|
+
// Verify nothing was ever called
|
|
128
|
+
verifyNoInteractions(mock)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Argument Captors
|
|
132
|
+
|
|
133
|
+
```java
|
|
134
|
+
@Captor
|
|
135
|
+
private ArgumentCaptor<String> captor;
|
|
136
|
+
|
|
137
|
+
@Test
|
|
138
|
+
void shouldPassCorrectArgumentToService() {
|
|
139
|
+
orderService.submit("order-1");
|
|
140
|
+
|
|
141
|
+
verify(emailService).sendConfirmation(captor.capture());
|
|
142
|
+
assertEquals("order-1", captor.getValue());
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Spy (Partial Mock)
|
|
147
|
+
|
|
148
|
+
Use `@Spy` or `spy()` when you want a real object but need to stub specific methods:
|
|
149
|
+
|
|
150
|
+
```java
|
|
151
|
+
@Spy
|
|
152
|
+
private List<String> spyList = new ArrayList<>();
|
|
153
|
+
|
|
154
|
+
@Test
|
|
155
|
+
void shouldUseRealImplementationExceptStubbedMethod() {
|
|
156
|
+
doReturn(42).when(spyList).size(); // stub one method
|
|
157
|
+
|
|
158
|
+
spyList.add("hello"); // real add
|
|
159
|
+
assertEquals(42, spyList.size()) // stubbed size
|
|
160
|
+
assertEquals("hello", spyList.get(0)) // real get
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Void Methods
|
|
165
|
+
|
|
166
|
+
```java
|
|
167
|
+
// Do nothing (default for void mocks, but explicit)
|
|
168
|
+
doNothing().when(mock).voidMethod()
|
|
169
|
+
|
|
170
|
+
// Throw from void method
|
|
171
|
+
doThrow(new RuntimeException()).when(mock).voidMethod()
|
|
172
|
+
|
|
173
|
+
// Execute custom logic for void method
|
|
174
|
+
doAnswer(invocation -> {
|
|
175
|
+
System.out.println("called");
|
|
176
|
+
return null;
|
|
177
|
+
}).when(mock).voidMethod()
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Static Methods (Mockito 3.4+)
|
|
181
|
+
|
|
182
|
+
```java
|
|
183
|
+
try (MockedStatic<Utilities> mocked = mockStatic(Utilities.class)) {
|
|
184
|
+
mocked.when(Utilities::generateId).thenReturn("test-id");
|
|
185
|
+
assertEquals("test-id", Utilities.generateId());
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## pom.xml Dependency
|
|
190
|
+
|
|
191
|
+
```xml
|
|
192
|
+
<dependency>
|
|
193
|
+
<groupId>org.mockito</groupId>
|
|
194
|
+
<artifactId>mockito-junit-jupiter</artifactId>
|
|
195
|
+
<version>5.5.0</version>
|
|
196
|
+
<scope>test</scope>
|
|
197
|
+
</dependency>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`mockito-junit-jupiter` includes `mockito-core` — no need to add both.
|
|
201
|
+
|
|
202
|
+
## Common Pitfalls
|
|
203
|
+
|
|
204
|
+
- **Don't stub what you don't verify** — unnecessary stubbing causes `UnnecessaryStubbingException` with `MockitoExtension`
|
|
205
|
+
- **Argument matcher mixing** — if one argument uses a matcher (`any()`), ALL arguments must use matchers
|
|
206
|
+
- **`@InjectMocks` limitations** — constructor injection is preferred; if the class has no single matching constructor, injection may silently fail
|
|
207
|
+
- **Verify after build** — `verify()` calls go AFTER the method call being tested, not before
|
|
208
|
+
- **Don't mock value objects** — mock services, repositories, gateways; use real instances for simple data objects
|
|
209
|
+
- **`spy` on final classes** — not supported by default; enable with Mockito extensions or use a wrapper
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-vitest
|
|
3
|
+
description: Use this skill when writing or fixing unit tests with Vitest (TypeScript/JavaScript).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vitest Testing Skill
|
|
7
|
+
|
|
8
|
+
Vitest is the recommended test framework for TypeScript/JavaScript projects using Vite. It provides Jest-compatible APIs with first-class ESM support.
|
|
9
|
+
|
|
10
|
+
## Detection
|
|
11
|
+
|
|
12
|
+
Vitest is in use when:
|
|
13
|
+
- `package.json` devDependencies includes `vitest`
|
|
14
|
+
- A `vitest.config.ts` or `vitest.config.js` exists
|
|
15
|
+
- Test files use `.spec.ts` or `.test.ts` extensions with `import { describe, it, expect } from 'vitest'`
|
|
16
|
+
|
|
17
|
+
## File Structure
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
src/
|
|
21
|
+
foo.ts # production file
|
|
22
|
+
foo.spec.ts # test file (co-located)
|
|
23
|
+
# OR
|
|
24
|
+
__tests__/
|
|
25
|
+
foo.test.ts # alternative location
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Place test files co-located with production files unless the project uses a separate `__tests__/` directory — match the existing convention.
|
|
29
|
+
|
|
30
|
+
## Basic Test Structure
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
|
|
34
|
+
import { myFunction } from './myModule'
|
|
35
|
+
|
|
36
|
+
describe('myModule', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
vi.clearAllMocks()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
describe('myFunction', () => {
|
|
42
|
+
it('should return expected value for valid input', () => {
|
|
43
|
+
// Arrange
|
|
44
|
+
const input = 'hello'
|
|
45
|
+
|
|
46
|
+
// Build
|
|
47
|
+
const result = myFunction(input)
|
|
48
|
+
|
|
49
|
+
// Assert
|
|
50
|
+
expect(result).toBe('HELLO')
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('should throw for invalid input', () => {
|
|
54
|
+
expect(() => myFunction(null)).toThrow('Input must not be null')
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Mocking
|
|
61
|
+
|
|
62
|
+
### Mock a module
|
|
63
|
+
```typescript
|
|
64
|
+
vi.mock('./dependency', () => ({
|
|
65
|
+
fetchData: vi.fn().mockResolvedValue({ id: 1, name: 'test' }),
|
|
66
|
+
}))
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Mock a function
|
|
70
|
+
```typescript
|
|
71
|
+
const mockFn = vi.fn().mockReturnValue(42)
|
|
72
|
+
const mockAsync = vi.fn().mockResolvedValue({ ok: true })
|
|
73
|
+
const mockRejected = vi.fn().mockRejectedValue(new Error('fail'))
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Spy on a method
|
|
77
|
+
```typescript
|
|
78
|
+
const spy = vi.spyOn(obj, 'method').mockReturnValue('mocked')
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Reset mocks between tests
|
|
82
|
+
```typescript
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
vi.clearAllMocks() // clear call history
|
|
85
|
+
vi.resetAllMocks() // clear call history + reset implementations
|
|
86
|
+
vi.restoreAllMocks() // restore original implementations
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Async Tests
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
it('should resolve promise', async () => {
|
|
94
|
+
const result = await someAsyncFunction()
|
|
95
|
+
expect(result).toEqual({ success: true })
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('should reject promise', async () => {
|
|
99
|
+
await expect(someAsyncFunction()).rejects.toThrow('error message')
|
|
100
|
+
})
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Common Assertions
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
expect(value).toBe(42) // strict equality
|
|
107
|
+
expect(value).toEqual({ a: 1 }) // deep equality
|
|
108
|
+
expect(value).toBeNull()
|
|
109
|
+
expect(value).toBeUndefined()
|
|
110
|
+
expect(value).toBeTruthy()
|
|
111
|
+
expect(value).toBeFalsy()
|
|
112
|
+
expect(array).toHaveLength(3)
|
|
113
|
+
expect(array).toContain('item')
|
|
114
|
+
expect(object).toHaveProperty('key', 'value')
|
|
115
|
+
expect(fn).toHaveBeenCalledWith('arg')
|
|
116
|
+
expect(fn).toHaveBeenCalledTimes(2)
|
|
117
|
+
expect(fn).not.toHaveBeenCalled()
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Running Tests
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Run all tests once
|
|
124
|
+
npx vitest run
|
|
125
|
+
|
|
126
|
+
# Run with coverage
|
|
127
|
+
npx vitest run --coverage
|
|
128
|
+
|
|
129
|
+
# Run specific file
|
|
130
|
+
npx vitest run src/foo.spec.ts
|
|
131
|
+
|
|
132
|
+
# Watch mode (development)
|
|
133
|
+
npx vitest
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Coverage
|
|
137
|
+
|
|
138
|
+
Vitest uses `@vitest/coverage-v8` or `@vitest/coverage-istanbul`. Configure in `vitest.config.ts`:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
export default defineConfig({
|
|
142
|
+
test: {
|
|
143
|
+
coverage: {
|
|
144
|
+
provider: 'v8',
|
|
145
|
+
reporter: ['text', 'lcov'],
|
|
146
|
+
exclude: ['**/*.spec.ts', '**/*.test.ts', '**/node_modules/**'],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
})
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Run with: `npx vitest run --coverage`
|
|
153
|
+
|
|
154
|
+
## Common Pitfalls
|
|
155
|
+
|
|
156
|
+
- Always call `vi.clearAllMocks()` in `beforeEach` to prevent test pollution
|
|
157
|
+
- Use `vi.mock()` at the top level of the file (not inside `describe`/`it` blocks) — Vitest hoists mock calls
|
|
158
|
+
- For ESM modules, prefer `vi.mock()` with factory functions over `jest.spyOn` patterns
|
|
159
|
+
- When mocking the same module across multiple test files, each file gets its own isolated mock
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OpencodeClient } from "@opencode-ai/sdk";
|
|
2
|
+
export declare function createAutocodeAgentSwapTool(client?: OpencodeClient): {
|
|
3
|
+
description: string;
|
|
4
|
+
args: {
|
|
5
|
+
agent: import("zod").ZodString;
|
|
6
|
+
prompt: import("zod").ZodString;
|
|
7
|
+
};
|
|
8
|
+
execute(args: {
|
|
9
|
+
agent: string;
|
|
10
|
+
prompt: string;
|
|
11
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=autocode_agent_swap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocode_agent_swap.d.ts","sourceRoot":"","sources":["../../src/tools/autocode_agent_swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAItD,wBAAgB,2BAA2B,CAAC,MAAM,CAAC,EAAE,cAAc;;;;;;;;;;EA8ClE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocode_agent_swap.test.d.ts","sourceRoot":"","sources":["../../src/tools/autocode_agent_swap.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { OpencodeClient } from "@opencode-ai/sdk";
|
|
2
|
+
type FileSystem = {
|
|
3
|
+
mkdir: (dirPath: string, options?: {
|
|
4
|
+
recursive?: boolean;
|
|
5
|
+
}) => Promise<string | undefined | void>;
|
|
6
|
+
stat: (filePath: string) => Promise<{
|
|
7
|
+
mtimeMs: number;
|
|
8
|
+
}>;
|
|
9
|
+
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export declare function createAutocodeConceptCreateTool(client?: OpencodeClient, fileSystem?: FileSystem, getNow?: () => Date): {
|
|
12
|
+
description: string;
|
|
13
|
+
args: {
|
|
14
|
+
label: import("zod").ZodOptional<import("zod").ZodString>;
|
|
15
|
+
concept: import("zod").ZodString;
|
|
16
|
+
};
|
|
17
|
+
execute(args: {
|
|
18
|
+
concept: string;
|
|
19
|
+
label?: string | undefined;
|
|
20
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=autocode_concept_create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocode_concept_create.d.ts","sourceRoot":"","sources":["../../src/tools/autocode_concept_create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAMtD,KAAK,UAAU,GAAG;IACd,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAA;IACjG,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACxD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAClE,CAAA;AAqED,wBAAgB,+BAA+B,CAC3C,MAAM,CAAC,EAAE,cAAc,EACvB,UAAU,GAAE,UAA8B,EAC1C,MAAM,GAAE,MAAM,IAAuB;;;;;;;;;;EA4DxC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Dirent } from "fs";
|
|
2
|
+
type FileSystem = {
|
|
3
|
+
readdir: (filePath: string, options: {
|
|
4
|
+
withFileTypes: true;
|
|
5
|
+
}) => Promise<Dirent[]>;
|
|
6
|
+
readFile: (filePath: string, encoding: "utf8") => Promise<string>;
|
|
7
|
+
};
|
|
8
|
+
export declare function createAutocodeConceptListTool(fileSystem?: FileSystem): {
|
|
9
|
+
description: string;
|
|
10
|
+
args: {};
|
|
11
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=autocode_concept_list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocode_concept_list.d.ts","sourceRoot":"","sources":["../../src/tools/autocode_concept_list.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAA;AAMhC,KAAK,UAAU,GAAG;IACd,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,aAAa,EAAE,IAAI,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAClF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACpE,CAAA;AAsBD,wBAAgB,6BAA6B,CAAC,UAAU,GAAE,UAA8B;;;;EA2BvF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OpencodeClient } from "@opencode-ai/sdk";
|
|
2
|
+
type FileSystem = {
|
|
3
|
+
mkdir?: (dirPath: string, options?: {
|
|
4
|
+
recursive?: boolean;
|
|
5
|
+
}) => Promise<string | undefined | void>;
|
|
6
|
+
readFile: (filePath: string, encoding: "utf8") => Promise<string>;
|
|
7
|
+
rename?: (oldPath: string, newPath: string) => Promise<void>;
|
|
8
|
+
writeFile?: (filePath: string, content: string) => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export declare function createAutocodeConceptReadTool(clientOrFileSystem?: OpencodeClient | FileSystem, maybeFileSystem?: FileSystem): {
|
|
11
|
+
description: string;
|
|
12
|
+
args: {
|
|
13
|
+
label: import("zod").ZodString;
|
|
14
|
+
};
|
|
15
|
+
execute(args: {
|
|
16
|
+
label: string;
|
|
17
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=autocode_concept_read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocode_concept_read.d.ts","sourceRoot":"","sources":["../../src/tools/autocode_concept_read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAOtD,KAAK,UAAU,GAAG;IACd,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAA;IAClG,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IACjE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACnE,CAAA;AA6BD,wBAAgB,6BAA6B,CAAC,kBAAkB,CAAC,EAAE,cAAc,GAAG,UAAU,EAAE,eAAe,CAAC,EAAE,UAAU;;;;;;;;EAmC3H"}
|