@akanjs/cli 3.2.0-rc.2 → 3.2.0-rc.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.
Files changed (50) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-6cpjtj25.js → CodeAgent-e9c712an.js} +3 -3
  3. package/{CodeTui-zyc7zaq6.js → CodeTui-wv9yf7eq.js} +1 -1
  4. package/{agent.command-kf1g3nh4.js → agent.command-9erafkcb.js} +6 -6
  5. package/akanCode.js +3 -3
  6. package/{application.command-vb278qnq.js → application.command-6515t682.js} +3 -3
  7. package/{cloud.command-ca777ee2.js → cloud.command-32esk0v1.js} +7 -7
  8. package/{cloud.script-agpxzq6j.js → cloud.script-arsagnq6.js} +7 -7
  9. package/{code.command-j08txqcd.js → code.command-xk7rwq2x.js} +4 -4
  10. package/{context.command-2fa6egp9.js → context.command-jwenkkf0.js} +11 -11
  11. package/{context.runner-ftv8373t.js → context.runner-mqpp67br.js} +10 -10
  12. package/{devTui-w38ch13a.js → devTui-cd03z4mx.js} +1 -1
  13. package/incrementalBuilder.proc.js +3 -3
  14. package/{index-qgazn58x.js → index-0ba8nj4d.js} +2 -2
  15. package/{index-mvwvxgtd.js → index-2eym1yjb.js} +6 -6
  16. package/{index-2gees180.js → index-2rqyrvcy.js} +3 -3
  17. package/{index-ebwkh7bt.js → index-39jz41jb.js} +23 -5
  18. package/{index-c5ymqb05.js → index-43acpsc7.js} +6 -6
  19. package/{index-xa0289eg.js → index-54s6knqe.js} +5 -0
  20. package/{index-cbcwxp5v.js → index-8gm4yag8.js} +6 -4
  21. package/{index-m5sg5spm.js → index-9p260r4e.js} +114 -24
  22. package/{index-65b6ms4c.js → index-bak9f2br.js} +1 -1
  23. package/{index-1cb9apzn.js → index-cmg5ngqa.js} +1 -1
  24. package/{index-8nbx607g.js → index-ddk49ypz.js} +7 -3
  25. package/{index-dk4g0x0d.js → index-dpgywgeq.js} +1 -1
  26. package/{index-pq5rjkch.js → index-h0p6n4k1.js} +6 -1
  27. package/{index-j7p0jgaq.js → index-j4hkbzj6.js} +3 -3
  28. package/{index-0mqga3h9.js → index-ngpt3zz3.js} +1 -1
  29. package/{index-abfbf01s.js → index-qrk06tfp.js} +1 -1
  30. package/{index-htxck0pn.js → index-s34v3y28.js} +6 -1
  31. package/{index-23860fej.js → index-sc0g6zbm.js} +2 -0
  32. package/index-x3x31df8.js +14 -0
  33. package/{index-xq97me1h.js → index-xrmrvafh.js} +6 -6
  34. package/{index-0fj9ra3q.js → index-ytpmk3pb.js} +4 -4
  35. package/{index-annxfpgz.js → index-zcdmnfrf.js} +2 -2
  36. package/{index-466z5931.js → index-zhkcab5a.js} +1 -1
  37. package/index.js +17 -17
  38. package/{library.command-8d03a0pq.js → library.command-qs8beggh.js} +1 -1
  39. package/{localRegistry.command-vyv5k6t0.js → localRegistry.command-hz4ged9n.js} +6 -6
  40. package/{module.command-vy3kg965.js → module.command-z9js77m2.js} +3 -3
  41. package/{package.command-qjh13rs9.js → package.command-zqenq8c0.js} +3 -3
  42. package/package.json +2 -2
  43. package/{primitive.command-8vm49279.js → primitive.command-v5kypwy4.js} +4 -4
  44. package/{quality.command-v76fev72.js → quality.command-q55j2htd.js} +2 -2
  45. package/{repair.command-fp4m3w03.js → repair.command-7ssbbdq2.js} +4 -4
  46. package/{scalar.command-hxe6try8.js → scalar.command-p5jb7z57.js} +3 -3
  47. package/{subspace.command-q42n1844.js → subspace.command-7wxy6ptj.js} +1 -1
  48. package/{verify.command-rx43bha1.js → verify.command-m0wnndd7.js} +3 -3
  49. package/{workflow.command-yg0d8mmq.js → workflow.command-jx8dqs9n.js} +8 -8
  50. package/{workspace.command-fcfztvn5.js → workspace.command-ca9kfyt3.js} +24 -20
@@ -29,6 +29,9 @@ class AkanGraphDiff {
29
29
  ...head.edges.flatMap((edge) => !baseKeys.has(edgeKeyOf(edge)) ? [{ ...edge, change: "added" }] : marked.has(edge.from) || marked.has(edge.to) ? [edge] : []),
30
30
  ...base.edges.filter((edge) => !headKeys.has(edgeKeyOf(edge))).map((edge) => ({ ...edge, change: "removed" }))
31
31
  ];
