Skip to content

Commit 64ac1da

Browse files
author
Matt Carey
committed
feat: openai compat tools
0 parents  commit 64ac1da

30 files changed

+2139
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
description: Standards for placing Cursor rule files in the correct
3+
globs: *.mdc
4+
---
5+
# Cursor Rules Location
6+
7+
Rules for placing and organizing Cursor rule files in the repository.
8+
9+
<rule>
10+
name: cursor_rules_location
11+
description: Standards for placing Cursor rule files in the correct directory
12+
filters:
13+
# Match any .mdc files
14+
- type: file_extension
15+
pattern: "\\.mdc$"
16+
# Match files that look like Cursor rules
17+
- type: content
18+
pattern: "(?s)<rule>.*?</rule>"
19+
# Match file creation events
20+
- type: event
21+
pattern: "file_create"
22+
23+
actions:
24+
- type: reject
25+
conditions:
26+
- pattern: "^(?!\\.\\/\\.cursor\\/rules\\/.*\\.mdc$)"
27+
message: "Cursor rule files (.mdc) must be placed in the .cursor/rules directory"
28+
29+
- type: suggest
30+
message: |
31+
When creating Cursor rules:
32+
33+
1. Always place rule files in PROJECT_ROOT/.cursor/rules/:
34+
```
35+
.cursor/rules/
36+
├── your-rule-name.mdc
37+
├── another-rule.mdc
38+
└── ...
39+
```
40+
41+
2. Follow the naming convention:
42+
- Use kebab-case for filenames
43+
- Always use .mdc extension
44+
- Make names descriptive of the rule's purpose
45+
46+
3. Directory structure:
47+
```
48+
PROJECT_ROOT/
49+
├── .cursor/
50+
│ └── rules/
51+
│ ├── your-rule-name.mdc
52+
│ └── ...
53+
└── ...
54+
```
55+
56+
4. Never place rule files:
57+
- In the project root
58+
- In subdirectories outside .cursor/rules
59+
- In any other location
60+
61+
examples:
62+
- input: |
63+
# Bad: Rule file in wrong location
64+
rules/my-rule.mdc
65+
my-rule.mdc
66+
.rules/my-rule.mdc
67+
68+
# Good: Rule file in correct location
69+
.cursor/rules/my-rule.mdc
70+
output: "Correctly placed Cursor rule file"
71+
72+
metadata:
73+
priority: high
74+
version: 1.0
75+
</rule>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
description:
3+
globs:
4+
---
5+
# Examples Standards
6+
7+
Standards for creating and maintaining examples in the StackOne repository.
8+
9+
<rule>
10+
name: examples_standards
11+
description: Standards for creating and maintaining examples for all functionality
12+
13+
filters:
14+
- type: path
15+
pattern: "^examples/.*"
16+
- type: path
17+
pattern: "^packages/.*/.*"
18+
19+
actions:
20+
- type: suggest
21+
message: |
22+
When working with examples:
23+
24+
1. Location Requirements:
25+
```
26+
examples/
27+
├── basic_usage/
28+
│ ├── basic_tool_usage.py # Basic usage examples
29+
│ └── error_handling.py # Error handling examples
30+
├── integrations/ # Integration examples
31+
│ ├── openai_integration.py
32+
│ └── other_integration.py
33+
└── README.md # Examples documentation
34+
```
35+
36+
2. Example Requirements:
37+
- Every public function/class needs at least one example
38+
- Examples should be runnable Python scripts
39+
- Include error handling cases
40+
- Load credentials from .env
41+
- Include type hints
42+
- Follow the same code style as the main codebase
43+
44+
3. Documentation:
45+
- Each example file should start with a docstring explaining its purpose
46+
- Include expected output in comments
47+
- Document any prerequisites (environment variables, etc)
48+
49+
4. Testing:
50+
- Examples should be tested as part of CI
51+
- Examples should work with the latest package version
52+
- Include sample responses in comments
53+
54+
examples:
55+
- input: |
56+
# Good example structure
57+
import os
58+
from dotenv import load_dotenv
59+
from stackone_ai import StackOneToolSet
60+
61+
def main():
62+
"""Example showing basic usage of StackOneToolSet."""
63+
load_dotenv()
64+
65+
api_key = os.getenv("STACKONE_API_KEY")
66+
if not api_key:
67+
raise ValueError("STACKONE_API_KEY not found")
68+
69+
# Example code...
70+
71+
if __name__ == "__main__":
72+
main()
73+
output: "Correctly structured example"
74+
75+
- input: |
76+
# Bad example - missing error handling, docs, types
77+
from stackone_ai import StackOneToolSet
78+
79+
toolset = StackOneToolSet("hardcoded_key")
80+
tools = toolset.get_tools("crm")
81+
result = tools["some_tool"].execute()
82+
output: "Incorrectly structured example"
83+
84+
metadata:
85+
priority: high
86+
version: 1.0
87+
tags:
88+
- examples
89+
- documentation
90+
- testing
91+
</rule>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
description: Standards for StackOne package structure
3+
globs: packages/stackone-*/**
4+
---
5+
# StackOne Package Structure
6+
7+
<rule>
8+
name: stackone_package_structure
9+
description: Standards for organizing StackOne packages
10+
11+
filters:
12+
- type: path
13+
pattern: "^packages/stackone-.*"
14+
15+
actions:
16+
- type: suggest
17+
message: |
18+
When creating a new StackOne package:
19+
20+
1. Package Structure:
21+
```
22+
packages/stackone-{name}/
23+
├── stackone_{name}/ # Package code (no src directory)
24+
│ ├── __init__.py
25+
│ └── ...
26+
├── tests/ # Test files
27+
│ ├── __init__.py
28+
│ └── test_*.py
29+
├── pyproject.toml # Package configuration
30+
└── README.md # Package documentation
31+
```
32+
33+
2. Import paths:
34+
- Use absolute imports from package root
35+
- Example: `from stackone_ai.tools import Tool`
36+
37+
3. Resource files:
38+
- Place in package directory next to code
39+
- Example: `stackone_ai/oas/*.json`
40+
41+
4. Test files:
42+
- Place in tests directory
43+
- Name pattern: `test_*.py`
44+
- Use pytest fixtures and mocks
45+
46+
examples:
47+
- input: |
48+
# Bad structure
49+
packages/stackone-core/
50+
├── src/
51+
│ └── stackone_ai/
52+
53+
# Good structure
54+
packages/stackone-core/
55+
├── stackone_ai/
56+
│ ├── __init__.py
57+
│ ├── tools.py
58+
│ └── oas/
59+
│ └── crm.json
60+
output: "Correctly structured StackOne package"
61+
62+
metadata:
63+
priority: high
64+
version: 1.0
65+
tags:
66+
- package
67+
- structure
68+
- python
69+
</rule>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# No Relative Imports
2+
3+
Standards for using absolute imports instead of relative imports in Python files.
4+
5+
<rule>
6+
name: no_relative_imports
7+
description: Enforce the use of absolute imports instead of relative imports in Python files
8+
filters:
9+
- type: file_extension
10+
pattern: "\\.py$"
11+
- type: content
12+
pattern: "^from \\."
13+
14+
actions:
15+
- type: reject
16+
conditions:
17+
- pattern: "^from \\."
18+
message: "Use absolute imports (from stackone_ai...) instead of relative imports"
19+
20+
- type: suggest
21+
message: |
22+
When importing modules:
23+
24+
1. Always use absolute imports:
25+
```python
26+
# Good
27+
from stackone_ai.tools import ToolDefinition
28+
from stackone_ai.constants import OAS_DIR
29+
30+
# Bad
31+
from .tools import ToolDefinition
32+
from ..constants import OAS_DIR
33+
```
34+
35+
2. Guidelines:
36+
- Start imports with the full package name (stackone_ai)
37+
- Never use relative imports (. or ..)
38+
- Keep imports organized and grouped
39+
40+
examples:
41+
- input: |
42+
# Bad: Using relative imports
43+
from .tools import ToolDefinition
44+
from ..constants import OAS_DIR
45+
46+
# Good: Using absolute imports
47+
from stackone_ai.tools import ToolDefinition
48+
from stackone_ai.constants import OAS_DIR
49+
output: "Correctly formatted absolute imports"
50+
51+
metadata:
52+
priority: high
53+
version: 1.0
54+
</rule>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
description: Standards for installing packages with UV in StackOne
3+
globs: "**/pyproject.toml"
4+
---
5+
# Package Installation Standards
6+
7+
<rule>
8+
name: package_installation
9+
description: Standards for installing packages with UV in StackOne monorepo
10+
11+
filters:
12+
- type: file_extension
13+
pattern: "\\.toml$"
14+
- type: path
15+
pattern: ".*pyproject\\.toml$"
16+
17+
actions:
18+
- type: suggest
19+
message: |
20+
When installing packages with UV:
21+
22+
1. Root Level Dev Dependencies:
23+
```bash
24+
# Install dev dependencies at root level
25+
uv add --dev pytest
26+
uv add --dev pytest-cov
27+
uv add --dev black
28+
```
29+
30+
2. Package Level Dependencies:
31+
```bash
32+
# Navigate to package directory
33+
cd packages/stackone-core
34+
35+
# Install package dependencies
36+
uv add pydantic
37+
uv add requests
38+
```
39+
40+
3. Never use:
41+
```bash
42+
# ❌ Don't use pip install
43+
uv pip install package-name
44+
45+
# ❌ Don't use -e or editable installs
46+
uv pip install -e .
47+
```
48+
49+
4. Running Tests:
50+
```bash
51+
# Run from root directory
52+
uv run pytest
53+
54+
# Run specific package tests
55+
uv run pytest packages/stackone-core/tests/
56+
```
57+
58+
5. Package Dependencies:
59+
```toml
60+
# In package's pyproject.toml
61+
[project]
62+
dependencies = [
63+
"pydantic>=2.10.6",
64+
"requests>=2.32.3",
65+
]
66+
```
67+
68+
examples:
69+
- input: |
70+
# Good: Installing dev dependencies at root
71+
uv add --dev pytest
72+
uv add --dev black
73+
74+
# Good: Installing package dependencies
75+
cd packages/stackone-core
76+
uv add pydantic
77+
78+
# Bad: Using pip install
79+
uv pip install -e ".[test]"
80+
output: "Correctly installed packages with UV"
81+
82+
metadata:
83+
priority: high
84+
version: 1.0
85+
tags:
86+
- uv
87+
- dependencies
88+
- installation
89+
</rule>

0 commit comments

Comments
 (0)