@lunnoa/client 1.3.0 → 1.4.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.
package/README.md CHANGED
@@ -268,7 +268,7 @@ Re-run codegen whenever entity types, workflows, or agents change on the deploym
268
268
 
269
269
  ## Define, run, and CLI deploy
270
270
 
271
- Author local definitions with `defineWorkflow` / `defineAgent` / `defineEntityType`, run linear chains with `lunnoa.runs.start`, and upsert with the CLI (prefer CLI over calling upsert from app code). Entity types are workspace-scoped (no `--project-id`); instance writes reject unknown attribute keys unless `allowUnknownAttributes` is true — use the reserved `extensions` object for flexible bags:
271
+ Author local definitions with `defineWorkflow` / `defineAgent` / `defineEntityType`, run linear chains with `lunnoa.runs.start`, and upsert with the CLI (prefer CLI over calling upsert from app code). An entity type slug is unique on the deployment. Deploy grants that type to the API key's workspace when the slug is new, and will not rewrite a type already granted to other workspaces (no `--project-id`). Instance writes reject unknown attribute keys unless `allowUnknownAttributes` is true — use the reserved `extensions` object for flexible bags:
272
272
 
273
273
  ```bash
274
274
  npx @lunnoa/client entity-types deploy ./human.ts --url https://lunnoa.example --api-key lna_...
@@ -322,7 +322,9 @@ Two Cursor / Claude Code skills ship in the published package under `skills/`:
322
322
  | **lunnoa-solution-design** | [`skills/lunnoa-solution-design/SKILL.md`](./skills/lunnoa-solution-design/SKILL.md) | Interview the human, map intent to Lunnoa primitives, produce a build brief |
323
323
  | **lunnoa-client** | [`skills/lunnoa-client/SKILL.md`](./skills/lunnoa-client/SKILL.md) | Implement with auth, discovery, codegen, `define*` / `runs` / CLI deploy, React hooks |
324
324
 
325
- After install, copy or enable them from `node_modules/@lunnoa/client/skills/` into your app’s `.cursor/skills/` (or Claude Code skills directory). Prefer **solution-design** first when requirements are unclear, then **lunnoa-client**.
325
+ Install them into your app with `npx @lunnoa/client skills install`. It copies the skills of the installed SDK version into `.claude/skills/` and `.cursor/skills/`. Add it as a `postinstall` script and gitignore both folders so the skills stay in step with the SDK. Prefer **solution-design** first when requirements are unclear, then **lunnoa-client**.
326
+
327
+ In this repo, edit `skills/` only; `pnpm install` copies it into the local `.cursor/skills/` and `.claude/skills/`.
326
328
 
327
329
  Partner paste block:
328
330
 
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/cli/index.ts
4
4
  import { mkdir, writeFile } from "fs/promises";
5
- import { resolve as resolve2 } from "path";
5
+ import { resolve as resolve3 } from "path";
6
6
 
7
7
  // src/core/auth.ts
8
8
  var API_KEY_PREFIX = "lna_";
@@ -1042,7 +1042,7 @@ var EntityTypesResource = class {
1042
1042
  }
1043
1043
  http;
1044
1044
  /**
1045
- * Lists entity types in the workspace. Request
1045
+ * Lists entity types granted to the API key's workspace. Request
1046
1046
  * `expansion: ['attributeSchema', 'stateSchema']` for the field and state
1047
1047
  * machine definitions the codegen CLI builds types from.
1048
1048
  */
@@ -1067,7 +1067,9 @@ var EntityTypesResource = class {
1067
1067
  });
1068
1068
  }
1069
1069
  /**
1070
- * Creates or updates an entity type by workspace-scoped slug.
1070
+ * Creates or updates an entity type by deployment-wide slug.
1071
+ * A new slug is granted to the API key's workspace. A slug already shared
1072
+ * with another workspace is rejected unless the key belongs to a platform admin.
1071
1073
  * Prefer the CLI (`npx @lunnoa/client entity-types deploy`) for happy-path deploy.
1072
1074
  */
1073
1075
  upsertBySlug(definition) {
@@ -1420,7 +1422,7 @@ function computeDurationMs(start, end) {
1420
1422
  return b - a;
1421
1423
  }
1422
1424
  function defaultSleep(ms) {
1423
- return new Promise((resolve3) => setTimeout(resolve3, ms));
1425
+ return new Promise((resolve4) => setTimeout(resolve4, ms));
1424
1426
  }
1425
1427
 
1426
1428
  // src/resources/knowledge.ts
@@ -2107,7 +2109,8 @@ var GROUPS_WITH_SUBCOMMAND = /* @__PURE__ */ new Set([
2107
2109
  "tools",
2108
2110
  "apps",
2109
2111
  "connections",
2110
- "projects"
2112
+ "projects",
2113
+ "skills"
2111
2114
  ]);
2112
2115
  var VALUE_FLAGS = /* @__PURE__ */ new Set([
2113
2116
  "--url",
@@ -2214,6 +2217,9 @@ var USAGE = `Usage:
2214
2217
  npx @lunnoa/client agents deploy <path> --url <url> --api-key <key> --project-id <uuid>
