@akanjs/cli 3.1.1 → 3.1.2-rc.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 (113) hide show
  1. package/.build-stamp +1 -1
  2. package/CodeAgent-dyc45f5w.js +11 -0
  3. package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
  4. package/CodeAgentRpcListener-tcwrdvst.js +182 -0
  5. package/{CodeTui-h6yz2kvq.js → CodeTui-q55b2zrn.js} +25 -8
  6. package/TunnelShare-hdq9h1hr.js +14 -0
  7. package/{agent.command-3r4jsck8.js → agent.command-20zaqe60.js} +18 -15
  8. package/akanCode.js +8 -7
  9. package/{application.command-g7xv6ad0.js → application.command-nd0fshsk.js} +11 -11
  10. package/{applicationBuildRunner-qvjnhr9j.js → applicationBuildRunner-s13x3zqb.js} +10 -9
  11. package/buildBatch.proc.js +6 -6
  12. package/{cloud.command-6ebygmhw.js → cloud.command-8kbddsz9.js} +25 -18
  13. package/cloud.script-hgvvajm3.js +27 -0
  14. package/code.command-625bg8s8.js +345 -0
  15. package/{context.command-svdh6b2w.js → context.command-p6haqjay.js} +19 -18
  16. package/context.runner-rsnqnk9j.js +27 -0
  17. package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
  18. package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
  19. package/{guideline.command-qwp3tnjx.js → guideline.command-195g0h9a.js} +4 -4
  20. package/guidelines/agentRule/agentRule.instruction.md +22 -8
  21. package/guidelines/conventions/rules/auth.md +5 -4
  22. package/guidelines/conventions/rules/config.md +5 -1
  23. package/guidelines/conventions/rules/gates.md +2 -1
  24. package/guidelines/conventions/rules/module.md +1 -1
  25. package/guidelines/conventions/rules/server.md +8 -3
  26. package/guidelines/conventions/rules/ssr.md +2 -2
  27. package/guidelines/conventions/rules/tsx.md +2 -1
  28. package/guidelines/pageRule/pageRule.instruction.md +4 -4
  29. package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
  30. package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
  31. package/guidelines/transportRule/transportRule.instruction.md +5 -4
  32. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +1 -1
  33. package/incrementalBuilder.proc.js +4 -4
  34. package/{index-w4k2ragk.js → index-00a7j05x.js} +7 -7
  35. package/{index-w7q6h97v.js → index-0j1t1h2b.js} +3 -1
  36. package/{index-payhwt51.js → index-1h2jc0x3.js} +141 -67
  37. package/{index-vxmy1p4f.js → index-1qsd8ft1.js} +63 -123
  38. package/{index-s6da8ta9.js → index-2mwjshz5.js} +158 -51
  39. package/index-2nxk8wgs.js +266 -0
  40. package/{index-k5jbcxyh.js → index-2phm56a1.js} +49 -8
  41. package/{index-jje9qzyq.js → index-35j83zkd.js} +37 -3
  42. package/{index-m5n3ka0p.js → index-4am4dvmf.js} +13 -2
  43. package/index-75y7bcz4.js +28 -0
  44. package/{index-b8c289dx.js → index-7apsdr5g.js} +55 -12
  45. package/{index-8559hsz4.js → index-84h43kg6.js} +6 -5
  46. package/{index-eja64h28.js → index-9zy8479y.js} +5 -3
  47. package/{index-96wzdhfh.js → index-a1vb3x7t.js} +209 -36
  48. package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
  49. package/{index-am36s3jh.js → index-cjmjvg4r.js} +157 -117
  50. package/{index-1p0qbq3m.js → index-defp4gmb.js} +1 -1
  51. package/{index-4pdts00b.js → index-ewbmfarf.js} +10 -8
  52. package/{index-9rvcs76p.js → index-fhw7yq2d.js} +10 -10
  53. package/{index-8scw1pjk.js → index-g500c5j9.js} +178 -82
  54. package/{index-qxzrp5xt.js → index-g841cap9.js} +4 -4
  55. package/{index-qkkdhjm6.js → index-gr9thy79.js} +5 -5
  56. package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
  57. package/{index-4mj92tsh.js → index-hm0tn7qv.js} +73 -68
  58. package/{index-r2wedvqn.js → index-j6eeh5d7.js} +1 -1
  59. package/{index-tgt2fnd6.js → index-j7hwy56s.js} +3 -3
  60. package/{index-rnphv731.js → index-jc2zbwra.js} +2 -2
  61. package/{index-z4b84y6k.js → index-khk05tsf.js} +1 -1
  62. package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
  63. package/{index-266dewjs.js → index-qw6814m4.js} +53 -15
  64. package/{index-zcf6k8a5.js → index-raz588b3.js} +47 -12
  65. package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
  66. package/{index-3yz30c07.js → index-sp0qsr7a.js} +114 -12
  67. package/{index-1shvxzt0.js → index-sveq36gh.js} +39 -42
  68. package/{index-r2w2eh93.js → index-t1t9wq9a.js} +4 -4
  69. package/index-t78230d7.js +191 -0
  70. package/{index-r0k3ham2.js → index-tgqameyb.js} +4 -4
  71. package/{index-dd44g6vz.js → index-tp56652m.js} +5 -5
  72. package/index-w15mg3km.js +389 -0
  73. package/{index-xq543a5y.js → index-y4kcmbt2.js} +2 -2
  74. package/index-yf9wc28h.js +52 -0
  75. package/{index-xqgwjz7a.js → index-zbrwnmf1.js} +9 -7
  76. package/{index-xxfy1jp2.js → index-zttm13c3.js} +4 -4
  77. package/index.js +24 -24
  78. package/{library.command-2853y6mk.js → library.command-63hgt9te.js} +4 -4
  79. package/{localRegistry.command-76ds31p4.js → localRegistry.command-g3f8k25t.js} +43 -23
  80. package/{module.command-yfnb0abs.js → module.command-r4sa2khp.js} +7 -6
  81. package/{package.command-d9s86hp9.js → package.command-96eheyvd.js} +5 -5
  82. package/package.json +2 -2
  83. package/{page.command-6a8a8rd1.js → page.command-gs6d841d.js} +4 -4
  84. package/{pipeline.command-rt3rwd2z.js → pipeline.command-wdfvdbfj.js} +3 -3
  85. package/{primitive.command-emcebgrq.js → primitive.command-dfsv4mpe.js} +8 -7
  86. package/{projectTypecheck-51m7eh1f.js → projectTypecheck-kqj1t6hb.js} +1 -1
  87. package/{prompter-hgcta8pb.js → prompter-qrwx1p17.js} +2 -2
  88. package/{quality.command-xtrk0n3x.js → quality.command-webzxee2.js} +6 -4
  89. package/{repair.command-51szxnxx.js → repair.command-3r3j1xre.js} +7 -6
  90. package/{scalar.command-8qv27t82.js → scalar.command-e8y47j6d.js} +6 -5
  91. package/skills/akan-agent/SKILL.md +8 -1
  92. package/skills/akan-code/SKILL.md +37 -11
  93. package/skills/akan-debug/SKILL.md +2 -1
  94. package/skills/akan-err/SKILL.md +2 -1
  95. package/skills/akan-query/SKILL.md +3 -2
  96. package/skills/akan-runtime/SKILL.md +3 -0
  97. package/{subspace.command-pn56pnh8.js → subspace.command-a1sf9n5a.js} +12 -10
  98. package/templates/appSample/lib/task/task.signal.ts +14 -9
  99. package/templates/appSample/srvkit/guards.ts +11 -0
  100. package/templates/service/__model__.dictionary.ts +3 -5
  101. package/templates/workspaceRoot/.gitignore.template +1 -0
  102. package/{tunnel.command-q2h0j2en.js → tunnel.command-dcb0wg93.js} +25 -13
  103. package/{verify.command-z1dsbmrt.js → verify.command-yyepccbh.js} +13 -11
  104. package/{workflow.command-r3y67jeq.js → workflow.command-z5pg9ay0.js} +12 -11
  105. package/{workspace.command-t2f0xsrw.js → workspace.command-d7x5jttw.js} +74 -47
  106. package/CodeAgent-35wnb7w5.js +0 -9
  107. package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
  108. package/TunnelShare-xyjpa7gx.js +0 -14
  109. package/cloud.script-0s1jybd5.js +0 -26
  110. package/code.command-mpkm2emr.js +0 -167
  111. package/context.runner-ch0z3a8g.js +0 -26
  112. package/index-c6eggbee.js +0 -123
  113. package/index-ksfgqq1x.js +0 -49
