Like 0

travisshears revised this gist 9 months ago · 911972d

2 files changed, 518 insertions

COOKING_HELPER.md (file created)
@@ -0,0 +1,117 @@
1 + # Cooking Helper Script
2 +
3 + A CLI tool for creating, editing, and viewing cooking notes stored in PocketBase. This allows Claude Code to integrate with your cooking notes feature.
4 +
5 + ## Setup
6 +
7 + The script uses your existing `.env` file for PocketBase credentials:
8 + - `POCKET_BASE_HOST` - PocketBase server URL
9 + - `POCKET_BASE_PASSWORD` - PocketBase user password
10 +
11 + ## Commands
12 +
13 + ### List all cooking notes
14 + ```bash
15 + npx ts-node scripts/cooking-helper.ts list
16 + ```
17 + Returns JSON with all cooking notes, sorted by most recently updated.
18 +
19 + ### View a specific note
20 + ```bash
21 + npx ts-node scripts/cooking-helper.ts view <slug>
22 + ```
23 + Example: `npx ts-node scripts/cooking-helper.ts view dashi`
24 +
25 + ### Fetch recipe from URL
26 + ```bash
27 + npx ts-node scripts/cooking-helper.ts fetch-recipe <url>
28 + ```
29 + Fetches and parses a recipe from a URL. Returns extracted title and content to help write a cooking note in your style.
30 +
31 + Example: `npx ts-node scripts/cooking-helper.ts fetch-recipe https://example.com/recipe`
32 +
33 + ### Create a new note
34 + ```bash
35 + npx ts-node scripts/cooking-helper.ts create '<json>'
36 + ```
37 + Create a new cooking note from JSON data.
38 +
39 + **Required fields:** `title`, `slug`, `content`
40 + **Optional fields:** `description`, `tags` (array of strings)
41 +
42 + Example:
43 + ```bash
44 + npx ts-node scripts/cooking-helper.ts create '{"title":"Pasta Carbonara","slug":"pasta-carbonara","description":"Classic Italian pasta","content":"## Ingredients\n- Pasta\n- Eggs\n- Guanciale\n\n## Steps\n1. Cook pasta\n2. Make sauce","tags":["pasta","italian","quick"]}'
45 + ```
46 +
47 + ### Update a note
48 + ```bash
49 + npx ts-node scripts/cooking-helper.ts update <id> '<json>'
50 + ```
51 + Update an existing note by ID. Only fields provided in JSON will be updated.
52 +
53 + Example:
54 + ```bash
55 + npx ts-node scripts/cooking-helper.ts update abc123 '{"content":"Updated content here","tags":["updated","tag"]}'
56 + ```
57 +
58 + ### Delete a note
59 + ```bash
60 + npx ts-node scripts/cooking-helper.ts delete <id>
61 + ```
62 + Permanently delete a cooking note.
63 +
64 + ## Workflow Example
65 +
66 + ### Creating a recipe from a website
67 +
68 + 1. Fetch the recipe URL:
69 + ```bash
70 + npx ts-node scripts/cooking-helper.ts fetch-recipe https://www.example.com/recipe
71 + ```
72 +
73 + 2. Review the extracted content
74 +
75 + 3. Write a cooking note in your style based on the content (using Claude's assistance)
76 +
77 + 4. Create the note:
78 + ```bash
79 + npx ts-node scripts/cooking-helper.ts create '{"title":"...","slug":"...","description":"...","content":"...","tags":[...]}'
80 + ```
81 +
82 + ## Output Format
83 +
84 + All commands return JSON output for easy parsing:
85 +
86 + **Success response:**
87 + ```json
88 + {
89 + "success": true,
90 + "message": "...",
91 + "note": { ... }
92 + }
93 + ```
94 +
95 + **Error response:**
96 + ```json
97 + {
98 + "success": false,
99 + "error": "error message"
100 + }
101 + ```
102 +
103 + ## Tips
104 +
105 + - **Slugs**: Use lowercase, hyphenated slugs (e.g., `pasta-carbonara`)
106 + - **Content**: Use Markdown format with sections like `## Ingredients`, `## Steps`, `## Notes`
107 + - **Tags**: Use simple, lowercase tags for categorization (e.g., `pasta`, `vegetarian`, `quick`)
108 + - **IDs**: Get IDs from `list` or `view` commands to use in `update`/`delete`
109 +
110 + ## With Claude Code
111 +
112 + You can use this script directly in Claude Code to:
113 + 1. Ask Claude to create a cooking note from a recipe URL
114 + 2. Ask Claude to update existing notes
115 + 3. Ask Claude to view notes for reference
116 +
117 + Example prompt: "Create a cooking note for pasta carbonara based on this URL: https://example.com/recipe"
cooking-helper.ts (file created)

Diff is too large to be shown