32
+ const shown = new Set([...marked.keys(), ...edges.flatMap((edge) => [edge.from, edge.to])]);
33
+ const listed = new Set(edges.map(edgeKeyOf));
34
+ edges.push(...head.edges.filter((edge) => edge.kind === "binds" && shown.has(edge.from) && !listed.has(edgeKeyOf(edge))));
32
35
  const context = edges.flatMap((edge) => [edge.from, edge.to]).filter((id) => !marked.has(id)).flatMap((id) => {
33
36
  const node = headNodes.get(id) ?? baseNodes.get(id);
34
37
  return node ? [node] : [];
@@ -486,7 +489,7 @@ var createFactReader = (ts, ast) => {
486
489
  const [size, unit] = intervalUnits.find(([size]) => ms >= size && ms % size === 0) ?? [1, "ms"];
487
490
  return `${ms / size}${unit}`;
488
491
  };
489
- const modesOf = (option) => {
492
+ const modesOf = (option, type) => {
490
493
  const object = option && unwrap(option);
491
494
  if (!object || !ts.isObjectLiteralExpression(object))
492
495
  return [];
@@ -496,9 +499,9 @@ var createFactReader = (ts, ast) => {
496
499
  if (name === "enabled")
497
500
  return value.kind === ts.SyntaxKind.FalseKeyword ? ["disabled"] : [];
498
501
  if (name === "once")
499
- return value.kind === ts.SyntaxKind.TrueKeyword ? ["once"] : [];
502
+ return type === "initialize" && value.kind === ts.SyntaxKind.TrueKeyword ? ["once"] : [];
500
503
  if (name === "lock")
501
- return value.kind === ts.SyntaxKind.FalseKeyword ? ["unlocked"] : [];
504
+ return type === "interval" && value.kind === ts.SyntaxKind.FalseKeyword ? ["unlocked"] : [];
502
505
  if (name !== "serverMode" && name !== "operationMode")
503
506
  return [];
504
507
  const values = ts.isArrayLiteralExpression(value) ? [...value.elements] : [value];
@@ -516,7 +519,8 @@ var createFactReader = (ts, ast) => {
516
519
  const { root } = chainOf(property.initializer);
517
520
  const type = root ? verbOf(root.expression) : null;
518
521
  const [first, second] = root?.arguments ?? [];
519
- const schedule = type === "cron" && first ? ts.isStringLiteralLike(first) ? first.text : first.getText(source) : type === "interval" || type === "timeout" ? durationOf(first, source) : null;
522
+ const cron = type === "cron" && first ? unwrap(first) : null;
523
+ const schedule = cron ? ts.isStringLiteralLike(cron) ? cron.text : cron.getText(source) : type === "interval" || type === "timeout" ? durationOf(first, source) : null;
520
524
  const option = type === "initialize" || type === "destroy" ? first : second;
521
525
  return [
522
526
  {
@@ -525,7 +529,7 @@ var createFactReader = (ts, ast) => {
525
529
  extent: extentOf(source, property),
526
530
  type,
527
531
  schedule,
528
- modes: modesOf(option)
532
+ modes: modesOf(option, type)
529
533
  }
530
534
  ];
531
535
  });
@@ -542,6 +546,19 @@ var createFactReader = (ts, ast) => {
542
546
  return name && targetName ? [{ name, span: spanOf(source, property.name), target: targetName }] : [];
543
547
  });
544
548
  };
549
+ const adaptorBindingsIn = (source) => {
550
+ const bindings = [];
551
+ const visit = (node) => {
552
+ if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === "applyAdaptor") {
553
+ const [role, adaptor] = node.arguments.map(guardNameOf);
554
+ if (role && adaptor)
555
+ bindings.push({ role, adaptor, span: spanOf(source, node.expression.name) });
556
+ }
557
+ ts.forEachChild(node, visit);
558
+ };
559
+ visit(source);
560
+ return bindings;
561
+ };
545
562
  const endpointKeysOf = (source, builder, made, model) => {
546
563
  const verbOf = verbReaderOf(builder?.parameters[0]);
547
564
  return (returnedObject(builder)?.properties ?? []).flatMap((property) => {
@@ -662,6 +679,7 @@ var createFactReader = (ts, ast) => {
662
679
  endpoints: [],
663
680
  internals: [],
664
681
  adaptors: [],
682
+ adaptorBindings: source.text.includes("applyAdaptor") ? adaptorBindingsIn(source) : [],
665
683
  stores: []
666
684
  };
667
685
  for (const statement of source.statements) {
@@ -686,7 +704,8 @@ var createFactReader = (ts, ast) => {
686
704
  ...name,
687
705
  model: moduleRefOf(call.arguments[0], "db"),
688
706
  methods: methodsOf(source, statement),
689
- plugs: plugsOf(source, builder)
707
+ plugs: plugsOf(source, builder),
708
+ fields: objectKeys(source, returnedObject(builder)).map(({ name }) => name)
690
709
  });
691
710
  else if (callee === "slice") {
692
711
  const model = moduleRefOf(call.arguments[0], "srv");
@@ -1358,6 +1377,7 @@ class GraphBuilder {
1358
1377
  #resolver;
1359
1378
  #adaptors = new Map;
1360
1379
  #plugs = new Map;
1380
+ #serviceFields = new Set;
1361
1381
  constructor(source) {
1362
1382
  this.#source = source;
1363
1383
  this.#routes = new RouteFactReader(source.ts, source.reader, source.parse);
@@ -1373,16 +1393,26 @@ class GraphBuilder {
1373
1393
  ...[...constantsByOwner].filter(([key]) => key !== owner && key?.startsWith("libs/")).flatMap(([, list]) => list)
1374
1394
  ];
1375
1395
  const typed = [];
1396
+ const adaptorCounts = new Map;
1376
1397
  for (const file of facts)
1377
1398
  for (const fact of file.adaptors) {
1378
- const declared = { fact, owner: file.owner, fileName: file.fileName };
1379
- this.#adaptors.set(fact.name, [...this.#adaptors.get(fact.name) ?? [], declared]);
1380
- this.#adaptorNodeOf(declared);
1399
+ const key = this.#key("adaptor", file.owner, fact.name);
1400
+ adaptorCounts.set(key, (adaptorCounts.get(key) ?? 0) + 1);
1381
1401
  }
1402
+ const declaredAdaptors = facts.flatMap((file) => file.adaptors.map((fact) => {
1403
+ const key = this.#key("adaptor", file.owner, fact.name);
1404
+ const id = (adaptorCounts.get(key) ?? 0) > 1 ? this.#key("adaptor", file.owner, `${this.#resolver.inOwner(file.fileName, file.owner)}#${fact.name}`) : key;
1405
+ const declared = { fact, owner: file.owner, fileName: file.fileName, id };
1406
+ this.#adaptors.set(fact.name, [...this.#adaptors.get(fact.name) ?? [], declared]);
1407
+ this.#adaptorNodeOf(declared);
1408
+ return { declared, file };
1409
+ }));
1410
+ for (const { declared, file } of declaredAdaptors)
1411
+ for (const plug of declared.fact.plugs)
1412
+ this.#addEdge(declared.id, this.#adaptorIdOf(plug.target, file), "plugs", plug.name, this.#location(plug.span));
1382
1413
  for (const file of facts)
1383
- for (const fact of file.adaptors)
1384
- for (const plug of fact.plugs)
1385
- this.#addEdge(this.#key("adaptor", file.owner, fact.name), this.#adaptorIdOf(plug.target, file), "plugs", plug.name, this.#location(plug.span));
1414
+ for (const binding of file.adaptorBindings)
1415
+ this.#addEdge(this.#adaptorIdOf(binding.role, file), this.#adaptorIdOf(binding.adaptor, file), "binds", file.owner, this.#location(binding.span));
1386
1416
  for (const guard of this.#resolver.declare(facts))
1387
1417
  this.#guardNodeOf(guard);
1388
1418
  for (const file of facts) {
@@ -1415,10 +1445,18 @@ class GraphBuilder {
1415
1445
  }
1416
1446
  for (const method of service.methods)
1417
1447
  this.#addMember("method", owner, refName, method, `${service.name}.${method.name}`, file.fileName);
1418
- for (const plug of service.plugs)
1419
- this.#plugs.set(`${owner ?? ""}
1448
+ for (const plug of service.plugs) {
1449
+ const key = `${refName}
1450
+ ${plug.name}`;
1451
+ this.#plugs.set(key, [
1452
+ ...this.#plugs.get(key) ?? [],
1453
+ { owner, target: this.#adaptorIdOf(plug.target, file) }
1454
+ ]);
1455
+ }
1456
+ for (const field of service.fields)
1457
+ this.#serviceFields.add(`${owner ?? ""}
1420
1458
  ${refName}
1421
- ${plug.name}`, this.#adaptorIdOf(plug.target, file));
1459
+ ${field}`);
1422
1460
  }
1423
1461
  for (const filter of file.filters) {
1424
1462
  if (!filter.name.endsWith("Filter"))
@@ -1677,18 +1715,70 @@ ${dir}`, node);
1677
1715
  #adaptorIdOf(local, file) {
1678
1716
  const [head, member] = local.split(".");
1679
1717
  const imported = file.imports.find((item) => item.name === head);
1680
- const from = imported ? this.#resolver.ownerOfSpecifier(file.fileName, imported.from) : undefined;
1681
1718
  const name = member ?? (imported && imported.imported !== "default" && imported.imported !== "*" ? imported.imported : head);
1719
+ const path = imported ? this.#resolver.pathOfSpecifier(file.fileName, imported.from) : null;
1720
+ if (imported && path === null && !frameworkPattern.test(imported.from))
1721
+ return this.#packageAdaptorOf(name, imported.from);
1722
+ const from = imported ? this.#resolver.ownerOfSpecifier(file.fileName, imported.from) : undefined;
1682
1723
  const declared = this.#adaptors.get(name) ?? [];
1683
- const found = from === undefined ? declared.find((adaptor) => adaptor.owner === file.owner) ?? declared.find((adaptor) => this.#resolver.visible(adaptor.owner, file.owner)) : declared.find((adaptor) => adaptor.owner === from) ?? (from === frameworkOwner ? undefined : declared.find((adaptor) => this.#resolver.visible(adaptor.owner, from)));
1724
+ const found = from === undefined ? this.#adaptorIn(declared, file.owner, path, file.fileName) ?? declared.find((adaptor) => this.#resolver.visible(adaptor.owner, file.owner)) : this.#adaptorIn(declared, from, path, file.fileName) ?? (from === frameworkOwner ? undefined : declared.find((adaptor) => this.#resolver.visible(adaptor.owner, from)));
1684
1725
  if (found)
1685
- return this.#adaptorNodeOf(found);
1726
+ return found.id;
1727
+ const reexported = from && from !== frameworkOwner ? this.#packageShimOf(from, name, path) : null;
1728
+ if (reexported)
1729
+ return this.#packageAdaptorOf(reexported.name, reexported.from);
1686
1730
  const owner = from === frameworkOwner ? null : imported ? from ?? null : file.owner;
1687
1731
  const detail = from === frameworkOwner ? [frameworkOwner] : [];
1688
1732
  return this.#addNode(this.#key("adaptor", owner, name), "adaptor", owner, null, name, null, detail).id;
1689
1733
  }
1690
- #adaptorNodeOf({ fact, owner, fileName }) {
1691
- const id = this.#key("adaptor", owner, fact.name);
1734
+ #adaptorIn(declared, owner, path, fileName) {
1735
+ const own = declared.filter((adaptor) => adaptor.owner === owner);
1736
+ if (own.length < 2)
1737
+ return own.at(0);
1738
+ const pathOf = (adaptor) => this.#source.relative(adaptor.fileName).replace(/\.tsx?$/, "");
1739
+ const named = path === null ? own.find((adaptor) => adaptor.fileName === fileName) : own.find((adaptor) => pathOf(adaptor) === path || pathOf(adaptor) === `${path}/index`) ?? own.find((adaptor) => pathOf(adaptor).startsWith(`${path}/`));
1740
+ return named ?? own.at(0);
1741
+ }
1742
+ #pluggedOf({ owner, module }, field) {
1743
+ const plugs = this.#plugs.get(`${module}
1744
+ ${field}`) ?? [];
1745
+ const own = plugs.filter((plug) => plug.owner === owner);
1746
+ if (!own.length && this.#serviceFields.has(`${owner ?? ""}
1747
+ ${module}
1748
+ ${field}`))
1749
+ return [];
1750
+ const inherited = own.length ? own : plugs.filter((plug) => this.#resolver.visible(plug.owner, owner));
1751
+ return [...new Set(inherited.map(({ target }) => target))];
1752
+ }
1753
+ #packageAdaptorOf(name, specifier) {
1754
+ if (frameworkPattern.test(specifier))
1755
+ return this.#addNode(this.#key("adaptor", null, name), "adaptor", null, null, name, null, [frameworkOwner]).id;
1756
+ const pkg = specifier.split("/").slice(0, specifier.startsWith("@") ? 2 : 1).join("/");
1757
+ return this.#addNode(this.#key("adaptor", pkg, name), "adaptor", null, null, name, null, [pkg]).id;
1758
+ }
1759
+ #packageShimOf(owner, name, near) {
1760
+ const reexport = this.#resolver.reexportOf(owner, name, near);
1761
+ const [shim] = reexport?.site.imports ?? [];
1762
+ if (reexport && shim && this.#resolver.pathOfSpecifier(reexport.site.fileName, shim.from) === null)
1763
+ return { name: reexport.local === "default" ? name : reexport.local, from: shim.from };
1764
+ if (reexport || !near)
1765
+ return null;
1766
+ const packages = new Set;
1767
+ for (const [fileName, words] of this.#resolver.filesIn(owner)) {
1768
+ const relative = this.#source.relative(fileName);
1769
+ const isNear = relative.startsWith(`${near}/`) || relative.replace(/\.tsx?$/, "") === near;
1770
+ if (!isNear || !words.includes(`
1771
+ export
1772
+ `))
1773
+ continue;
1774
+ for (const [, specifier = ""] of this.#source.readText(fileName)?.matchAll(starExportPattern) ?? [])
1775
+ if (this.#resolver.pathOfSpecifier(fileName, specifier) === null)
1776
+ packages.add(specifier);
1777
+ }
1778
+ const [only] = packages;
1779
+ return packages.size === 1 && only && !this.#resolver.declares(owner, name) ? { name, from: only } : null;
1780
+ }
1781
+ #adaptorNodeOf({ fact, owner, fileName, id }) {
1692
1782
  const detail = fact.refName ? [fact.refName] : [];
1693
1783
  const node = this.#addNode(id, "adaptor", owner, null, fact.name, fact.span, detail);
1694
1784
  if (fact.doc && !node.doc)
@@ -1798,10 +1888,8 @@ st
1798
1888
  visit(source);
1799
1889
  }
1800
1890
  #link(fileName, source, identifier, chain, context, owner) {
1801
- const plugged = chain?.length === 2 && chain[0] === "this" && context.kind === "method" && this.#isServiceThis(identifier) ? this.#plugs.get(`${context.owner ?? ""}
1802
- ${context.module}
1803
- ${chain[1]}`) : undefined;
1804
- const resolved = plugged ? [plugged] : this.#source.resolve(fileName, identifier).map((target) => this.#targetNodeOf(target)).filter((id) => id !== null);
1891
+ const plugged = chain?.length === 2 && chain[0] === "this" && context.kind === "method" && this.#isServiceThis(identifier) ? this.#pluggedOf(context, chain[1]) : [];
1892
+ const resolved = plugged.length ? plugged : this.#source.resolve(fileName, identifier).map((target) => this.#targetNodeOf(target)).filter((id) => id !== null);
1805
1893
  const targets = resolved.length ? resolved : this.#plainTargetsOf(chain, identifier.text, context, owner);
1806
1894
  if (!targets.length)
1807
1895
  return;
@@ -2382,6 +2470,8 @@ canPass
2382
2470
  adapt
2383
2471
  `) || words.includes(`
2384
2472
  dangerouslyAdapt
2473
+ `) || words.includes(`
2474
+ applyAdaptor
2385
2475
  `);
2386
2476
  }
2387
2477
  static #sourceKeyOf({ family, sourceKey, label, detail, span }) {
@@ -14,7 +14,7 @@ import {
14
14
  } from "./index-qd7xn2bk.js";
15
15
  import {
16
16
  FrameworkGraph
17
- } from "./index-1cb9apzn.js";
17
+ } from "./index-cmg5ngqa.js";
18
18
  import {
19
19
  MaintainabilityBaseline
20
20
  } from "./index-ygrdw6jw.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  FrameworkMapBuilder,
4
4
  FrameworkMapDoc
5
- } from "./index-m5sg5spm.js";
5
+ } from "./index-9p260r4e.js";
6
6
 
7
7
  // pkgs/@akanjs/devkit/frameworkGraph.ts
8
8
  import { readdir, readFile, realpath, stat } from "fs/promises";
@@ -19,7 +19,7 @@ import {
19
19
  } from "./index-20wvskt8.js";
20
20
  import {
21
21
  LibraryScript
22
- } from "./index-xa0289eg.js";
22
+ } from "./index-54s6knqe.js";
23
23
  import {
24
24
  ApplicationRunner,
25
25
  VerifyScope
@@ -28,10 +28,13 @@ import {
28
28
  PreviewChrome2,
29
29
  PreviewView2,
30
30
  stripAnsi
31
- } from "./index-23860fej.js";
31
+ } from "./index-sc0g6zbm.js";
32
32
  import {
33
33
  formatSlicePlan
34
34
  } from "./index-8jpc5fqv.js";
35
+ import {
36
+ assertPlainName
37
+ } from "./index-x3x31df8.js";
35
38
  import {
36
39
  openBrowser
37
40
  } from "./index-9dp031by.js";
@@ -1258,6 +1261,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1258
1261
  }
1259
1262
  }