@@ -28,6 +28,17 @@ export class SignedIn implements Guard {
28
28
  }
29
29
  }
30
30
 
31
+ // Open locally and under \`akan test\` so the sample works before sign-in; once the app signs users in, use SignedIn.
32
+ export class LocalOrSignedIn implements Guard {
33
+ static name = "LocalOrSignedIn";
34
+ static scope: GuardScope = "account";
35
+
36
+ canPass(context: SignalContext): boolean {
37
+ const environment = process.env.AKAN_PUBLIC_ENV;
38
+ return environment === "local" || environment === "testing" || new SignedIn().canPass(context);
39
+ }
40
+ }
41
+
31
42
  // ---- Expandable additional fields: ----
32
43
  // Role-based guard: only allow users with a specific role
33
44
  // export class IsAdmin implements Guard {
@@ -1,18 +1,16 @@
1
1
  import type { AppInfo, LibInfo } from "akanjs";
2
- import { BiomeForm } from "../biomeForm";
3
2
 
4
3
  interface Dict {
5
4
  Model: string;
6
5
  model: string;
7
6
  }
8
7
  export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
9
- const { Model, model } = dict;
10
- return `import { modelDictionary } from "akanjs/dictionary";
8
+ const { Model } = dict;
9
+ return `import { serviceDictionary } from "akanjs/dictionary";
11
10
 
