@codeflyai/codefly 0.24.0 → 0.24.2
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/README.md +3 -1
- package/bundle/builtin/skill-creator/SKILL.md +382 -0
- package/bundle/builtin/skill-creator/scripts/init_skill.cjs +235 -0
- package/bundle/builtin/skill-creator/scripts/package_skill.cjs +102 -0
- package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +127 -0
- package/bundle/codefly.js +318024 -294904
- package/bundle/docs/architecture.md +3 -3
- package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
- package/bundle/docs/changelogs/index.md +134 -0
- package/bundle/docs/changelogs/latest.md +355 -210
- package/bundle/docs/changelogs/preview.md +318 -115
- package/bundle/docs/cli/commands.md +21 -0
- package/bundle/docs/cli/custom-commands.md +9 -9
- package/bundle/docs/cli/index.md +6 -2
- package/bundle/docs/cli/keyboard-shortcuts.md +61 -78
- package/bundle/docs/cli/model-routing.md +7 -2
- package/bundle/docs/cli/model.md +1 -1
- package/bundle/docs/cli/openspec.md +164 -0
- package/bundle/docs/cli/sandbox.md +1 -1
- package/bundle/docs/cli/settings.md +80 -60
- package/bundle/docs/cli/skills.md +188 -0
- package/bundle/docs/cli/system-prompt.md +32 -0
- package/bundle/docs/cli/telemetry.md +38 -3
- package/bundle/docs/cli/themes.md +0 -2
- package/bundle/docs/cli/tutorials/skills-getting-started.md +124 -0
- package/bundle/docs/cli/tutorials.md +4 -0
- package/bundle/docs/core/index.md +4 -0
- package/bundle/docs/core/memport.md +2 -0
- package/bundle/docs/core/policy-engine.md +3 -2
- package/bundle/docs/extensions/getting-started-extensions.md +39 -2
- package/bundle/docs/get-started/configuration.md +127 -71
- package/bundle/docs/get-started/gemini-3.md +2 -17
- package/bundle/docs/hooks/reference.md +245 -116
- package/bundle/docs/index.md +2 -0
- package/bundle/docs/local-development.md +1 -1
- package/bundle/docs/releases.md +1 -1
- package/bundle/docs/sidebar.json +5 -5
- package/bundle/docs/tools/database-schema.md +231 -0
- package/bundle/docs/tools/index.md +7 -0
- package/bundle/docs/tools/mcp-server.md +26 -2
- package/bundle/docs/tools/shell.md +1 -1
- package/bundle/docs/tools/swagger-schema.md +236 -0
- package/bundle/docs/troubleshooting.md +23 -5
- package/bundle/policies/agent.toml +1 -1
- package/bundle/policies/plan.toml +70 -0
- package/bundle/policies/read-only.toml +0 -5
- package/bundle/policies/yolo.toml +1 -0
- package/package.json +12 -5
- package/bundle/docs/get-started/deployment.md +0 -143
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Database Schema Tool
|
|
2
|
+
|
|
3
|
+
The Database Schema Tool (`get_database_schema`) allows Codefly to retrieve
|
|
4
|
+
database table structures and column information from MySQL or PostgreSQL
|
|
5
|
+
databases. This tool is essential for understanding database schemas, generating
|
|
6
|
+
ORMs, creating migrations, and working with database-driven applications.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The Database Schema Tool connects to a MySQL or PostgreSQL database and
|
|
11
|
+
retrieves comprehensive schema information including:
|
|
12
|
+
|
|
13
|
+
- Table names
|
|
14
|
+
- Column names and data types
|
|
15
|
+
- Nullable constraints
|
|
16
|
+
- Primary keys and indexes (MySQL)
|
|
17
|
+
|
|
18
|
+
## How to use
|
|
19
|
+
|
|
20
|
+
### Basic usage
|
|
21
|
+
|
|
22
|
+
Ask Codefly to fetch database schema information:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
> Get the schema for the MySQL database 'myapp_db' on localhost with user 'root'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
> Fetch the PostgreSQL database schema from host db.example.com, database 'production_db', user 'admin'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Common use cases
|
|
33
|
+
|
|
34
|
+
#### Understanding database structure
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
> What tables exist in the MySQL database 'shop_db' on localhost?
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### Generating ORM models
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
> Get the schema from the PostgreSQL database 'app_db' and generate TypeScript TypeORM entities
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### Creating database documentation
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
> Fetch the schema from MySQL database 'inventory_db' and create markdown documentation for all tables
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Database migration planning
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
> Get the current schema from the dev database and suggest migrations to match the production schema structure
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Tool parameters
|
|
59
|
+
|
|
60
|
+
The `get_database_schema` tool accepts the following parameters:
|
|
61
|
+
|
|
62
|
+
- **`type`** (required): Database type
|
|
63
|
+
- `mysql`: For MySQL or MariaDB databases
|
|
64
|
+
- `postgres`: For PostgreSQL databases
|
|
65
|
+
|
|
66
|
+
- **`host`** (required): Database host address
|
|
67
|
+
- Examples: `localhost`, `127.0.0.1`, `db.example.com`
|
|
68
|
+
|
|
69
|
+
- **`user`** (required): Username for database connection
|
|
70
|
+
|
|
71
|
+
- **`database`** (required): Name of the database to query
|
|
72
|
+
|
|
73
|
+
- **`password`** (optional): Password for database connection
|
|
74
|
+
- If not provided, will attempt connection without password
|
|
75
|
+
|
|
76
|
+
- **`port`** (optional): Port number
|
|
77
|
+
- Defaults to `3306` for MySQL
|
|
78
|
+
- Defaults to `5432` for PostgreSQL
|
|
79
|
+
|
|
80
|
+
## Output format
|
|
81
|
+
|
|
82
|
+
The tool returns a formatted list of tables and their columns:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Table: users
|
|
86
|
+
- id (int) [PRI]
|
|
87
|
+
- username (varchar)
|
|
88
|
+
- email (varchar)
|
|
89
|
+
- created_at (timestamp) NULL
|
|
90
|
+
|
|
91
|
+
Table: orders
|
|
92
|
+
- id (int) [PRI]
|
|
93
|
+
- user_id (int) [MUL]
|
|
94
|
+
- total (decimal)
|
|
95
|
+
- status (varchar)
|
|
96
|
+
- created_at (timestamp)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
For each column, the output includes:
|
|
100
|
+
|
|
101
|
+
- Column name
|
|
102
|
+
- Data type
|
|
103
|
+
- NULL/NOT NULL constraint
|
|
104
|
+
- Index information (for MySQL: PRI for primary key, MUL for indexed, etc.)
|
|
105
|
+
|
|
106
|
+
## Dependencies
|
|
107
|
+
|
|
108
|
+
The Database Schema Tool requires database client libraries:
|
|
109
|
+
|
|
110
|
+
### For MySQL/MariaDB
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install mysql2
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### For PostgreSQL
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm install pg
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
If the required package is not installed, the tool will ask you to install it.
|
|
123
|
+
|
|
124
|
+
## Security considerations
|
|
125
|
+
|
|
126
|
+
- **Credentials**: Be cautious when providing database passwords. Consider using
|
|
127
|
+
environment variables or secure credential storage
|
|
128
|
+
- **Read-only access**: The tool only reads schema information and does not
|
|
129
|
+
modify data
|
|
130
|
+
- **Network security**: Ensure database connections are made over secure
|
|
131
|
+
networks
|
|
132
|
+
- **Least privilege**: Use database accounts with minimal required permissions
|
|
133
|
+
(e.g., `SHOW TABLES`, `DESCRIBE` for MySQL, or `pg_catalog` read access for
|
|
134
|
+
PostgreSQL)
|
|
135
|
+
|
|
136
|
+
## Examples
|
|
137
|
+
|
|
138
|
+
### Example 1: Local development database
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
> Get the schema from MySQL database 'dev_db' on localhost with user 'root' and no password
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Example 2: Remote PostgreSQL database
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
> Connect to PostgreSQL at db.example.com:5432, database 'production_db', user 'readonly', and fetch the complete schema
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Example 3: Generating TypeORM entities
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
> Get the schema from MySQL database 'app_db' on localhost and generate TypeORM entities for all tables
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Codefly will fetch the schema and generate TypeScript classes with appropriate
|
|
157
|
+
decorators.
|
|
158
|
+
|
|
159
|
+
### Example 4: Creating database documentation
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
> Fetch the schema from PostgreSQL database 'analytics_db' and create a comprehensive markdown document describing all tables, their relationships, and fields
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Example 5: Schema comparison
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
> Get schemas from both the dev and production databases and show me the differences
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Troubleshooting
|
|
172
|
+
|
|
173
|
+
### "The 'mysql2' package is required"
|
|
174
|
+
|
|
175
|
+
For MySQL databases, install the mysql2 package:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm install mysql2
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### "The 'pg' package is required"
|
|
182
|
+
|
|
183
|
+
For PostgreSQL databases, install the pg package:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm install pg
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### "Connection failed"
|
|
190
|
+
|
|
191
|
+
Common connection issues:
|
|
192
|
+
|
|
193
|
+
- **Wrong host/port**: Verify the database server address and port
|
|
194
|
+
- **Authentication failed**: Check username and password
|
|
195
|
+
- **Database doesn't exist**: Ensure the database name is correct
|
|
196
|
+
- **Network issues**: Verify firewall rules and network connectivity
|
|
197
|
+
- **Permissions**: Ensure the user has permission to access schema information
|
|
198
|
+
|
|
199
|
+
### "Access denied"
|
|
200
|
+
|
|
201
|
+
The database user needs appropriate permissions:
|
|
202
|
+
|
|
203
|
+
For MySQL:
|
|
204
|
+
|
|
205
|
+
```sql
|
|
206
|
+
GRANT SELECT ON information_schema.* TO 'username'@'host';
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
For PostgreSQL:
|
|
210
|
+
|
|
211
|
+
```sql
|
|
212
|
+
GRANT CONNECT ON DATABASE dbname TO username;
|
|
213
|
+
GRANT USAGE ON SCHEMA public TO username;
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Best practices
|
|
217
|
+
|
|
218
|
+
1. **Use read-only credentials**: Create database users with minimal required
|
|
219
|
+
permissions
|
|
220
|
+
2. **Protect passwords**: Avoid hardcoding passwords in prompts; use environment
|
|
221
|
+
variables when possible
|
|
222
|
+
3. **Test connections**: Verify connectivity with a simple query before running
|
|
223
|
+
complex operations
|
|
224
|
+
4. **Document schema changes**: Use this tool to track schema evolution over
|
|
225
|
+
time
|
|
226
|
+
|
|
227
|
+
## See also
|
|
228
|
+
|
|
229
|
+
- [Swagger Schema Tool](./swagger-schema.md) - For retrieving API schemas
|
|
230
|
+
- [File System Tools](./file-system.md) - For working with local schema files
|
|
231
|
+
- [Shell Tool](./shell.md) - For running database migration commands
|
|
@@ -86,10 +86,17 @@ Gemini CLI's built-in tools can be broadly categorized as follows:
|
|
|
86
86
|
information across sessions.
|
|
87
87
|
- **[Todo Tool](./todos.md) (`write_todos`):** For managing subtasks of complex
|
|
88
88
|
requests.
|
|
89
|
+
- **[Database Schema Tool](./database-schema.md) (`get_database_schema`):** For
|
|
90
|
+
retrieving database table structures from MySQL or PostgreSQL databases.
|
|
91
|
+
- **[Swagger Schema Tool](./swagger-schema.md) (`get_swagger_schema`):** For
|
|
92
|
+
fetching and parsing Swagger/OpenAPI schema definitions from URLs.
|
|
89
93
|
|
|
90
94
|
Additionally, these tools incorporate:
|
|
91
95
|
|
|
92
96
|
- **[MCP servers](./mcp-server.md)**: MCP servers act as a bridge between the
|
|
93
97
|
Gemini model and your local environment or other services like APIs.
|
|
98
|
+
- **[Agent Skills](../cli/skills.md)**: (Experimental) On-demand expertise
|
|
99
|
+
packages that are activated via the `activate_skill` tool to provide
|
|
100
|
+
specialized guidance and resources.
|
|
94
101
|
- **[Sandboxing](../cli/sandbox.md)**: Sandboxing isolates the model and its
|
|
95
102
|
changes from your environment to reduce potential risk.
|
|
@@ -722,7 +722,8 @@ The MCP integration tracks several states:
|
|
|
722
722
|
|
|
723
723
|
### Debugging tips
|
|
724
724
|
|
|
725
|
-
1. **Enable debug mode:** Run the CLI with `--debug` for verbose output
|
|
725
|
+
1. **Enable debug mode:** Run the CLI with `--debug` for verbose output (use F12
|
|
726
|
+
to open debug console in interactive mode)
|
|
726
727
|
2. **Check stderr:** MCP server stderr is captured and logged (INFO messages
|
|
727
728
|
filtered)
|
|
728
729
|
3. **Test isolation:** Test your MCP server independently before integrating
|
|
@@ -732,7 +733,7 @@ The MCP integration tracks several states:
|
|
|
732
733
|
|
|
733
734
|
## Important notes
|
|
734
735
|
|
|
735
|
-
### Security
|
|
736
|
+
### Security considerations
|
|
736
737
|
|
|
737
738
|
- **Trust settings:** The `trust` option bypasses all confirmation dialogs. Use
|
|
738
739
|
cautiously and only for servers you completely control
|
|
@@ -1037,6 +1038,29 @@ gemini mcp remove my-server
|
|
|
1037
1038
|
This will find and delete the "my-server" entry from the `mcpServers` object in
|
|
1038
1039
|
the appropriate `settings.json` file based on the scope (`-s, --scope`).
|
|
1039
1040
|
|
|
1041
|
+
### Enabling/disabling a server (`gemini mcp enable`, `gemini mcp disable`)
|
|
1042
|
+
|
|
1043
|
+
Temporarily disable an MCP server without removing its configuration, or
|
|
1044
|
+
re-enable a previously disabled server.
|
|
1045
|
+
|
|
1046
|
+
**Commands:**
|
|
1047
|
+
|
|
1048
|
+
```bash
|
|
1049
|
+
gemini mcp enable <name> [--session]
|
|
1050
|
+
gemini mcp disable <name> [--session]
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
**Options (flags):**
|
|
1054
|
+
|
|
1055
|
+
- `--session`: Apply change only for this session (not persisted to file).
|
|
1056
|
+
|
|
1057
|
+
Disabled servers appear in `/mcp` status as "Disabled" but won't connect or
|
|
1058
|
+
provide tools. Enablement state is stored in
|
|
1059
|
+
`~/.gemini/mcp-server-enablement.json`.
|
|
1060
|
+
|
|
1061
|
+
The same commands are available as slash commands during an active session:
|
|
1062
|
+
`/mcp enable <name>` and `/mcp disable <name>`.
|
|
1063
|
+
|
|
1040
1064
|
## Instructions
|
|
1041
1065
|
|
|
1042
1066
|
Gemini CLI supports
|
|
@@ -135,7 +135,7 @@ user input, such as text editors (`vim`, `nano`), terminal-based UIs (`htop`),
|
|
|
135
135
|
and interactive version control operations (`git rebase -i`).
|
|
136
136
|
|
|
137
137
|
When an interactive command is running, you can send input to it from the Gemini
|
|
138
|
-
CLI. To focus on the interactive shell, press `
|
|
138
|
+
CLI. To focus on the interactive shell, press `Tab`. The terminal output,
|
|
139
139
|
including complex TUIs, will be rendered correctly.
|
|
140
140
|
|
|
141
141
|
## Important notes
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Swagger Schema Tool
|
|
2
|
+
|
|
3
|
+
The Swagger Schema Tool (`get_swagger_schema`) allows Codefly to fetch and parse
|
|
4
|
+
Swagger/OpenAPI schema definitions from URLs. This tool is particularly useful
|
|
5
|
+
for understanding API structures, generating API clients, documenting endpoints,
|
|
6
|
+
and integrating with external services.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The Swagger Schema Tool retrieves Swagger/OpenAPI specifications from a given
|
|
11
|
+
URL and can return them in different formats:
|
|
12
|
+
|
|
13
|
+
- **Summary format** (default): A human-readable overview of the API including
|
|
14
|
+
endpoints, parameters, and models
|
|
15
|
+
- **JSON format**: The complete schema in JSON format
|
|
16
|
+
- **YAML format**: The complete schema in YAML format
|
|
17
|
+
|
|
18
|
+
## How to use
|
|
19
|
+
|
|
20
|
+
### Basic usage
|
|
21
|
+
|
|
22
|
+
Simply ask Codefly to fetch a Swagger schema:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
> Fetch the Swagger schema from https://api.example.com/swagger.json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Specify output format
|
|
29
|
+
|
|
30
|
+
You can request a specific format:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
> Get the Swagger schema from https://petstore.swagger.io/v2/swagger.json in JSON format
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
> Show me a summary of the API endpoints from https://api.example.com/v2/api-docs
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Common use cases
|
|
41
|
+
|
|
42
|
+
#### Understanding an API structure
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
> What endpoints are available in the API at https://api.github.com/swagger.json?
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Generating API documentation
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
> Fetch the Swagger schema from https://api.example.com/swagger.json and create a markdown documentation file
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Comparing API versions
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
> Compare the endpoints between https://api.example.com/v1/swagger.json and https://api.example.com/v2/swagger.json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### Creating API clients
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
> Get the Swagger schema from https://api.example.com/swagger.json and generate a TypeScript client for it
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Tool parameters
|
|
67
|
+
|
|
68
|
+
The `get_swagger_schema` tool accepts the following parameters:
|
|
69
|
+
|
|
70
|
+
- **`url`** (required): The URL of the Swagger/OpenAPI schema file
|
|
71
|
+
- Examples:
|
|
72
|
+
- `https://api.example.com/swagger.json`
|
|
73
|
+
- `https://api.example.com/v2/api-docs`
|
|
74
|
+
- `https://petstore.swagger.io/v2/swagger.yaml`
|
|
75
|
+
|
|
76
|
+
- **`format`** (optional): The output format
|
|
77
|
+
- `summary` (default): Human-readable overview with endpoints and models
|
|
78
|
+
- `json`: Full schema in JSON format
|
|
79
|
+
- `yaml`: Full schema in YAML format
|
|
80
|
+
|
|
81
|
+
## Output format
|
|
82
|
+
|
|
83
|
+
### Summary format
|
|
84
|
+
|
|
85
|
+
The summary format provides:
|
|
86
|
+
|
|
87
|
+
- API title, version, and description
|
|
88
|
+
- OpenAPI/Swagger version
|
|
89
|
+
- Server URLs or base paths
|
|
90
|
+
- List of endpoints with:
|
|
91
|
+
- HTTP method and path
|
|
92
|
+
- Summary and description
|
|
93
|
+
- Operation ID
|
|
94
|
+
- Tags
|
|
95
|
+
- Parameters (name, location, type, required status)
|
|
96
|
+
- Request body information
|
|
97
|
+
- Response codes
|
|
98
|
+
- List of model/schema definitions
|
|
99
|
+
|
|
100
|
+
Example output:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
API: Petstore API
|
|
104
|
+
Version: 1.0.0
|
|
105
|
+
Description: This is a sample server Petstore server.
|
|
106
|
+
|
|
107
|
+
OpenAPI/Swagger Version: 3.0.0
|
|
108
|
+
Servers:
|
|
109
|
+
- https://petstore.swagger.io/v2
|
|
110
|
+
|
|
111
|
+
Endpoints:
|
|
112
|
+
|
|
113
|
+
GET /pets
|
|
114
|
+
Summary: List all pets
|
|
115
|
+
Operation ID: listPets
|
|
116
|
+
Tags: pets
|
|
117
|
+
Parameters:
|
|
118
|
+
- limit (query, integer)
|
|
119
|
+
Responses: 200, default
|
|
120
|
+
|
|
121
|
+
POST /pets
|
|
122
|
+
Summary: Create a pet
|
|
123
|
+
Operation ID: createPets
|
|
124
|
+
Tags: pets
|
|
125
|
+
Request Body (required)
|
|
126
|
+
Responses: 201
|
|
127
|
+
|
|
128
|
+
Models/Schemas:
|
|
129
|
+
- Pet
|
|
130
|
+
- Error
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### JSON/YAML formats
|
|
134
|
+
|
|
135
|
+
These formats return the complete Swagger/OpenAPI specification as-is, which is
|
|
136
|
+
useful for:
|
|
137
|
+
|
|
138
|
+
- Importing into API development tools
|
|
139
|
+
- Generating code
|
|
140
|
+
- Detailed schema analysis
|
|
141
|
+
- Integration with other tools
|
|
142
|
+
|
|
143
|
+
## Supported formats
|
|
144
|
+
|
|
145
|
+
The tool supports both Swagger 2.0 and OpenAPI 3.x specifications in:
|
|
146
|
+
|
|
147
|
+
- JSON format (`.json` files or `application/json` content type)
|
|
148
|
+
- YAML format (`.yaml` or `.yml` files, or `application/x-yaml`/`text/yaml`
|
|
149
|
+
content types)
|
|
150
|
+
|
|
151
|
+
The tool automatically detects the format based on the content type header or
|
|
152
|
+
file extension.
|
|
153
|
+
|
|
154
|
+
## Dependencies
|
|
155
|
+
|
|
156
|
+
The Swagger Schema Tool uses the following optional dependencies:
|
|
157
|
+
|
|
158
|
+
- **`node-fetch`**: For fetching schemas from URLs (built-in)
|
|
159
|
+
- **`js-yaml`**: For parsing YAML format schemas (optional)
|
|
160
|
+
|
|
161
|
+
If a YAML schema is encountered and `js-yaml` is not installed, the tool will
|
|
162
|
+
ask you to install it:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npm install js-yaml
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Security considerations
|
|
169
|
+
|
|
170
|
+
- The tool fetches schemas from remote URLs, so ensure you trust the source
|
|
171
|
+
- Review the fetched schema before using it to generate code or make API calls
|
|
172
|
+
- The tool does not execute any code from the fetched schema, it only parses and
|
|
173
|
+
displays the structure
|
|
174
|
+
|
|
175
|
+
## Examples
|
|
176
|
+
|
|
177
|
+
### Example 1: Exploring a public API
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
> Fetch the Swagger schema from https://petstore.swagger.io/v2/swagger.json and tell me what endpoints are available
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Codefly will fetch the schema, parse it, and provide a summary of all available
|
|
184
|
+
endpoints.
|
|
185
|
+
|
|
186
|
+
### Example 2: Generating API client code
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
> Get the Swagger schema from https://api.example.com/v2/api-docs in JSON format, then generate a Python client using the requests library
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Codefly will fetch the schema in JSON format and use it to generate a Python
|
|
193
|
+
client.
|
|
194
|
+
|
|
195
|
+
### Example 3: API documentation
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
> Fetch the Swagger schema from https://api.example.com/swagger.json and create comprehensive API documentation in markdown format, including all endpoints, parameters, and response schemas
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Codefly will analyze the schema and generate human-readable documentation.
|
|
202
|
+
|
|
203
|
+
## Troubleshooting
|
|
204
|
+
|
|
205
|
+
### "Failed to fetch Swagger schema: 404 Not Found"
|
|
206
|
+
|
|
207
|
+
The URL you provided does not point to a valid Swagger schema. Common
|
|
208
|
+
Swagger/OpenAPI endpoint paths include:
|
|
209
|
+
|
|
210
|
+
- `/swagger.json`
|
|
211
|
+
- `/swagger.yaml`
|
|
212
|
+
- `/v2/api-docs` (Springfox/SpringDoc)
|
|
213
|
+
- `/openapi.json`
|
|
214
|
+
- `/api-docs`
|
|
215
|
+
|
|
216
|
+
### "Failed to parse Swagger schema"
|
|
217
|
+
|
|
218
|
+
The content at the URL is not a valid JSON or YAML document. Ensure:
|
|
219
|
+
|
|
220
|
+
- The URL returns a proper Swagger/OpenAPI specification
|
|
221
|
+
- The content type is correct
|
|
222
|
+
- The file is not corrupted
|
|
223
|
+
|
|
224
|
+
### "The 'js-yaml' package is required"
|
|
225
|
+
|
|
226
|
+
If you're fetching a YAML schema, you need to install js-yaml:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npm install js-yaml
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## See also
|
|
233
|
+
|
|
234
|
+
- [Database Schema Tool](./database-schema.md) - For retrieving database schemas
|
|
235
|
+
- [Web Fetch Tool](./web-fetch.md) - For fetching general web content
|
|
236
|
+
- [File System Tools](./file-system.md) - For working with local files
|
|
@@ -28,6 +28,16 @@ topics on:
|
|
|
28
28
|
- **Organizational Users:** Contact your Google Cloud administrator to be
|
|
29
29
|
added to your organization's Gemini Code Assist subscription.
|
|
30
30
|
|
|
31
|
+
- **Error:
|
|
32
|
+
`Failed to login. Message: Your current account is not eligible... because it is not currently available in your location.`**
|
|
33
|
+
- **Cause:** Gemini CLI does not currently support your location. For a full
|
|
34
|
+
list of supported locations, see the following pages:
|
|
35
|
+
- Gemini Code Assist for individuals:
|
|
36
|
+
[Available locations](https://developers.google.com/gemini-code-assist/resources/available-locations#americas)
|
|
37
|
+
- Google AI Pro and Ultra where Gemini Code Assist (and Gemini CLI) is also
|
|
38
|
+
available:
|
|
39
|
+
[Available locations](https://developers.google.com/gemini-code-assist/resources/locations-pro-ultra)
|
|
40
|
+
|
|
31
41
|
- **Error: `Failed to login. Message: Request contains an invalid argument`**
|
|
32
42
|
- **Cause:** Users with Google Workspace accounts or Google Cloud accounts
|
|
33
43
|
associated with their Gmail accounts may not be able to activate the free
|
|
@@ -43,9 +53,15 @@ topics on:
|
|
|
43
53
|
- **Cause:** You may be on a corporate network with a firewall that intercepts
|
|
44
54
|
and inspects SSL/TLS traffic. This often requires a custom root CA
|
|
45
55
|
certificate to be trusted by Node.js.
|
|
46
|
-
- **Solution:**
|
|
47
|
-
|
|
48
|
-
-
|
|
56
|
+
- **Solution:** First try setting `NODE_USE_SYSTEM_CA`; if that does not
|
|
57
|
+
resolve the issue, set `NODE_EXTRA_CA_CERTS`.
|
|
58
|
+
- Set the `NODE_USE_SYSTEM_CA=1` environment variable to tell Node.js to use
|
|
59
|
+
the operating system's native certificate store (where corporate
|
|
60
|
+
certificates are typically already installed).
|
|
61
|
+
- Example: `export NODE_USE_SYSTEM_CA=1`
|
|
62
|
+
- Set the `NODE_EXTRA_CA_CERTS` environment variable to the absolute path of
|
|
63
|
+
your corporate root CA certificate file.
|
|
64
|
+
- Example: `export NODE_EXTRA_CA_CERTS=/path/to/your/corporate-ca.crt`
|
|
49
65
|
|
|
50
66
|
## Common error messages and solutions
|
|
51
67
|
|
|
@@ -124,13 +140,15 @@ This is especially useful for scripting and automation.
|
|
|
124
140
|
## Debugging tips
|
|
125
141
|
|
|
126
142
|
- **CLI debugging:**
|
|
127
|
-
- Use the `--debug` flag for more detailed output.
|
|
143
|
+
- Use the `--debug` flag for more detailed output. In interactive mode, press
|
|
144
|
+
F12 to view the debug console.
|
|
128
145
|
- Check the CLI logs, often found in a user-specific configuration or cache
|
|
129
146
|
directory.
|
|
130
147
|
|
|
131
148
|
- **Core debugging:**
|
|
132
149
|
- Check the server console output for error messages or stack traces.
|
|
133
|
-
- Increase log verbosity if configurable.
|
|
150
|
+
- Increase log verbosity if configurable. For example, set the `DEBUG_MODE`
|
|
151
|
+
environment variable to `true` or `1`.
|
|
134
152
|
- Use Node.js debugging tools (e.g., `node --inspect`) if you need to step
|
|
135
153
|
through server-side code.
|
|
136
154
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Priority system for policy rules:
|
|
2
|
+
# - Higher priority numbers win over lower priority numbers
|
|
3
|
+
# - When multiple rules match, the highest priority rule is applied
|
|
4
|
+
# - Rules are evaluated in order of priority (highest first)
|
|
5
|
+
#
|
|
6
|
+
# Priority bands (tiers):
|
|
7
|
+
# - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
|
|
8
|
+
# - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
|
|
9
|
+
# - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
|
|
10
|
+
#
|
|
11
|
+
# This ensures Admin > User > Default hierarchy is always preserved,
|
|
12
|
+
# while allowing user-specified priorities to work within each tier.
|
|
13
|
+
#
|
|
14
|
+
# Settings-based and dynamic rules (all in user tier 2.x):
|
|
15
|
+
# 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
|
|
16
|
+
# 2.9: MCP servers excluded list (security: persistent server blocks)
|
|
17
|
+
# 2.4: Command line flag --exclude-tools (explicit temporary blocks)
|
|
18
|
+
# 2.3: Command line flag --allowed-tools (explicit temporary allows)
|
|
19
|
+
# 2.2: MCP servers with trust=true (persistent trusted servers)
|
|
20
|
+
# 2.1: MCP servers allowed list (persistent general server allows)
|
|
21
|
+
#
|
|
22
|
+
# TOML policy priorities (before transformation):
|
|
23
|
+
# 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
|
|
24
|
+
# 20: Plan mode catch-all DENY override (becomes 1.020 in default tier)
|
|
25
|
+
# 50: Read-only tools (becomes 1.050 in default tier)
|
|
26
|
+
# 999: YOLO mode allow-all (becomes 1.999 in default tier)
|
|
27
|
+
|
|
28
|
+
# Catch-All: Deny everything by default in Plan mode.
|
|
29
|
+
|
|
30
|
+
[[rule]]
|
|
31
|
+
decision = "deny"
|
|
32
|
+
priority = 20
|
|
33
|
+
modes = ["plan"]
|
|
34
|
+
|
|
35
|
+
# Explicitly Allow Read-Only Tools in Plan mode.
|
|
36
|
+
|
|
37
|
+
[[rule]]
|
|
38
|
+
toolName = "glob"
|
|
39
|
+
decision = "allow"
|
|
40
|
+
priority = 50
|
|
41
|
+
modes = ["plan"]
|
|
42
|
+
|
|
43
|
+
[[rule]]
|
|
44
|
+
toolName = "search_file_content"
|
|
45
|
+
decision = "allow"
|
|
46
|
+
priority = 50
|
|
47
|
+
modes = ["plan"]
|
|
48
|
+
|
|
49
|
+
[[rule]]
|
|
50
|
+
toolName = "list_directory"
|
|
51
|
+
decision = "allow"
|
|
52
|
+
priority = 50
|
|
53
|
+
modes = ["plan"]
|
|
54
|
+
|
|
55
|
+
[[rule]]
|
|
56
|
+
toolName = "read_file"
|
|
57
|
+
decision = "allow"
|
|
58
|
+
priority = 50
|
|
59
|
+
modes = ["plan"]
|
|
60
|
+
|
|
61
|
+
[[rule]]
|
|
62
|
+
toolName = "google_web_search"
|
|
63
|
+
decision = "allow"
|
|
64
|
+
priority = 50
|
|
65
|
+
modes = ["plan"]
|
|
66
|
+
|
|
67
|
+
[[rule]]
|
|
68
|
+
toolName = "SubagentInvocation"
|
|
69
|
+
decision = "allow"
|
|
70
|
+
priority = 50
|