@intentsolutionsio/orm-code-generator 1.0.0 → 1.0.5
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/agents/orm-agent.md +34 -0
- package/package.json +1 -1
- package/skills/generating-orm-code/SKILL.md +12 -6
- package/skills/generating-orm-code/references/README.md +0 -1
- package/skills/generating-orm-code/scripts/generate_model.py +24 -24
- package/skills/generating-orm-code/scripts/generate_schema.py +21 -23
package/agents/orm-agent.md
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: orm-agent
|
|
3
3
|
description: Generate ORM models and schemas
|
|
4
|
+
tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- WebFetch
|
|
12
|
+
- WebSearch
|
|
13
|
+
- Task
|
|
14
|
+
- TodoWrite
|
|
15
|
+
model: sonnet
|
|
16
|
+
color: orange
|
|
17
|
+
version: 1.0.0
|
|
18
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
19
|
+
tags:
|
|
20
|
+
- database
|
|
21
|
+
- orm
|
|
22
|
+
disallowedTools: []
|
|
23
|
+
skills: []
|
|
24
|
+
background: false
|
|
25
|
+
# ── upgrade levers — uncomment + set when tuning this agent ──
|
|
26
|
+
# effort: high # reasoning depth: low/medium/high/xhigh/max (omit = inherit session)
|
|
27
|
+
# maxTurns: 50 # cap the agentic loop (omit = engine default)
|
|
28
|
+
# memory: project # persistent scope: user/project/local (omit = ephemeral)
|
|
29
|
+
# isolation: worktree # run in an isolated git worktree
|
|
30
|
+
# initialPrompt: "…" # seed the agent's first turn
|
|
31
|
+
# hooks / mcpServers / permissionMode → set at the PLUGIN level, not on a plugin agent
|
|
4
32
|
---
|
|
5
33
|
# ORM Code Generator Agent
|
|
6
34
|
|
|
@@ -9,18 +37,21 @@ You are an ORM code generation specialist supporting multiple ORM frameworks acr
|
|
|
9
37
|
## Supported ORMs
|
|
10
38
|
|
|
11
39
|
### JavaScript/TypeScript
|
|
40
|
+
|
|
12
41
|
- **TypeORM**: Decorators, entities, migrations
|
|
13
42
|
- **Prisma**: Schema definition language
|
|
14
43
|
- **Sequelize**: Model definitions, associations
|
|
15
44
|
- **Mongoose**: MongoDB schemas
|
|
16
45
|
|
|
17
46
|
### Python
|
|
47
|
+
|
|
18
48
|
- **SQLAlchemy**: Declarative models, relationships
|
|
19
49
|
- **Django ORM**: Models, managers, migrations
|
|
20
50
|
- **Peewee**: Simple ORM models
|
|
21
51
|
- **Tortoise ORM**: Async ORM
|
|
22
52
|
|
|
23
53
|
### Other Languages
|
|
54
|
+
|
|
24
55
|
- **Entity Framework** (C#)
|
|
25
56
|
- **Hibernate** (Java)
|
|
26
57
|
- **ActiveRecord** (Ruby)
|
|
@@ -50,6 +81,7 @@ You are an ORM code generation specialist supporting multiple ORM frameworks acr
|
|
|
50
81
|
## Example Outputs
|
|
51
82
|
|
|
52
83
|
### TypeORM Entity
|
|
84
|
+
|
|
53
85
|
```typescript
|
|
54
86
|
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm';
|
|
55
87
|
import { User } from './User';
|
|
@@ -74,6 +106,7 @@ export class Post {
|
|
|
74
106
|
```
|
|
75
107
|
|
|
76
108
|
### Prisma Schema
|
|
109
|
+
|
|
77
110
|
```prisma
|
|
78
111
|
model Post {
|
|
79
112
|
id Int @id @default(autoincrement())
|
|
@@ -86,6 +119,7 @@ model Post {
|
|
|
86
119
|
```
|
|
87
120
|
|
|
88
121
|
### SQLAlchemy Model
|
|
122
|
+
|
|
89
123
|
```python
|
|
90
124
|
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey
|
|
91
125
|
from sqlalchemy.orm import relationship
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentsolutionsio/orm-code-generator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Generate ORM models from database schemas or create database schemas from models for TypeORM, Prisma, Sequelize, SQLAlchemy, and more",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"orm",
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: generating-orm-code
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
This skill provides ORM model and code generation with comprehensive guidance and
|
|
3
|
+
description: 'Execute use when you need to work with ORM code generation.
|
|
4
|
+
|
|
5
|
+
This skill provides ORM model and code generation with comprehensive guidance and
|
|
6
|
+
automation.
|
|
7
|
+
|
|
6
8
|
Trigger with phrases like "generate ORM models", "create entity classes",
|
|
9
|
+
|
|
7
10
|
or "scaffold database models".
|
|
8
11
|
|
|
12
|
+
'
|
|
9
13
|
allowed-tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)
|
|
10
14
|
version: 1.0.0
|
|
11
15
|
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
12
16
|
license: MIT
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
tags:
|
|
18
|
+
- database
|
|
19
|
+
- orm-code
|
|
20
|
+
compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
|
|
15
21
|
---
|
|
16
22
|
# ORM Code Generator
|
|
17
23
|
|
|
@@ -93,4 +99,4 @@ Generate type-safe ORM model classes, migration files, and repository patterns f
|
|
|
93
99
|
- TypeORM entity documentation: https://typeorm.io/entities
|
|
94
100
|
- SQLAlchemy ORM tutorial: https://docs.sqlalchemy.org/en/20/orm/
|
|
95
101
|
- Drizzle ORM schema: https://orm.drizzle.team/docs/sql-schema-declaration
|
|
96
|
-
- Django inspectdb command: https://docs.djangoproject.com/en/5.0/howto/legacy-databases/
|
|
102
|
+
- Django inspectdb command: https://docs.djangoproject.com/en/5.0/howto/legacy-databases/
|
|
@@ -5,16 +5,17 @@ Generates ORM model code based on a database schema or user-defined model defini
|
|
|
5
5
|
Generated: 2025-12-10 03:48:17
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
import os
|
|
9
8
|
import json
|
|
10
9
|
import argparse
|
|
11
10
|
from pathlib import Path
|
|
12
11
|
from datetime import datetime
|
|
12
|
+
from typing import Dict
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
class Generator:
|
|
15
16
|
def __init__(self, config: Dict):
|
|
16
17
|
self.config = config
|
|
17
|
-
self.output_dir = Path(config.get(
|
|
18
|
+
self.output_dir = Path(config.get("output", "./output"))
|
|
18
19
|
self.output_dir.mkdir(parents=True, exist_ok=True)
|
|
19
20
|
|
|
20
21
|
def generate_markdown(self, title: str, content: str) -> Path:
|
|
@@ -25,7 +26,7 @@ class Generator:
|
|
|
25
26
|
md_content = f"""# {title}
|
|
26
27
|
|
|
27
28
|
Generated by orm-code-generator
|
|
28
|
-
Date: {datetime.now().strftime(
|
|
29
|
+
Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
29
30
|
|
|
30
31
|
## Overview
|
|
31
32
|
{content}
|
|
@@ -56,10 +57,10 @@ orm-code-generator
|
|
|
56
57
|
"category": "database",
|
|
57
58
|
"plugin": "orm-code-generator",
|
|
58
59
|
"data": data,
|
|
59
|
-
"config": self.config
|
|
60
|
+
"config": self.config,
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
with open(file_path,
|
|
63
|
+
with open(file_path, "w") as f:
|
|
63
64
|
json.dump(output_data, f, indent=2)
|
|
64
65
|
|
|
65
66
|
return file_path
|
|
@@ -71,7 +72,7 @@ orm-code-generator
|
|
|
71
72
|
|
|
72
73
|
script_content = f"""#!/bin/bash
|
|
73
74
|
# Generated by orm-code-generator
|
|
74
|
-
# Date: {datetime.now().strftime(
|
|
75
|
+
# Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
75
76
|
|
|
76
77
|
set -e # Exit on error
|
|
77
78
|
|
|
@@ -87,17 +88,20 @@ echo "✅ Completed successfully"
|
|
|
87
88
|
file_path.chmod(0o755) # Make executable
|
|
88
89
|
return file_path
|
|
89
90
|
|
|
91
|
+
|
|
90
92
|
def main():
|
|
91
|
-
parser = argparse.ArgumentParser(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
parser.add_argument(
|
|
95
|
-
parser.add_argument(
|
|
96
|
-
parser.add_argument(
|
|
93
|
+
parser = argparse.ArgumentParser(
|
|
94
|
+
description="Generates ORM model code based on a database schema or user-defined model definition."
|
|
95
|
+
)
|
|
96
|
+
parser.add_argument("--type", choices=["markdown", "json", "script"], default="markdown")
|
|
97
|
+
parser.add_argument("--output", "-o", default="./output", help="Output directory")
|
|
98
|
+
parser.add_argument("--config", "-c", help="Configuration file")
|
|
99
|
+
parser.add_argument("--title", default="orm-code-generator Output")
|
|
100
|
+
parser.add_argument("--content", help="Content to include")
|
|
97
101
|
|
|
98
102
|
args = parser.parse_args()
|
|
99
103
|
|
|
100
|
-
config = {
|
|
104
|
+
config = {"output": args.output}
|
|
101
105
|
if args.config and Path(args.config).exists():
|
|
102
106
|
with open(args.config) as f:
|
|
103
107
|
config.update(json.load(f))
|
|
@@ -106,24 +110,20 @@ def main():
|
|
|
106
110
|
|
|
107
111
|
print(f"🔧 Generating {args.type} output...")
|
|
108
112
|
|
|
109
|
-
if args.type ==
|
|
110
|
-
output_file = generator.generate_markdown(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
elif args.type == 'json':
|
|
115
|
-
output_file = generator.generate_json(
|
|
116
|
-
{"title": args.title, "content": args.content}
|
|
117
|
-
)
|
|
113
|
+
if args.type == "markdown":
|
|
114
|
+
output_file = generator.generate_markdown(args.title, args.content or "Generated content")
|
|
115
|
+
elif args.type == "json":
|
|
116
|
+
output_file = generator.generate_json({"title": args.title, "content": args.content})
|
|
118
117
|
else: # script
|
|
119
118
|
output_file = generator.generate_script(
|
|
120
|
-
args.title.lower().replace(
|
|
121
|
-
args.content or "# Add your script content here"
|
|
119
|
+
args.title.lower().replace(" ", "_"), args.content or "# Add your script content here"
|
|
122
120
|
)
|
|
123
121
|
|
|
124
122
|
print(f"✅ Generated: {output_file}")
|
|
125
123
|
return 0
|
|
126
124
|
|
|
125
|
+
|
|
127
126
|
if __name__ == "__main__":
|
|
128
127
|
import sys
|
|
128
|
+
|
|
129
129
|
sys.exit(main())
|
|
@@ -5,16 +5,17 @@ Generates database schema based on an ORM model definition.
|
|
|
5
5
|
Generated: 2025-12-10 03:48:17
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
import os
|
|
9
8
|
import json
|
|
10
9
|
import argparse
|
|
11
10
|
from pathlib import Path
|
|
12
11
|
from datetime import datetime
|
|
12
|
+
from typing import Dict
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
class Generator:
|
|
15
16
|
def __init__(self, config: Dict):
|
|
16
17
|
self.config = config
|
|
17
|
-
self.output_dir = Path(config.get(
|
|
18
|
+
self.output_dir = Path(config.get("output", "./output"))
|
|
18
19
|
self.output_dir.mkdir(parents=True, exist_ok=True)
|
|
19
20
|
|
|
20
21
|
def generate_markdown(self, title: str, content: str) -> Path:
|
|
@@ -25,7 +26,7 @@ class Generator:
|
|
|
25
26
|
md_content = f"""# {title}
|
|
26
27
|
|
|
27
28
|
Generated by orm-code-generator
|
|
28
|
-
Date: {datetime.now().strftime(
|
|
29
|
+
Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
29
30
|
|
|
30
31
|
## Overview
|
|
31
32
|
{content}
|
|
@@ -56,10 +57,10 @@ orm-code-generator
|
|
|
56
57
|
"category": "database",
|
|
57
58
|
"plugin": "orm-code-generator",
|
|
58
59
|
"data": data,
|
|
59
|
-
"config": self.config
|
|
60
|
+
"config": self.config,
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
with open(file_path,
|
|
63
|
+
with open(file_path, "w") as f:
|
|
63
64
|
json.dump(output_data, f, indent=2)
|
|
64
65
|
|
|
65
66
|
return file_path
|
|
@@ -71,7 +72,7 @@ orm-code-generator
|
|
|
71
72
|
|
|
72
73
|
script_content = f"""#!/bin/bash
|
|
73
74
|
# Generated by orm-code-generator
|
|
74
|
-
# Date: {datetime.now().strftime(
|
|
75
|
+
# Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
75
76
|
|
|
76
77
|
set -e # Exit on error
|
|
77
78
|
|
|
@@ -87,17 +88,18 @@ echo "✅ Completed successfully"
|
|
|
87
88
|
file_path.chmod(0o755) # Make executable
|
|
88
89
|
return file_path
|
|
89
90
|
|
|
91
|
+
|
|
90
92
|
def main():
|
|
91
93
|
parser = argparse.ArgumentParser(description="Generates database schema based on an ORM model definition.")
|
|
92
|
-
parser.add_argument(
|
|
93
|
-
parser.add_argument(
|
|
94
|
-
parser.add_argument(
|
|
95
|
-
parser.add_argument(
|
|
96
|
-
parser.add_argument(
|
|
94
|
+
parser.add_argument("--type", choices=["markdown", "json", "script"], default="markdown")
|
|
95
|
+
parser.add_argument("--output", "-o", default="./output", help="Output directory")
|
|
96
|
+
parser.add_argument("--config", "-c", help="Configuration file")
|
|
97
|
+
parser.add_argument("--title", default="orm-code-generator Output")
|
|
98
|
+
parser.add_argument("--content", help="Content to include")
|
|
97
99
|
|
|
98
100
|
args = parser.parse_args()
|
|
99
101
|
|
|
100
|
-
config = {
|
|
102
|
+
config = {"output": args.output}
|
|
101
103
|
if args.config and Path(args.config).exists():
|
|
102
104
|
with open(args.config) as f:
|
|
103
105
|
config.update(json.load(f))
|
|
@@ -106,24 +108,20 @@ def main():
|
|
|
106
108
|
|
|
107
109
|
print(f"🔧 Generating {args.type} output...")
|
|
108
110
|
|
|
109
|
-
if args.type ==
|
|
110
|
-
output_file = generator.generate_markdown(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
elif args.type == 'json':
|
|
115
|
-
output_file = generator.generate_json(
|
|
116
|
-
{"title": args.title, "content": args.content}
|
|
117
|
-
)
|
|
111
|
+
if args.type == "markdown":
|
|
112
|
+
output_file = generator.generate_markdown(args.title, args.content or "Generated content")
|
|
113
|
+
elif args.type == "json":
|
|
114
|
+
output_file = generator.generate_json({"title": args.title, "content": args.content})
|
|
118
115
|
else: # script
|
|
119
116
|
output_file = generator.generate_script(
|
|
120
|
-
args.title.lower().replace(
|
|
121
|
-
args.content or "# Add your script content here"
|
|
117
|
+
args.title.lower().replace(" ", "_"), args.content or "# Add your script content here"
|
|
122
118
|
)
|
|
123
119
|
|
|
124
120
|
print(f"✅ Generated: {output_file}")
|
|
125
121
|
return 0
|
|
126
122
|
|
|
123
|
+
|
|
127
124
|
if __name__ == "__main__":
|
|
128
125
|
import sys
|
|
126
|
+
|
|
129
127
|
sys.exit(main())
|