charlie-agents 0.2.0__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.
Potentially problematic release.
This version of charlie-agents might be problematic. Click here for more details.
- charlie_agents-0.2.0/.charlie/commands/commit.md +19 -0
- charlie_agents-0.2.0/.cursor/commands/commit.md +19 -0
- charlie_agents-0.2.0/.github/workflows/ci.yml +81 -0
- charlie_agents-0.2.0/.github/workflows/publish.yml +37 -0
- charlie_agents-0.2.0/.gitignore +48 -0
- charlie_agents-0.2.0/.plans.i/remove-docstrings-plan.plan.md +68 -0
- charlie_agents-0.2.0/.zed/extensions/slash-commands-example/Cargo.toml +16 -0
- charlie_agents-0.2.0/.zed/extensions/slash-commands-example/LICENSE-APACHE +1 -0
- charlie_agents-0.2.0/.zed/extensions/slash-commands-example/README.md +84 -0
- charlie_agents-0.2.0/.zed/extensions/slash-commands-example/extension.toml +15 -0
- charlie_agents-0.2.0/.zed/extensions/slash-commands-example/src/slash_commands_example.rs +90 -0
- charlie_agents-0.2.0/.zed/settings.json +0 -0
- charlie_agents-0.2.0/AGENTS.md +30 -0
- charlie_agents-0.2.0/AGENT_FIELDS.md +249 -0
- charlie_agents-0.2.0/LICENSE +22 -0
- charlie_agents-0.2.0/PKG-INFO +640 -0
- charlie_agents-0.2.0/README.md +609 -0
- charlie_agents-0.2.0/examples/directory-based/.charlie/commands/deploy.md +31 -0
- charlie_agents-0.2.0/examples/directory-based/.charlie/commands/init.md +25 -0
- charlie_agents-0.2.0/examples/directory-based/.charlie/mcp-servers/local-tools.yaml +21 -0
- charlie_agents-0.2.0/examples/directory-based/.charlie/rules/code-style.md +62 -0
- charlie_agents-0.2.0/examples/directory-based/.charlie/rules/commit-messages.md +46 -0
- charlie_agents-0.2.0/examples/directory-based/.charlie/rules/testing.md +40 -0
- charlie_agents-0.2.0/examples/directory-based/.claude/commands/example.deploy.md +26 -0
- charlie_agents-0.2.0/examples/directory-based/.claude/commands/example.init.md +23 -0
- charlie_agents-0.2.0/examples/directory-based/.cursor/commands/example.deploy.md +26 -0
- charlie_agents-0.2.0/examples/directory-based/.cursor/commands/example.deploy.mdc +26 -0
- charlie_agents-0.2.0/examples/directory-based/.cursor/commands/example.init.md +20 -0
- charlie_agents-0.2.0/examples/directory-based/.cursor/commands/example.init.mdc +20 -0
- charlie_agents-0.2.0/examples/directory-based/.cursor/mcp.json +53 -0
- charlie_agents-0.2.0/examples/directory-based/.cursor/rules/charlie-rules.mdc +162 -0
- charlie_agents-0.2.0/examples/directory-based/README.md +69 -0
- charlie_agents-0.2.0/examples/directory-based/charlie.yaml +9 -0
- charlie_agents-0.2.0/examples/env-placeholder-example.yaml +73 -0
- charlie_agents-0.2.0/examples/root-placeholder-example.yaml +45 -0
- charlie_agents-0.2.0/examples/simple.yaml +62 -0
- charlie_agents-0.2.0/examples/speckit.yaml +221 -0
- charlie_agents-0.2.0/mcp-config.json +10 -0
- charlie_agents-0.2.0/node_modules/.bin/prettier +1 -0
- charlie_agents-0.2.0/node_modules/.package-lock.json +24 -0
- charlie_agents-0.2.0/node_modules/prettier/LICENSE +7 -0
- charlie_agents-0.2.0/node_modules/prettier/README.md +104 -0
- charlie_agents-0.2.0/node_modules/prettier/THIRD-PARTY-NOTICES.md +5844 -0
- charlie_agents-0.2.0/node_modules/prettier/bin/prettier.cjs +80 -0
- charlie_agents-0.2.0/node_modules/prettier/doc.d.ts +254 -0
- charlie_agents-0.2.0/node_modules/prettier/doc.js +1270 -0
- charlie_agents-0.2.0/node_modules/prettier/doc.mjs +1242 -0
- charlie_agents-0.2.0/node_modules/prettier/index.cjs +685 -0
- charlie_agents-0.2.0/node_modules/prettier/index.d.ts +962 -0
- charlie_agents-0.2.0/node_modules/prettier/index.mjs +19117 -0
- charlie_agents-0.2.0/node_modules/prettier/internal/experimental-cli-worker.mjs +2634 -0
- charlie_agents-0.2.0/node_modules/prettier/internal/experimental-cli.mjs +13609 -0
- charlie_agents-0.2.0/node_modules/prettier/internal/legacy-cli.mjs +4707 -0
- charlie_agents-0.2.0/node_modules/prettier/package.json +202 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/acorn.d.ts +6 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/acorn.js +15 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/acorn.mjs +15 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/angular.d.ts +8 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/angular.js +2 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/angular.mjs +2 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/babel.d.ts +18 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/babel.js +15 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/babel.mjs +15 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/estree.d.ts +1 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/estree.js +36 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/estree.mjs +36 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/flow.d.ts +5 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/flow.js +19 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/flow.mjs +19 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/glimmer.d.ts +5 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/glimmer.js +29 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/glimmer.mjs +29 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/graphql.d.ts +5 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/graphql.js +29 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/graphql.mjs +29 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/html.d.ts +9 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/html.js +22 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/html.mjs +22 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/markdown.d.ts +7 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/markdown.js +63 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/markdown.mjs +63 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/meriyah.d.ts +5 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/meriyah.js +4 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/meriyah.mjs +4 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/postcss.d.ts +7 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/postcss.js +54 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/postcss.mjs +54 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/typescript.d.ts +5 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/typescript.js +20 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/typescript.mjs +20 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/yaml.d.ts +5 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/yaml.js +160 -0
- charlie_agents-0.2.0/node_modules/prettier/plugins/yaml.mjs +160 -0
- charlie_agents-0.2.0/node_modules/prettier/standalone.d.ts +33 -0
- charlie_agents-0.2.0/node_modules/prettier/standalone.js +34 -0
- charlie_agents-0.2.0/node_modules/prettier/standalone.mjs +34 -0
- charlie_agents-0.2.0/pyproject.toml +78 -0
- charlie_agents-0.2.0/script.i.bash +9 -0
- charlie_agents-0.2.0/src/charlie/__init__.py +6 -0
- charlie_agents-0.2.0/src/charlie/agents/__init__.py +4 -0
- charlie_agents-0.2.0/src/charlie/agents/base.py +70 -0
- charlie_agents-0.2.0/src/charlie/agents/claude.py +23 -0
- charlie_agents-0.2.0/src/charlie/agents/copilot.py +23 -0
- charlie_agents-0.2.0/src/charlie/agents/cursor.py +23 -0
- charlie_agents-0.2.0/src/charlie/agents/gemini.py +32 -0
- charlie_agents-0.2.0/src/charlie/agents/qwen.py +32 -0
- charlie_agents-0.2.0/src/charlie/agents/registry.py +181 -0
- charlie_agents-0.2.0/src/charlie/cli.py +189 -0
- charlie_agents-0.2.0/src/charlie/enums.py +16 -0
- charlie_agents-0.2.0/src/charlie/mcp.py +93 -0
- charlie_agents-0.2.0/src/charlie/parser.py +271 -0
- charlie_agents-0.2.0/src/charlie/rules.py +212 -0
- charlie_agents-0.2.0/src/charlie/schema.py +99 -0
- charlie_agents-0.2.0/src/charlie/transpiler.py +100 -0
- charlie_agents-0.2.0/src/charlie/utils.py +103 -0
- charlie_agents-0.2.0/tests/__init__.py +1 -0
- charlie_agents-0.2.0/tests/test_adapters.py +227 -0
- charlie_agents-0.2.0/tests/test_base_adapter.py +214 -0
- charlie_agents-0.2.0/tests/test_cli.py +344 -0
- charlie_agents-0.2.0/tests/test_integration.py +160 -0
- charlie_agents-0.2.0/tests/test_mcp.py +426 -0
- charlie_agents-0.2.0/tests/test_parser.py +524 -0
- charlie_agents-0.2.0/tests/test_registry.py +38 -0
- charlie_agents-0.2.0/tests/test_rules.py +769 -0
- charlie_agents-0.2.0/tests/test_schema.py +245 -0
- charlie_agents-0.2.0/tests/test_transpiler.py +433 -0
- charlie_agents-0.2.0/tests/test_utils.py +396 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
3
|
+
description: Analyze changes and create a high-quality git commit
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
- Current branch: !`git branch --show-current`
|
|
9
|
+
- Working tree status: !`git status --short --branch`
|
|
10
|
+
- Diff (staged + unstaged): !`git diff $(git rev-parse --verify HEAD 2>/dev/null || echo --cached)`
|
|
11
|
+
- Recent history (if available): !`git log --oneline -10 || echo "No commits yet"`
|
|
12
|
+
|
|
13
|
+
## Your task
|
|
14
|
+
|
|
15
|
+
Analyze the context above and:
|
|
16
|
+
|
|
17
|
+
1. Summarize the intent of the changes.
|
|
18
|
+
2. Explain why those changes are important
|
|
19
|
+
3. Commit the changes `git commit -m "<generated message>"`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze changes and create a high-quality git commit
|
|
3
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
- Current branch: !`git branch --show-current`
|
|
9
|
+
- Working tree status: !`git status --short --branch`
|
|
10
|
+
- Diff (staged + unstaged): !`git diff $(git rev-parse --verify HEAD 2>/dev/null || echo --cached)`
|
|
11
|
+
- Recent history (if available): !`git log --oneline -10 || echo "No commits yet"`
|
|
12
|
+
|
|
13
|
+
## Your task
|
|
14
|
+
|
|
15
|
+
Analyze the context above and:
|
|
16
|
+
|
|
17
|
+
1. Summarize the intent of the changes.
|
|
18
|
+
2. Explain why those changes are important
|
|
19
|
+
3. Commit the changes `git commit -m "<generated message>"`.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality:
|
|
11
|
+
name: Quality Assurance
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
17
|
+
python-version: ["3.11", "3.12"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout code
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install -e ".[dev]"
|
|
32
|
+
|
|
33
|
+
- name: Run Ruff linter
|
|
34
|
+
run: |
|
|
35
|
+
ruff check src/ tests/
|
|
36
|
+
|
|
37
|
+
- name: Run mypy type checker
|
|
38
|
+
run: |
|
|
39
|
+
mypy --install-types --non-interactive src/charlie
|
|
40
|
+
|
|
41
|
+
- name: Run pytest with coverage
|
|
42
|
+
run: |
|
|
43
|
+
pytest
|
|
44
|
+
|
|
45
|
+
- name: Upload coverage to Codecov
|
|
46
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
47
|
+
uses: codecov/codecov-action@v4
|
|
48
|
+
with:
|
|
49
|
+
file: ./coverage.xml
|
|
50
|
+
fail_ci_if_error: false
|
|
51
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
52
|
+
continue-on-error: true
|
|
53
|
+
|
|
54
|
+
build:
|
|
55
|
+
name: Build Package
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
needs: quality
|
|
58
|
+
|
|
59
|
+
steps:
|
|
60
|
+
- name: Checkout code
|
|
61
|
+
uses: actions/checkout@v4
|
|
62
|
+
|
|
63
|
+
- name: Set up Python
|
|
64
|
+
uses: actions/setup-python@v5
|
|
65
|
+
with:
|
|
66
|
+
python-version: "3.12"
|
|
67
|
+
|
|
68
|
+
- name: Install build dependencies
|
|
69
|
+
run: |
|
|
70
|
+
python -m pip install --upgrade pip
|
|
71
|
+
pip install build
|
|
72
|
+
|
|
73
|
+
- name: Build package
|
|
74
|
+
run: |
|
|
75
|
+
python -m build
|
|
76
|
+
|
|
77
|
+
- name: Check package metadata
|
|
78
|
+
run: |
|
|
79
|
+
pip install twine
|
|
80
|
+
twine check dist/*
|
|
81
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch: # Allow manual trigger
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
id-token: write # Required for trusted publishing
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: '3.11'
|
|
24
|
+
|
|
25
|
+
- name: Install build tools
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install build
|
|
29
|
+
|
|
30
|
+
- name: Build package
|
|
31
|
+
run: python -m build
|
|
32
|
+
|
|
33
|
+
- name: Publish to PyPI
|
|
34
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
35
|
+
with:
|
|
36
|
+
print-hash: true
|
|
37
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Testing
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.coverage
|
|
26
|
+
coverage.xml
|
|
27
|
+
htmlcov/
|
|
28
|
+
.tox/
|
|
29
|
+
.mypy_cache/
|
|
30
|
+
.dmypy.json
|
|
31
|
+
dmypy.json
|
|
32
|
+
|
|
33
|
+
# IDE
|
|
34
|
+
.vscode/
|
|
35
|
+
.idea/
|
|
36
|
+
*.swp
|
|
37
|
+
*.swo
|
|
38
|
+
*~
|
|
39
|
+
|
|
40
|
+
# Virtual environments
|
|
41
|
+
venv/
|
|
42
|
+
env/
|
|
43
|
+
ENV/
|
|
44
|
+
|
|
45
|
+
# OS
|
|
46
|
+
.DS_Store
|
|
47
|
+
Thumbs.db
|
|
48
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!-- 07797365-cdc6-497b-888b-8b695b5fff0e 549ae982-b920-4b4b-89bf-0ce2689c1cbe -->
|
|
2
|
+
# Remove Docstrings from Charlie Project
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This plan outlines the removal of all docstrings that only describe WHAT the code does. Based on analysis of the codebase, all current docstrings fall into this category - none explain WHY the code was created.
|
|
7
|
+
|
|
8
|
+
## Files to Modify
|
|
9
|
+
|
|
10
|
+
### Source Files (11 files)
|
|
11
|
+
|
|
12
|
+
1. **Module-level docstrings** (11 files)
|
|
13
|
+
|
|
14
|
+
- `src/charlie/__init__.py`
|
|
15
|
+
- `src/charlie/mcp.py`
|
|
16
|
+
- `src/charlie/rules.py`
|
|
17
|
+
- `src/charlie/agents/__init__.py`
|
|
18
|
+
- `src/charlie/agents/claude.py`
|
|
19
|
+
- `src/charlie/agents/copilot.py`
|
|
20
|
+
- `src/charlie/agents/cursor.py`
|
|
21
|
+
- `src/charlie/agents/gemini.py`
|
|
22
|
+
- `src/charlie/agents/qwen.py`
|
|
23
|
+
- `src/charlie/agents/registry.py`
|
|
24
|
+
- `tests/__init__.py`
|
|
25
|
+
|
|
26
|
+
2. **Class-level docstrings** (5 classes in agent files)
|
|
27
|
+
|
|
28
|
+
- `ClaudeAdapter` in `claude.py`
|
|
29
|
+
- `CopilotAdapter` in `copilot.py`
|
|
30
|
+
- `CursorAdapter` in `cursor.py`
|
|
31
|
+
- `GeminiAdapter` in `gemini.py`
|
|
32
|
+
- `QwenAdapter` in `qwen.py`
|
|
33
|
+
|
|
34
|
+
3. **Function-level docstrings** (18 functions)
|
|
35
|
+
|
|
36
|
+
- `mcp.py`: 3 functions (`_command_to_tool_schema`, `_server_to_mcp_config`, `generate_mcp_config`)
|
|
37
|
+
- `rules.py`: 8 functions (all private helpers and generators)
|
|
38
|
+
- `registry.py`: 2 functions (`get_agent_spec`, `list_supported_agents`)
|
|
39
|
+
- Agent adapters: 5 `generate_command` methods
|
|
40
|
+
|
|
41
|
+
4. **Test docstrings**
|
|
42
|
+
|
|
43
|
+
- Check all test files for any docstrings
|
|
44
|
+
|
|
45
|
+
## Execution Plan
|
|
46
|
+
|
|
47
|
+
- [ ] Remove module-level docstrings from main source files
|
|
48
|
+
- [ ] Remove module-level docstrings from agent files
|
|
49
|
+
- [ ] Remove class-level docstrings from all adapter classes
|
|
50
|
+
- [ ] Remove function-level docstrings from `mcp.py`
|
|
51
|
+
- [ ] Remove function-level docstrings from `rules.py`
|
|
52
|
+
- [ ] Remove function-level docstrings from `registry.py`
|
|
53
|
+
- [ ] Remove function-level docstrings from agent adapter methods
|
|
54
|
+
- [ ] Remove test file docstrings
|
|
55
|
+
- [ ] Verify no linter errors were introduced
|
|
56
|
+
- [ ] Run tests to ensure functionality unchanged
|
|
57
|
+
|
|
58
|
+
## Notes
|
|
59
|
+
|
|
60
|
+
All docstrings found describe only WHAT the code does (e.g., "MCP server configuration generator", "Convert command to MCP tool schema format"). None explain WHY decisions were made or provide context about the reasoning behind the implementation. Therefore, all should be removed per the criteria.
|
|
61
|
+
|
|
62
|
+
### To-dos
|
|
63
|
+
|
|
64
|
+
- [ ] Remove module-level docstrings from all Python files
|
|
65
|
+
- [ ] Remove class-level docstrings from adapter classes
|
|
66
|
+
- [ ] Remove function-level docstrings from all modules
|
|
67
|
+
- [ ] Remove docstrings from test files
|
|
68
|
+
- [ ] Run tests and verify no linter errors
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "slash_commands_example"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition.workspace = true
|
|
5
|
+
publish.workspace = true
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
|
|
8
|
+
[lints]
|
|
9
|
+
workspace = true
|
|
10
|
+
|
|
11
|
+
[lib]
|
|
12
|
+
path = "src/slash_commands_example.rs"
|
|
13
|
+
crate-type = ["cdylib"]
|
|
14
|
+
|
|
15
|
+
[dependencies]
|
|
16
|
+
zed_extension_api = "0.1.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../LICENSE-APACHE
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Slash Commands Example Extension
|
|
2
|
+
|
|
3
|
+
This is an example extension showcasing how to write slash commands.
|
|
4
|
+
|
|
5
|
+
See: [Extensions: Slash Commands](https://zed.dev/docs/extensions/slash-commands) in the Zed Docs.
|
|
6
|
+
|
|
7
|
+
## Pre-requisites
|
|
8
|
+
|
|
9
|
+
[Install Rust Toolchain](https://www.rust-lang.org/tools/install):
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
git clone https://github.com/zed-industries/zed.git
|
|
19
|
+
cp -RL zed/extensions/slash-commands-example .
|
|
20
|
+
|
|
21
|
+
cd slash-commands-example/
|
|
22
|
+
|
|
23
|
+
# Update Cargo.toml to make it standalone
|
|
24
|
+
cat > Cargo.toml << EOF
|
|
25
|
+
[package]
|
|
26
|
+
name = "slash_commands_example"
|
|
27
|
+
version = "0.1.0"
|
|
28
|
+
edition = "2021"
|
|
29
|
+
license = "Apache-2.0"
|
|
30
|
+
|
|
31
|
+
[lib]
|
|
32
|
+
path = "src/slash_commands_example.rs"
|
|
33
|
+
crate-type = ["cdylib"]
|
|
34
|
+
|
|
35
|
+
[dependencies]
|
|
36
|
+
zed_extension_api = "0.1.0"
|
|
37
|
+
EOF
|
|
38
|
+
|
|
39
|
+
curl -O https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-APACHE
|
|
40
|
+
echo "# Zed Slash Commands Example Extension" > README.md
|
|
41
|
+
echo "Cargo.lock" > .gitignore
|
|
42
|
+
echo "target/" >> .gitignore
|
|
43
|
+
echo "*.wasm" >> .gitignore
|
|
44
|
+
|
|
45
|
+
git init
|
|
46
|
+
git add .
|
|
47
|
+
git commit -m "Initial commit"
|
|
48
|
+
|
|
49
|
+
cd ..
|
|
50
|
+
mv slash-commands-example MY-SUPER-COOL-ZED-EXTENSION
|
|
51
|
+
zed $_
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
1. Open the command palette (`cmd-shift-p` or `ctrl-shift-p`).
|
|
57
|
+
2. Launch `zed: install dev extension`
|
|
58
|
+
3. Select the extension folder created above
|
|
59
|
+
|
|
60
|
+
## Test
|
|
61
|
+
|
|
62
|
+
Open the assistant and type `/echo` and `/pick-one` at the beginning of a line.
|
|
63
|
+
|
|
64
|
+
## Customization
|
|
65
|
+
|
|
66
|
+
Open the `extensions.toml` file and set the `id`, `name`, `description`, `authors` and `repository` fields.
|
|
67
|
+
|
|
68
|
+
Rename `slash-commands-example.rs` you'll also have to update `Cargo.toml`
|
|
69
|
+
|
|
70
|
+
## Rebuild
|
|
71
|
+
|
|
72
|
+
Rebuild to see these changes reflected:
|
|
73
|
+
|
|
74
|
+
1. Open Zed Extensions (`cmd-shift-x` or `ctrl-shift-x`).
|
|
75
|
+
2. Click `Rebuild` next to your Dev Extension (formerly "Slash Command Example")
|
|
76
|
+
|
|
77
|
+
## Troubleshooting / Logs
|
|
78
|
+
|
|
79
|
+
- [zed.dev docs: Troubleshooting](https://zed.dev/docs/troubleshooting)
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
|
|
83
|
+
- [zed.dev docs: Extensions: Developing Extensions](https://zed.dev/docs/extensions/developing-extensions)
|
|
84
|
+
- [zed.dev docs: Extensions: Slash Commands](https://zed.dev/docs/extensions/slash-commands)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
id = "slash-commands-example"
|
|
2
|
+
name = "Slash Commands Example"
|
|
3
|
+
description = "An example extension showcasing slash commands."
|
|
4
|
+
version = "0.1.0"
|
|
5
|
+
schema_version = 1
|
|
6
|
+
authors = ["Zed Industries <hi@zed.dev>"]
|
|
7
|
+
repository = "https://github.com/zed-industries/zed"
|
|
8
|
+
|
|
9
|
+
[slash_commands.echo]
|
|
10
|
+
description = "echoes the provided input"
|
|
11
|
+
requires_argument = true
|
|
12
|
+
|
|
13
|
+
[slash_commands.pick-one]
|
|
14
|
+
description = "pick one of three options"
|
|
15
|
+
requires_argument = true
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
use zed_extension_api::{
|
|
2
|
+
self as zed, SlashCommand, SlashCommandArgumentCompletion, SlashCommandOutput,
|
|
3
|
+
SlashCommandOutputSection, Worktree,
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
struct SlashCommandsExampleExtension;
|
|
7
|
+
|
|
8
|
+
impl zed::Extension for SlashCommandsExampleExtension {
|
|
9
|
+
fn new() -> Self {
|
|
10
|
+
SlashCommandsExampleExtension
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
fn complete_slash_command_argument(
|
|
14
|
+
&self,
|
|
15
|
+
command: SlashCommand,
|
|
16
|
+
_args: Vec<String>,
|
|
17
|
+
) -> Result<Vec<zed_extension_api::SlashCommandArgumentCompletion>, String> {
|
|
18
|
+
match command.name.as_str() {
|
|
19
|
+
"echo" => Ok(vec![]),
|
|
20
|
+
"pick-one" => Ok(vec![
|
|
21
|
+
SlashCommandArgumentCompletion {
|
|
22
|
+
label: "Option One".to_string(),
|
|
23
|
+
new_text: "option-1".to_string(),
|
|
24
|
+
run_command: true,
|
|
25
|
+
},
|
|
26
|
+
SlashCommandArgumentCompletion {
|
|
27
|
+
label: "Option Two".to_string(),
|
|
28
|
+
new_text: "option-2".to_string(),
|
|
29
|
+
run_command: true,
|
|
30
|
+
},
|
|
31
|
+
SlashCommandArgumentCompletion {
|
|
32
|
+
label: "Option Three".to_string(),
|
|
33
|
+
new_text: "option-3".to_string(),
|
|
34
|
+
run_command: true,
|
|
35
|
+
},
|
|
36
|
+
]),
|
|
37
|
+
command => Err(format!("unknown slash command: \"{command}\"")),
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fn run_slash_command(
|
|
42
|
+
&self,
|
|
43
|
+
command: SlashCommand,
|
|
44
|
+
args: Vec<String>,
|
|
45
|
+
_worktree: Option<&Worktree>,
|
|
46
|
+
) -> Result<SlashCommandOutput, String> {
|
|
47
|
+
match command.name.as_str() {
|
|
48
|
+
"echo" => {
|
|
49
|
+
if args.is_empty() {
|
|
50
|
+
return Err("nothing to echo".to_string());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let text = args.join(" ");
|
|
54
|
+
|
|
55
|
+
Ok(SlashCommandOutput {
|
|
56
|
+
sections: vec![SlashCommandOutputSection {
|
|
57
|
+
range: (0..text.len()).into(),
|
|
58
|
+
label: "Echo".to_string(),
|
|
59
|
+
}],
|
|
60
|
+
text,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
"pick-one" => {
|
|
64
|
+
let Some(selection) = args.first() else {
|
|
65
|
+
return Err("no option selected".to_string());
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
match selection.as_str() {
|
|
69
|
+
"option-1" | "option-2" | "option-3" => {}
|
|
70
|
+
invalid_option => {
|
|
71
|
+
return Err(format!("{invalid_option} is not a valid option"));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let text = format!("You chose {selection}.");
|
|
76
|
+
|
|
77
|
+
Ok(SlashCommandOutput {
|
|
78
|
+
sections: vec![SlashCommandOutputSection {
|
|
79
|
+
range: (0..text.len()).into(),
|
|
80
|
+
label: format!("Pick One: {selection}"),
|
|
81
|
+
}],
|
|
82
|
+
text,
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
command => Err(format!("unknown slash command: \"{command}\"")),
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
zed::register_extension!(SlashCommandsExampleExtension);
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# AGENTS instructions
|
|
2
|
+
|
|
3
|
+
This document provides guidelines and instructions for using AI agents effectively.
|
|
4
|
+
|
|
5
|
+
## Commit messages
|
|
6
|
+
|
|
7
|
+
- Title
|
|
8
|
+
- Contains 5-116 characters
|
|
9
|
+
- Start with capital letter (A-Z)
|
|
10
|
+
- Use imperative mood ("Add feature" not "Added feature")
|
|
11
|
+
- No ticket numbers (use footer instead)
|
|
12
|
+
- No trailing whitespace
|
|
13
|
+
- Body
|
|
14
|
+
- Explain WHY and maybe a bit of HOW
|
|
15
|
+
- Empty line required between title and body
|
|
16
|
+
- Max 116 characters per line (except URLs, code blocks, footer annotations)
|
|
17
|
+
- Minimum 5 characters
|
|
18
|
+
- Footer
|
|
19
|
+
- Use trailers:
|
|
20
|
+
- `Ticket: PROJ-1234`
|
|
21
|
+
- `Reference: https://example.com`
|
|
22
|
+
- `Assisted-by: Tool/Agent (<Model/Version>)`
|
|
23
|
+
- AI attribution
|
|
24
|
+
- When an AI agent generates/assists with code or commits, add `Assisted-by: Tool/Agent (<Model/Version>)`, for example `Assisted-by: Claude (Claude Sonnet 4.5)`, `Assisted-by: Cursor (GPT-5)`, `Assisted-by: Zed (GPT-4o)`
|
|
25
|
+
- If you're not sure which agent or model is being used, ask the user.
|
|
26
|
+
|
|
27
|
+
## Testing
|
|
28
|
+
|
|
29
|
+
- Describe behaviour, not implementation.
|
|
30
|
+
- Do not use docstrings to document the test, but instead has very descriptive names.
|