1260
1263
  async createApplication(appName, workspace, { start = false, libs = [] } = {}) {
1264
+ assertPlainName("app", appName);
1261
1265
  const spinner = workspace.spinning("Creating application...");
1262
1266
  const app = await this.applicationRunner.createApplication(appName, workspace, libs);
1263
1267
  spinner.succeed(`Application created in apps/${app.name}`);
@@ -1483,7 +1487,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1483
1487
  throw new Error("No app selected to start");
1484
1488
  const startedDatabase = dbup ? await this.#prepareSharedDatabase(apps) : false;
1485
1489
  const supervisor = new DevSupervisor({ apps, mode, concurrency, open, write, shares });
1486
- const view = mode === "tui" ? new (await import("./devTui-w38ch13a.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
1490
+ const view = mode === "tui" ? new (await import("./devTui-cd03z4mx.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
1487
1491
  await supervisor.run(view);
1488
1492
  if (startedDatabase)
1489
1493
  await this.#stopDatabase(workspace);
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  WorkspaceRunner,
16
16
  AkanQualityScanner
17
- } from "./index-466z5931.js";
17
+ } from "./index-zhkcab5a.js";
18
18
 
19
19
  // pkgs/@akanjs/cli/verify/verifyComments.ts
20
20
  import { existsSync } from "fs";
@@ -7,10 +7,13 @@ import {
7
7
  generatedFilesForSync,
8
8
  createPassedPrimitiveReport,
9
9
  scalarChangedFiles
10
- } from "./index-xq97me1h.js";
10
+ } from "./index-xrmrvafh.js";
11
11
  import {
12
12
  pluralizeName
13
13
  } from "./index-nz8prx9g.js";
14
+ import {
15
+ assertPlainName
16
+ } from "./index-x3x31df8.js";
14
17
 
15
18
  // pkgs/@akanjs/cli/scalar/scalar.runner.ts
16
19
  class ScalarRunner extends runner("scalar") {
@@ -37,6 +40,7 @@ class ScalarRunner extends runner("scalar") {
37
40
  // pkgs/@akanjs/cli/scalar/scalar.script.ts
38
41
  class ScalarScript extends script("scalar", [ScalarRunner]) {
39
42
  async createScalar(sys, scalarName) {
43
+ assertPlainName("scalar", scalarName);
40
44
  const files = await this.scalarRunner.applyScalarTemplate(sys, scalarName);
41
45
  return createPassedPrimitiveReport({
42
46
  command: "create-scalar",
@@ -46,6 +50,7 @@ class ScalarScript extends script("scalar", [ScalarRunner]) {
46
50
  });
47
51
  }
48
52
  async removeScalar(sys, scalarName) {
53
+ assertPlainName("scalar", scalarName);
49
54
  await sys.removeDir(`lib/__scalar/${scalarName}`);
50
55
  }
51
56
  }
@@ -1,16 +1,16 @@
1
1
  // @bun
2
2
  import {
3
3
  akanMcpInstallTargets
4
- } from "./index-0mqga3h9.js";
4
+ } from "./index-ngpt3zz3.js";
5
5
  import {
6
6
  jsonText
7
- } from "./index-xq97me1h.js";
7
+ } from "./index-xrmrvafh.js";
8
8
  import {
9
9
  script
10
10
  } from "./index-386canwe.js";
11
11
  import {
12
12
  ContextRunner2
13
- } from "./index-mvwvxgtd.js";
13
+ } from "./index-2eym1yjb.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/context/context.script.ts
16
16
  import { Logger } from "akanjs/common";
@@ -23,7 +23,7 @@ import {
23
23
  workflowPathsForPlan,
24
24
  workflowRunArtifactPath,
25
25
  workflowSyncDir
26
- } from "./index-xq97me1h.js";
26
+ } from "./index-xrmrvafh.js";
27
27
 
28
28
  // pkgs/@akanjs/devkit/akanContext.ts
29
29
  import { readdir } from "fs/promises";
@@ -157,7 +157,7 @@ class SubagentPool2 {
157
157
  }
158
158
  }
