sqlobjects 1.0.11__tar.gz → 1.0.12__tar.gz
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.
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/CHANGELOG.md +6 -0
- {sqlobjects-1.0.11/sqlobjects.egg-info → sqlobjects-1.0.12}/PKG-INFO +9 -6
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/README.md +8 -1
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/docs/rules/README.md +9 -5
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/pyproject.toml +7 -7
- sqlobjects-1.0.12/scripts/__init__.py +1 -0
- sqlobjects-1.0.12/scripts/install_rules.py +90 -0
- sqlobjects-1.0.12/setup.py +7 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12/sqlobjects.egg-info}/PKG-INFO +9 -6
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects.egg-info/SOURCES.txt +3 -1
- sqlobjects-1.0.12/sqlobjects.egg-info/entry_points.txt +2 -0
- sqlobjects-1.0.12/sqlobjects.egg-info/requires.txt +1 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects.egg-info/top_level.txt +1 -0
- sqlobjects-1.0.11/MANIFEST.in +0 -4
- sqlobjects-1.0.11/setup.py +0 -105
- sqlobjects-1.0.11/sqlobjects.egg-info/requires.txt +0 -9
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/LICENSE +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/docs/rules/01-database-session-guide.md +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/docs/rules/02-model-definition-guide.md +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/docs/rules/03-query-operations-guide.md +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/docs/rules/04-crud-operations-guide.md +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/docs/rules/05-relationships-guide.md +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/docs/rules/06-validation-signals-guide.md +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/docs/rules/07-performance-guide.md +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/setup.cfg +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/cascade.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/database/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/database/config.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/database/manager.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/exceptions.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/expressions/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/expressions/aggregate.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/expressions/base.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/expressions/function.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/expressions/mixins.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/expressions/scalar.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/expressions/subquery.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/expressions/terminal.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/core.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/functions.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/proxies.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/relations/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/relations/descriptors.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/relations/managers.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/relations/prefetch.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/relations/strategies.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/relations/utils.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/shortcuts.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/types/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/types/base.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/types/comparators.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/types/registry.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/fields/utils.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/internal/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/internal/operations.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/internal/results.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/metadata.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/mixins.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/model.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/objects/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/objects/bulk.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/objects/core.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/objects/upsert.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/queries/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/queries/builder.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/queries/dialect.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/queries/executor.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/queryset.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/session.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/signals.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/utils/__init__.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/utils/inspect.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/utils/naming.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/utils/pattern.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects/validators.py +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/sqlobjects.egg-info/dependency_links.txt +0 -0
- {sqlobjects-1.0.11 → sqlobjects-1.0.12}/tests/test_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlobjects
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.12
|
|
4
4
|
Summary: Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading
|
|
5
5
|
Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
6
6
|
Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
@@ -26,10 +26,6 @@ Requires-Python: >=3.12
|
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.43
|
|
29
|
-
Provides-Extra: amazonq
|
|
30
|
-
Provides-Extra: kiro
|
|
31
|
-
Provides-Extra: claude
|
|
32
|
-
Provides-Extra: cursor
|
|
33
29
|
Dynamic: license-file
|
|
34
30
|
|
|
35
31
|
# SQLObjects
|
|
@@ -233,7 +229,14 @@ Best practices and usage patterns optimized for AI coding assistants:
|
|
|
233
229
|
- [Validation & Signals Guide](docs/rules/06-validation-signals-guide.md) - Data validation and lifecycle hooks
|
|
234
230
|
- [Performance Guide](docs/rules/07-performance-guide.md) - Optimization techniques and best practices
|
|
235
231
|
|
|
236
|
-
**Installation**:
|
|
232
|
+
**Installation**:
|
|
233
|
+
```bash
|
|
234
|
+
# Install package
|
|
235
|
+
pip install sqlobjects
|
|
236
|
+
|
|
237
|
+
# Install rules for your AI assistant
|
|
238
|
+
sqlobjects-install-rules amazonq # or cursor, claude, kiro
|
|
239
|
+
```
|
|
237
240
|
|
|
238
241
|
### Feature Documentation
|
|
239
242
|
|
|
@@ -199,7 +199,14 @@ Best practices and usage patterns optimized for AI coding assistants:
|
|
|
199
199
|
- [Validation & Signals Guide](docs/rules/06-validation-signals-guide.md) - Data validation and lifecycle hooks
|
|
200
200
|
- [Performance Guide](docs/rules/07-performance-guide.md) - Optimization techniques and best practices
|
|
201
201
|
|
|
202
|
-
**Installation**:
|
|
202
|
+
**Installation**:
|
|
203
|
+
```bash
|
|
204
|
+
# Install package
|
|
205
|
+
pip install sqlobjects
|
|
206
|
+
|
|
207
|
+
# Install rules for your AI assistant
|
|
208
|
+
sqlobjects-install-rules amazonq # or cursor, claude, kiro
|
|
209
|
+
```
|
|
203
210
|
|
|
204
211
|
### Feature Documentation
|
|
205
212
|
|
|
@@ -42,13 +42,17 @@ These rules complement the full documentation:
|
|
|
42
42
|
|
|
43
43
|
## Installation
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Install the package, then install rules for your AI assistant:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
|
|
49
|
-
pip install sqlobjects
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
# Install SQLObjects
|
|
49
|
+
pip install sqlobjects
|
|
50
|
+
|
|
51
|
+
# Install rules for your AI assistant
|
|
52
|
+
sqlobjects-install-rules amazonq # For Amazon Q
|
|
53
|
+
sqlobjects-install-rules cursor # For Cursor
|
|
54
|
+
sqlobjects-install-rules claude # For Claude
|
|
55
|
+
sqlobjects-install-rules kiro # For Kiro
|
|
52
56
|
```
|
|
53
57
|
|
|
54
58
|
## Version
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sqlobjects"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.12"
|
|
4
4
|
description = "Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = { text = "MIT" }
|
|
@@ -38,11 +38,8 @@ dependencies = [
|
|
|
38
38
|
"sqlalchemy[asyncio]>=2.0.43",
|
|
39
39
|
]
|
|
40
40
|
|
|
41
|
-
[project.
|
|
42
|
-
|
|
43
|
-
kiro = []
|
|
44
|
-
claude = []
|
|
45
|
-
cursor = []
|
|
41
|
+
[project.scripts]
|
|
42
|
+
sqlobjects-install-rules = "scripts.install_rules:main"
|
|
46
43
|
|
|
47
44
|
[project.urls]
|
|
48
45
|
Homepage = "https://github.com/XtraVisionsAI/sqlobjects"
|
|
@@ -75,11 +72,14 @@ build-backend = "setuptools.build_meta"
|
|
|
75
72
|
include-package-data = true
|
|
76
73
|
|
|
77
74
|
[tool.setuptools.packages.find]
|
|
78
|
-
include = ["sqlobjects*"]
|
|
75
|
+
include = ["sqlobjects*", "scripts*"]
|
|
79
76
|
|
|
80
77
|
[tool.setuptools.package-data]
|
|
81
78
|
sqlobjects = ["py.typed"]
|
|
82
79
|
|
|
80
|
+
[tool.setuptools.data-files]
|
|
81
|
+
"docs/rules" = ["docs/rules/*.md"]
|
|
82
|
+
|
|
83
83
|
[[tool.uv.index]]
|
|
84
84
|
name = "tsinghua"
|
|
85
85
|
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Scripts for SQLObjects package management."""
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Install AI assistant rules to configuration directories."""
|
|
2
|
+
|
|
3
|
+
import shutil
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def install_rules(target_name: str) -> bool:
|
|
9
|
+
"""Install rules to AI assistant configuration directory.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
target_name: Target AI assistant (amazonq, kiro, claude, cursor)
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
True if successful, False otherwise
|
|
16
|
+
"""
|
|
17
|
+
# Get rules directory from package installation
|
|
18
|
+
try:
|
|
19
|
+
# Find the package installation directory
|
|
20
|
+
import sqlobjects
|
|
21
|
+
|
|
22
|
+
package_root = Path(sqlobjects.__file__).parent.parent
|
|
23
|
+
rules_dir = package_root / "docs" / "rules"
|
|
24
|
+
except Exception as e:
|
|
25
|
+
print(f"Error: Cannot locate sqlobjects package: {e}", file=sys.stderr)
|
|
26
|
+
return False
|
|
27
|
+
|
|
28
|
+
# Target directory mapping
|
|
29
|
+
target_dirs = {
|
|
30
|
+
"amazonq": Path.home() / ".amazonq" / "rules" / "sqlobjects",
|
|
31
|
+
"kiro": Path.home() / ".kiro" / "rules" / "sqlobjects",
|
|
32
|
+
"claude": Path.home() / ".claude" / "rules" / "sqlobjects",
|
|
33
|
+
"cursor": Path.home() / ".cursor" / "rules" / "sqlobjects",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
target_dir = target_dirs.get(target_name)
|
|
37
|
+
if not target_dir:
|
|
38
|
+
print(f"Error: Unknown target '{target_name}'", file=sys.stderr)
|
|
39
|
+
print(f"Valid targets: {', '.join(target_dirs.keys())}", file=sys.stderr)
|
|
40
|
+
return False
|
|
41
|
+
|
|
42
|
+
if not rules_dir.exists():
|
|
43
|
+
print(f"Error: Rules directory not found at {rules_dir}", file=sys.stderr)
|
|
44
|
+
return False
|
|
45
|
+
|
|
46
|
+
# Create target directory and copy files
|
|
47
|
+
try:
|
|
48
|
+
target_dir.mkdir(parents=True, exist_ok=True)
|
|
49
|
+
|
|
50
|
+
copied_count = 0
|
|
51
|
+
for file in rules_dir.glob("*.md"):
|
|
52
|
+
shutil.copy2(file, target_dir / file.name)
|
|
53
|
+
copied_count += 1
|
|
54
|
+
|
|
55
|
+
if copied_count > 0:
|
|
56
|
+
print(f"✓ Installed {copied_count} rule files to {target_dir}")
|
|
57
|
+
return True
|
|
58
|
+
else:
|
|
59
|
+
print("Warning: No rule files found to install", file=sys.stderr)
|
|
60
|
+
return False
|
|
61
|
+
except Exception as e:
|
|
62
|
+
print(f"Error: Failed to install rules: {e}", file=sys.stderr)
|
|
63
|
+
return False
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def main():
|
|
67
|
+
"""CLI entry point."""
|
|
68
|
+
if len(sys.argv) < 2:
|
|
69
|
+
print("Usage: sqlobjects-install-rules <target>")
|
|
70
|
+
print()
|
|
71
|
+
print("Install SQLObjects AI assistant rules to configuration directory.")
|
|
72
|
+
print()
|
|
73
|
+
print("Targets:")
|
|
74
|
+
print(" amazonq - Install to ~/.amazonq/rules/sqlobjects/")
|
|
75
|
+
print(" cursor - Install to ~/.cursor/rules/sqlobjects/")
|
|
76
|
+
print(" claude - Install to ~/.claude/rules/sqlobjects/")
|
|
77
|
+
print(" kiro - Install to ~/.kiro/rules/sqlobjects/")
|
|
78
|
+
print()
|
|
79
|
+
print("Examples:")
|
|
80
|
+
print(" sqlobjects-install-rules amazonq")
|
|
81
|
+
print(" sqlobjects-install-rules cursor")
|
|
82
|
+
sys.exit(1)
|
|
83
|
+
|
|
84
|
+
target = sys.argv[1].lower()
|
|
85
|
+
success = install_rules(target)
|
|
86
|
+
sys.exit(0 if success else 1)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
main()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlobjects
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.12
|
|
4
4
|
Summary: Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading
|
|
5
5
|
Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
6
6
|
Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
@@ -26,10 +26,6 @@ Requires-Python: >=3.12
|
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.43
|
|
29
|
-
Provides-Extra: amazonq
|
|
30
|
-
Provides-Extra: kiro
|
|
31
|
-
Provides-Extra: claude
|
|
32
|
-
Provides-Extra: cursor
|
|
33
29
|
Dynamic: license-file
|
|
34
30
|
|
|
35
31
|
# SQLObjects
|
|
@@ -233,7 +229,14 @@ Best practices and usage patterns optimized for AI coding assistants:
|
|
|
233
229
|
- [Validation & Signals Guide](docs/rules/06-validation-signals-guide.md) - Data validation and lifecycle hooks
|
|
234
230
|
- [Performance Guide](docs/rules/07-performance-guide.md) - Optimization techniques and best practices
|
|
235
231
|
|
|
236
|
-
**Installation**:
|
|
232
|
+
**Installation**:
|
|
233
|
+
```bash
|
|
234
|
+
# Install package
|
|
235
|
+
pip install sqlobjects
|
|
236
|
+
|
|
237
|
+
# Install rules for your AI assistant
|
|
238
|
+
sqlobjects-install-rules amazonq # or cursor, claude, kiro
|
|
239
|
+
```
|
|
237
240
|
|
|
238
241
|
### Feature Documentation
|
|
239
242
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
CHANGELOG.md
|
|
2
2
|
LICENSE
|
|
3
|
-
MANIFEST.in
|
|
4
3
|
README.md
|
|
5
4
|
pyproject.toml
|
|
6
5
|
setup.py
|
|
@@ -12,6 +11,8 @@ docs/rules/05-relationships-guide.md
|
|
|
12
11
|
docs/rules/06-validation-signals-guide.md
|
|
13
12
|
docs/rules/07-performance-guide.md
|
|
14
13
|
docs/rules/README.md
|
|
14
|
+
scripts/__init__.py
|
|
15
|
+
scripts/install_rules.py
|
|
15
16
|
sqlobjects/__init__.py
|
|
16
17
|
sqlobjects/cascade.py
|
|
17
18
|
sqlobjects/exceptions.py
|
|
@@ -25,6 +26,7 @@ sqlobjects/validators.py
|
|
|
25
26
|
sqlobjects.egg-info/PKG-INFO
|
|
26
27
|
sqlobjects.egg-info/SOURCES.txt
|
|
27
28
|
sqlobjects.egg-info/dependency_links.txt
|
|
29
|
+
sqlobjects.egg-info/entry_points.txt
|
|
28
30
|
sqlobjects.egg-info/requires.txt
|
|
29
31
|
sqlobjects.egg-info/top_level.txt
|
|
30
32
|
sqlobjects/database/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sqlalchemy[asyncio]>=2.0.43
|
sqlobjects-1.0.11/MANIFEST.in
DELETED
sqlobjects-1.0.11/setup.py
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import re
|
|
3
|
-
import shutil
|
|
4
|
-
import sys
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
from setuptools import Distribution, setup
|
|
8
|
-
from setuptools.command.develop import develop
|
|
9
|
-
from setuptools.command.install import install
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class PostInstallCommand(install):
|
|
13
|
-
"""Post-installation for installation mode."""
|
|
14
|
-
|
|
15
|
-
user_options = install.user_options + [
|
|
16
|
-
("extras=", None, "Extras to install (comma-separated)"),
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
def __init__(self, dist: Distribution):
|
|
20
|
-
super().__init__(dist)
|
|
21
|
-
self.extras: str | None = None
|
|
22
|
-
|
|
23
|
-
def initialize_options(self):
|
|
24
|
-
install.initialize_options(self)
|
|
25
|
-
self.extras = None
|
|
26
|
-
|
|
27
|
-
def run(self):
|
|
28
|
-
install.run(self)
|
|
29
|
-
self._post_install()
|
|
30
|
-
|
|
31
|
-
def _post_install(self):
|
|
32
|
-
"""执行安装后的 rules 复制"""
|
|
33
|
-
extras_to_install = set()
|
|
34
|
-
|
|
35
|
-
# 方法1: 从环境变量获取
|
|
36
|
-
env_extras = os.environ.get("SQLOBJECTS_INSTALL_EXTRAS", "")
|
|
37
|
-
if env_extras:
|
|
38
|
-
extras_to_install.update(e.strip() for e in env_extras.split(","))
|
|
39
|
-
|
|
40
|
-
# 方法2: 从命令行参数检测
|
|
41
|
-
for arg in sys.argv:
|
|
42
|
-
# 匹配 sqlobjects[amazonq] 或 .[amazonq] 格式
|
|
43
|
-
match = re.search(r"\[([^\]]+)\]", arg)
|
|
44
|
-
if match:
|
|
45
|
-
extras_str = match.group(1)
|
|
46
|
-
extras_to_install.update(e.strip() for e in extras_str.split(","))
|
|
47
|
-
|
|
48
|
-
# 方法3: 从 self.extras 获取(如果通过 --extras 传递)
|
|
49
|
-
if self.extras:
|
|
50
|
-
extras_to_install.update(e.strip() for e in self.extras.split(","))
|
|
51
|
-
|
|
52
|
-
# 执行安装
|
|
53
|
-
valid_extras = {"amazonq", "kiro", "claude", "cursor"}
|
|
54
|
-
for extra in extras_to_install & valid_extras:
|
|
55
|
-
try:
|
|
56
|
-
self._install_rules(extra)
|
|
57
|
-
except Exception as e:
|
|
58
|
-
print(f"Warning: Failed to install rules for {extra}: {e}", file=sys.stderr)
|
|
59
|
-
|
|
60
|
-
def _install_rules(self, target_name: str) -> None:
|
|
61
|
-
"""复制 rules 到 AI 助手配置目录"""
|
|
62
|
-
# 获取 rules 目录
|
|
63
|
-
package_dir = Path(__file__).parent
|
|
64
|
-
rules_dir = package_dir / "docs" / "rules"
|
|
65
|
-
|
|
66
|
-
# 目标目录映射
|
|
67
|
-
target_dirs = {
|
|
68
|
-
"amazonq": Path.home() / ".amazonq" / "rules" / "sqlobjects",
|
|
69
|
-
"kiro": Path.home() / ".kiro" / "rules" / "sqlobjects",
|
|
70
|
-
"claude": Path.home() / ".claude" / "rules" / "sqlobjects",
|
|
71
|
-
"cursor": Path.home() / ".cursor" / "rules" / "sqlobjects",
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
target_dir = target_dirs.get(target_name)
|
|
75
|
-
if not target_dir or not rules_dir.exists():
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
# 创建目标目录并复制文件
|
|
79
|
-
target_dir.mkdir(parents=True, exist_ok=True)
|
|
80
|
-
copied_count = 0
|
|
81
|
-
for file in rules_dir.glob("*.md"):
|
|
82
|
-
try:
|
|
83
|
-
shutil.copy2(file, target_dir / file.name)
|
|
84
|
-
copied_count += 1
|
|
85
|
-
except Exception:
|
|
86
|
-
pass
|
|
87
|
-
|
|
88
|
-
if copied_count > 0:
|
|
89
|
-
print(f"✓ Installed {copied_count} rule files to {target_dir}")
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class PostDevelopCommand(develop):
|
|
93
|
-
"""Post-installation for development mode."""
|
|
94
|
-
|
|
95
|
-
def run(self):
|
|
96
|
-
develop.run(self)
|
|
97
|
-
# 开发模式不自动安装 rules(避免污染开发环境)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
setup(
|
|
101
|
-
cmdclass={
|
|
102
|
-
"install": PostInstallCommand,
|
|
103
|
-
"develop": PostDevelopCommand,
|
|
104
|
-
},
|
|
105
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|