@akanjs/cli 3.0.0-alpha.10 → 3.0.0-alpha.12

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 (49) hide show
  1. package/.build-stamp +1 -1
  2. package/{agent.command-f0gqkfgz.js → agent.command-a3n15c6t.js} +5 -5
  3. package/{application.command-x903m2qq.js → application.command-rp3y4ejb.js} +4 -4
  4. package/{applicationBuildRunner-ha3y8ew8.js → applicationBuildRunner-73kbbb7e.js} +1 -1
  5. package/buildBatch.proc.js +2 -2
  6. package/{capacitorApp-9xswcgx7.js → capacitorApp-mr81qdxq.js} +2 -2
  7. package/{cloud.command-zs6kyf83.js → cloud.command-7mcmm52j.js} +7 -7
  8. package/{context.command-fmepgjzg.js → context.command-ysxawe7h.js} +12 -12
  9. package/{guideline.command-n6sw0a0c.js → guideline.command-yqf9a372.js} +2 -2
  10. package/guidelines/conventions/conventions.instruction.md +158 -1
  11. package/guidelines/cssRule/cssRule.instruction.md +7 -0
  12. package/guidelines/framework/framework.instruction.md +1 -0
  13. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +3 -1
  14. package/incrementalBuilder.proc.js +1 -1
  15. package/{index-5sn5w2mt.js → index-3789fdpg.js} +10 -10
  16. package/{index-y4vkyhvv.js → index-4mgkgba3.js} +2 -2
  17. package/{index-62955kn5.js → index-5yjc80ha.js} +5 -5
  18. package/{index-xmmzf150.js → index-65aeh789.js} +1 -1
  19. package/{index-d43t8af2.js → index-8pd02prk.js} +2 -2
  20. package/{index-779ske1y.js → index-9va8zayb.js} +1 -1
  21. package/{index-qzdjd4ct.js → index-cv9cxs5k.js} +3 -3
  22. package/{index-774gcx29.js → index-e4b2ae6b.js} +2 -2
  23. package/{index-kdh76j26.js → index-etwh7sd3.js} +1 -1
  24. package/{index-gcv8ncfh.js → index-h5whaj26.js} +2 -2
  25. package/{index-82jrh4hj.js → index-k8gpsrm1.js} +5 -5
  26. package/{index-rxkpk7n4.js → index-kcsa1zff.js} +1 -1
  27. package/{index-3vta1tqa.js → index-m90fn8xe.js} +4 -4
  28. package/{index-jhpa13zj.js → index-mewacxye.js} +4 -4
  29. package/{index-4m0bphac.js → index-rdv33eye.js} +8 -10
  30. package/{index-qb61h0k7.js → index-wzdeact3.js} +72 -8
  31. package/{index-jf2ya7r2.js → index-yzmqvg23.js} +3 -3
  32. package/{index-z8ptfkzv.js → index-yzsxc30b.js} +15 -12
  33. package/{index-eyyf2149.js → index-z1s5f4e0.js} +3 -3
  34. package/index.js +18 -18
  35. package/{library.command-cv9gdbmg.js → library.command-x6t29a30.js} +3 -3
  36. package/{localRegistry.command-d8fg36zc.js → localRegistry.command-f75tqg9w.js} +6 -6
  37. package/{module.command-qyr1s9cn.js → module.command-8w8ys5t3.js} +5 -5
  38. package/{package.command-wsjx0k47.js → package.command-zgy7f3fz.js} +3 -3
  39. package/package.json +2 -2
  40. package/{page.command-rdzg65rm.js → page.command-yjmnkyk2.js} +3 -3
  41. package/{primitive.command-89g38b53.js → primitive.command-gfqaagsg.js} +6 -6
  42. package/{quality.command-0cs2z92d.js → quality.command-ec8r1dn3.js} +361 -90
  43. package/{repair.command-6fphxfwj.js → repair.command-p9ey6mkm.js} +5 -5
  44. package/{scalar.command-xfer69s6.js → scalar.command-9dhmqhtm.js} +4 -4
  45. package/templates/appSample/srvkit/AuthGuard.ts +9 -5
  46. package/templates/appSample/srvkit/SessionInternalArg.ts +4 -3
  47. package/templates/workspaceRoot/biome.json.template +1 -0
  48. package/{workflow.command-2ygfqt4f.js → workflow.command-ycwc6zr6.js} +9 -9
  49. package/{workspace.command-vbgpjkf9.js → workspace.command-x49ekpkt.js} +50 -33
