Add prodev_tasks.py script and update skill with DB integration

This commit is contained in:
Connor Rhodes 2026-05-22 16:08:43 +00:00
parent d7dfb6c0e2
commit 2df14f1694
3 changed files with 75 additions and 2 deletions

View file

@ -14,7 +14,7 @@ Connect to and interact with the MongoDB instance using Python (`pymongo`) with
- **Port**: `35563` - **Port**: `35563`
- **Username**: `root` - **Username**: `root`
- **Password**: `3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl` - **Password**: `3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl`
- **Connection string**: `mongodb://root:3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl@docdb.connorrhodes.com:35563` - **Connection string**: `mongodb://root:3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl@docdb.connorrhodes.com:35563?tls=true&tlsAllowInvalidCertificates=true`
## How to Run Scripts ## How to Run Scripts

View file

@ -29,6 +29,24 @@ When Connor needs to justify a training, tool, book, course, or other profession
4. Save the file to `~/notes/Inbox/agent/`. Use the format `YYMMDD-pro-dev-[short-name].md`. 4. Save the file to `~/notes/Inbox/agent/`. Use the format `YYMMDD-pro-dev-[short-name].md`.
5. **Create a database entry** using the script:
```bash
uv run --with pymongo ~/notes/skills/professional-development-business-case/scripts/prodev_tasks.py create "<paragraph>"
```
This inserts into `wip.agent_tasks` with `type: "prodev expense"` and `status: "todo"`. Save the returned document ID.
6. **If Connor asks to update the wording**, update both the saved file AND the database entry:
```bash
uv run --with pymongo ~/notes/skills/professional-development-business-case/scripts/prodev_tasks.py update <document_id> "<updated_paragraph>"
```
## Database Commands
The script supports three commands:
- `create "<note>"` — insert a new prodev expense entry
- `update <doc_id> "<note>"` — update the note for an existing entry
- `list` — list all prodev expense entries
## Rules ## Rules
- **Single paragraph, no headers, no bullet points, no tables.** This is not a full document; it is one paragraph meant to paste into a form or email. - **Single paragraph, no headers, no bullet points, no tables.** This is not a full document; it is one paragraph meant to paste into a form or email.
@ -51,4 +69,4 @@ Three sentences:
## Example Output ## Example Output
> The OmniFocus 4 Field Guide is a self-paced video course covering advanced task management workflows, including organization techniques, automation, project templates, and structured review systems. The course provides specific instructions for building capture, processing, and review workflows that scale across simultaneous projects. This course will support my professional development by improving how I track deal follow-up items, SE process work, calendar hygiene, and Salesforce hygiene. > The OmniFocus 4 Field Guide is a video course covering advanced task management workflows, including organization techniques, automation, project templates, and structured review systems. The course provides specific instructions for building capture, processing, and review workflows that scale across simultaneous projects. This course will support my professional development by improving how I track deal follow-up items, SE process work, calendar hygiene, and Salesforce hygiene.

View file

@ -0,0 +1,55 @@
#!/usr/bin/env python3
"""Manage prodev expense entries in wip.agent_tasks on DocDB.
Usage:
prodev_tasks.py create "<note>"
prodev_tasks.py update <document_id> "<note>"
prodev_tasks.py list
"""
import sys
from pymongo import MongoClient
URI = "mongodb://root:3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl@docdb.connorrhodes.com:35563?tls=true&tlsAllowInvalidCertificates=true"
DB = "wip"
COLL = "agent_tasks"
def get_collection():
client = MongoClient(URI, serverSelectionTimeoutMS=10000)
return client[DB][COLL], client
def create(note):
coll, client = get_collection()
result = coll.insert_one({"note": note, "type": "prodev expense", "status": "todo"})
print(result.inserted_id)
client.close()
def update(doc_id, note):
coll, client = get_collection()
result = coll.update_one({"_id": doc_id}, {"$set": {"note": note}})
print(f"matched={result.matched_count} modified={result.modified_count}")
client.close()
def list_all():
from bson import ObjectId
coll, client = get_collection()
for doc in coll.find({"type": "prodev expense"}):
print(f"{doc['_id']} | {doc['status']} | {doc['note'][:80]}...")
client.close()
if __name__ == "__main__":
if len(sys.argv) < 2:
print(__doc__)
sys.exit(1)
cmd = sys.argv[1]
if cmd == "create" and len(sys.argv) >= 3:
create(sys.argv[2])
elif cmd == "update" and len(sys.argv) >= 4:
from bson import ObjectId
update(ObjectId(sys.argv[2]), sys.argv[3])
elif cmd == "list":
list_all()
else:
print(__doc__)
sys.exit(1)