froggy-docs 1.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/.codex ADDED
File without changes
package/.dockerignore ADDED
@@ -0,0 +1,34 @@
1
+ # Dependencies
2
+ .dart_tool/
3
+ .pub/
4
+ .packages
5
+
6
+ # Build outputs
7
+ bin/*.dill
8
+ *.swp
9
+ *.swo
10
+
11
+ # IDE
12
+ .idea/
13
+ .vscode/
14
+ *.iml
15
+
16
+ # OS
17
+ .DS_Store
18
+ Thumbs.db
19
+
20
+ # Test files
21
+ test/
22
+
23
+ # Frontend build
24
+ frontend/deploy/
25
+ frontend/.dart_tool/
26
+ node_modules/
27
+
28
+ # Logs
29
+ *.log
30
+ npm-debug.log*
31
+
32
+ # Temp
33
+ tmp/
34
+ temp/
@@ -0,0 +1,36 @@
1
+ {
2
+ "title": "My API Documentation",
3
+ "version": "1.0.0",
4
+ "description": "Auto-generated API documentation",
5
+
6
+ "server": {
7
+ "port": 8080,
8
+ "host": "localhost"
9
+ },
10
+
11
+ "paths": {
12
+ "include": ["lib/", "src/", "api/"],
13
+ "exclude": ["test/", "node_modules/", ".dart_tool/"]
14
+ },
15
+
16
+ "annotations": {
17
+ "prefix": "//",
18
+ "tags": {
19
+ "api": "Endpoint definition",
20
+ "desc": "Description",
21
+ "body": "Request body field",
22
+ "auth": "Requires authentication",
23
+ "tag": "Group/category"
24
+ }
25
+ },
26
+
27
+ "output": {
28
+ "format": "openapi",
29
+ "file": "docs/froggy_docs.json"
30
+ },
31
+
32
+ "theme": {
33
+ "primaryColor": "#2e7d32",
34
+ "darkMode": true
35
+ }
36
+ }
@@ -0,0 +1,31 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+
15
+ - name: Install Dart
16
+ uses: dart-lang/setup-dart@v1
17
+
18
+ - name: Get dependencies
19
+ run: dart pub get
20
+
21
+ - name: Analyze
22
+ run: dart analyze lib/
23
+
24
+ - name: Build
25
+ run: dart compile exe bin/froggy_docs.dart -o froggy-docs
26
+
27
+ - name: Upload artifact
28
+ uses: actions/upload-artifact@v3
29
+ with:
30
+ name: froggy-docs
31
+ path: froggy-docs
package/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 1.0.0
2
+
3
+ - Initial version.
package/Dockerfile ADDED
@@ -0,0 +1,49 @@
1
+ # FroggyDocs Dockerfile
2
+ # Multi-stage build for smaller image
3
+
4
+ # Stage 1: Build
5
+ FROM dart:stable AS builder
6
+
7
+ WORKDIR /app
8
+
9
+ # Copy source
10
+ COPY . .
11
+ RUN dart pub get
12
+
13
+ # Compile the executable
14
+ RUN dart compile exe bin/froggy_docs.dart -o froggy-docs
15
+
16
+ # Stage 2: Runtime
17
+ FROM debian:stable-slim
18
+
19
+ # Install curl for healthcheck
20
+ RUN apt-get update && apt-get install -y --no-install-recommends \
21
+ curl \
22
+ && rm -rf /var/lib/apt/lists/*
23
+
24
+ WORKDIR /app
25
+
26
+ # Copy compiled binary from builder
27
+ COPY --from=builder /app/froggy-docs /usr/local/bin/froggy-docs
28
+
29
+ # Copy docs and static files
30
+ COPY frontend/deploy/web /app/frontend/web
31
+ COPY frontend/web/froggy_docs.json /app/frontend/web/froggy_docs.json
32
+
33
+ # Make executable
34
+ RUN chmod +x /usr/local/bin/froggy-docs
35
+
36
+ # Expose default port
37
+ EXPOSE 8080
38
+
39
+ # Health check
40
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
41
+ CMD curl -f http://localhost:8080/ || exit 1
42
+
43
+ # Default command
44
+ CMD ["froggy-docs", "serve", "-h", "0.0.0.0"]
45
+
46
+ # Alternative commands:
47
+ # docker run -p 8080:8080 froggy-docs serve -p 8080
48
+ # docker run -p 3000:8080 froggy-docs serve -p 3000
49
+ # docker run -v $(pwd):/app froggy-docs serve
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # 🐸 FroggyDocs
2
+
3
+ > Auto-generate API documentation from code annotations. Works with any programming language.
4
+
5
+ [![Pub](https://img.shields.io/pub/v/froggy_docs.svg)](https://pub.dev/package/froggy_docs)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Docker](https://img.shields.io/badge/Docker-ready-blue.svg)](https://docker.com)
8
+
9
+ ---
10
+
11
+ ## ✨ Features
12
+
13
+ - 📝 **Easy Annotations** - Add comments to your API code, no config needed
14
+ - 🌐 **Universal** - Works with any language (JavaScript, Python, Go, Ruby, etc.)
15
+ - 🎨 **Beautiful UI** - Interactive API docs with "Try It Out" functionality
16
+ - 🔄 **Live Reload** - Auto-regenerates docs when code changes
17
+ - 📦 **Multiple Outputs** - npm, Docker, GitHub Template
18
+ - 🔒 **OpenAPI 3.0** - Industry-standard specification
19
+
20
+ ---
21
+
22
+ ## 🚀 Quick Start
23
+
24
+ ### Via npm (Recommended)
25
+ ```bash
26
+ npm install -g froggy-docs
27
+ froggy-docs serve
28
+ ```
29
+
30
+ ### Via Docker
31
+ ```bash
32
+ docker run -p 8080:8080 froggy-docs
33
+ ```
34
+
35
+ ### Via Dart
36
+ ```bash
37
+ dart pub global activate froggy_docs
38
+ froggy_docs serve
39
+ ```
40
+
41
+ ---
42
+
43
+ ## 💻 Usage
44
+
45
+ ### 1. Add Annotations to Your Code
46
+
47
+ ```javascript
48
+ // @api POST /api/users
49
+ // @tag Users
50
+ // @tag Auth
51
+ // @desc Create a new user
52
+ // @body name string User's full name
53
+ // @body email string User's email
54
+ // @auth
55
+ app.post('/api/users', async (req, res) => {
56
+ // Your API logic here
57
+ });
58
+ ```
59
+
60
+ ### 2. Run the Documentation Server
61
+
62
+ ```bash
63
+ # Default (localhost:8080)
64
+ froggy-docs serve
65
+
66
+ # Custom port
67
+ froggy-docs serve -p 3000
68
+
69
+ # Network accessible
70
+ froggy-docs serve -h 0.0.0.0 -p 8080
71
+
72
+ # Watch mode (no server)
73
+ froggy-docs watch
74
+ ```
75
+
76
+ ### 3. Open in Browser
77
+
78
+ ```
79
+ http://localhost:8080
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 📖 Annotation Reference
85
+
86
+ | Annotation | Description | Example |
87
+ |------------|-------------|---------|
88
+ | `@api` | Define endpoint | `@api GET /users` |
89
+ | `@desc` | Description | `@desc Get all users` |
90
+ | `@tag` | Category | `@tag Users` |
91
+ | `@body` | Request body field | `@body name string User's name` |
92
+ | `@body-json` | Inline JSON schema | `@body-json {...}` |
93
+ | `@body-file` | From JSON file | `@body-file ./schema.json` |
94
+ | `@auth` | Requires auth | `@auth` |
95
+
96
+ **Full guide:** [docs/annotations.md](docs/annotations.md)
97
+
98
+ ---
99
+
100
+ ## 🐳 Docker
101
+
102
+ ### Build
103
+ ```bash
104
+ docker build -t froggy-docs .
105
+ ```
106
+
107
+ ### Run
108
+ ```bash
109
+ # Default
110
+ docker run -p 8080:8080 froggy-docs
111
+
112
+ # Custom port
113
+ docker run -p 3000:8080 froggy-docs serve -p 3000
114
+
115
+ # Mount project
116
+ docker run -v $(pwd):/app -p 8080:8080 froggy-docs
117
+ ```
118
+
119
+ ### Docker Compose
120
+ ```yaml
121
+ version: '3'
122
+ services:
123
+ froggy-docs:
124
+ build: .
125
+ ports:
126
+ - "8080:8080"
127
+ volumes:
128
+ - .:/app
129
+ command: serve -h 0.0.0.0
130
+ ```
131
+
132
+ ---
133
+
134
+ ## ⚙️ Configuration
135
+
136
+ Create `.froggyrc` in your project root:
137
+
138
+ ```json
139
+ {
140
+ "server": {
141
+ "port": 8080,
142
+ "host": "localhost"
143
+ },
144
+ "paths": {
145
+ "include": ["lib/", "src/", "api/"],
146
+ "exclude": ["test/", "node_modules/"]
147
+ },
148
+ "output": {
149
+ "format": "openapi",
150
+ "file": "docs/froggy_docs.json"
151
+ }
152
+ }
153
+ ```
154
+
155
+ See: [`.froggyrc.example`](.froggyrc.example)
156
+
157
+ ---
158
+
159
+ ## 🌐 Supported Languages
160
+
161
+ | Language | Extensions | Comment |
162
+ |----------|------------|----------|
163
+ | JavaScript/TypeScript | .js, .ts, .jsx, .tsx | `//` |
164
+ | Python | .py | `#` |
165
+ | Ruby | .rb | `#` |
166
+ | Go | .go | `//` |
167
+ | Rust | .rs | `//` |
168
+ | Dart | .dart | `//` |
169
+ | Java/Kotlin | .java, .kt | `//` |
170
+ | PHP | .php | `//` |
171
+ | C# | .cs | `//` |
172
+ | C/C++ | .c, .cpp, .h | `//` |
173
+
174
+ ---
175
+
176
+ ## 📦 Installation Options
177
+
178
+ ### npm
179
+ ```bash
180
+ npm install -g froggy-docs
181
+ ```
182
+
183
+ ### pip
184
+ ```bash
185
+ pip install froggy-docs
186
+ ```
187
+
188
+ ### Docker
189
+ ```bash
190
+ docker run -p 8080:8080 froggy-docs
191
+ ```
192
+
193
+ ### Standalone Binary
194
+ Download from [Releases](https://github.com/yourusername/froggy-docs/releases)
195
+
196
+ ---
197
+
198
+ ## 🤝 Contributing
199
+
200
+ 1. Fork the repo
201
+ 2. Create your branch (`git checkout -b feature/amazing`)
202
+ 3. Commit changes (`git commit -m 'Add amazing feature'`)
203
+ 4. Push to branch (`git push origin feature/amazing`)
204
+ 5. Open a Pull Request
205
+
206
+ ---
207
+
208
+ ## 📄 License
209
+
210
+ MIT License - see [LICENSE](LICENSE) for details.
211
+
212
+ ---
213
+
214
+ ## 🙏 Acknowledgments
215
+
216
+ - [Shelf](https://pub.dev/packages/shelf) - HTTP server
217
+ - [Watcher](https://pub.dev/packages/watcher) - File watching
218
+ - [Jaspr](https://pub.dev/packages/jaspr) - Web framework
@@ -0,0 +1,30 @@
1
+ # This file configures the static analysis results for your project (errors,
2
+ # warnings, and lints).
3
+ #
4
+ # This enables the 'recommended' set of lints from `package:lints`.
5
+ # This set helps identify many issues that may lead to problems when running
6
+ # or consuming Dart code, and enforces writing Dart using a single, idiomatic
7
+ # style and format.
8
+ #
9
+ # If you want a smaller set of lints you can change this to specify
10
+ # 'package:lints/core.yaml'. These are just the most critical lints
11
+ # (the recommended set includes the core lints).
12
+ # The core lints are also what is used by pub.dev for scoring packages.
13
+
14
+ include: package:lints/recommended.yaml
15
+
16
+ # Uncomment the following section to specify additional rules.
17
+
18
+ # linter:
19
+ # rules:
20
+ # - camel_case_types
21
+
22
+ # analyzer:
23
+ # exclude:
24
+ # - path/to/excluded/files/**
25
+
26
+ # For more information about the core and recommended set of lints, see
27
+ # https://dart.dev/go/core-lints
28
+
29
+ # For additional information about configuring this file, see
30
+ # https://dart.dev/guides/language/analysis-options
@@ -0,0 +1,38 @@
1
+ import 'dart:io';
2
+ import 'dart:async';
3
+ import 'package:args/args.dart';
4
+ import 'package:froggy_docs/src/watcher_engine.dart';
5
+ import 'package:froggy_docs/src/web_server.dart';
6
+
7
+ void main(List<String> arguments) async {
8
+ final parser = ArgParser();
9
+ parser.addCommand('watch');
10
+ parser.addCommand('serve');
11
+ parser.addOption(
12
+ 'port',
13
+ abbr: 'p',
14
+ help: 'Port for server',
15
+ defaultsTo: '8080',
16
+ );
17
+
18
+ try {
19
+ final results = parser.parse(arguments);
20
+
21
+ if (results.command?.name == 'watch') {
22
+ print('🐸 FroggyDocs is watching your API project...');
23
+ final watcher = WatcherEngine();
24
+ watcher.startWatching(Directory.current.path);
25
+ } else if (results.command?.name == 'serve') {
26
+ final port = int.parse(results['port'] as String);
27
+ print('🐸 Starting FroggyDocs server with live reload...');
28
+
29
+ // Start server and watcher
30
+ await startServer(port: port);
31
+ final watcher = WatcherEngine();
32
+ watcher.startWatching(Directory.current.path);
33
+ }
34
+ } catch (e) {
35
+ print('Error: ${e.toString()}');
36
+ exit(1);
37
+ }
38
+ }
@@ -0,0 +1,174 @@
1
+ # 📝 FroggyDocs Annotations Guide
2
+
3
+ Add annotations directly in your API code files. FroggyDocs parses these to generate OpenAPI documentation.
4
+
5
+ ---
6
+
7
+ ## Basic Annotations
8
+
9
+ ### @api - Define Endpoint (Required)
10
+ ```javascript
11
+ // @api GET /users
12
+ // @api POST /api/users
13
+ // @api PUT /api/users/:id
14
+ // @api DELETE /api/users/:id
15
+ // @api PATCH /api/users/:id
16
+ ```
17
+
18
+ **Format:** `@api <METHOD> <PATH>`
19
+
20
+ **Supported Methods:**
21
+ - `GET`
22
+ - `POST`
23
+ - `PUT`
24
+ - `PATCH`
25
+ - `DELETE`
26
+ - `HEAD`
27
+ - `OPTIONS`
28
+
29
+ ---
30
+
31
+ ### @desc - Description
32
+ ```javascript
33
+ // @desc Get all users from the database
34
+ ```
35
+
36
+ ---
37
+
38
+ ### @tag - Category/Group
39
+ ```javascript
40
+ // @tag Users
41
+ // @tag Auth
42
+ // @tag Admin
43
+ ```
44
+ Multiple tags are supported:
45
+ ```javascript
46
+ // @tag Users
47
+ // @tag Auth
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Request Body
53
+
54
+ ### @body - Field Definition
55
+ ```javascript
56
+ // @body name string User's full name
57
+ // @body email string User's email address
58
+ // @body age number User's age
59
+ // @body isActive boolean Account status
60
+ ```
61
+
62
+ **Format:** `@body <field_name> <type> <description>`
63
+
64
+ **Supported Types:**
65
+ - `string`
66
+ - `number`
67
+ - `boolean`
68
+ - `array`
69
+ - `object`
70
+
71
+ ---
72
+
73
+ ### @body-json - Inline JSON
74
+ ```javascript
75
+ // @body-json
76
+ // {
77
+ // "company": "Acme Inc",
78
+ // "employees": 50,
79
+ // "active": true
80
+ // }
81
+ ```
82
+
83
+ ---
84
+
85
+ ### @body-file - From JSON File
86
+ ```javascript
87
+ // @body-file ./schemas/user.json
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Authentication
93
+
94
+ ### @auth - Requires Authentication
95
+ ```javascript
96
+ // @auth
97
+ ```
98
+ Adds security requirement to the endpoint.
99
+
100
+ ---
101
+
102
+ ## Examples
103
+
104
+ ### Complete Example (JavaScript/Node.js)
105
+ ```javascript
106
+ // @api POST /api/users
107
+ // @tag Users
108
+ // @tag Auth
109
+ // @desc Create a new user account
110
+ // @body name string User's full name
111
+ // @body email string User's email address
112
+ // @body password string User's password
113
+ // @auth
114
+ app.post('/api/users', async (req, res) => {
115
+ // Your API logic here
116
+ });
117
+ ```
118
+
119
+ ### Python Example
120
+ ```python
121
+ # @api GET /users
122
+ # @tag Users
123
+ # @desc Get all users
124
+ def get_users():
125
+ # Your API logic here
126
+ pass
127
+ ```
128
+
129
+ ### Go Example
130
+ ```go
131
+ // @api GET /users
132
+ // @tag Users
133
+ // @desc Get all users
134
+ func GetUsers(w http.ResponseWriter, r *http.Request) {
135
+ // Your API logic here
136
+ }
137
+ ```
138
+
139
+ ### Dart/Flutter Example
140
+ ```dart
141
+ // @api GET /users
142
+ // @tag Users
143
+ // @desc Get all users
144
+ Future<List<User>> getUsers() async {
145
+ // Your API logic here
146
+ }
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Language Support
152
+
153
+ | Language | Comment Style | Extensions |
154
+ |----------|--------------|-------------|
155
+ | JavaScript/TypeScript | `//` | `.js`, `.ts`, `.jsx`, `.tsx` |
156
+ | Dart | `//` | `.dart` |
157
+ | Python | `#` | `.py` |
158
+ | Ruby | `#` | `.rb` |
159
+ | Go | `//` | `.go` |
160
+ | Rust | `//` | `.rs` |
161
+ | Java/Kotlin | `//` | `.java`, `.kt` |
162
+ | PHP | `//` | `.php` |
163
+ | C# | `//` | `.cs` |
164
+ | C/C++ | `//` | `.c`, `.cpp`, `.h` |
165
+
166
+ ---
167
+
168
+ ## Output
169
+
170
+ FroggyDocs generates [OpenAPI 3.0](https://spec.openapis.org/oas/v3.0.0) specification that can be:
171
+ - Viewed in the built-in web UI
172
+ - Imported into Swagger UI
173
+ - Used with other OpenAPI tools
174
+ - Exported as JSON or YAML
@@ -0,0 +1,15 @@
1
+ # frontend
2
+
3
+ A new Jaspr project
4
+
5
+ ## Running the project
6
+
7
+ Run your project using `jaspr serve`.
8
+
9
+ The development server will be available on `http://localhost:8080`.
10
+
11
+ ## Building the project
12
+
13
+ Build your project using `jaspr build`.
14
+
15
+ The output will be located inside the `build/jaspr/` directory.
@@ -0,0 +1,46 @@
1
+ # This file configures the static analysis results for your project (errors,
2
+ # warnings, and lints).
3
+ #
4
+ # This enables the 'recommended' set of lints from `package:lints`.
5
+ # This set helps identify many issues that may lead to problems when running
6
+ # or consuming Dart code, and enforces writing Dart using a single, idiomatic
7
+ # style and format.
8
+ #
9
+ # If you want a smaller set of lints you can change this to specify
10
+ # 'package:lints/core.yaml'. These are just the most critical lints
11
+ # (the recommended set includes the core lints).
12
+ # The core lints are also what is used by pub.dev for scoring packages.
13
+
14
+ include: package:lints/recommended.yaml
15
+
16
+ analyzer:
17
+ # exclude:
18
+ # - path/to/excluded/files/**
19
+
20
+ # Jaspr has a custom analyzer plugin 'jaspr_lints', which is enabled here.
21
+ #
22
+ # You can toggle Jaspr specific lint rules in the 'diagnostics' section below.
23
+ plugins:
24
+ jaspr_lints:
25
+ version: ^0.7.0
26
+ diagnostics:
27
+ prefer_html_components: true
28
+ sort_children_last: true
29
+ styles_ordering: true
30
+
31
+ # Uncomment the following section to enable or disable additional rules.
32
+
33
+ # linter:
34
+ # rules:
35
+ # camel_case_types: true
36
+
37
+ # For more information about the core and recommended set of lints, see
38
+ # https://dart.dev/go/core-lints
39
+
40
+ formatter:
41
+ # Change this to your preferred line length.
42
+ page_width: 120
43
+ trailing_commas: preserve
44
+
45
+ # For additional information about configuring this file, see
46
+ # https://dart.dev/guides/language/analysis-options