potion-kit 0.0.2 → 0.0.3

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.
@@ -18,7 +18,7 @@ export const POTION_KIT_RULES = `You are the potion-kit assistant: static sites
18
18
  1. STACK — Handlebars (.hbs), Markdown + front matter (.md), SCSS. src/ → build/. No React, Vue, Tailwind.
19
19
  2. SOURCES — Use Harold context below and UIPotion: catalog + search_potions + get_potion_spec(category, id). Do not invent specs; fetch full spec with get_potion_spec before generating. Implement the full spec (states, transitions, interactions); for interactive UIs (e.g. chat) use mock data or mock API so the UI works. fetch_doc_page only as fallback (haroldjs.com, uipotion.com).
20
20
  3. BEHAVIOUR — Clarify if needed, then fetch UIPotion guide(s) and get_harold_project_info. Generate Handlebars, SCSS, Markdown via write_project_file. New project: create package.json (harold-scripts, harold config), .gitignore, src/ (main.scss single file, partials head.hbs + footer.hbs, pages index.hbs). Reply with short text every turn (never only tool calls). Mention HaroldJS and UIPotion when describing the stack.
21
- 4. OUTPUT — relativePath, formatDate, postsList, responsiveImg. write_project_file(path from project root). One main.scss when scaffolding (no @import/@use). publicationDate YYYY-MM-DD. Never {{formatDate date='now'}}; use e.g. date='2025-01-01' format='yyyy'. .js only under src/ for browser scripts. Keep replies short (2–4 sentences).
21
+ 4. OUTPUT — relativePath, formatDate, postsList, responsiveImg. write_project_file(path from project root). One main.scss when scaffolding (no @import/@use). publicationDate YYYY-MM-DD. Never {{formatDate date='now'}}; use e.g. date='2025-01-01' format='yyyy'. Browser/Harold.js scripts only in src/assets/js/; link with {{relativePath 'assets/js/…'}}. Never put scripts in statics/ or src/ root. Keep replies short (2–4 sentences).
22
22
  5. FIXES — Before editing any file, call read_project_file; make minimal edits from returned content. Do not overwrite with a fresh component; get_harold_project_info does not return file contents — always read before write.
23
23
  `;
24
24
  /**
package/dist/ai/tools.js CHANGED
@@ -12,7 +12,7 @@ import { fetchPotionsIndex } from "./context/potions-catalog.js";
12
12
  import { potionSpecUrl } from "./endpoints.js";
13
13
  import { getJson } from "./remote.js";
14
14
  const ALLOWED_EXTENSIONS = new Set([".hbs", ".md", ".scss", ".css", ".html", ".json"]);
15
- /** .js only allowed under src/ for browser scripts (interactions, client-side search). Node.js scripts are not allowed. */
15
+ /** .js only allowed under src/assets/js/ for browser scripts (Harold.js, interactions, client-side). Node.js scripts are not allowed. */
16
16
  const FORBIDDEN_SUBSTRINGS = [".env", ".."];
17
17
  async function isPathAllowed(projectRoot, relativePath) {
18
18
  const normalized = relativePath.replace(/\\/g, "/").trim();
@@ -29,17 +29,17 @@ async function isPathAllowed(projectRoot, relativePath) {
29
29
  const isAllowedRootDotfile = allowedRootDotfiles.includes(normalized) ||
30
30
  allowedRootDotfiles.some((f) => normalized === f || normalized.endsWith("/" + f));
31
31
  const allowedExtensions = ALLOWED_EXTENSIONS.has(ext);
32
- const jsUnderSrc = ext === ".js" && normalized.startsWith("src/");
33
- if (!allowedExtensions && !jsUnderSrc && !isAllowedRootDotfile) {
32
+ const jsUnderAssetsJs = ext === ".js" && normalized.startsWith("src/assets/js/");
33
+ if (!allowedExtensions && !jsUnderAssetsJs && !isAllowedRootDotfile) {
34
34
  if (ext === ".js") {
35
35
  return {
36
36
  ok: false,
37
- error: "Only browser/client-side .js under src/ is allowed (e.g. src/scripts/search.js). Node.js scripts are not allowed.",
37
+ error: "Only browser/client-side .js under src/assets/js/ is allowed (e.g. src/assets/js/search.js). Node.js scripts are not allowed.",
38
38
  };
39
39
  }
40
40
  return {
41
41
  ok: false,
42
- error: `Allowed extensions: ${[...ALLOWED_EXTENSIONS].join(", ")}, or .js under src/, or ${allowedRootDotfiles.join(", ")} in project root`,
42
+ error: `Allowed extensions: ${[...ALLOWED_EXTENSIONS].join(", ")}, or .js under src/assets/js/, or ${allowedRootDotfiles.join(", ")} in project root`,
43
43
  };
44
44
  }
45
45
  const absolute = resolve(projectRoot, normalized);
@@ -221,7 +221,7 @@ export function createPotionKitTools() {
221
221
  },
222
222
  }),
223
223
  write_project_file: tool({
224
- description: 'Create or overwrite a file in the user\'s project. Path must be relative to the project root; you cannot write outside this directory. Allowed: .hbs, .md, .scss, .css, .html, .json anywhere (including package.json, .haroldrc.json at root); .js only under src/ for browser scripts; .gitignore at root. When the project is new or missing root setup, create package.json with scripts "build": "harold-scripts build", "start": "harold-scripts start", devDependencies harold-scripts, and a "harold" config object (see system prompt scaffold). Do NOT write Node.js scripts (no .js at project root). Do not write .env or paths containing "..".',
224
+ description: 'Create or overwrite a file in the user\'s project. Path must be relative to the project root; you cannot write outside this directory. Allowed: .hbs, .md, .scss, .css, .html, .json anywhere (including package.json, .haroldrc.json at root); .js only under src/assets/js/ for browser/Harold scripts; .gitignore at root. When the project is new or missing root setup, create package.json with scripts "build": "harold-scripts build", "start": "harold-scripts start", devDependencies harold-scripts, and a "harold" config object (see system prompt scaffold). Do NOT write Node.js scripts (no .js at project root). Do not write .env or paths containing "..".',
225
225
  parameters: z.object({
226
226
  path: z
227
227
  .string()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "potion-kit",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "CLI to build HaroldJS + UIPotion websites",
5
5
  "author": "Julian Ćwirko <julian.io>",
6
6
  "type": "module",