12
11
  import type { ${Model}Endpoint } from "../sig";
13
12
 
14
- export const dictionary = modelDictionary(["en", "ko"])
15
- ${BiomeForm.dictionaryOf([model, model], [`${model} description`, `${model} 설명`])}
13
+ export const dictionary = serviceDictionary(["en", "ko"])
16
14
  .endpoint<${Model}Endpoint>((fn) => ({}))
17
15
  .error({})
18
16
  .translate({});
@@ -11,6 +11,7 @@ apps/*/data
11
11
  apps/*/scripts
12
12
  **/env.client.*.ts
13
13
  !**/env.client.type.ts
14
+ !**/env.client.example.ts
14
15
  **/env.server.*.ts
15
16
  !**/env.server.example.ts
16
17
  **/*secrets.yaml
@@ -4,22 +4,22 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-eja64h28.js";
8
- import"./index-52w0fvh8.js";
7
+ } from "./index-9zy8479y.js";
8
+ import"./index-bns3wcpc.js";
9
9
  import {
10
10
  AppExecutor
11
- } from "./index-8scw1pjk.js";
11
+ } from "./index-g500c5j9.js";
12
12
  import {
13
13
  GlobalConfig,
14
14
  CloudApi
15
- } from "./index-qkkdhjm6.js";
15
+ } from "./index-gr9thy79.js";
16
16
  import"./index-m9jj544v.js";
17
- import"./index-3yz30c07.js";
18
- import"./index-1shvxzt0.js";
19
- import"./index-xqgwjz7a.js";
17
+ import"./index-sp0qsr7a.js";
18
+ import"./index-zbrwnmf1.js";
19
+ import"./index-sveq36gh.js";
20
20
  import {
21
21
  TunnelShare2
22
- } from "./index-ksfgqq1x.js";
22
+ } from "./index-t78230d7.js";
23
23
  import {
24
24
  writeClipboard
25
25
  } from "./index-p6pbz9n5.js";
@@ -46,7 +46,8 @@ class TunnelRunner extends runner("tunnel") {
46
46
  ${chalk.bold(share.url)}${copied ? chalk.dim(" (copied)") : ""}`);
47
47
  if (share.grant.expiresAt)
48
48
  Logger.rawLog(chalk.dim(` expires ${share.grant.expiresAt}`));
49
- Logger.rawLog(chalk.dim(` code ${share.grant.code} \u2014 stop it with: akan tunnel --stop ${share.grant.code}
49
+ Logger.rawLog(chalk.dim(` code ${share.grant.code} \u2014 stop it with: akan tunnel --stop ${share.grant.code}`));
50
+ Logger.rawLog(chalk.yellow(` ${TunnelShare2.exposureNotice(app.name, !!options.devRoutes)}
50
51
  `));
51
52
  await TunnelRunner.holdUntilInterrupt(() => share.close());
52
53
  }
@@ -100,13 +101,14 @@ class TunnelScript extends script("tunnel", [TunnelRunner]) {
100
101
  return AppExecutor.from(workspace, only);
101
102
  return AppExecutor.from(workspace, await select({ message: "Select the app to share", choices: appNames }));
102
103
  }
103
- async share(name, { workspace, host, port, ttl }) {
104
+ async share(name, { workspace, host, port, ttl, devRoutes }) {
104
105
  const app = await TunnelScript.resolveApp(workspace, name);
105
106
  await this.tunnelRunner.share(app, {
106
107
  workspace,
107
108
  ...host ? { host } : {},
108
109
  ...port ? { port } : {},
109
- ...ttl ? { ttlMinutes: ttl } : {}
110
+ ...ttl ? { ttlMinutes: ttl } : {},
111
+ ...devRoutes ? { devRoutes } : {}
110
112
  });
111
113
  }
112
114
  async list(workspace, host) {
@@ -122,12 +124,22 @@ class TunnelCommand extends command("tunnel", [TunnelScript], ({ public: target
122
124
  tunnel: target({ desc: "Share a locally running app on a public URL" }).arg("app", String, { desc: "app to share", nullable: true }).option("list", Boolean, { desc: "list the shares this account is holding", default: false }).option("stop", String, { desc: "stop the share with this code", default: "" }).option("host", String, {
123
125
  desc: "host of the cloud (default: cloud.host of the root akan.config.ts, else Akan Cloud)",
124
126
  nullable: true
125
- }).option("port", Number, { desc: "local port to share (default: the app's dev port)", nullable: true }).option("ttl", Number, { desc: "minutes before the share expires", nullable: true }).with(Workspace).exec(async function(app, list, stop, host, port, ttl, workspace) {
127
+ }).option("port", Number, { desc: "local port to share (default: the app's dev port)", nullable: true }).option("ttl", Number, { desc: "minutes before the share expires", nullable: true }).option("devRoutes", Boolean, {
128
+ flag: "d",
129
+ desc: "also share devtools, the HMR socket and source maps, which a share leaves out by default",
130
+ default: false
131
+ }).with(Workspace).exec(async function(app, list, stop, host, port, ttl, devRoutes, workspace) {
126
132
  if (list)
127
133
  return await this.tunnelScript.list(workspace, host);
128
134
  if (stop)
129
135
  return await this.tunnelScript.stop(stop, workspace, host);
130
- await this.tunnelScript.share(app, { workspace, host, ...port ? { port } : {}, ...ttl ? { ttl } : {} });
136
+ await this.tunnelScript.share(app, {
137
+ workspace,
138
+ host,
139
+ devRoutes,
140
+ ...port ? { port } : {},
141
+ ...ttl ? { ttl } : {}
142
+ });
131
143
  })
132
144
  })) {
133
145
  }
@@ -5,30 +5,32 @@ import {
5
5
  ExitCodeError,
6
6
  markCliErrorPrinted,
7
7
  command
8
- } from "./index-eja64h28.js";
9
- import"./index-52w0fvh8.js";
10
- import"./index-8scw1pjk.js";
8
+ } from "./index-9zy8479y.js";
9
+ import"./index-bns3wcpc.js";
10
+ import"./index-g500c5j9.js";
11
11
  import {
12
12
  ApplicationRunner,
13
13
  VerifyScope
14
- } from "./index-s6da8ta9.js";
14
+ } from "./index-2mwjshz5.js";
15
15
  import"./index-p6x5b7hr.js";
16
- import"./index-3yz30c07.js";
17
- import"./index-w7q6h97v.js";
16
+ import"./index-sp0qsr7a.js";
17
+ import"./index-0j1t1h2b.js";
18
18
  import"./index-m9jj544v.js";
19
- import"./index-1shvxzt0.js";
20
- import"./index-xqgwjz7a.js";
19
+ import"./index-zbrwnmf1.js";
20
+ import"./index-sveq36gh.js";
21
21
  import"./index-62md4dwy.js";
22
22
  import {
23
23
  WorkspaceRunner
24
- } from "./index-am36s3jh.js";
24
+ } from "./index-cjmjvg4r.js";
25
+ import"./index-2nxk8wgs.js";
25
26
  import"./index-hj6w4ka1.js";
27
+ import"./index-4am4dvmf.js";
26
28
  import"./index-fbewhg4g.js";
27
29
  import {
28
30
  VerifyPipeline,
29
31
  VerifyReport
30
- } from "./index-b8c289dx.js";
31
- import"./index-1p0qbq3m.js";
32
+ } from "./index-7apsdr5g.js";
33
+ import"./index-defp4gmb.js";
32
34
 
33
35
  // pkgs/@akanjs/cli/verify/verify.script.ts
34
36
  import path from "path";
@@ -3,21 +3,22 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-eja64h28.js";
7
- import"./index-52w0fvh8.js";
8
- import"./index-8scw1pjk.js";
6
+ } from "./index-9zy8479y.js";
7
+ import"./index-bns3wcpc.js";
8
+ import"./index-g500c5j9.js";
9
9
  import"./index-hj6w4ka1.js";
10
- import"./index-4mj92tsh.js";
11
- import"./index-tgt2fnd6.js";
12
- import"./index-z4b84y6k.js";
13
- import"./index-r2w2eh93.js";
14
- import"./index-qxzrp5xt.js";
15
- import"./index-k5jbcxyh.js";
16
- import"./index-rnphv731.js";
10
+ import"./index-hm0tn7qv.js";
11
+ import"./index-2nxk8wgs.js";
12
+ import"./index-j7hwy56s.js";
13
+ import"./index-khk05tsf.js";
14
+ import"./index-t1t9wq9a.js";
15
+ import"./index-g841cap9.js";
16
+ import"./index-2phm56a1.js";
17
+ import"./index-jc2zbwra.js";
17
18
  import"./index-fbewhg4g.js";
18
19
  import {
19
20
  WorkflowRunner
20
- } from "./index-zcf6k8a5.js";
21
+ } from "./index-raz588b3.js";
21
22
 
22
23
  // pkgs/@akanjs/cli/workflow/workflow.script.ts
23
24
  import { Logger } from "akanjs/common";
@@ -4,63 +4,72 @@ import {
4
4
  Workspace,
5
5
  script,
6
6
  command
7
- } from "./index-eja64h28.js";
8
- import"./index-52w0fvh8.js";
7
+ } from "./index-9zy8479y.js";
8
+ import"./index-bns3wcpc.js";
9
9
  import {
10
10
  AppExecutor,
11
11
  LibExecutor,
12
12
  PkgExecutor
13
- } from "./index-8scw1pjk.js";
13
+ } from "./index-g500c5j9.js";
14
+ import {
15
+ npmRegistryFromEnv,
16
+ warnIgnoredNpmRegistry
17
+ } from "./index-4am4dvmf.js";
14
18
  import"./index-62md4dwy.js";
15
19
  import {
16
20
  defaultMaxDiagnostics,
17
21
  WorkspaceRunner
18
- } from "./index-am36s3jh.js";
22
+ } from "./index-cjmjvg4r.js";
23
+ import"./index-2nxk8wgs.js";
19
24
  import"./index-hj6w4ka1.js";
20
25
  import"./index-fbewhg4g.js";
21
- import"./index-r2wedvqn.js";
22
- import"./index-4mj92tsh.js";
23
- import"./index-tgt2fnd6.js";
24
- import"./index-s6da8ta9.js";
26
+ import"./index-35j83zkd.js";
27
+ import"./index-j6eeh5d7.js";
28
+ import"./index-hm0tn7qv.js";
29
+ import"./index-j7hwy56s.js";
30
+ import"./index-2mwjshz5.js";
25
31
  import"./index-p6x5b7hr.js";
26
- import"./index-3yz30c07.js";
27
- import"./index-w7q6h97v.js";
32
+ import"./index-sp0qsr7a.js";
33
+ import"./index-0j1t1h2b.js";
28
34
  import"./index-m9jj544v.js";
29
- import"./index-1shvxzt0.js";
30
- import"./index-xqgwjz7a.js";
35
+ import"./index-zbrwnmf1.js";
36
+ import"./index-sveq36gh.js";
31
37
  import {
32
38
  AgentScript
33
- } from "./index-9rvcs76p.js";
39
+ } from "./index-fhw7yq2d.js";
34
40
  import {
35
41
  LibraryScript
36
- } from "./index-xq543a5y.js";
42
+ } from "./index-y4kcmbt2.js";
37
43
  import {
38
44
  ApplicationScript
39
- } from "./index-4pdts00b.js";
45
+ } from "./index-ewbmfarf.js";
40
46
  import"./index-tenw3mah.js";
41
- import"./index-qkkdhjm6.js";
42
- import"./index-tvehn2sp.js";
47
+ import"./index-gr9thy79.js";
48
+ import"./index-qd7xn2bk.js";
43
49
  import {
44
50
  PackageScript
45
- } from "./index-8559hsz4.js";
46
- import"./index-payhwt51.js";
51
+ } from "./index-84h43kg6.js";
52
+ import"./index-1h2jc0x3.js";
47
53
  import {
48
54
  CloudScript2
49
- } from "./index-w4k2ragk.js";
50
- import"./index-266dewjs.js";
51
- import"./index-k5jbcxyh.js";
52
- import"./index-z4b84y6k.js";
53
- import"./index-r2w2eh93.js";
54
- import"./index-qxzrp5xt.js";
55
- import"./index-rnphv731.js";
56
- import"./index-zcf6k8a5.js";
55
+ } from "./index-00a7j05x.js";
56
+ import"./index-qw6814m4.js";
57
+ import"./index-2phm56a1.js";
58
+ import"./index-khk05tsf.js";
59
+ import"./index-t1t9wq9a.js";
60
+ import"./index-g841cap9.js";
61
+ import"./index-jc2zbwra.js";
62
+ import"./index-raz588b3.js";
57
63
  import {
58
64
  ContextScript
59
- } from "./index-r0k3ham2.js";
60
- import"./index-b8c289dx.js";
61
- import"./index-1p0qbq3m.js";
65
+ } from "./index-tgqameyb.js";
66
+ import"./index-7apsdr5g.js";
67
+ import"./index-defp4gmb.js";
62
68
  import"./index-9bv479q5.js";
63
69
 
70
+ // pkgs/@akanjs/cli/workspace/workspace.command.ts
71
+ import path from "path";
72
+
64
73
  // pkgs/@akanjs/cli/workspace/workspace.script.ts
65
74
  import { Logger } from "akanjs/common";
66
75
  class WorkspaceScript extends script("workspace", [
@@ -74,18 +83,23 @@ class WorkspaceScript extends script("workspace", [
74
83
  ]) {
75
84
  async createWorkspace(repoName, appName, {
76
85
  dirname = ".",
86
+ inPlace = false,
77
87
  installLibs = false,
78
88
  init = true,
89
+ sample = true,
79
90
  registryUrl,
80
91
  owner,
81
92
  mcpInstall = true,
82
93
  agentInstall = true
83
94
  }) {
84
95
  const akanVersion = await this.packageScript.version(null, { log: false });
96
+ const libs = installLibs ? ["util", "shared"] : [];
85
97
  const workspace = await this.workspaceRunner.createWorkspace(repoName, appName, {
86
98
  dirname,
99
+ inPlace,
87
100
  init,
88
101
  akanVersion,
102
+ libs,
89
103
  ...registryUrl ? { registryUrl } : {},
90
104
  ...owner ? { owner } : {}
91
105
  });
@@ -93,24 +107,27 @@ class WorkspaceScript extends script("workspace", [
93
107
  await this.libraryScript.installLibrary(workspace, "util");
94
108
  await this.libraryScript.installLibrary(workspace, "shared");
95
109
  }
96
- await this.applicationScript.createApplication(appName, workspace, {
97
- libs: installLibs ? ["util", "shared"] : [],
98
- sample: true
99
- });
100
- await workspace.applyTemplate({
101
- basePath: `apps/${appName}`,
102
- template: "appSample",
103
- dict: { appName },
104
- options: { libs: installLibs ? ["util", "shared"] : [] }
105
- });
110
+ await this.applicationScript.createApplication(appName, workspace, { libs, sample });
111
+ if (sample)
112
+ await workspace.applyTemplate({
113
+ basePath: `apps/${appName}`,
114
+ template: "appSample",
115
+ dict: { appName },
116
+ options: { libs }
117
+ });
106
118
  if (agentInstall)
107
119
  await this.agentScript.agent(workspace, "install", "all", { force: true });
108
120
  if (mcpInstall)
109
121
  await this.contextScript.mcpInstall(workspace, "all", { force: true });
110
122
  const gitSpinner = workspace.spinning("Initializing git repository and commit...");
111
123
  try {
112
- await workspace.commit("Initial commit", { init: true });
113
- gitSpinner.succeed("Git repository initialized and committed");
124
+ const commit = await this.workspaceRunner.commitWorkspace(workspace);
125
+ if (!commit.committed)
126
+ gitSpinner.succeed(`Left the new files uncommitted in the git repository at ${commit.repository}`);
127
+ else if (commit.identity)
128
+ gitSpinner.succeed(`Git repository initialized and committed as ${commit.identity.name} <${commit.identity.email}>, since git ` + "has no identity here. Once user.name and user.email are set, `git commit --amend --reset-author` makes it yours");
129
+ else
130
+ gitSpinner.succeed("Git repository initialized and committed");
114
131
  } catch (_) {
115
132
  gitSpinner.fail("Git repository initialization failed. It's not fatal, you can commit manually");
116
133
  }
@@ -194,8 +211,10 @@ var maxDiagnosticsOption = {
194
211
  };
195
212
 
196
213
  class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public: target }) => ({
197
- createWorkspace: target({ desc: "Create a new Akan.js workspace", runsOnWorkspaceRoot: false }).arg("workspaceName", String, { desc: "what is the name of your organization?" }).option("app", String, { desc: "what is the codename of your first application? (e.g. myapp)" }).option("dir", String, {
198
- desc: "directory of workspace",
214
+ createWorkspace: target({ desc: "Create a new Akan.js workspace", runsOnWorkspaceRoot: false }).arg("workspaceName", String, {
215
+ desc: 'what is the name of your organization? ("." creates the workspace in --dir itself, named after it)'
216
+ }).option("app", String, { desc: "what is the codename of your first application? (e.g. myapp)" }).option("dir", String, {
217
+ desc: 'directory the workspace is created in, as <dir>/<name>, or as <dir> itself when the name is "."',
199
218
  default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "."
200
219
  }).option("libs", Boolean, {
201
220
  desc: "Do you want to install shared and util libraries? (admin, user file, etc.)",
@@ -209,7 +228,7 @@ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public
209
228
  default: false
210
229
  }).option("init", Boolean, { desc: "Do you want to initialize the workspace? (Recommended)", default: true }).option("registry", String, {
211
230
  desc: "npm registry URL for installing Akan packages",
212
- default: process.env.AKAN_NPM_REGISTRY ?? "https://registry.npmjs.org"
231
+ default: npmRegistryFromEnv() ?? "https://registry.npmjs.org"
213
232
  }).option("owner", String, { desc: "owner of the workspace", default: process.env.GITHUB_OWNER, nullable: true }).option("mcpInstall", Boolean, {
214
233
  desc: "Install the Akan MCP server config for Cursor, Claude Code, and Codex? (Recommended)",
215
234
  default: true
@@ -217,12 +236,20 @@ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public
217
236
  flag: "A",
218
237
  desc: "Install Akan agent rules (AGENTS.md, CLAUDE.md, Cursor)? (Recommended)",
219
238
  default: true
220
- }).exec(async function(workspaceName, app, dir, libs, init, registry, owner, mcpInstall, agentInstall) {
239
+ }).option("sample", Boolean, {
240
+ desc: "Generate the sample task module, pages and helpers in the first app?",
241
+ default: true
242
+ }).exec(async function(workspaceName, app, dir, libs, init, registry, owner, mcpInstall, agentInstall, sample) {
243
+ warnIgnoredNpmRegistry();
221
244
  const appName = app || "app";
222
- await this.workspaceScript.createWorkspace(workspaceName.toLowerCase().replace(/ /g, "-"), appName.toLowerCase().replace(/ /g, "-"), {
245
+ const inPlace = workspaceName === ".";
246
+ const repoName = inPlace ? path.basename(path.resolve(dir)) : workspaceName;
247
+ await this.workspaceScript.createWorkspace(repoName.toLowerCase().replace(/ /g, "-"), appName.toLowerCase().replace(/ /g, "-"), {
223
248
  dirname: dir,
249
+ inPlace,
224
250
  installLibs: libs,
225
251
  init,
252
+ sample,
226
253
  owner,
227
254
  mcpInstall,
228
255
  agentInstall,
@@ -1,9 +0,0 @@
1
- // @bun
2
- import {
3
- CodeAgent2
4
- } from "./index-96wzdhfh.js";
5
- import"./index-vxmy1p4f.js";
6
- import"./index-tenw3mah.js";
7
- export {
8
- CodeAgent2 as CodeAgent
9
- };
@@ -1,97 +0,0 @@
1
- // @bun
2
- // pkgs/@akanjs/devkit/codeAgent/agent/CodeAgentRpcListener.ts
3
- import { existsSync, rmSync } from "fs";
4
-
5
- class CodeAgentRpcListener {
6
- #host;
7
- #address;
8
- #listener = null;
9
- #client = null;
10
- constructor(host, address) {
11
- this.#host = host;
12
- this.#address = address;
13
- }
14
- static parse(spec) {
15
- if (spec.startsWith("unix:"))
16
- return { unix: spec.slice("unix:".length) };
17
- const rest = spec.startsWith("tcp:") ? spec.slice("tcp:".length) : spec;
18
- const separator = rest.lastIndexOf(":");
19
- const hostname = separator >= 0 ? rest.slice(0, separator) : "127.0.0.1";
20
- const port = Number(separator >= 0 ? rest.slice(separator + 1) : rest);
21
- if (!Number.isInteger(port) || port < 0 || port > 65535)
22
- throw new Error(`--rpc-listen takes unix:<path> or tcp:[host:]<port>, not "${spec}"`);
23
- return { hostname: hostname || "127.0.0.1", port };
24
- }
25
- get port() {
26
- return this.#listener && "port" in this.#listener ? this.#listener.port : null;
27
- }
28
- listen() {
29
- if ("unix" in this.#address && existsSync(this.#address.unix))
30
- rmSync(this.#address.unix);
31
- const socket = {
32
- open: (client) => this.#open(client),
33
- data: (client, data) => this.#data(client, data),
34
- drain: (client) => this.#drain(client),
35
- close: (client) => this.#close(client),
36
- error: (client) => this.#close(client)
37
- };
38
- this.#listener = "unix" in this.#address ? Bun.listen({ unix: this.#address.unix, socket }) : Bun.listen({ hostname: this.#address.hostname, port: this.#address.port, socket });
39
- this.#host.start();
40
- return this;
41
- }
42
- async serve() {
43
- if (!this.#listener)
44
- this.listen();
45
- await this.#host.shutdown;
46
- this.stop();
47
- }
48
- stop() {
49
- this.#client?.end();
50
- this.#client = null;
51
- this.#host.attach(null);
52
- this.#listener?.stop(true);
53
- this.#listener = null;
54
- if ("unix" in this.#address && existsSync(this.#address.unix))
55
- rmSync(this.#address.unix);
56
- }
57
- #open(client) {
58
- client.data = { pending: null, decoder: new TextDecoder };
59
- const previous = this.#client;
60
- this.#client = client;
61
- previous?.end();
62
- this.#host.attach((line) => this.#write(client, line));
63
- }
64
- #data(client, data) {
65
- if (client !== this.#client)
66
- return;
67
- this.#host.feed(client.data.decoder.decode(data, { stream: true }));
68
- }
69
- #write(client, line) {
70
- if (client !== this.#client)
71
- return;
72
- const bytes = Buffer.from(line);
73
- if (client.data.pending) {
74
- client.data.pending = Buffer.concat([client.data.pending, bytes]);
75
- return;
76
- }
77
- const written = client.write(bytes);
78
- if (written < bytes.length)
79
- client.data.pending = bytes.subarray(Math.max(0, written));
80
- }
81
- #drain(client) {
82
- const pending = client.data.pending;
83
- if (!pending)
84
- return;
85
- const written = client.write(pending);
86
- client.data.pending = written < pending.length ? pending.subarray(Math.max(0, written)) : null;
87
- }
88
- #close(client) {
89
- if (client !== this.#client)
90
- return;
91
- this.#client = null;
92
- this.#host.attach(null);
93
- }
94
- }
95
- export {
96
- CodeAgentRpcListener
97
- };
@@ -1,14 +0,0 @@
1
- // @bun
2
- import {
3
- TunnelShare2
4
- } from "./index-ksfgqq1x.js";
5
- import"./index-qkkdhjm6.js";
6
- import"./index-3yz30c07.js";
7
- import"./index-m9jj544v.js";
8
- import"./index-1shvxzt0.js";
9
- import"./index-xqgwjz7a.js";
10
- import"./index-8scw1pjk.js";
11
- import"./index-52w0fvh8.js";
12
- export {
13
- TunnelShare2 as TunnelShare
14
- };
@@ -1,26 +0,0 @@
1
- // @bun
2
- import {
3
- CloudScript2
4
- } from "./index-w4k2ragk.js";
5
- import"./index-payhwt51.js";
6
- import"./index-4pdts00b.js";
7
- import"./index-xq543a5y.js";
8
- import"./index-8559hsz4.js";
9
- import"./index-qkkdhjm6.js";
10
- import"./index-s6da8ta9.js";
11
- import"./index-1p0qbq3m.js";
12
- import"./index-w7q6h97v.js";
13
- import"./index-3yz30c07.js";
14
- import"./index-m9jj544v.js";
15
- import"./index-eja64h28.js";
16
- import"./index-9bv479q5.js";
17
- import"./index-tenw3mah.js";
18
- import"./index-1shvxzt0.js";
19
- import"./index-p6x5b7hr.js";
20
- import"./index-xqgwjz7a.js";
21
- import"./index-8scw1pjk.js";
22
- import"./index-tvehn2sp.js";
23
- import"./index-52w0fvh8.js";
24
- export {
25
- CloudScript2 as CloudScript
26
- };