@@ -1,15 +1,15 @@
1
1
  // @bun
2
2
  import {
3
3
  RepairRunner
4
- } from "./index-jf2ya7r2.js";
5
- import"./index-774gcx29.js";
6
- import"./index-rxkpk7n4.js";
4
+ } from "./index-yzmqvg23.js";
5
+ import"./index-e4b2ae6b.js";
6
+ import"./index-kcsa1zff.js";
7
7
  import {
8
8
  Workspace,
9
9
  command,
10
10
  script
11
- } from "./index-kdh76j26.js";
12
- import"./index-z8ptfkzv.js";
11
+ } from "./index-etwh7sd3.js";
12
+ import"./index-yzsxc30b.js";
13
13
  import"./index-mxvakhsm.js";
14
14
  import"./index-xys926f2.js";
15
15
  import"./index-1577bej2.js";
@@ -1,18 +1,18 @@
1
1
  // @bun
2
2
  import {
3
3
  ScalarScript
4
- } from "./index-y4vkyhvv.js";
4
+ } from "./index-4mgkgba3.js";
5
5
  import"./index-ss469dec.js";
6
6
  import"./index-0cj2zxbm.js";
7
7
  import {
8
8
  renderPrimitiveReport
9
- } from "./index-rxkpk7n4.js";
9
+ } from "./index-kcsa1zff.js";
10
10
  import"./index-j37qq1f2.js";
11
11
  import {
12
12
  Sys,
13
13
  command
14
- } from "./index-kdh76j26.js";
15
- import"./index-z8ptfkzv.js";
14
+ } from "./index-etwh7sd3.js";
15
+ import"./index-yzsxc30b.js";
16
16
  import"./index-mxvakhsm.js";
17
17
  import"./index-1577bej2.js";
18
18
  import"./index-67546d0j.js";
@@ -3,7 +3,7 @@ import type { AppInfo, LibInfo } from "akanjs";
3
3
  export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { appName: string }) {
4
4
  return {
5
5
  filename: "AuthGuard.ts",
6
- content: `import type { Guard, SignalContext } from "akanjs/signal";
6
+ content: `import type { Guard, GuardScope, SignalContext } from "akanjs/signal";
7
7
 
8
8
  // ===== AuthGuard.ts =====
9
9
  // Convention: srvkit/ folder — server-only helpers, cannot import from client code.
@@ -14,10 +14,14 @@ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { a
14
14
 
15
15
  export class SignedIn implements Guard {
16
16
  static name = "SignedIn";
17
+ // "account" — the verdict reads the caller and nothing about the call, so an MCP catalogue can evaluate it with
18
+ // no arguments and hide what this caller certainly cannot use. Unmarked means "resource", which is never
19
+ // evaluated for a listing: a guard like this one would then filter nothing.
20
+ static scope: GuardScope = "account";
17
21
 
18
22
  canPass(context: SignalContext): boolean {
19
- const user = context.getHttpContext<{ user?: { id: string } }>().req.user;
20
- return !!user;
23
+ // Reads the account the middleware resolved, so the same guard answers over HTTP, a websocket and MCP alike.
24
+ return !!context.get<{ id?: string }>("account");
21
25
  }
22
26
  }
23
27
 
@@ -25,9 +29,9 @@ export class SignedIn implements Guard {
25
29
  // Role-based guard: only allow users with a specific role
26
30
  // export class IsAdmin implements Guard {
27
31
  // static name = "IsAdmin";
32
+ // static scope: GuardScope = "account";
28
33
  // canPass(context: SignalContext): boolean {
29
- // const user = context.getHttpContext<{ user?: { role: string } }>().req.user;
30
- // return user?.role === "admin";
34
+ // return context.get<{ role?: string }>("account")?.role === "admin";
31
35
  // }
32
36
  // }
33
37
  `,
@@ -15,8 +15,9 @@ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { a
15
15
 
16
16
  export class CurrentUserId implements InternalArg<string | null> {
17
17
  getArg(context: SignalContext): string | null {
18
- const user = context.getHttpContext<{ user?: { id: string } }>().req.user;
19
- return user?.id ?? null;
18
+ // \`context.get\` reads what the account middleware resolved, on every transport. Branching on
19
+ // \`getHttpContext()\` would return null for the same caller arriving over a websocket or MCP.
20
+ return context.get<{ id?: string }>("account")?.id ?? null;
20
21
  }
21
22
  }
22
23
 
@@ -24,7 +25,7 @@ export class CurrentUserId implements InternalArg<string | null> {
24
25
  // Inject current session language/locale
25
26
  // export class CurrentLocale implements InternalArg<string> {
26
27
  // getArg(context: SignalContext): string {
27
- // return context.getHttpContext<{ locale?: string }>().req.locale ?? "en";
28
+ // return context.get<string>("locale") ?? "en";
28
29
  // }
29
30
  // }
30
31
  `,
@@ -12,6 +12,7 @@
12
12
  "!!**/node_modules",
13
13
  "!!**/dist",
14
14
  "!!**/.akan",
15
+ "!!**/.claude",
15
16
  "!!**/dump",
16
17
  "!!**/local",
17
18
  "!!**/ios/DerivedData"
@@ -1,30 +1,30 @@
1
1
  // @bun
2
2
  import {
3
3
  WorkflowRunner
4
- } from "./index-qzdjd4ct.js";
4
+ } from "./index-cv9cxs5k.js";
5
5
  import {
6
6
  ScalarScript
7
- } from "./index-y4vkyhvv.js";
7
+ } from "./index-4mgkgba3.js";
8
8
  import {
9
9
  PrimitiveScript
10
- } from "./index-3vta1tqa.js";
10
+ } from "./index-m90fn8xe.js";
11
11
  import {
12
12
  ModuleScript
13
- } from "./index-jhpa13zj.js";
13
+ } from "./index-mewacxye.js";
14
14
  import"./index-ss469dec.js";
