diff --git a/professional-development-business-case/SKILL.md b/professional-development-business-case/SKILL.md index 46ce2b6..1e33042 100644 --- a/professional-development-business-case/SKILL.md +++ b/professional-development-business-case/SKILL.md @@ -23,29 +23,35 @@ When Connor needs to justify a training, tool, book, course, or other profession - Resource name or URL (visit the URL to get accurate details) - Specific topics it covers -2. Write a single, direct paragraph. +2. **Research the resource.** If Connor provides a URL, fetch the page to get accurate details about contents, format, and topics. Also try to extract: + - **Price** — look for pricing on the page + - **Vendor** — identify the creator/company selling it + - **Product type** — classify it (e.g., `educational course`, `book`, `subscription`, `conference`, `tool`) -3. Do not ask follow-up questions or offer alternatives — just produce the paragraph. + If any of these cannot be determined from the URL, ask Connor as a follow-up before proceeding. + +3. Write a single, direct paragraph. 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 "" + uv run --with pymongo ~/notes/skills/professional-development-business-case/scripts/prodev_tasks.py create "" --price --vendor "" --product-type "" ``` - This inserts into `wip.agent_tasks` with `type: "prodev expense"` and `status: "todo"`. Save the returned document ID. + This inserts into `wip.agent_tasks` with `type: "prodev expense"`, `status: "todo"`, and metadata fields `price`, `vendor`, `product_type`. 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 "" ``` + You can also update individual metadata fields with `--price`, `--vendor`, `--product-type`. ## Database Commands The script supports three commands: -- `create ""` — insert a new prodev expense entry -- `update ""` — update the note for an existing entry -- `list` — list all prodev expense entries +- `create "" [--price PRICE] [--vendor VENDOR] [--product-type TYPE]` — insert a new prodev expense entry +- `update "" [--price PRICE] [--vendor VENDOR] [--product-type TYPE]` — update the note and/or metadata for an existing entry +- `list` — list all prodev expense entries with price, vendor, and product type ## Rules diff --git a/professional-development-business-case/scripts/prodev_tasks.py b/professional-development-business-case/scripts/prodev_tasks.py index 614e4bf..496034e 100644 --- a/professional-development-business-case/scripts/prodev_tasks.py +++ b/professional-development-business-case/scripts/prodev_tasks.py @@ -2,12 +2,13 @@ """Manage prodev expense entries in wip.agent_tasks on DocDB. Usage: - prodev_tasks.py create "" - prodev_tasks.py update "" + prodev_tasks.py create "" [--price PRICE] [--vendor VENDOR] [--product-type TYPE] + prodev_tasks.py update "" [--price PRICE] [--vendor VENDOR] [--product-type TYPE] prodev_tasks.py list """ import sys +import argparse from pymongo import MongoClient URI = "mongodb://root:3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl@docdb.connorrhodes.com:35563?tls=true&tlsAllowInvalidCertificates=true" @@ -18,15 +19,29 @@ def get_collection(): client = MongoClient(URI, serverSelectionTimeoutMS=10000) return client[DB][COLL], client -def create(note): +def create(note, price=None, vendor=None, product_type=None): coll, client = get_collection() - result = coll.insert_one({"note": note, "type": "prodev expense", "status": "todo"}) + doc = {"note": note, "type": "prodev expense", "status": "todo"} + if price is not None: + doc["price"] = float(price) + if vendor is not None: + doc["vendor"] = vendor + if product_type is not None: + doc["product_type"] = product_type + result = coll.insert_one(doc) print(result.inserted_id) client.close() -def update(doc_id, note): +def update(doc_id, note, price=None, vendor=None, product_type=None): coll, client = get_collection() - result = coll.update_one({"_id": doc_id}, {"$set": {"note": note}}) + sets = {"note": note} + if price is not None: + sets["price"] = float(price) + if vendor is not None: + sets["vendor"] = vendor + if product_type is not None: + sets["product_type"] = product_type + result = coll.update_one({"_id": doc_id}, {"$set": sets}) print(f"matched={result.matched_count} modified={result.modified_count}") client.close() @@ -34,22 +49,40 @@ 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]}...") + price = doc.get("price", "?") + vendor = doc.get("vendor", "?") + ptype = doc.get("product_type", "?") + print(f"{doc['_id']} | ${price} | {vendor} | {ptype} | {doc['status']} | {doc['note'][:60]}...") client.close() if __name__ == "__main__": - if len(sys.argv) < 2: - print(__doc__) - sys.exit(1) + parser = argparse.ArgumentParser(description="Manage prodev expense entries") + sub = parser.add_subparsers(dest="cmd") - cmd = sys.argv[1] - if cmd == "create" and len(sys.argv) >= 3: - create(sys.argv[2]) - elif cmd == "update" and len(sys.argv) >= 4: + p_create = sub.add_parser("create") + p_create.add_argument("note") + p_create.add_argument("--price", default=None) + p_create.add_argument("--vendor", default=None) + p_create.add_argument("--product-type", default=None) + + p_update = sub.add_parser("update") + p_update.add_argument("doc_id") + p_update.add_argument("note") + p_update.add_argument("--price", default=None) + p_update.add_argument("--vendor", default=None) + p_update.add_argument("--product-type", default=None) + + sub.add_parser("list") + + args = parser.parse_args() + + if args.cmd == "create": + create(args.note, args.price, args.vendor, args.product_type) + elif args.cmd == "update": from bson import ObjectId - update(ObjectId(sys.argv[2]), sys.argv[3]) - elif cmd == "list": + update(ObjectId(args.doc_id), args.note, args.price, args.vendor, args.product_type) + elif args.cmd == "list": list_all() else: - print(__doc__) + parser.print_help() sys.exit(1)