159
159
  async#run(id, kind, prompt, signal) {
160
- const { CodeAgent } = await import("./CodeAgent-6cpjtj25.js");
160
+ const { CodeAgent } = await import("./CodeAgent-e9c712an.js");
161
161
  const budget = this.#options.parent.tools.subagent;
162
162
  const child = SubagentPool2.childOf(this.#options.parent, kind);
163
163
  const model = this.#options.model?.();
@@ -13,13 +13,16 @@ import {
13
13
  createPassedPrimitiveReport,
14
14
  bilingualLabelForField,
15
15
  bilingualDescriptionForField
16
- } from "./index-xq97me1h.js";
16
+ } from "./index-xrmrvafh.js";
17
17
  import {
18
18
  PageScript
19
19
  } from "./index-7kmbqp0b.js";
20
20
  import {
21
21
  pluralizeName
22
22
  } from "./index-nz8prx9g.js";
23
+ import {
24
+ assertPlainName
25
+ } from "./index-x3x31df8.js";
23
26
 
24
27
  // pkgs/@akanjs/cli/module/module.script.ts
25
28
  import { capitalize as capitalize2 } from "akanjs/common";
@@ -137,6 +140,7 @@ var moduleChangedFiles = (sys, moduleName, files) => Object.values(files).map((f
137
140
 
138
141
  class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
139
142
  async createModuleTemplate(sys, name, { page = false } = {}) {
143
+ assertPlainName("module", name);
140
144
  const mod = ModuleExecutor.from(sys, name);
141
145
  const files = await this.moduleRunner.createModuleTemplate(mod);
142
146
  if (page && sys.type === "app")
@@ -153,6 +157,7 @@ class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
153
157
  await this.moduleRunner.removeModule(mod);
154
158
  }
155
159
  async createService(sys, name) {
160
+ assertPlainName("service", name);
156
161
  const service = ModuleExecutor.from(sys, `_${name}`);
157
162
  const files = await this.moduleRunner.createService(service);
158
163
  await sys.scan();
@@ -109,6 +109,8 @@ class PreviewView2 {
109
109
  await PreviewView2.#within(view.navigate("about:blank"), Date.now() + startMs, stalled).then(() => PreviewView2.#stalled.delete(engine), (error) => {
110
110
  if (error === stalled)
111
111
  PreviewView2.#stalled.add(engine);
112
+ else
113
+ PreviewView2.#stalled.delete(engine);
112
114
  throw error;
113
115
  });
114
116
  const deadline = Date.now() + timeoutMs;
@@ -0,0 +1,14 @@
1
+ // @bun
2
+ // pkgs/@akanjs/devkit/workflow/plainName.ts
3
+ var sysNamePattern = /^[a-z0-9][a-zA-Z0-9_-]*$/;
4
+ var identifierPattern = /^_{0,2}[a-zA-Z][a-zA-Z0-9_-]*$/;
5
+ var isWorkflowSysName = (value) => typeof value === "string" && sysNamePattern.test(value);
6
+ var isWorkflowModuleName = (value) => typeof value === "string" && identifierPattern.test(value);
7
+ var assertPlainName = (kind, name) => {
8
+ const isSys = kind === "app" || kind === "lib";
9
+ if (isSys ? isWorkflowSysName(name) : isWorkflowModuleName(name))
10
+ return;
11
+ throw new Error(`${JSON.stringify(name)} is no ${kind} name; use letters, digits, - and _, starting with ${isSys ? "a lowercase letter or digit" : "a letter"}`);
12
+ };
13
+
14
+ export { sysNamePattern, identifierPattern, isWorkflowSysName, isWorkflowModuleName, assertPlainName };
@@ -6,7 +6,11 @@ import {
6
6
  import {
7
7
  createAst,
8
8
  AkanIndex
9
- } from "./index-m5sg5spm.js";
9
+ } from "./index-9p260r4e.js";
10
+ import {
11
+ sysNamePattern,
12
+ identifierPattern
13
+ } from "./index-x3x31df8.js";
10
14
  import {
11
15
  camelToKebabCase
12
16
  } from "./index-386canwe.js";
@@ -3015,8 +3019,6 @@ class MutationScaffold {
3015
3019
  // pkgs/@akanjs/devkit/workflow/plan.ts
3016
3020
  import { capitalize as capitalize4 } from "akanjs/common";
3017
3021
  var surfaceModes = new Set(["infer", "include", "skip"]);
3018
- var sysNamePattern = /^[a-z0-9][a-zA-Z0-9_-]*$/;
3019
- var identifierPattern = /^_{0,2}[a-zA-Z][a-zA-Z0-9_-]*$/;
3020
3022
  var nameInputPatterns = {
3021
3023
  app: sysNamePattern,
3022
3024
  module: identifierPattern,
@@ -3028,8 +3030,6 @@ var nameInputPatterns = {
3028
3030
  mutation: identifierPattern,
3029
3031
  interaction: identifierPattern
3030
3032
  };
3031
- var isWorkflowSysName = (value) => typeof value === "string" && sysNamePattern.test(value);
3032
- var isWorkflowModuleName = (value) => typeof value === "string" && identifierPattern.test(value);
3033
3033
  var parseStringList = (value) => {
3034
3034
  if (Array.isArray(value)) {
3035
3035
  const values = value.filter((item) => typeof item === "string" && item.trim().length > 0);
@@ -3839,4 +3839,4 @@ for (const candidate of toolingRolloutCandidates) {
3839
3839
  if (isRestrictedCandidate(candidate))
3840
3840
  restrictedCandidates.set(candidate.packageName, candidate);
3841
3841
  }
3842
- export { InteractionScaffold, jsonText, workflowStatus, compactDiagnostics, workflowPlanApproval, createWorkflowApplyReport, workflowCommandsForPlan, workflowPathsForPlan, workflowRunArtifactPath, writeWorkflowRunArtifact, workflowSyncDir, generatedFilePathsForTarget, writeGeneratedSyncState, readWorkflowRunArtifact, createWorkflowBaselineSummary, createWorkflowValidationRunReport, createDryRunWorkflowApplyReport, createRepairReport, sourceFile, moduleComponentName, moduleSourcePaths, generatedFilesForSync, validationCommandsForTarget, nextActionsForTarget, createPrimitiveWriteReport, createPassedPrimitiveReport, scalarChangedFiles, bilingualLabelForField, bilingualDescriptionForField, normalizeFieldType, ensureNamedImport, ensureBaseImport, ensureBaseTypeImport, coerceFieldDefault, fieldExpression, viaBuilderParameterName, insertIntoObject, insertLightProjectionField, insertTemplateField, ensureEnumImport, insertEnumClass, insertDictionaryModelField, hasConstantInputField, hasDictionaryModelField, ensureConstantTypeImport, insertDictionaryEnum, parseValues, hasSourceParseErrors, hasClassMethod, insertClassMethod, hasSignalFactoryEntry, insertSignalFactoryEntry, buildAkanModuleContextIndex, addFieldUiPolicyForType, createWorkflowStepRegistry, WorkflowExecutor, KeyRename, MutationScaffold, isWorkflowSysName, isWorkflowModuleName, listWorkflowSpecs, getWorkflowSpec, compactWorkflowInputs, createWorkflowPlan, workflowTargetDiagnostics, inspectWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, renderPrimitiveReport, toolingRolloutGate };
3842
+ export { InteractionScaffold, jsonText, workflowStatus, compactDiagnostics, workflowPlanApproval, createWorkflowApplyReport, workflowCommandsForPlan, workflowPathsForPlan, workflowRunArtifactPath, writeWorkflowRunArtifact, workflowSyncDir, generatedFilePathsForTarget, writeGeneratedSyncState, readWorkflowRunArtifact, createWorkflowBaselineSummary, createWorkflowValidationRunReport, createDryRunWorkflowApplyReport, createRepairReport, sourceFile, moduleComponentName, moduleSourcePaths, generatedFilesForSync, validationCommandsForTarget, nextActionsForTarget, createPrimitiveWriteReport, createPassedPrimitiveReport, scalarChangedFiles, bilingualLabelForField, bilingualDescriptionForField, normalizeFieldType, ensureNamedImport, ensureBaseImport, ensureBaseTypeImport, coerceFieldDefault, fieldExpression, viaBuilderParameterName, insertIntoObject, insertLightProjectionField, insertTemplateField, ensureEnumImport, insertEnumClass, insertDictionaryModelField, hasConstantInputField, hasDictionaryModelField, ensureConstantTypeImport, insertDictionaryEnum, parseValues, hasSourceParseErrors, hasClassMethod, insertClassMethod, hasSignalFactoryEntry, insertSignalFactoryEntry, buildAkanModuleContextIndex, addFieldUiPolicyForType, createWorkflowStepRegistry, WorkflowExecutor, KeyRename, MutationScaffold, listWorkflowSpecs, getWorkflowSpec, compactWorkflowInputs, createWorkflowPlan, workflowTargetDiagnostics, inspectWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, renderPrimitiveReport, toolingRolloutGate };
@@ -14,12 +14,12 @@ import {
14
14
  import {
15
15
  PreviewView2,
16
16
  stripAnsi
17
- } from "./index-23860fej.js";
17
+ } from "./index-sc0g6zbm.js";
18
18
  import {
19
19
  SubagentPool2,
20
20
  McpSignIn,
21
21
  AkanCodeCompaction2
22
- } from "./index-abfbf01s.js";
22
+ } from "./index-qrk06tfp.js";
23
23
  import {
24
24
  codeAgentIsLoopback,
25
25
  codeAgentHostListed,
@@ -659,7 +659,7 @@ class AkanToolPack2 {
659
659
  return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
660
660
  }
661
661
  async names() {
662
- const { ContextRunner } = await import("./context.runner-ftv8373t.js");
662
+ const { ContextRunner } = await import("./context.runner-mqpp67br.js");
663
663
  return [
664
664
  ...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
665
665
  AkanToolPack2.verifyToolName
@@ -667,7 +667,7 @@ class AkanToolPack2 {
667
667
  }
668
668
  static verifyToolName = "akan_verify";
669
669
  async#register(pi) {
670
- const { ContextRunner } = await import("./context.runner-ftv8373t.js");
670
+ const { ContextRunner } = await import("./context.runner-mqpp67br.js");
671
671
  const runner = new ContextRunner;
672
672
  const guidelineNames = await AkanToolPack2.#guidelineNames();
673
673
  for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
@@ -18,10 +18,10 @@ import {
18
18
  } from "./index-386canwe.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-8nbx607g.js";
21
+ } from "./index-ddk49ypz.js";
22
22
  import {
23
23
  PackageScript
24
- } from "./index-65b6ms4c.js";
24
+ } from "./index-bak9f2br.js";
25
25
  import {
26
26
  CloudRunner
27
27
  } from "./index-6h775rv3.js";
@@ -36,7 +36,7 @@ import {
36
36
  import {
37
37
  createFactReader,
38
38
  createAst
39
- } from "./index-m5sg5spm.js";
39
+ } from "./index-9p260r4e.js";
40
40
  import {
41
41
  collectRecipeSources2,
42
42
  scanRecipes2
package/index.js CHANGED
@@ -22,25 +22,25 @@ import path from "path";
22
22
 
23
23
  // pkgs/@akanjs/cli/commandModules.ts
24
24
  var commandModules = {
25
- workspace: async () => (await import("./workspace.command-fcfztvn5.js")).WorkspaceCommand,
26
- agent: async () => (await import("./agent.command-kf1g3nh4.js")).AgentCommand,
27
- code: async () => (await import("./code.command-j08txqcd.js")).CodeCommand,
28
- application: async () => (await import("./application.command-vb278qnq.js")).ApplicationCommand,
29
- library: async () => (await import("./library.command-8d03a0pq.js")).LibraryCommand,
30
- localRegistry: async () => (await import("./localRegistry.command-vyv5k6t0.js")).LocalRegistryCommand,
31
- package: async () => (await import("./package.command-qjh13rs9.js")).PackageCommand,
32
- module: async () => (await import("./module.command-vy3kg965.js")).ModuleCommand,
25
+ workspace: async () => (await import("./workspace.command-ca9kfyt3.js")).WorkspaceCommand,
26
+ agent: async () => (await import("./agent.command-9erafkcb.js")).AgentCommand,
27
+ code: async () => (await import("./code.command-xk7rwq2x.js")).CodeCommand,
28
+ application: async () => (await import("./application.command-6515t682.js")).ApplicationCommand,
29
+ library: async () => (await import("./library.command-qs8beggh.js")).LibraryCommand,
30
+ localRegistry: async () => (await import("./localRegistry.command-hz4ged9n.js")).LocalRegistryCommand,
31
+ package: async () => (await import("./package.command-zqenq8c0.js")).PackageCommand,
32
+ module: async () => (await import("./module.command-z9js77m2.js")).ModuleCommand,
33
33
  page: async () => (await import("./page.command-t0nx1jat.js")).PageCommand,
34
- context: async () => (await import("./context.command-2fa6egp9.js")).ContextCommand,
35
- cloud: async () => (await import("./cloud.command-ca777ee2.js")).CloudCommand,
36
- subspace: async () => (await import("./subspace.command-q42n1844.js")).SubspaceCommand,
34
+ context: async () => (await import("./context.command-jwenkkf0.js")).ContextCommand,
35
+ cloud: async () => (await import("./cloud.command-32esk0v1.js")).CloudCommand,
36
+ subspace: async () => (await import("./subspace.command-7wxy6ptj.js")).SubspaceCommand,
37
37
  guideline: async () => (await import("./guideline.command-w6yqpdec.js")).GuidelineCommand,
38
- scalar: async () => (await import("./scalar.command-hxe6try8.js")).ScalarCommand,
39
- primitive: async () => (await import("./primitive.command-8vm49279.js")).PrimitiveCommand,
40
- quality: async () => (await import("./quality.command-v76fev72.js")).QualityCommand,
41
- verify: async () => (await import("./verify.command-rx43bha1.js")).VerifyCommand,
42
- repair: async () => (await import("./repair.command-fp4m3w03.js")).RepairCommand,
43
- workflow: async () => (await import("./workflow.command-yg0d8mmq.js")).WorkflowCommand,
38
+ scalar: async () => (await import("./scalar.command-p5jb7z57.js")).ScalarCommand,
39
+ primitive: async () => (await import("./primitive.command-v5kypwy4.js")).PrimitiveCommand,
40
+ quality: async () => (await import("./quality.command-q55j2htd.js")).QualityCommand,
41
+ verify: async () => (await import("./verify.command-m0wnndd7.js")).VerifyCommand,
42
+ repair: async () => (await import("./repair.command-7ssbbdq2.js")).RepairCommand,
43
+ workflow: async () => (await import("./workflow.command-jx8dqs9n.js")).WorkflowCommand,
44
44
  pipeline: async () => (await import("./pipeline.command-2yjeas7m.js")).PipelineCommand,
45
45
  tunnel: async () => (await import("./tunnel.command-22g11n0x.js")).TunnelCommand
46
46
  };
@@ -8,7 +8,7 @@ import"./index-bns3wcpc.js";
8
8
  import"./index-wfmpxke3.js";
9
9
  import {
10
10
  LibraryScript
11
- } from "./index-xa0289eg.js";
11
+ } from "./index-54s6knqe.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.command.ts
14
14
  class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({
@@ -21,23 +21,23 @@ import"./index-20wvskt8.js";
21
21
  import"./index-m9jj544v.js";
22
22
  import"./index-84c2pgak.js";
23
23
  import"./index-wr9magsr.js";
24
- import"./index-xa0289eg.js";
24
+ import"./index-54s6knqe.js";
25
25
  import"./index-kcpk2d20.js";
26
- import"./index-23860fej.js";
26
+ import"./index-sc0g6zbm.js";
27
27
  import {
28
28
  ApplicationScript
29
- } from "./index-8nbx607g.js";
29
+ } from "./index-ddk49ypz.js";
30
30
  import"./index-e22zedc2.js";
31
31
  import {
32
32
  CloudRunner
33
33
  } from "./index-6h775rv3.js";
34
34
  import"./index-qd7xn2bk.js";
35
- import"./index-m5sg5spm.js";
36
- import"./index-1cb9apzn.js";
35
+ import"./index-9p260r4e.js";
36
+ import"./index-cmg5ngqa.js";
37
37
  import"./index-ygrdw6jw.js";
38
38
  import {
39
39
  PackageScript
40
- } from "./index-65b6ms4c.js";
40
+ } from "./index-bak9f2br.js";
41
41
  import"./index-8jpc5fqv.js";
42
42
  import"./index-9bv479q5.js";
43
43