framer-dalton 0.0.30 → 0.0.32

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/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import net from 'net';
12
12
  import { fileURLToPath } from 'url';
13
13
  import { createTRPCClient, httpLink } from '@trpc/client';
14
14
 
15
- /* @framer/ai CLI v0.0.30 */
15
+ /* @framer/ai CLI v0.0.32 */
16
16
  var __defProp = Object.defineProperty;
17
17
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
18
18
 
@@ -375,7 +375,7 @@ __name(markTelemetryNoticeShown, "markTelemetryNoticeShown");
375
375
  // src/version.ts
376
376
  var VERSION = (
377
377
  // typeof is used to ensure this can be used just via tsx or node etc. without build
378
- "0.0.30"
378
+ "0.0.32"
379
379
  );
380
380
  var trackingEndpoint = "https://events.framer.com/track";
381
381
  var inProgressTrackings = /* @__PURE__ */ new Set();
@@ -16444,6 +16444,37 @@ function expandReferences(refs, seen) {
16444
16444
  return result;
16445
16445
  }
16446
16446
  __name(expandReferences, "expandReferences");
16447
+ function getMethodByPath(query) {
16448
+ const pathParts = query.split(".");
16449
+ if (pathParts.length < 2) return void 0;
16450
+ if (pathParts.length === 2) {
16451
+ const method = getMethod(query);
16452
+ return method ? { method, displayCategory: method.category } : void 0;
16453
+ }
16454
+ let methods = methodsByCategory[pathParts[0].toLowerCase()];
16455
+ const rootClass = classes[pathParts[0].toLowerCase()];
16456
+ let displayCategory = rootClass?.name ?? pathParts[0];
16457
+ for (let pathIndex = 1; pathIndex < pathParts.length; pathIndex++) {
16458
+ const pathPart = pathParts[pathIndex];
16459
+ const method = methods?.find(
16460
+ (candidateMethod) => candidateMethod.name === pathPart
16461
+ );
16462
+ if (!method) return void 0;
16463
+ if (pathIndex === pathParts.length - 1) {
16464
+ return { method, displayCategory };
16465
+ }
16466
+ if (!method.signature.startsWith(`${method.name}:`) && !method.signature.startsWith(`${method.name}?:`)) {
16467
+ return void 0;
16468
+ }
16469
+ const nestedCategory = method.references.find(
16470
+ (referenceName) => methodsByCategory[referenceName.toLowerCase()]
16471
+ );
16472
+ if (!nestedCategory) return void 0;
16473
+ displayCategory = `${displayCategory}.${method.name}`;
16474
+ methods = methodsByCategory[nestedCategory.toLowerCase()];
16475
+ }
16476
+ }
16477
+ __name(getMethodByPath, "getMethodByPath");
16447
16478
  function renderDocs(queries) {
16448
16479
  const lines = [];
16449
16480
  const errors = [];
@@ -16455,8 +16486,8 @@ function renderDocs(queries) {
16455
16486
  const query = queries[i];
16456
16487
  if (i > 0) lines.push("");
16457
16488
  if (query.includes(".")) {
16458
- const method = getMethod(query);
16459
- if (!method) {
16489
+ const methodPath = getMethodByPath(query);
16490
+ if (!methodPath) {
16460
16491
  const { methodNames } = getAllKnownNames();
16461
16492
  const suggestion = findClosestMatch(query, methodNames);
16462
16493
  const hint = suggestion ? ` Did you mean '${suggestion}'?` : "";
@@ -16465,8 +16496,9 @@ function renderDocs(queries) {
16465
16496
  );
16466
16497
  return { lines, errors };
16467
16498
  }
16499
+ const { method, displayCategory } = methodPath;
16468
16500
  if (method.description) lines.push(formatDocComment(method.description));
16469
- lines.push(`${method.category}.${method.signature}`);
16501
+ lines.push(`${displayCategory}.${method.signature}`);
16470
16502
  const seen = /* @__PURE__ */ new Set();
16471
16503
  for (const typeDef of expandReferences(method.references, seen)) {
16472
16504
  lines.push(`
@@ -14,7 +14,7 @@ import { z } from 'zod';
14
14
  import { createRequire } from 'module';
15
15
  import * as vm from 'vm';
16
16
 
17
- /* @framer/ai relay server v0.0.30 */
17
+ /* @framer/ai relay server v0.0.32 */
18
18
  var __defProp = Object.defineProperty;
19
19
  var __knownSymbol = (name2, symbol) => (symbol = Symbol[name2]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name2);
20
20
  var __typeError = (msg) => {
@@ -199,7 +199,7 @@ __name(debug, "debug");
199
199
  // src/version.ts
200
200
  var VERSION = (
201
201
  // typeof is used to ensure this can be used just via tsx or node etc. without build
202
- "0.0.30"
202
+ "0.0.32"
203
203
  );
204
204
 
205
205
  // src/relay-client.ts
@@ -687,15 +687,24 @@ async function execute(session, code, options = {}) {
687
687
  }
688
688
  __name(execute, "execute");
689
689
  async function readActiveBranch(session) {
690
+ if (session.branchMonitoringDisabled) return void 0;
690
691
  try {
691
692
  const branch = await session.connection.framer.agent.getActiveBranch();
692
693
  session.connection.setActiveBranchId(branch.id);
693
694
  return branch;
694
- } catch {
695
+ } catch (err) {
696
+ if (isBranchingUnavailableError(err)) {
697
+ session.branchMonitoringDisabled = true;
698
+ }
695
699
  return void 0;
696
700
  }
697
701
  }
698
702
  __name(readActiveBranch, "readActiveBranch");
703
+ function isBranchingUnavailableError(err) {
704
+ if (!(err instanceof Error)) return false;
705
+ return err.message.includes("Branching is not available");
706
+ }
707
+ __name(isBranchingUnavailableError, "isBranchingUnavailableError");
699
708
  async function getBranchChange(session, previousBranch) {
700
709
  if (!previousBranch) return void 0;
701
710
  const activeBranch = await readActiveBranch(session);
@@ -262,7 +262,7 @@ const commands = rows.flatMap((row, i) => {
262
262
  return [`+CollectionItemNode ${itemId} parent="${collectionId}";`, `SET ${itemId} ${sets.join(" ")};`];
263
263
  });
264
264
 
265
- await framer.agent.applyChanges(commands.join(" "));
265
+ console.log(await framer.agent.applyChanges(commands.join(" ")));
266
266
  ```
267
267
 
268
268
  #### Writing enum fields
@@ -275,10 +275,10 @@ const collection = (await framer.agent.getNodesOfTypes({ types: ["CollectionNode
275
275
  const statusField = collection.variables.find((v) => v.name === "Status");
276
276
  const status = statusField.cases.find((name) => name === "New");
277
277
 
278
- await framer.agent.applyChanges(
278
+ console.log(await framer.agent.applyChanges(
279
279
  `+CollectionItemNode newPost parent="${collection.id}";
280
280
  SET newPost $control__slug="hello-world" ${statusField.key}="${status}";`,
281
- );
281
+ ));
282
282
  ```
283
283
 
284
284
  #### Sync external data
@@ -306,7 +306,7 @@ const commands = source.flatMap((row, i) => {
306
306
  });
307
307
  existing.filter((item) => !seen.has(item.id)).forEach((item) => commands.push(`DEL ${item.id};`));
308
308
 
309
- await framer.agent.applyChanges(commands.join(" "));
309
+ console.log(await framer.agent.applyChanges(commands.join(" ")));
310
310
  ```
311
311
 
312
312
  #### Field Types
@@ -383,10 +383,10 @@ console.log(state.diagnostics);
383
383
  state.component = state.codeFile.exports.find(
384
384
  (exportItem) => exportItem.type === "component" && exportItem.isDefaultExport,
385
385
  );
386
- await framer.agent.applyChanges(
386
+ console.log(await framer.agent.applyChanges(
387
387
  `+ComponentInstanceNode badge parent="wrapper" component="${state.component.componentId}"; SET badge width=120 height=48;`,
388
388
  { pagePath: "/" },
389
- );
389
+ ));
390
390
  ```
391
391
 
392
392
  #### Editing
@@ -65,8 +65,6 @@ npx @framer/agent@latest project remix "<url, project id, or remix link>"
65
65
  npx @framer/agent@latest session new "<returned project id>"
66
66
  ```
67
67
 
68
- Note that during beta, you cannot connect to non-beta projects. If creating a session errors with a message about this, you need to move your project to beta.
69
-
70
68
  List active sessions:
71
69
 
72
70
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framer-dalton",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "type": "module",
5
5
  "bin": "./dist/cli.js",
6
6
  "main": "./dist/cli.js",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@biomejs/biome": "^2.4.13",
32
32
  "@framerjs/framer-events": "0.0.185",
33
- "@types/node": "24.12.4",
33
+ "@types/node": "24.13.0",
34
34
  "tsup": "^8.0.2",
35
35
  "tsx": "^4.22.3",
36
36
  "typescript": "^5.9.2",