15
- import"./index-xmmzf150.js";
15
+ import"./index-65aeh789.js";
16
16
  import"./index-0cj2zxbm.js";
17
- import"./index-774gcx29.js";
17
+ import"./index-e4b2ae6b.js";
18
18
  import {
19
19
  createWorkflowStepRegistry
20
- } from "./index-rxkpk7n4.js";
20
+ } from "./index-kcsa1zff.js";
21
21
  import"./index-j37qq1f2.js";
22
22
  import {
23
23
  Workspace,
24
24
  command,
25
25
  script
26
- } from "./index-kdh76j26.js";
27
- import"./index-z8ptfkzv.js";
26
+ } from "./index-etwh7sd3.js";
27
+ import"./index-yzsxc30b.js";
28
28
  import"./index-mxvakhsm.js";
29
29
  import"./index-xys926f2.js";
30
30
  import"./index-1577bej2.js";
@@ -1,40 +1,40 @@
1
1
  // @bun
2
2
  import {
3
3
  ContextScript
4
- } from "./index-5sn5w2mt.js";
5
- import"./index-jf2ya7r2.js";
6
- import"./index-qzdjd4ct.js";
7
- import"./index-y4vkyhvv.js";
8
- import"./index-3vta1tqa.js";
9
- import"./index-jhpa13zj.js";
4
+ } from "./index-3789fdpg.js";
5
+ import"./index-yzmqvg23.js";
6
+ import"./index-cv9cxs5k.js";
7
+ import"./index-4mgkgba3.js";
8
+ import"./index-m90fn8xe.js";
9
+ import"./index-mewacxye.js";
10
10
  import"./index-ss469dec.js";
11
- import"./index-xmmzf150.js";
11
+ import"./index-65aeh789.js";
12
12
  import {
13
13
  CloudScript
14
- } from "./index-82jrh4hj.js";
14
+ } from "./index-k8gpsrm1.js";
15
15
  import {
16
16
  getLatestPackageVersion,
17
17
  getNpmRegistryUrl
18
- } from "./index-4m0bphac.js";
18
+ } from "./index-rdv33eye.js";
19
19
  import {
20
20
  PackageScript
21
- } from "./index-gcv8ncfh.js";
22
- import"./index-779ske1y.js";
21
+ } from "./index-h5whaj26.js";
22
+ import"./index-9va8zayb.js";
23
23
  import {
24
24
  GlobalConfig
25
25
  } from "./index-0cj2zxbm.js";
26
26
  import {
27
27
  AgentScript
28
- } from "./index-eyyf2149.js";
29
- import"./index-774gcx29.js";
30
- import"./index-rxkpk7n4.js";
28
+ } from "./index-z1s5f4e0.js";
29
+ import"./index-e4b2ae6b.js";
30
+ import"./index-kcsa1zff.js";
31
31
  import"./index-j37qq1f2.js";
