kopular 1.2.5 → 1.3.0

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.
Files changed (3) hide show
  1. package/GUIDE.md +5 -1
  2. package/bin/kp.mjs +27 -0
  3. package/package.json +1 -1
package/GUIDE.md CHANGED
@@ -19,7 +19,11 @@ app.Mount(document.body);
19
19
  ```
20
20
 
21
21
  Run `npm run build && npm run serve`, or `npm start` (a scaffolded project already has
22
- both scripts). `ks check src/app.ks` type-checks without building, if you just want errors.
22
+ both scripts). **Verify with one command, not two:** whatever runs your app or its tests
23
+ builds first, and a compile failure stops it right there with every error and its `fix:`
24
+ hint — so running a separate build before it only adds a round-trip (the build itself takes
25
+ well under a second). `ks check src/app.ks` type-checks without building, for when you only
26
+ want the errors.
23
27
 
24
28
  ## The language you need
25
29
 
package/bin/kp.mjs CHANGED
@@ -203,6 +203,31 @@ Counter app = new Counter();
203
203
  app.Mount(document.body);
204
204
  `;
205
205
 
206
+ // Loaded automatically at session start by AI coding agents (AGENTS.md is the
207
+ // cross-tool convention; Claude Code reads CLAUDE.md, which imports it). Kept
208
+ // deliberately tiny, because it sits in every request's context. Its one job is
209
+ // routing: an agent that opens node_modules/kopular/LLM.md (~53K chars) before
210
+ // GUIDE.md (~15K) pays for that on every call after, and benchmark transcripts
211
+ // showed agents never read a project's README unprompted.
212
+ const AGENTS_MD_TEMPLATE = `# Notes for AI coding agents
213
+
214
+ This app is KopScript + Kopular: a typed language that compiles to JavaScript, and is
215
+ probably not in your training data.
216
+
217
+ - **Read \`node_modules/kopular/GUIDE.md\` first**, in full: one page covering the language
218
+ subset, components, templates, forms, HTTP and routing. Search the much longer
219
+ \`node_modules/kopular/LLM.md\` and \`node_modules/kopscript/LLM.md\` only for what it
220
+ doesn't cover.
221
+ - **Check your work with one command.** \`npm run build\` compiles \`src/app.ks\` and every file
222
+ it \`using\`s in well under a second and prints every error with a \`fix:\` hint. Anything
223
+ that runs the app or its tests builds first, so don't run a separate build before it.
224
+ - Kopular's source in \`node_modules\` isn't its documentation — try GUIDE.md, the compiler's
225
+ hint, then the LLM.md references before reading it.
226
+ `;
227
+
228
+ const CLAUDE_MD_TEMPLATE = `@AGENTS.md
229
+ `;
230
+
206
231
  function scaffoldProject(dirPath) {
207
232
  const name = basename(dirPath);
208
233
  if (existsSync(dirPath) && readdirSync(dirPath).length > 0) {
@@ -218,6 +243,8 @@ function scaffoldProject(dirPath) {
218
243
  writeFileSync(join(dirPath, "index.html"), indexHtmlTemplate(), "utf-8");
219
244
  writeFileSync(join(dirPath, ".gitignore"), GITIGNORE_TEMPLATE, "utf-8");
220
245
  writeFileSync(join(dirPath, "README.md"), readmeTemplate(name), "utf-8");
246
+ writeFileSync(join(dirPath, "AGENTS.md"), AGENTS_MD_TEMPLATE, "utf-8");
247
+ writeFileSync(join(dirPath, "CLAUDE.md"), CLAUDE_MD_TEMPLATE, "utf-8");
221
248
  writeFileSync(join(dirPath, "scripts", "serve.mjs"), SERVE_MJS_TEMPLATE, "utf-8");
222
249
  writeFileSync(join(dirPath, "scripts", "vendor-kopular.mjs"), VENDOR_KOPULAR_MJS_TEMPLATE, "utf-8");
223
250
  writeFileSync(join(dirPath, "src", "counter.ks"), COUNTER_KS_TEMPLATE, "utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kopular",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "description": "Kopular: a small component framework for KopScript — components, reactive state, constructor-injected services, routing, real compiled templates, and HTTP, with no DI container",
5
5
  "type": "module",
6
6
  "license": "MIT",