combicode 1.7.4 β 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +340 -19
- package/index.js +1473 -157
- package/package.json +22 -1
- package/test/test.js +473 -119
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.0](https://github.com/aaurelions/combicode/compare/combicode-js-v1.7.2...combicode-js-v2.0.0) (2026-02-28)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- **code-map:** add expanded code map with classes, functions, loops, and constructors parsed from 15+ languages
|
|
8
|
+
- **code-map:** show OL (Original Line), ML (Merged Line), and SIZE references for every element
|
|
9
|
+
- **output:** wrap output in `<code_index>` and `<merged_code>` XML tags for clear section separation
|
|
10
|
+
- **output:** update file headers to `# FILE: path [OL: X-Y | ML: X-Y | SIZE]` format
|
|
11
|
+
- **output:** update system prompts to reference code map and OL/ML navigation
|
|
12
|
+
- **recreate:** add `--recreate` / `-r` flag to extract files from combicode.txt back to project structure
|
|
13
|
+
- **recreate:** add `--input` flag to specify input file for recreate
|
|
14
|
+
- **recreate:** add `--overwrite` flag to overwrite existing files when recreating
|
|
15
|
+
- **parse:** add `--no-parse` flag to disable code structure parsing (show only file tree)
|
|
16
|
+
- **parsers:** regex-based parsers for JavaScript, TypeScript, Go, Rust, Java, C/C++, C#, PHP, Ruby, Swift, Kotlin, Scala, Lua, Perl, Bash
|
|
17
|
+
- **parsers:** Python parser with indent-based block detection
|
|
18
|
+
|
|
19
|
+
### Breaking Changes
|
|
20
|
+
|
|
21
|
+
- Output format changed: files are now wrapped in `<code_index>` and `<merged_code>` XML sections
|
|
22
|
+
- File headers changed from `### **FILE:** \`path\`` to `# FILE: path [OL: X-Y | ML: X-Y | SIZE]`
|
|
23
|
+
- System prompts updated to reference code map and line navigation
|
|
24
|
+
|
|
3
25
|
## [1.7.2](https://github.com/aaurelions/combicode/compare/combicode-js-v1.7.1...combicode-js-v1.7.2) (2025-01-XX)
|
|
4
26
|
|
|
5
27
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -6,37 +6,97 @@
|
|
|
6
6
|
|
|
7
7
|
<img align="center" src="https://github.com/aaurelions/combicode/raw/main/screenshot.png" width="800"/>
|
|
8
8
|
|
|
9
|
-
**Combicode** is a
|
|
9
|
+
**Combicode** is a CLI tool that intelligently combines your project's source code into a single, LLM-friendly text file with an **expanded code map** showing classes, functions, and loops with precise line references.
|
|
10
10
|
|
|
11
|
-
The generated file starts with a system prompt and
|
|
11
|
+
The generated file starts with a system prompt and an **expanded tree structure** that shows not just files, but also the code elements inside them (classes, functions, loops) with their line numbers and sizes. This gives the LLM a complete mental model of your codebase architecture before it reads a single line of code.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Table of Contents
|
|
16
|
+
|
|
17
|
+
- [Why use Combicode?](#why-use-combicode)
|
|
18
|
+
- [Quick Start](#quick-start)
|
|
19
|
+
- [Supported Languages](#supported-languages)
|
|
20
|
+
- [Usage and Options](#usage-and-options)
|
|
21
|
+
- [All CLI Options](#all-cli-options)
|
|
22
|
+
- [How the Code Map Works](#how-the-code-map-works)
|
|
23
|
+
- [Examples](#examples)
|
|
24
|
+
- [License](#license)
|
|
25
|
+
|
|
26
|
+
---
|
|
12
27
|
|
|
13
28
|
## Why use Combicode?
|
|
14
29
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
| Feature | Description |
|
|
31
|
+
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| πΊοΈ **Expanded Code Map** | Shows classes, functions, and loops with line numbers and sizes - LLMs understand your architecture instantly |
|
|
33
|
+
| π― **Precise Navigation** | Every element has `[OL: X-Y \| ML: X-Y \| SIZE]` references for both original and merged line numbers |
|
|
34
|
+
| π¦ **Maximum Context** | Gives your LLM a complete picture of your project structure and code |
|
|
35
|
+
| π **40+ Languages** | Python (AST-based), JavaScript, TypeScript, Go, Rust, Java, C/C++, C#, PHP, Ruby, Swift, Kotlin, Scala, and more |
|
|
36
|
+
| π§Ή **Intelligent Ignoring** | Automatically skips `node_modules`, `.venv`, `dist`, `.git`, binary files, and other common junk |
|
|
37
|
+
| π **`.gitignore` Aware** | Respects your project's existing `.gitignore` rules out of the box |
|
|
38
|
+
| π **Nested Ignore Support** | Correctly handles `.gitignore` files located in subdirectories |
|
|
39
|
+
| β‘ **Zero-Install Usage** | Run it directly with `npx` or `pipx` without polluting your environment |
|
|
40
|
+
| π **Recreate Support** | Extract files from `combicode.txt` back to original project structure |
|
|
41
|
+
|
|
42
|
+
---
|
|
22
43
|
|
|
23
44
|
## Quick Start
|
|
24
45
|
|
|
25
46
|
Navigate to your project's root directory in your terminal and run one of the following commands:
|
|
26
47
|
|
|
27
|
-
|
|
48
|
+
### For Node.js/JavaScript/TypeScript projects (via `npx`)
|
|
28
49
|
|
|
29
50
|
```bash
|
|
30
51
|
npx combicode
|
|
31
52
|
```
|
|
32
53
|
|
|
33
|
-
|
|
54
|
+
### For Python projects (via `pipx`)
|
|
34
55
|
|
|
35
56
|
```bash
|
|
36
57
|
pipx run combicode
|
|
37
58
|
```
|
|
38
59
|
|
|
39
|
-
This will create a `combicode.txt` file in your project directory
|
|
60
|
+
This will create a `combicode.txt` file in your project directory with the expanded code map.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Supported Languages
|
|
65
|
+
|
|
66
|
+
Combicode parses code structure for 40+ programming languages:
|
|
67
|
+
|
|
68
|
+
### Full Language Support Table
|
|
69
|
+
|
|
70
|
+
| Language | Parser | Elements Detected |
|
|
71
|
+
| ---------- | -------------- | ------------------------------------------------------ |
|
|
72
|
+
| Python | AST (built-in) | `class`, `def`, `async def`, `for`, `while` |
|
|
73
|
+
| JavaScript | Regex | `class`, `function`, `async function`, arrow functions |
|
|
74
|
+
| TypeScript | Regex | `class`, `interface`, `function`, `async function` |
|
|
75
|
+
| Go | Regex | `struct`, `interface`, `func` |
|
|
76
|
+
| Rust | Regex | `struct`, `enum`, `trait`, `impl`, `fn` |
|
|
77
|
+
| Java | Regex | `class`, `interface`, `enum`, methods |
|
|
78
|
+
| C/C++ | Regex | `class`, `struct`, functions |
|
|
79
|
+
| C# | Regex | `class`, `struct`, `interface`, `enum`, `record` |
|
|
80
|
+
| PHP | Regex | `class`, `interface`, `trait`, `function` |
|
|
81
|
+
| Ruby | Regex | `class`, `module`, `def` |
|
|
82
|
+
| Swift | Regex | `class`, `struct`, `enum`, `protocol`, `func` |
|
|
83
|
+
| Kotlin | Regex | `class`, `interface`, `object`, `fun` |
|
|
84
|
+
| Scala | Regex | `class`, `object`, `trait`, `def` |
|
|
85
|
+
| Lua | Regex | `function`, `local function` |
|
|
86
|
+
| Perl | Regex | `sub`, `package` |
|
|
87
|
+
| Bash | Regex | `function`, `for`, `while` |
|
|
88
|
+
|
|
89
|
+
### Configuration Files (No Parsing)
|
|
90
|
+
|
|
91
|
+
These files are included in the tree but not parsed for code structure:
|
|
92
|
+
|
|
93
|
+
| Type | Extensions |
|
|
94
|
+
| ------ | ------------------------------------------------- |
|
|
95
|
+
| Config | `.json`, `.yaml`, `.yml`, `.toml`, `.ini`, `.env` |
|
|
96
|
+
| Markup | `.md`, `.rst`, `.txt` |
|
|
97
|
+
| Styles | `.css`, `.scss`, `.less`, `.sass` |
|
|
98
|
+
|
|
99
|
+
---
|
|
40
100
|
|
|
41
101
|
## Usage and Options
|
|
42
102
|
|
|
@@ -45,19 +105,39 @@ This will create a `combicode.txt` file in your project directory, complete with
|
|
|
45
105
|
Use the `--dry-run` or `-d` flag to see a list of files without creating the output file.
|
|
46
106
|
|
|
47
107
|
```bash
|
|
48
|
-
# npx
|
|
49
108
|
npx combicode --dry-run
|
|
50
|
-
|
|
51
|
-
# pipx
|
|
52
109
|
pipx run combicode -d
|
|
53
110
|
```
|
|
54
111
|
|
|
112
|
+
**Example output:**
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
β¨ Combicode v2.0.0
|
|
116
|
+
|
|
117
|
+
π Root: /home/user/my-project
|
|
118
|
+
|
|
119
|
+
π Files to include (dry run):
|
|
120
|
+
|
|
121
|
+
src/index.ts (2.1KB)
|
|
122
|
+
src/server.ts (3.4KB)
|
|
123
|
+
src/utils/db.ts (1.2KB)
|
|
124
|
+
package.json (0.8KB)
|
|
125
|
+
tsconfig.json (0.3KB)
|
|
126
|
+
|
|
127
|
+
π Summary:
|
|
128
|
+
β’ Total files: 5
|
|
129
|
+
β’ Total size: 7.8KB
|
|
130
|
+
|
|
131
|
+
β
Done!
|
|
132
|
+
```
|
|
133
|
+
|
|
55
134
|
### Specify an output file
|
|
56
135
|
|
|
57
136
|
Use the `--output` or `-o` flag.
|
|
58
137
|
|
|
59
138
|
```bash
|
|
60
139
|
npx combicode -o my_project_context.md
|
|
140
|
+
pipx run combicode --output ./output/context.txt
|
|
61
141
|
```
|
|
62
142
|
|
|
63
143
|
### Include only specific file types
|
|
@@ -70,6 +150,9 @@ npx combicode -i .ts,.tsx,.css
|
|
|
70
150
|
|
|
71
151
|
# Include only Python and YAML files
|
|
72
152
|
pipx run combicode -i .py,.yaml
|
|
153
|
+
|
|
154
|
+
# Include only markdown documentation
|
|
155
|
+
npx combicode -i .md -o llms.txt
|
|
73
156
|
```
|
|
74
157
|
|
|
75
158
|
### Add custom exclude patterns
|
|
@@ -79,6 +162,9 @@ Use the `--exclude` or `-e` flag with comma-separated glob patterns.
|
|
|
79
162
|
```bash
|
|
80
163
|
# Exclude all test files and anything in a 'docs' folder
|
|
81
164
|
npx combicode -e "**/*_test.py,docs/**"
|
|
165
|
+
|
|
166
|
+
# Exclude generated files and fixtures
|
|
167
|
+
pipx run combicode -e "**/*.generated.*,fixtures/**"
|
|
82
168
|
```
|
|
83
169
|
|
|
84
170
|
### Skip content for specific files
|
|
@@ -91,34 +177,269 @@ npx combicode --skip-content "**/*.test.ts"
|
|
|
91
177
|
|
|
92
178
|
# Skip content for multiple patterns
|
|
93
179
|
npx combicode --skip-content "**/*.test.ts,**/*.spec.ts,**/tests/**"
|
|
180
|
+
|
|
181
|
+
# Skip large generated files
|
|
182
|
+
pipx run combicode --skip-content "**/*.min.js,dist/**"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Output with skipped content:**
|
|
186
|
+
|
|
187
|
+
```text
|
|
188
|
+
βββ tests/
|
|
189
|
+
βββ test_server.py [OL: 1-450 | ML: 183-184 | 12.1KB]
|
|
190
|
+
(Content omitted - file size: 12.1KB)
|
|
94
191
|
```
|
|
95
192
|
|
|
96
|
-
|
|
193
|
+
### Disable code structure parsing
|
|
194
|
+
|
|
195
|
+
Use the `--no-parse` flag to generate a simple file tree without parsing classes, functions, or loops. This is useful for quick overviews or when parsing is not needed.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npx combicode --no-parse
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Output with `--no-parse`:**
|
|
202
|
+
|
|
203
|
+
```text
|
|
204
|
+
<code_index>
|
|
205
|
+
project-root/
|
|
206
|
+
βββ src/
|
|
207
|
+
β βββ server.py [OL: 1-85 | ML: 53-137 | 2.4KB]
|
|
208
|
+
β βββ utils/
|
|
209
|
+
β βββ db.py [OL: 1-45 | ML: 138-182 | 1.2KB]
|
|
210
|
+
βββ tests/
|
|
211
|
+
βββ test_server.py [OL: 1-50 | ML: 183-232 | 1.1KB]
|
|
212
|
+
</code_index>
|
|
213
|
+
```
|
|
97
214
|
|
|
98
215
|
### Generating Context for `llms.txt`
|
|
99
216
|
|
|
100
|
-
The `--llms
|
|
217
|
+
The `--llms-txt` or `-l` flag is designed for projects that use an [`llms.txt`](https://llmstxt.org/) file to specify important documentation.
|
|
101
218
|
|
|
102
219
|
```bash
|
|
103
220
|
# Combine all markdown files for an llms.txt context
|
|
104
221
|
npx combicode -l -i .md -o llms.txt
|
|
222
|
+
|
|
223
|
+
# Combine documentation from docs folder
|
|
224
|
+
pipx run combicode -l -i .md,.rst -o llms.txt
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Recreate Project from combicode.txt
|
|
228
|
+
|
|
229
|
+
The `--recreate` or `-r` flag extracts all files from a `combicode.txt` file and recreates the original project structure. This is useful for:
|
|
230
|
+
|
|
231
|
+
- π Restoring a project from an LLM-generated context
|
|
232
|
+
- π€ Extracting code shared by others in `combicode.txt` format
|
|
233
|
+
- π οΈ Converting the merged file back to individual source files
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Recreate project from combicode.txt (default)
|
|
237
|
+
npx combicode --recreate
|
|
238
|
+
|
|
239
|
+
# Specify input file and output directory
|
|
240
|
+
npx combicode --recreate --input my_context.txt -o ./restored_project
|
|
241
|
+
|
|
242
|
+
# Short form
|
|
243
|
+
npx combicode -r -i my_context.txt -o ./output
|
|
244
|
+
|
|
245
|
+
# Dry run to see what files would be extracted
|
|
246
|
+
npx combicode --recreate --dry-run
|
|
247
|
+
|
|
248
|
+
# Overwrite existing files
|
|
249
|
+
npx combicode --recreate --overwrite
|
|
105
250
|
```
|
|
106
251
|
|
|
252
|
+
**Example output:**
|
|
253
|
+
|
|
254
|
+
```text
|
|
255
|
+
β¨ Combicode v2.0.0
|
|
256
|
+
|
|
257
|
+
π Root: /home/user/projects
|
|
258
|
+
|
|
259
|
+
π Output directory: /home/user/projects
|
|
260
|
+
|
|
261
|
+
src/index.ts (2.1KB)
|
|
262
|
+
src/server.ts (3.4KB)
|
|
263
|
+
src/utils/db.ts (1.2KB)
|
|
264
|
+
src/utils/logger.ts (0.8KB)
|
|
265
|
+
src/handlers/user.ts (1.5KB)
|
|
266
|
+
src/handlers/auth.ts (1.2KB)
|
|
267
|
+
config/app.yaml (0.4KB)
|
|
268
|
+
package.json (0.8KB)
|
|
269
|
+
tsconfig.json (0.3KB)
|
|
270
|
+
...
|
|
271
|
+
|
|
272
|
+
π Summary:
|
|
273
|
+
β’ Files recreated: 15
|
|
274
|
+
β’ Total size: 45.2KB
|
|
275
|
+
|
|
276
|
+
β
Done!
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
107
281
|
## All CLI Options
|
|
108
282
|
|
|
109
283
|
| Option | Alias | Description | Default |
|
|
110
284
|
| ---------------- | ----- | ------------------------------------------------------------------------------ | --------------- |
|
|
111
|
-
| `--output` | `-o` |
|
|
112
|
-
| `--dry-run` | `-d` | Preview
|
|
285
|
+
| `--output` | `-o` | Output file (combine) or directory (recreate). | `combicode.txt` |
|
|
286
|
+
| `--dry-run` | `-d` | Preview without making changes. | `false` |
|
|
113
287
|
| `--include-ext` | `-i` | Comma-separated list of extensions to exclusively include. | (include all) |
|
|
114
288
|
| `--exclude` | `-e` | Comma-separated list of additional glob patterns to exclude. | (none) |
|
|
115
289
|
| `--skip-content` | | Comma-separated glob patterns for files to include in tree but omit content. | (none) |
|
|
290
|
+
| `--no-parse` | | Disable code structure parsing (show only file tree). | `false` |
|
|
116
291
|
| `--llms-txt` | `-l` | Use a specialized system prompt for context generated from an `llms.txt` file. | `false` |
|
|
117
292
|
| `--no-gitignore` | | Do not use patterns from the project's `.gitignore` file. | `false` |
|
|
118
293
|
| `--no-header` | | Omit the introductory prompt and file tree from the output. | `false` |
|
|
294
|
+
| `--recreate` | `-r` | Recreate project from a combicode.txt file. | `false` |
|
|
295
|
+
| `--input` | | Input combicode.txt file for recreate. | `combicode.txt` |
|
|
296
|
+
| `--overwrite` | | Overwrite existing files when recreating. | `false` |
|
|
119
297
|
| `--version` | `-v` | Show the version number. | |
|
|
120
298
|
| `--help` | `-h` | Show the help message. | |
|
|
121
299
|
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## How the Code Map Works
|
|
303
|
+
|
|
304
|
+
### Line Reference System
|
|
305
|
+
|
|
306
|
+
Every element has dual line references:
|
|
307
|
+
|
|
308
|
+
| Reference | Description | Usage |
|
|
309
|
+
| ---------------------- | ------------------------------------------------- | ------------------------------- |
|
|
310
|
+
| **OL (Original Line)** | Line numbers in the source file on disk | Find code in original project |
|
|
311
|
+
| **ML (Merged Line)** | Line numbers in the combined `combicode.txt` file | Extract code with `sed` command |
|
|
312
|
+
|
|
313
|
+
**Extracting code using ML:**
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Extract lines 100-150 from combicode.txt
|
|
317
|
+
sed -n '100,150p' combicode.txt
|
|
318
|
+
|
|
319
|
+
# Extract a specific function
|
|
320
|
+
sed -n '69,97p' combicode.txt # Extracts async start() method
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Element Types
|
|
324
|
+
|
|
325
|
+
The code map extracts these element types:
|
|
326
|
+
|
|
327
|
+
| Label | Description | Example |
|
|
328
|
+
| ---------- | ------------------------------------------- | -------------------------------- |
|
|
329
|
+
| `class` | Classes, structs, interfaces, enums, traits | `class Server` |
|
|
330
|
+
| `fn` | Functions and methods | `fn parse_args()` |
|
|
331
|
+
| `async` | Async functions | `async fetch_data()` |
|
|
332
|
+
| `ctor` | Constructors (`__init__`, `constructor`) | `ctor __init__(self, port: int)` |
|
|
333
|
+
| `loop` | For/while loops (only if > 5 lines) | `loop for item in items` |
|
|
334
|
+
| `impl` | Implementation blocks (Rust) | `impl Server` |
|
|
335
|
+
| `test` | Test functions | `test test_server_start` |
|
|
336
|
+
| `describe` | Test suites | `describe Server` |
|
|
337
|
+
|
|
338
|
+
### Filtering Rules
|
|
339
|
+
|
|
340
|
+
| Category | Elements |
|
|
341
|
+
| -------------------------- | -------------------------------------------------------- |
|
|
342
|
+
| **Always included** | Files, classes, functions, constructors |
|
|
343
|
+
| **Conditionally included** | Loops and try/catch blocks (only if > 5-10 lines) |
|
|
344
|
+
| **Excluded** | Imports, comments, single-line elements, getters/setters |
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Examples
|
|
349
|
+
|
|
350
|
+
### Python Project
|
|
351
|
+
|
|
352
|
+
```text
|
|
353
|
+
src/
|
|
354
|
+
βββ main.py [OL: 1-85 | ML: 53-137 | 2.4KB]
|
|
355
|
+
β βββ class Server [OL: 5-60 | ML: 57-112 | 1.8KB]
|
|
356
|
+
β β βββ ctor __init__(self, host: str, port: int) [OL: 7-15 | ML: 59-67 | 284B]
|
|
357
|
+
β β βββ async start(self) -> None [OL: 17-45 | ML: 69-97 | 892B]
|
|
358
|
+
β β βββ fn stop(self) -> None [OL: 47-55 | ML: 99-107 | 256B]
|
|
359
|
+
β βββ fn parse_args() -> dict [OL: 63-85 | ML: 115-137 | 612B]
|
|
360
|
+
βββ utils/
|
|
361
|
+
β βββ db.py [OL: 1-45 | ML: 138-182 | 1.2KB]
|
|
362
|
+
β βββ class Database [OL: 5-40 | ML: 142-177 | 1.1KB]
|
|
363
|
+
β βββ ctor __init__(self, connection_string: str) [OL: 7-15 | ML: 144-152 | 312B]
|
|
364
|
+
β βββ fn query(self, sql: str) -> list [OL: 17-40 | ML: 154-177 | 756B]
|
|
365
|
+
βββ config.py [OL: 1-20 | ML: 183-202 | 0.4KB]
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### TypeScript Project
|
|
369
|
+
|
|
370
|
+
```text
|
|
371
|
+
src/
|
|
372
|
+
βββ index.ts [OL: 1-52 | ML: 53-104 | 2.1KB]
|
|
373
|
+
β βββ class Server [OL: 5-42 | ML: 57-94 | 1.5KB]
|
|
374
|
+
β β βββ ctor (port: number, host?: string) [OL: 7-14 | ML: 59-66 | 256B]
|
|
375
|
+
β β βββ async start(): Promise<void> [OL: 16-32 | ML: 68-84 | 612B]
|
|
376
|
+
β β βββ fn stop(): void [OL: 34-42 | ML: 86-94 | 298B]
|
|
377
|
+
β βββ fn createApp(config: Config): Express [OL: 45-52 | ML: 97-104 | 412B]
|
|
378
|
+
βββ handlers/
|
|
379
|
+
β βββ user.ts [OL: 1-78 | ML: 105-182 | 2.4KB]
|
|
380
|
+
β βββ interface UserRoutes [OL: 5-15 | ML: 109-119 | 312B]
|
|
381
|
+
β βββ fn createUser(req: Request, res: Response) [OL: 17-78 | ML: 121-182 | 1.8KB]
|
|
382
|
+
βββ types/
|
|
383
|
+
βββ index.ts [OL: 1-25 | ML: 183-207 | 0.5KB]
|
|
384
|
+
βββ interface Config [OL: 3-25 | ML: 185-207 | 456B]
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Go Project
|
|
388
|
+
|
|
389
|
+
```text
|
|
390
|
+
cmd/
|
|
391
|
+
βββ server/
|
|
392
|
+
βββ main.go [OL: 1-60 | ML: 53-112 | 1.6KB]
|
|
393
|
+
βββ fn main() [OL: 5-60 | ML: 57-112 | 1.4KB]
|
|
394
|
+
|
|
395
|
+
internal/
|
|
396
|
+
βββ handlers/
|
|
397
|
+
β βββ user.go [OL: 1-120 | ML: 113-232 | 3.2KB]
|
|
398
|
+
β βββ struct UserHandler [OL: 8-25 | ML: 120-137 | 512B]
|
|
399
|
+
β βββ fn NewUserHandler(db *sql.DB) *UserHandler [OL: 27-35 | ML: 139-147 | 234B]
|
|
400
|
+
βββ models/
|
|
401
|
+
βββ user.go [OL: 1-45 | ML: 233-277 | 1.1KB]
|
|
402
|
+
βββ struct User [OL: 5-45 | ML: 237-277 | 945B]
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Rust Project
|
|
406
|
+
|
|
407
|
+
```text
|
|
408
|
+
src/
|
|
409
|
+
βββ main.rs [OL: 1-45 | ML: 53-97 | 1.2KB]
|
|
410
|
+
β βββ fn main() [OL: 3-45 | ML: 55-97 | 1.0KB]
|
|
411
|
+
βββ server/
|
|
412
|
+
β βββ mod.rs [OL: 1-120 | ML: 98-217 | 3.4KB]
|
|
413
|
+
β βββ struct Server [OL: 5-25 | ML: 102-122 | 612B]
|
|
414
|
+
β βββ impl Server [OL: 27-100 | ML: 124-197 | 2.5KB]
|
|
415
|
+
β β βββ fn new(host: &str, port: u16) -> Self [OL: 29-45 | ML: 126-142 | 456B]
|
|
416
|
+
β β βββ async fn start(&self) -> Result<()> [OL: 47-100 | ML: 144-197 | 1.8KB]
|
|
417
|
+
β βββ fn create_server(config: Config) -> Server [OL: 102-120 | ML: 199-217 | 534B]
|
|
418
|
+
βββ config.rs [OL: 1-35 | ML: 218-252 | 0.8KB]
|
|
419
|
+
βββ struct Config [OL: 3-35 | ML: 220-252 | 712B]
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Java Project
|
|
423
|
+
|
|
424
|
+
```text
|
|
425
|
+
src/main/java/com/example/
|
|
426
|
+
βββ Application.java [OL: 1-30 | ML: 53-82 | 0.9KB]
|
|
427
|
+
β βββ class Application [OL: 3-30 | ML: 55-82 | 756B]
|
|
428
|
+
β βββ fn main(String[] args) [OL: 5-30 | ML: 57-82 | 654B]
|
|
429
|
+
βββ server/
|
|
430
|
+
β βββ Server.java [OL: 1-150 | ML: 83-232 | 4.2KB]
|
|
431
|
+
β βββ class Server [OL: 5-120 | ML: 87-202 | 3.4KB]
|
|
432
|
+
β β βββ ctor Server(int port, String host) [OL: 15-35 | ML: 97-117 | 612B]
|
|
433
|
+
β β βββ fn start() [OL: 37-80 | ML: 119-162 | 1.2KB]
|
|
434
|
+
β β βββ fn stop() [OL: 82-120 | ML: 164-202 | 1.1KB]
|
|
435
|
+
β βββ class ServerBuilder [OL: 122-150 | ML: 204-232 | 756B]
|
|
436
|
+
βββ config/
|
|
437
|
+
βββ Config.java [OL: 1-45 | ML: 233-277 | 1.1KB]
|
|
438
|
+
βββ class Config [OL: 3-45 | ML: 235-277 | 1.0KB]
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
122
443
|
## License
|
|
123
444
|
|
|
124
445
|
This project is licensed under the MIT License.
|