2215
2218
  npx @lunnoa/client entity-types deploy <path> --url <url> --api-key <key>
2216
2219
 
2220
+ Agent skills (copies this version's skills into .claude/skills and .cursor/skills):
2221
+ npx @lunnoa/client skills install [projectDir]
2222
+
2217
2223
  Options:
2218
2224
  --url Base URL of the Lunnoa Automate deployment
2219
2225
  --api-key Machine API key (lna_...)
@@ -2229,8 +2235,9 @@ Environment: LUNNOA_URL, LUNNOA_API_KEY, LUNNOA_PROJECT_ID
2229
2235
  Optional config file: lunnoa.config.ts | .mjs | .js | .json
2230
2236
 
2231
2237
  tools get prints inputConfig and a defineAction() sketch. tools list is compact;
2232
- run tools get for the schema. Entity-type deploy is workspace-scoped (no
2233
- --project-id). Unknown instance attributes are rejected unless
2238
+ run tools get for the schema. Entity-type deploy uses a deployment-wide slug
2239
+ and grants the API key's workspace when the slug is new (no --project-id).
2240
+ A slug already granted to other workspaces is not rewritten. Unknown instance attributes are rejected unless
2234
2241
  allowUnknownAttributes is true; use extensions.
2235
2242
  `;
2236
2243
 
@@ -3230,6 +3237,26 @@ async function loadOptionalConfig() {
3230
3237
  return {};
3231
3238
  }
3232
3239
 
3240
+ // src/cli/skills.ts
3241
+ import { cp } from "fs/promises";
3242
+ import { dirname, resolve as resolve2 } from "path";
3243
+ import { fileURLToPath } from "url";
3244
+ var SKILL_TARGETS = [".claude/skills", ".cursor/skills"];
3245
+ var BUNDLED_SKILLS_DIR = resolve2(
3246
+ dirname(fileURLToPath(import.meta.url)),
3247
+ "..",
3248
+ "skills"
3249
+ );
3250
+ async function installSkills(projectDir, sourceDir = BUNDLED_SKILLS_DIR) {
3251
+ const written = [];
3252
+ for (const target of SKILL_TARGETS) {
3253
+ const dest = resolve2(projectDir, target);
3254
+ await cp(sourceDir, dest, { recursive: true, force: true });
3255
+ written.push(dest);
3256
+ }
3257
+ return written;
3258
+ }
3259
+
3233
3260
  // src/cli/index.ts
3234
3261
  async function bindClient(args) {
3235
3262
  const fileConfig = await loadOptionalConfig();
@@ -3285,9 +3312,9 @@ async function runCodegen(args) {
3285
3312
  `Found ${definitions.entityTypes.length} entity type(s), ${definitions.workflows.length} workflow(s), ${definitions.agents.length} agent(s).`
3286
3313
  );
3287
3314
  const moduleSource = generateDeploymentModule(definitions);
3288
- const outDir = resolve2(process.cwd(), args.out);
3315
+ const outDir = resolve3(process.cwd(), args.out);
3289
3316
  await mkdir(outDir, { recursive: true });
3290
- const outFile = resolve2(outDir, "lunnoa.generated.ts");
3317
+ const outFile = resolve3(outDir, "lunnoa.generated.ts");
3291
3318
  await writeFile(outFile, moduleSource, "utf8");
3292
3319
  console.log(`Wrote ${outFile}`);
3293
3320
  }
@@ -3459,6 +3486,13 @@ async function main() {
3459
3486
  console.log(USAGE);
3460
3487
  return;
3461
3488
  }
3489
+ if (args.command === "skills" && args.subcommand === "install") {
3490
+ const written = await installSkills(resolve3(process.cwd(), args.path ?? "."));
3491
+ for (const dest of written) {
3492
+ console.log(`Installed Lunnoa skills into ${dest}`);
3493
+ }
3494
+ return;
3495
+ }
3462
3496
  if (args.command === "codegen") {
3463
3497
  await runCodegen(args);
3464
3498
  return;
package/dist/index.cjs CHANGED
@@ -1084,7 +1084,7 @@ var EntityTypesResource = class {
1084
1084
  }
1085
1085
  http;
1086
1086
  /**
1087
- * Lists entity types in the workspace. Request
1087
+ * Lists entity types granted to the API key's workspace. Request
1088
1088
  * `expansion: ['attributeSchema', 'stateSchema']` for the field and state
1089
1089
  * machine definitions the codegen CLI builds types from.
1090
1090
  */
@@ -1109,7 +1109,9 @@ var EntityTypesResource = class {
1109
1109
  });
1110
1110
  }
1111
1111
  /**
1112
- * Creates or updates an entity type by workspace-scoped slug.
1112
+ * Creates or updates an entity type by deployment-wide slug.
1113
+ * A new slug is granted to the API key's workspace. A slug already shared
1114
+ * with another workspace is rejected unless the key belongs to a platform admin.
1113
1115
  * Prefer the CLI (`npx @lunnoa/client entity-types deploy`) for happy-path deploy.
1114
1116
  */
1115
1117
  upsertBySlug(definition) {