32
32
  import {
33
33
  ApplicationScript
34
- } from "./index-62955kn5.js";
34
+ } from "./index-5yjc80ha.js";
35
35
  import {
36
36
  LibraryScript
37
- } from "./index-d43t8af2.js";
37
+ } from "./index-8pd02prk.js";
38
38
  import"./index-76rn3g2c.js";
39
39
  import {
40
40
  Exec,
@@ -42,7 +42,7 @@ import {
42
42
  command,
43
43
  runner,
44
44
  script
45
- } from "./index-kdh76j26.js";
45
+ } from "./index-etwh7sd3.js";
46
46
  import"./index-fgc8r6dj.js";
47
47
  import {
48
48
  ThemeValidator,
@@ -59,7 +59,7 @@ import {
59
59
  collectScopeRecipeSources,
60
60
  extractAgentBlock,
61
61
  renderScopeAgentBlock
62
- } from "./index-z8ptfkzv.js";
62
+ } from "./index-yzsxc30b.js";
63
63
  import"./index-mxvakhsm.js";
64
64
  import {
65
65
  collectRecipeSources,
@@ -72,10 +72,6 @@ import {
72
72
  } from "./index-67546d0j.js";
73
73
  import"./index-r24hmh0q.js";
74
74
 
75
- // pkgs/@akanjs/cli/workspace/workspace.script.ts
76
- import path2 from "path";
77
- import { Logger } from "akanjs/common";
78
-
79
75
  // pkgs/@akanjs/cli/workspace/workspace.runner.ts
80
76
  import path from "path";
81
77
 
@@ -99,6 +95,7 @@ var defaultWorkspacePeerDependencies = new Set([
99
95
  "tailwindcss",
100
96
  "typescript"
101
97
  ]);
98
+ var defaultMaxDiagnostics = 200;
102
99
 
103
100
  class WorkspaceRunner extends runner("workspace") {
104
101
  async generateAgentRules(workspace, { overwrite = false, cursorRules = true } = {}) {
@@ -236,17 +233,28 @@ class WorkspaceRunner extends runner("workspace") {
236
233
  }
237
234
  throw new Error(`[workspace] failed to locate akanjs package.json from ${import.meta.dir}`);
238
235
  }
239
- async lint(exec, workspace, { fix = true } = {}) {
236
+ async lint(exec, workspace, { fix = true, maxDiagnostics = defaultMaxDiagnostics } = {}) {
237
+ const configPath = await WorkspaceRunner.resolveBiomeConfigPath(workspace);
240
238
  await workspace.spawn("./node_modules/.bin/biome", [
241
239
  "check",
242
240
  ...fix ? ["--write"] : [],
243
241
  "--no-errors-on-unmatched",
242
+ `--max-diagnostics=${maxDiagnostics > 0 ? maxDiagnostics : "none"}`,
243
+ ...configPath ? ["--config-path", configPath] : [],
244
244
  exec.cwdPath
245
245
  ]);
246
246
  await this.#enforceStyleContract(exec);
247
247
  await this.#enforceRecipeGate(exec);
248
248
  await this.#enforceAgentsIndex(exec);
249
249
  }
250
+ static async resolveBiomeConfigPath(workspace) {
251
+ for (const fileName of ["biome.json", "biome.jsonc"]) {
252
+ const configPath = path.join(workspace.workspaceRoot, fileName);
253
+ if (await Bun.file(configPath).exists())
254
+ return configPath;
255
+ }
256
+ return null;
257
+ }
250
258
  async#enforceAgentsIndex(exec) {
251
259
  if (!(exec instanceof SysExecutor))
252
260
  return;
@@ -314,6 +322,8 @@ AKAN_PUBLIC_LOG_LEVEL=debug
314
322
  }
315
323
 
316
324
  // pkgs/@akanjs/cli/workspace/workspace.script.ts
325
+ import path2 from "path";
326
+ import { Logger } from "akanjs/common";
317
327
  class WorkspaceScript extends script("workspace", [
318
328
  WorkspaceRunner,
319
329
  ApplicationScript,
@@ -376,28 +386,29 @@ class WorkspaceScript extends script("workspace", [
376
386
  await this.agentScript.agent(workspace, "install", "agents-md", { force: overwrite });
377
387
  spinner.succeed(`Agent rules ready (${files.length} file${files.length === 1 ? "" : "s"})`);
378
388
  }
379
- async lint(exec, workspace, { fix = true } = {}) {
389
+ async lint(exec, workspace, { fix = true, maxDiagnostics } = {}) {
380
390
  if (exec instanceof AppExecutor)
381
391
  await this.applicationScript.sync(exec);
382
392
  else if (exec instanceof LibExecutor)
383
393
  await this.libraryScript.syncLibrary(exec);
384
394
  const spinner = workspace.spinning(`Linting${fix ? " with fix" : ""}...`);
385
395
  try {
386
- await this.workspaceRunner.lint(exec, workspace, { fix });
396
+ await this.workspaceRunner.lint(exec, workspace, { fix, maxDiagnostics });
387
397
  spinner.succeed("Lint completed with no errors");
388
398
  } catch (error) {
389
399
  spinner.fail("Lint failed with errors");
390
400
  throw error;
391
401
  }
392
402
  }
393
- async lintAll(workspace, { fix = true } = {}) {
403
+ async lintAll(workspace, { fix = true, maxDiagnostics } = {}) {
394
404
  const [appNames, libNames, pkgNames] = await workspace.getExecs();
405
+ const options = { fix, maxDiagnostics };
395
406
  await Promise.all(appNames.map((appName) => this.applicationScript.sync(AppExecutor.from(workspace, appName))));
396
407
  await Promise.all(libNames.map((libName) => this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName))));
397
408
  await Promise.all([
398
- ...appNames.map((appName) => this.workspaceRunner.lint(AppExecutor.from(workspace, appName), workspace, { fix })),
399
- ...libNames.map((libName) => this.workspaceRunner.lint(LibExecutor.from(workspace, libName), workspace, { fix })),
400
- ...pkgNames.filter((pkgName) => pkgName !== "contract").map((pkgName) => this.workspaceRunner.lint(PkgExecutor.from(workspace, pkgName), workspace, { fix }))
409
+ ...appNames.map((appName) => this.workspaceRunner.lint(AppExecutor.from(workspace, appName), workspace, options)),
410
+ ...libNames.map((libName) => this.workspaceRunner.lint(LibExecutor.from(workspace, libName), workspace, options)),
411
+ ...pkgNames.filter((pkgName) => pkgName !== "contract").map((pkgName) => this.workspaceRunner.lint(PkgExecutor.from(workspace, pkgName), workspace, options))
401
412
  ]);
402
413
  }
403
414
  async syncAll(workspace) {
@@ -479,11 +490,17 @@ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public
479
490
  }).option("overwrite", Boolean, { desc: "Overwrite existing agent rule files", default: false }).option("cursorRules", Boolean, { desc: "Generate .cursor/rules/akan.mdc", default: true }).with(Workspace).exec(async function(overwrite, cursorRules, workspace) {
480
491
  await this.workspaceScript.generateAgentRules(workspace, { overwrite, cursorRules });
481
492
  }),
482
- lint: target({ desc: "Lint and fix code in a specific app/lib/pkg" }).with(Exec).option("fix", Boolean, { default: true }).with(Workspace).exec(async function(exec, fix, workspace) {
483
- await this.workspaceScript.lint(exec, workspace, { fix });
493
+ lint: target({ desc: "Lint and fix code in a specific app/lib/pkg" }).with(Exec).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, {
494
+ desc: "How many diagnostics Biome prints before truncating (0 for no limit)",
495
+ default: defaultMaxDiagnostics
496
+ }).with(Workspace).exec(async function(exec, fix, maxDiagnostics, workspace) {
497
+ await this.workspaceScript.lint(exec, workspace, { fix, maxDiagnostics });
484
498
  }),
485
- lintAll: target({ desc: "Lint and fix code in all apps and libraries" }).option("fix", Boolean, { default: true }).with(Workspace).exec(async function(fix, workspace) {
486
- await this.workspaceScript.lintAll(workspace, { fix });
499
+ lintAll: target({ desc: "Lint and fix code in all apps and libraries" }).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, {
500
+ desc: "How many diagnostics Biome prints before truncating (0 for no limit)",
501
+ default: defaultMaxDiagnostics
502
+ }).with(Workspace).exec(async function(fix, maxDiagnostics, workspace) {
503
+ await this.workspaceScript.lintAll(workspace, { fix, maxDiagnostics });
487
504
  }),
488
505
  syncAll: target({ desc: "Sync dependencies and configuration for all apps and libraries" }).with(Workspace).exec(async function(workspace) {
489
506
  await this.workspaceScript.syncAll(workspace);