@votadev/tooncode 2.2.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/README.md +243 -0
- package/__main__.py +2 -0
- package/bin/postinstall.js +81 -0
- package/bin/tooncode.js +104 -0
- package/package.json +42 -0
- package/requirements.txt +4 -0
- package/setup.py +22 -0
- package/skills/api/endpoint.md +16 -0
- package/skills/api/mock.md +15 -0
- package/skills/arch/diagram.md +14 -0
- package/skills/arch/pattern.md +15 -0
- package/skills/arch/split.md +16 -0
- package/skills/code/convert.md +15 -0
- package/skills/code/deps.md +15 -0
- package/skills/code/explain.md +13 -0
- package/skills/code/lint.md +23 -0
- package/skills/code/optimize.md +11 -0
- package/skills/code/refactor.md +26 -0
- package/skills/code/review.md +24 -0
- package/skills/code/scaffold.md +13 -0
- package/skills/code/test.md +26 -0
- package/skills/code/types.md +12 -0
- package/skills/data/migrate.md +14 -0
- package/skills/data/seed.md +13 -0
- package/skills/data/sql.md +14 -0
- package/skills/debug/error.md +27 -0
- package/skills/debug/fix.md +23 -0
- package/skills/debug/perf.md +16 -0
- package/skills/debug/trace.md +12 -0
- package/skills/devops/ci.md +16 -0
- package/skills/devops/docker.md +15 -0
- package/skills/doc/api.md +15 -0
- package/skills/doc/readme.md +29 -0
- package/skills/git/changelog.md +16 -0
- package/skills/git/commit.md +12 -0
- package/skills/git/pr.md +17 -0
- package/skills/security/audit.md +24 -0
- package/skills/security/secrets.md +13 -0
- package/tooncode.cmd +2 -0
- package/tooncode.py +5493 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactor
|
|
3
|
+
description: Refactor code (auto-detect or specify target)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Refactor target: {{input}}
|
|
7
|
+
|
|
8
|
+
## If a file was specified:
|
|
9
|
+
Refactor that specific file.
|
|
10
|
+
|
|
11
|
+
## If nothing specified (auto-detect):
|
|
12
|
+
1. Find the largest/most complex files: `wc -l *.py` or equivalent
|
|
13
|
+
2. Check for code smells:
|
|
14
|
+
- Functions longer than 50 lines
|
|
15
|
+
- Files longer than 500 lines
|
|
16
|
+
- Deep nesting (3+ levels)
|
|
17
|
+
- Duplicated code blocks
|
|
18
|
+
3. Pick the worst offender and refactor it
|
|
19
|
+
|
|
20
|
+
## Refactor checklist:
|
|
21
|
+
- Improve naming clarity
|
|
22
|
+
- Extract long functions into smaller ones
|
|
23
|
+
- Remove duplication (DRY)
|
|
24
|
+
- Simplify complex conditionals
|
|
25
|
+
- Better structure and separation of concerns
|
|
26
|
+
Show diff of every change.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review
|
|
3
|
+
description: Review code for bugs and security (auto-detect scope)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Review target: {{input}}
|
|
7
|
+
|
|
8
|
+
## If a file/folder was specified:
|
|
9
|
+
Read and review that specific target.
|
|
10
|
+
|
|
11
|
+
## If nothing specified (auto-detect):
|
|
12
|
+
1. Run `git diff` or `git diff --staged` to find recent changes
|
|
13
|
+
2. If no changes, review the main source files in the project
|
|
14
|
+
3. Focus on the most critical files first
|
|
15
|
+
|
|
16
|
+
## Review checklist:
|
|
17
|
+
- Security vulnerabilities (injection, XSS, auth bypass)
|
|
18
|
+
- Logic errors and edge cases
|
|
19
|
+
- Performance bottlenecks
|
|
20
|
+
- Error handling gaps
|
|
21
|
+
- Race conditions / concurrency issues
|
|
22
|
+
|
|
23
|
+
Output a report with severity: Critical / High / Medium / Low
|
|
24
|
+
For each: file:line, problem, fix suggestion.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold
|
|
3
|
+
description: Generate project boilerplate / new feature structure
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Scaffold: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Detect or ask: language, framework, project type
|
|
9
|
+
2. Create the file/folder structure
|
|
10
|
+
3. Write boilerplate code with proper imports
|
|
11
|
+
4. Add config files if needed (tsconfig, pyproject.toml, etc.)
|
|
12
|
+
5. Initialize dependencies (package.json, requirements.txt)
|
|
13
|
+
6. Make it runnable immediately
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test
|
|
3
|
+
description: Generate tests (auto-detect what needs testing)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Test target: {{input}}
|
|
7
|
+
|
|
8
|
+
## If a file was specified:
|
|
9
|
+
Write tests for that specific file.
|
|
10
|
+
|
|
11
|
+
## If nothing specified (auto-detect):
|
|
12
|
+
1. Find source files that have NO corresponding test files
|
|
13
|
+
2. Check `git diff` for recently changed files without tests
|
|
14
|
+
3. Prioritize: most critical/complex files first
|
|
15
|
+
4. Generate tests for the top 3 untested files
|
|
16
|
+
|
|
17
|
+
## For each test file:
|
|
18
|
+
1. Detect language -> choose framework (pytest, jest, vitest, go test)
|
|
19
|
+
2. Read the source code first
|
|
20
|
+
3. Write tests covering:
|
|
21
|
+
- Happy path
|
|
22
|
+
- Edge cases (empty, null, max values)
|
|
23
|
+
- Error handling
|
|
24
|
+
- Boundary conditions
|
|
25
|
+
4. Run the tests
|
|
26
|
+
5. Fix any failures
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: types
|
|
3
|
+
description: Add type annotations / interfaces
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Add type annotations to: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Read the code and infer types from usage
|
|
9
|
+
2. Add type hints (Python), TypeScript types, or Go type assertions
|
|
10
|
+
3. Create interfaces/types for complex objects
|
|
11
|
+
4. Add generics where appropriate
|
|
12
|
+
5. Verify no type errors (run mypy/tsc if available)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migrate
|
|
3
|
+
description: Create database migration
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Create database migration for: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Read existing models/schema
|
|
9
|
+
2. Generate migration file with:
|
|
10
|
+
- up() - apply changes
|
|
11
|
+
- down() - rollback changes
|
|
12
|
+
3. Use the project's migration tool (alembic, knex, prisma, django)
|
|
13
|
+
4. Handle: new tables, column changes, indexes, foreign keys
|
|
14
|
+
5. Test both up and down migrations
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: seed
|
|
3
|
+
description: Generate seed/fixture data
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Generate seed data for: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Read the data models/schema
|
|
9
|
+
2. Create realistic sample data (not lorem ipsum)
|
|
10
|
+
3. Respect relationships and foreign keys
|
|
11
|
+
4. Include edge cases (empty strings, nulls, long text, unicode)
|
|
12
|
+
5. Write as: seed script, SQL inserts, JSON fixtures, or factory functions
|
|
13
|
+
6. Make it idempotent (safe to run multiple times)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sql
|
|
3
|
+
description: Write and optimize SQL queries
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
SQL task: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Understand the schema (read models or migration files)
|
|
9
|
+
2. Write the query with:
|
|
10
|
+
- Proper JOINs (avoid N+1)
|
|
11
|
+
- Indexes consideration
|
|
12
|
+
- Pagination if needed
|
|
13
|
+
3. Optimize: EXPLAIN ANALYZE if database is available
|
|
14
|
+
4. Add as a named query, repository method, or ORM equivalent
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: error
|
|
3
|
+
description: Add error handling (auto-detect files or specify)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Target: {{input}}
|
|
7
|
+
|
|
8
|
+
## If a file/module was specified:
|
|
9
|
+
1. Read the specified file
|
|
10
|
+
2. Find all unhandled failure points
|
|
11
|
+
3. Add proper error handling
|
|
12
|
+
|
|
13
|
+
## If nothing specified (auto-detect):
|
|
14
|
+
1. Glob all source files in project
|
|
15
|
+
2. Search for risky patterns:
|
|
16
|
+
- Bare `except:` or `catch(e)` with no handling
|
|
17
|
+
- Missing null checks
|
|
18
|
+
- Unvalidated user input
|
|
19
|
+
- Network/file operations without try/catch
|
|
20
|
+
3. Fix the worst offenders first
|
|
21
|
+
4. Add logging where needed
|
|
22
|
+
|
|
23
|
+
For each fix:
|
|
24
|
+
- Use specific error types (not generic)
|
|
25
|
+
- Add meaningful error messages
|
|
26
|
+
- Add appropriate logging (error/warn/info)
|
|
27
|
+
- Add graceful degradation where possible
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix
|
|
3
|
+
description: Find and fix bugs (auto-detect or specify)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Bug to fix: {{input}}
|
|
7
|
+
|
|
8
|
+
## If a specific bug was described:
|
|
9
|
+
1. Search codebase for related code
|
|
10
|
+
2. Identify root cause
|
|
11
|
+
3. Fix it
|
|
12
|
+
4. Verify the fix
|
|
13
|
+
|
|
14
|
+
## If no bug was specified (auto-detect):
|
|
15
|
+
1. Run `git diff` to see recent changes that might have caused issues
|
|
16
|
+
2. Run tests: `pytest` / `npm test` / `go test ./...` (detect which)
|
|
17
|
+
3. Check for common issues:
|
|
18
|
+
- Import errors
|
|
19
|
+
- Syntax errors
|
|
20
|
+
- Runtime errors in recent changes
|
|
21
|
+
4. Read error logs if available
|
|
22
|
+
5. Fix all found issues
|
|
23
|
+
6. Re-run tests to confirm
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf
|
|
3
|
+
description: Profile and find performance bottlenecks
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Profile: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Add timing/profiling instrumentation
|
|
9
|
+
2. Run the code and collect metrics
|
|
10
|
+
3. Identify top bottlenecks:
|
|
11
|
+
- Slow functions (wall time)
|
|
12
|
+
- Memory usage spikes
|
|
13
|
+
- Unnecessary I/O or network calls
|
|
14
|
+
- N+1 query patterns
|
|
15
|
+
4. Fix the top 3 bottlenecks
|
|
16
|
+
5. Show before/after timing comparison
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trace
|
|
3
|
+
description: Trace execution flow of a feature
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Trace the execution flow of: {{input}}
|
|
7
|
+
|
|
8
|
+
1. Find the entry point
|
|
9
|
+
2. Follow the call chain step by step
|
|
10
|
+
3. Note key data transformations
|
|
11
|
+
4. Identify external calls (API, DB, filesystem)
|
|
12
|
+
5. Draw a simple flow: function A -> function B -> ...
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ci
|
|
3
|
+
description: Generate CI/CD pipeline config
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Create CI/CD pipeline for this project:
|
|
7
|
+
|
|
8
|
+
1. Detect language and framework
|
|
9
|
+
2. Generate config for {{input}} (default: GitHub Actions)
|
|
10
|
+
3. Include stages:
|
|
11
|
+
- Install dependencies
|
|
12
|
+
- Lint / format check
|
|
13
|
+
- Run tests
|
|
14
|
+
- Build
|
|
15
|
+
- Deploy (if applicable)
|
|
16
|
+
4. Add caching for faster builds
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docker
|
|
3
|
+
description: Generate Dockerfile and docker-compose
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Analyze the project and create:
|
|
7
|
+
|
|
8
|
+
1. **Dockerfile** - multi-stage build, minimal image, non-root user
|
|
9
|
+
2. **docker-compose.yml** - if multiple services needed
|
|
10
|
+
3. **.dockerignore** - exclude unnecessary files
|
|
11
|
+
|
|
12
|
+
Optimize for:
|
|
13
|
+
- Small image size
|
|
14
|
+
- Fast builds (layer caching)
|
|
15
|
+
- Security (non-root, no secrets in image)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api
|
|
3
|
+
description: Generate API documentation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Read {{input}} and generate API documentation:
|
|
7
|
+
|
|
8
|
+
For each endpoint/function:
|
|
9
|
+
- Method + path (or function signature)
|
|
10
|
+
- Description
|
|
11
|
+
- Parameters (name, type, required, description)
|
|
12
|
+
- Request body example
|
|
13
|
+
- Response example
|
|
14
|
+
- Error codes
|
|
15
|
+
- Usage example (curl or code)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: readme
|
|
3
|
+
description: Generate or update README.md
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Read the project structure and code, then generate a comprehensive README.md:
|
|
7
|
+
|
|
8
|
+
# Project Name
|
|
9
|
+
- Badge placeholders
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
- What this project does
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
- Step by step
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
- Code examples
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
- Environment variables, config files
|
|
22
|
+
|
|
23
|
+
## API / Commands
|
|
24
|
+
- Available endpoints or CLI commands
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
- How to set up dev environment, run tests
|
|
28
|
+
|
|
29
|
+
## License
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: changelog
|
|
3
|
+
description: Generate changelog from git history
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Generate CHANGELOG.md:
|
|
7
|
+
|
|
8
|
+
1. Read git log: `git log --oneline --since="last month"` (or {{input}} range)
|
|
9
|
+
2. Categorize commits:
|
|
10
|
+
- Features (feat:)
|
|
11
|
+
- Bug Fixes (fix:)
|
|
12
|
+
- Breaking Changes (breaking:)
|
|
13
|
+
- Other (refactor, docs, chore)
|
|
14
|
+
3. Format as Keep a Changelog standard
|
|
15
|
+
4. Include date and version if tagged
|
|
16
|
+
5. Write/update CHANGELOG.md
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit
|
|
3
|
+
description: Smart git commit with auto-generated message
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
1. Run `git diff --staged` and `git diff` to see all changes
|
|
7
|
+
2. If nothing staged, run `git add -A`
|
|
8
|
+
3. Write a clear commit message:
|
|
9
|
+
- First line: type(scope): summary (under 72 chars)
|
|
10
|
+
- Types: feat, fix, refactor, docs, test, chore
|
|
11
|
+
- Body: what changed and why
|
|
12
|
+
4. Commit with the message
|
package/skills/git/pr.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr
|
|
3
|
+
description: Create a pull request with summary
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
1. Check current branch and commits ahead of main
|
|
7
|
+
2. Run `git diff main...HEAD` to see all changes
|
|
8
|
+
3. Write a PR description:
|
|
9
|
+
## Summary
|
|
10
|
+
- Bullet points of what changed
|
|
11
|
+
|
|
12
|
+
## Changes
|
|
13
|
+
- File-by-file breakdown
|
|
14
|
+
|
|
15
|
+
## Testing
|
|
16
|
+
- How to test these changes
|
|
17
|
+
4. Create PR using `gh pr create` if gh CLI is available
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audit
|
|
3
|
+
description: Security audit - OWASP top 10 scan
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Security audit this project for OWASP Top 10:
|
|
7
|
+
|
|
8
|
+
1. **Injection** - SQL, NoSQL, OS command, LDAP
|
|
9
|
+
2. **Broken Auth** - weak passwords, session management
|
|
10
|
+
3. **Sensitive Data** - exposed secrets, unencrypted data
|
|
11
|
+
4. **XXE** - XML external entity
|
|
12
|
+
5. **Broken Access Control** - privilege escalation, IDOR
|
|
13
|
+
6. **Misconfig** - default credentials, verbose errors, open CORS
|
|
14
|
+
7. **XSS** - reflected, stored, DOM-based
|
|
15
|
+
8. **Insecure Deserialization** - pickle, yaml.load, JSON parse
|
|
16
|
+
9. **Known Vulnerabilities** - outdated dependencies
|
|
17
|
+
10. **Logging** - insufficient logging, log injection
|
|
18
|
+
|
|
19
|
+
Also check for:
|
|
20
|
+
- Hardcoded secrets (API keys, passwords, tokens)
|
|
21
|
+
- .env files in git
|
|
22
|
+
- Unsafe file operations
|
|
23
|
+
|
|
24
|
+
Output: severity, file:line, description, fix.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: secrets
|
|
3
|
+
description: Scan for hardcoded secrets and credentials
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Scan entire project for hardcoded secrets:
|
|
7
|
+
|
|
8
|
+
1. Search for patterns: API keys, tokens, passwords, connection strings
|
|
9
|
+
2. Check: .env files, config files, source code, scripts
|
|
10
|
+
3. Check .gitignore covers sensitive files
|
|
11
|
+
4. Verify no secrets in git history: `git log -p | grep -i "password\|secret\|api.key\|token"`
|
|
12
|
+
5. Suggest: use environment variables or secret manager
|
|
13
|
+
6. Create/update .gitignore if needed
|
package/tooncode.cmd
ADDED