@akanjs/cli 2.3.11-rc.4 → 2.3.11-rc.5

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.
@@ -1710,7 +1710,8 @@ var appRootAllowedFiles = new Set([
1710
1710
  "main.ts",
1711
1711
  "package.json",
1712
1712
  "server.ts",
1713
- "tsconfig.json"
1713
+ "tsconfig.json",
1714
+ "tsconfig.tsbuildinfo"
1714
1715
  ]);
1715
1716
  var appRootAllowedDirs = new Set([
1716
1717
  ".akan",
package/index.js CHANGED
@@ -1708,7 +1708,8 @@ var appRootAllowedFiles = new Set([
1708
1708
  "main.ts",
1709
1709
  "package.json",
1710
1710
  "server.ts",
1711
- "tsconfig.json"
1711
+ "tsconfig.json",
1712
+ "tsconfig.tsbuildinfo"
1712
1713
  ]);
1713
1714
  var appRootAllowedDirs = new Set([
1714
1715
  ".akan",
@@ -16028,19 +16029,12 @@ var targetPaths = {
16028
16029
  "agents-md": "AGENTS.md",
16029
16030
  claude: "CLAUDE.md"
16030
16031
  };
16031
- var targetTitle = {
16032
- cursor: "Akan Cursor Rules",
16033
- "agents-md": "Akan Agent Rules",
16034
- claude: "Akan Claude Rules"
16035
- };
16036
- var renderAgentRules = async (workspace, target) => {
16032
+ var AGENT_BLOCK_START = "<!-- akan:agent:start -->";
16033
+ var AGENT_BLOCK_END = "<!-- akan:agent:end -->";
16034
+ var renderManagedBlock = async (workspace) => {
16037
16035
  const context = await AkanContextAnalyzer.analyze(workspace);
16038
16036
  const frameworkGuide = await Prompter.getInstruction("framework");
16039
- return `# ${targetTitle[target]}
16040
-
16041
- This file is generated by \`akan agent install ${target}\`.
16042
-
16043
- ## Workspace
16037
+ return `## Workspace
16044
16038
 
16045
16039
  - Repo: ${context.repoName}
16046
16040
  - Apps: ${context.apps.map((app) => app.name).join(", ") || "none"}
@@ -16077,8 +16071,61 @@ ${context.validationCommands.map((command3) => `- \`${command3}\``).join(`
16077
16071
 
16078
16072
  ## Framework Guide
16079
16073
 
16080
- ${frameworkGuide.trim()}
16074
+ ${frameworkGuide.trim()}`;
16075
+ };
16076
+ var upsertManagedBlock = (existing, block) => {
16077
+ const managed = `${AGENT_BLOCK_START}
16078
+ ${block}
16079
+ ${AGENT_BLOCK_END}`;
16080
+ const startIndex = existing.indexOf(AGENT_BLOCK_START);
16081
+ const endIndex = existing.indexOf(AGENT_BLOCK_END);
16082
+ if (startIndex >= 0 && endIndex > startIndex) {
16083
+ return `${existing.slice(0, startIndex)}${managed}${existing.slice(endIndex + AGENT_BLOCK_END.length)}`;
16084
+ }
16085
+ return `${existing.replace(/\s*$/, "")}
16086
+
16087
+ ${managed}
16088
+ `;
16089
+ };
16090
+ var renderAgentsMd = async (workspace, existing) => {
16091
+ const block = await renderManagedBlock(workspace);
16092
+ if (existing?.trim())
16093
+ return upsertManagedBlock(existing, block);
16094
+ const context = await AkanContextAnalyzer.analyze(workspace);
16095
+ return `# ${context.repoName} Agent Guide
16096
+
16097
+ This file is the single source of truth for coding agents in this workspace. Claude Code reads it through
16098
+ \`CLAUDE.md\` (\`@AGENTS.md\`) and Cursor through \`.cursor/rules/akan.mdc\`. The section between the
16099
+ \`akan:agent\` markers is regenerated by \`akan agent install\`; edit anything outside the markers freely.
16100
+
16101
+ ${AGENT_BLOCK_START}
16102
+ ${block}
16103
+ ${AGENT_BLOCK_END}
16104
+ `;
16105
+ };
16106
+ var renderClaudeMd = async (workspace) => {
16107
+ const context = await AkanContextAnalyzer.analyze(workspace);
16108
+ return `# ${context.repoName} \u2014 Claude Code Guide
16109
+
16110
+ @AGENTS.md
16111
+ `;
16112
+ };
16113
+ var renderCursorRule = () => `---
16114
+ description: Akan workspace agent guide
16115
+ alwaysApply: true
16116
+ ---
16117
+
16118
+ Follow the workspace agent guide, which is the single source of truth for Akan conventions,
16119
+ generated-file rules, and the MCP workflow policy.
16120
+
16121
+ @AGENTS.md
16081
16122
  `;
16123
+ var renderTarget = async (workspace, target, existing) => {
16124
+ if (target === "agents-md")
16125
+ return await renderAgentsMd(workspace, existing);
16126
+ if (target === "claude")
16127
+ return await renderClaudeMd(workspace);
16128
+ return renderCursorRule();
16082
16129
  };
16083
16130
 
16084
16131
  class AgentRunner extends runner("agent") {
@@ -16086,11 +16133,13 @@ class AgentRunner extends runner("agent") {
16086
16133
  const written = [];
16087
16134
  for (const target of targets) {
16088
16135
  const filePath = targetPaths[target];
16089
- if (!force && await workspace.exists(filePath)) {
16136
+ const exists2 = await workspace.exists(filePath);
16137
+ if (exists2 && !force && target !== "agents-md") {
16090
16138
  throw new Error(`${filePath} already exists. Re-run with --force to overwrite it.`);
16091
16139
  }
16092
- const content = await renderAgentRules(workspace, target);
16093
- await workspace.writeFile(filePath, content, { overwrite: force });
16140
+ const existing = exists2 ? await workspace.readFile(filePath) : null;
16141
+ const content = await renderTarget(workspace, target, existing);
16142
+ await workspace.writeFile(filePath, content, { overwrite: true });
16094
16143
  written.push(filePath);
16095
16144
  }
16096
16145
  return written;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "2.3.11-rc.4",
3
+ "version": "2.3.11-rc.5",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -34,7 +34,7 @@
34
34
  "@langchain/openai": "^1.4.6",
35
35
  "@tailwindcss/node": "^4.3.0",
36
36
  "@trapezedev/project": "^7.1.4",
37
- "akanjs": "2.3.11-rc.4",
37
+ "akanjs": "2.3.11-rc.5",
38
38
  "chalk": "^5.6.2",
39
39
  "commander": "^14.0.3",
40
40
  "daisyui": "5.5.23",
@@ -1,38 +1,9 @@
1
1
  ---
2
- description: Akan.js workspace conventions for coding agents
2
+ description: Akan workspace agent guide
3
3
  alwaysApply: true
4
4
  ---
5
5
 
6
- # Akan.js Workspace Rules
6
+ Follow the workspace agent guide, which is the single source of truth for Akan conventions,
7
+ generated-file rules, and the MCP workflow policy.
7
8
 
8
- - Keep edits inside the established Akan structure: `apps/<app>`, `libs/<lib>`, `pkgs/*`, and `infra`.
9
- - Pages live under `apps/<app>/page`; index routes use `_index.tsx`, and nested layouts use `_layout.tsx`.
10
- - Database domain modules live under `lib/<model>`.
11
- - Service modules live under `lib/_<service>`.
12
- - Scalar modules live under `lib/__scalar/<scalar>`.
13
- - Module abstracts live beside module code as `<model>.abstract.md`, `<service>.abstract.md`, or
14
- `<scalar>.abstract.md`. Read them before changing module behavior.
15
- - Do not hand-edit generated Akan files such as `akan.app.json`, `client.ts`, `server.ts`, generated facet indexes,
16
- `lib/cnst.ts`, `lib/dict.ts`, `lib/db.ts`, `lib/srv.ts`, `lib/st.ts`, `lib/sig.ts`, `lib/useClient.ts`, or
17
- `lib/useServer.ts`.
18
- - Prefer Akan MCP workflows before direct source edits: use `akan mcp --mode plan` for workflow discovery and
19
- planning, then `akan mcp --mode apply` only for allowlisted apply, validation, and repair tools.
20
- - If `plan_workflow` returns `planPath` or `next.tool=apply_workflow`, call `apply_workflow({ planPath })` before
21
- editing source files directly.
22
- - After `apply_workflow`, run `run_validation` with `validationTarget` when present; otherwise use `applyReportPath`.
23
- - Direct source edits are denied when an allowlisted Akan workflow or repair tool can perform the change.
24
- - Direct edits are fallback only after `list_workflows`/`explain_workflow` show no matching workflow, or after
25
- `apply_workflow` reports unsupported/no-op/failed diagnostics that require manual action.
26
- - For compound requests, split the request into workflows and apply each `planPath` in order, such as `create-module`
27
- followed by `add-field`.
28
- - If generated output is stale or broken, update the owning source file and run `akan repair generated` or
29
- `akan sync <app-or-lib>` instead of patching generated files.
30
- - For new domain behavior, inspect sibling `constant`, `dictionary`, `signal`, `document`, `service`, `store`, and UI
31
- module files before changing shape.
32
- - Update `*.abstract.md` when business invariants, workflows, or public behavior change. Do not update it for
33
- formatting-only, import-only, or style-only changes.
34
- - Respect server/client import boundaries. Use `akanjs/server` only in server-side code and `akanjs/client` only in
35
- client/page runtime code.
36
- - Treat `AKAN_PUBLIC_*` env vars as public values. Do not store secrets in them.
37
- - Verify changes with the smallest relevant command: `akan lint <target>`, `akan test <target>`, or
38
- `akan build <app-name>`.
9
+ @AGENTS.md
@@ -576,3 +576,13 @@ akan sync automatically generates APIs across all layers. Only write custom logi
576
576
  | `insight[Query](args)`, `query[Query](args)` | Insight and raw query |
577
577
 
578
578
  **Rule**: Define `Filter` with `.query()` conditions in `document.ts`. akan sync auto-generates all 10 query helper methods per filter. Write `Document` chain methods only for state transitions with validation.
579
+
580
+ ## Generated Context
581
+
582
+ The section below is regenerated by `akan agent install` (run `bun run setup:agent`). It lists this
583
+ workspace's apps, generated files, validation commands, and framework guide. Edit anything outside the
584
+ markers freely; content between them is overwritten on the next install.
585
+
586
+ <!-- akan:agent:start -->
587
+ <!-- Populated by `akan agent install`. Run `bun run setup:agent` to refresh. -->
588
+ <!-- akan:agent:end -->