Skip to content

Commit 06ab078

Browse files
authored
Initial commit
0 parents  commit 06ab078

File tree

9 files changed

+416
-0
lines changed

9 files changed

+416
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Additional context**
24+
Add any other context about the problem here.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Additional context**
17+
Add any other context or screenshots about the feature request here.

.github/workflows/main.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Create Release
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
tags:
12+
- "*.*.*"
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
env:
19+
PLUGIN_JSON: "0.0.1"
20+
TAG_EXISTS: false
21+
PLUGIN_NAME: "my_plugin"
22+
23+
jobs:
24+
# This will be deleted by setup.py
25+
check:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
plugin_name: ${{ steps.init.outputs.plugin_name }}
29+
steps:
30+
- name: Get plugin name
31+
id: init
32+
run: |
33+
echo "plugin_name=${{ env.PLUGIN_NAME }}" >> $GITHUB_OUTPUT
34+
35+
# This is the end of the removed section
36+
release:
37+
# This will be deleted by setup.py
38+
needs: check
39+
if: startsWith(needs.check.outputs.plugin_name, 'MY_PLUGIN') == false
40+
# This is the end of the removed section
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v3
45+
- name: Get plugin version
46+
run: |
47+
echo 'PLUGIN_JSON<<EOF' >> $GITHUB_ENV
48+
cat ./plugin.json >> $GITHUB_ENV
49+
echo 'EOF' >> $GITHUB_ENV
50+
- name: Publish tag
51+
if: env.TAG_EXISTS == false
52+
uses: rickstaa/action-create-tag@v1
53+
with:
54+
tag: "${{fromJson(env.PLUGIN_JSON).version}}"
55+
tag_exists_error: false
56+
message: "Latest release"
57+
- name: Zip release
58+
uses: TheDoctor0/zip-release@0.7.1
59+
with:
60+
type: 'zip'
61+
filename: '${{env.PLUGIN_NAME}}.zip'
62+
exclusions: '*.git* setup.py'
63+
directory: '.'
64+
path: '.'
65+
- name: Upload release
66+
uses: ncipollo/release-action@v1.12.0
67+
with:
68+
tag: "${{fromJson(env.PLUGIN_JSON).version}}"
69+
artifacts: '${{env.PLUGIN_NAME}}.zip'
70+
allowUpdates: true
71+
replacesArtifacts: true
72+
body: |
73+
${{ github.event.head_commit.message }}
74+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
105+
__pypackages__/
106+
107+
# Celery stuff
108+
celerybeat-schedule
109+
celerybeat.pid
110+
111+
# SageMath parsed files
112+
*.sage.py
113+
114+
# Environments
115+
.env
116+
.venv
117+
env/
118+
venv/
119+
ENV/
120+
env.bak/
121+
venv.bak/
122+
123+
# Spyder project settings
124+
.spyderproject
125+
.spyproject
126+
127+
# Rope project settings
128+
.ropeproject
129+
130+
# mkdocs documentation
131+
/site
132+
133+
# mypy
134+
.mypy_cache/
135+
.dmypy.json
136+
dmypy.json
137+
138+
# Pyre type checker
139+
.pyre/
140+
141+
# pytype static type analyzer
142+
.pytype/
143+
144+
# Cython debug symbols
145+
cython_debug/
146+
147+
# PyCharm
148+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150+
# and can be added to the global gitignore or merged into this file. For a more nuclear
151+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
152+
.idea/
153+
154+
# Cheshire Cat Plugin settings
155+
settings.json

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# My plugin
2+
3+
[![awesome plugin](https://custom-icon-badges.demolab.com/static/v1?label=&message=awesome+plugin&color=383938&style=for-the-badge&logo=cheshire_cat_ai)](https://)
4+
[![Awesome plugin](https://custom-icon-badges.demolab.com/static/v1?label=&message=Awesome+plugin&color=000000&style=for-the-badge&logo=cheshire_cat_ai)](https://)
5+
[![awesome plugin](https://custom-icon-badges.demolab.com/static/v1?label=&message=awesome+plugin&color=F4F4F5&style=for-the-badge&logo=cheshire_cat_black)](https://)
6+
7+
Write here all the useful information about your plugin.
8+
9+
This repository is the template to automate the release of official Cheshire Cat AI plugins.
10+
11+
## Usage
12+
13+
1. Create a new repository clicking on the `Use this template` button.
14+
2. Clone your new repo directly in the Cat's `plugins` folder.
15+
3. Run the `setup.py` script:
16+
```bash
17+
python setup.py
18+
```
19+
The script will prompt you to write the name of your plugin and make an initial setup setting the name in the files.
20+
21+
4. Start developing!
22+
23+
> **Important**
24+
> A new release of your plugin is triggered every time you set a new `version` in the `plugin.json` file.
25+
> Please, remember to set it correctly every time you want to release an update.
26+

my_plugin.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from cat.mad_hatter.decorators import tool, hook, plugin
2+
from pydantic import BaseModel
3+
from datetime import datetime, date
4+
5+
class MySettings(BaseModel):
6+
required_int: int
7+
optional_int: int = 69
8+
required_str: str
9+
optional_str: str = "meow"
10+
required_date: date
11+
optional_date: date = 1679616000
12+
13+
@plugin
14+
def settings_model():
15+
return MySettings
16+
17+
@tool
18+
def get_the_day(tool_input, cat):
19+
"""Get the day of the week. Input is always None."""
20+
21+
dt = datetime.now()
22+
23+
return dt.strftime('%A')
24+
25+
@hook
26+
def before_cat_sends_message(message, cat):
27+
28+
prompt = f'Rephrase the following sentence in a grumpy way: {message["content"]}'
29+
message["content"] = cat.llm(prompt)
30+
31+
return message

plugin.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "My plugin",
3+
"version": "0.0.1",
4+
"description": "Description of my_plugin.",
5+
"author_name": "Me",
6+
"author_url": "https://mywebsite.me",
7+
"plugin_url": "https://github.com/my_name/my_plugin",
8+
"tags": "cat, template, example",
9+
"thumb": "https://raw.githubusercontent.com/my_repo_path/my_plugin.png"
10+
}

requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)