@akanjs/cli 2.4.2-rc.1 → 2.4.2-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.
- package/.build-stamp +1 -1
- package/abstractCompactor-ghh1q9an.js +103 -0
- package/{agent.command-ash7wabs.js → agent.command-de4r6vk8.js} +6 -6
- package/{application.command-zm47j93m.js → application.command-nfsfm96y.js} +14 -4
- package/buildBatch.proc.js +1 -1
- package/{capacitorApp-wc75rvfm.js → capacitorApp-yg9b4ajz.js} +2 -2
- package/{cloud.command-vwpzten0.js → cloud.command-1qf95x67.js} +7 -7
- package/commandManifest.json +1 -1
- package/{context.command-j0kq87xa.js → context.command-hhjyjtp7.js} +13 -13
- package/{guideline.command-1m4jwhv0.js → guideline.command-vj956kfr.js} +3 -3
- package/incrementalBuilder.proc.js +1 -1
- package/{index-tnngmzgf.js → index-04as43rp.js} +5 -5
- package/index-0wae5ebk.js +65 -0
- package/{index-xjkjcbhd.js → index-7ppn9v4n.js} +3 -3
- package/{index-mpj63mbw.js → index-acwxfncv.js} +4 -4
- package/{index-en4zpzdm.js → index-d0h48d2f.js} +1 -1
- package/{index-f1x6fe2e.js → index-dgeaqwmw.js} +1 -1
- package/{index-31183bxt.js → index-fbv96xaw.js} +21 -7
- package/{index-t5rn8q9f.js → index-h5cvg9z9.js} +3 -3
- package/{index-0wgpfp7t.js → index-h6eav7zx.js} +7 -7
- package/{index-2nb022xv.js → index-h971erkm.js} +3 -3
- package/{index-ckywhpvp.js → index-pfnh87f9.js} +1 -1
- package/{index-n08vr4hh.js → index-s9s0n5fz.js} +2 -2
- package/{index-xdf6rxyt.js → index-v9jqrdd1.js} +2 -2
- package/{index-ehjhzg5y.js → index-xftstr5s.js} +1 -1
- package/{index-s6nk9815.js → index-xwfg9bam.js} +1 -1
- package/{index-8dsjmcbp.js → index-y1e79mz3.js} +11 -11
- package/{index-31e8cwjq.js → index-z36qzgzp.js} +2 -2
- package/{index-cp26p7qd.js → index-z5v766nx.js} +3 -3
- package/{index-smt4re0s.js → index-zfp1gz9f.js} +1 -1
- package/{index-79v9jwqe.js → index-zn9rh7sh.js} +4 -3
- package/index.js +18 -18
- package/{library.command-39eq3brk.js → library.command-68ah07a3.js} +3 -3
- package/{localRegistry.command-34zvgkys.js → localRegistry.command-84dz000g.js} +8 -8
- package/{module.command-vwahdkzr.js → module.command-t68xhamx.js} +6 -6
- package/{package.command-wkwd5x5p.js → package.command-00ncttab.js} +3 -3
- package/package.json +2 -2
- package/{page.command-9w85hrg0.js → page.command-1096s18n.js} +3 -3
- package/{primitive.command-2hnr8h7f.js → primitive.command-02eqpx6t.js} +7 -7
- package/{quality.command-4kerz7mh.js → quality.command-r9cageqb.js} +30 -5
- package/{repair.command-zmwshmvr.js → repair.command-7dynpnf1.js} +5 -5
- package/{scalar.command-9kanb73t.js → scalar.command-3kxy3fkh.js} +5 -5
- package/templates/workspaceRoot/AGENTS.md.template +8 -1
- package/{workflow.command-4areq0ex.js → workflow.command-yy0d9gk3.js} +10 -10
- package/{workspace.command-02x93b10.js → workspace.command-stv9g4a0.js} +21 -21
package/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
521ade138cb20f2efa62ad3bbf6f52195b7e4717e808fb5a3808f73ede5cb3f0
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
AbstractDoc
|
|
4
|
+
} from "./index-0wae5ebk.js";
|
|
5
|
+
import {
|
|
6
|
+
AiSession
|
|
7
|
+
} from "./index-nsj2ftxj.js";
|
|
8
|
+
import"./index-67546d0j.js";
|
|
9
|
+
import"./index-6pz1j0zj.js";
|
|
10
|
+
import"./index-r24hmh0q.js";
|
|
11
|
+
|
|
12
|
+
// pkgs/@akanjs/devkit/abstractCompactor.ts
|
|
13
|
+
import { Logger } from "akanjs/common";
|
|
14
|
+
import chalk from "chalk";
|
|
15
|
+
class AbstractCompactor {
|
|
16
|
+
static #reviewRequest = `Review the compacted file you just wrote against the original.
|
|
17
|
+
- Did you drop an invariant, a security reason, or a workflow step that the source files cannot show by themselves? Restore it.
|
|
18
|
+
- Did you keep anything that only restates code, scaffold wording, or history? Remove it.
|
|
19
|
+
- Is it in the same language as the original, within the line budget, and one short line per bullet?
|
|
20
|
+
Respond with exactly one \`\`\`markdown code block holding the corrected file and nothing else. If nothing needs to change, repeat the file unchanged.`;
|
|
21
|
+
#sys;
|
|
22
|
+
#minLines;
|
|
23
|
+
#interactive;
|
|
24
|
+
constructor(sys, { minLines = AbstractDoc.compactMinLines, interactive = false } = {}) {
|
|
25
|
+
this.#sys = sys;
|
|
26
|
+
this.#minLines = minLines;
|
|
27
|
+
this.#interactive = interactive;
|
|
28
|
+
}
|
|
29
|
+
async compactAll({ module } = {}) {
|
|
30
|
+
const docs = await AbstractDoc.findAll(this.#sys, { module });
|
|
31
|
+
const targets = docs.filter((doc) => doc.lineCount > this.#minLines);
|
|
32
|
+
const reports = [];
|
|
33
|
+
for (const doc of targets)
|
|
34
|
+
reports.push(await this.compact(doc));
|
|
35
|
+
return { scanned: docs.length, reports };
|
|
36
|
+
}
|
|
37
|
+
async compact(doc) {
|
|
38
|
+
const session = new AiSession("compactAbstract", {
|
|
39
|
+
workspace: this.#sys.workspace,
|
|
40
|
+
cacheKey: `${this.#sys.name}-${doc.moduleName}`
|
|
41
|
+
});
|
|
42
|
+
const approve = !this.#interactive;
|
|
43
|
+
const compacted = await session.editMarkdown(this.#request(doc), { approve });
|
|
44
|
+
const reviewed = await session.editMarkdown(AbstractCompactor.#reviewRequest, { approve });
|
|
45
|
+
const next = [reviewed, compacted].map((candidate) => candidate.trim()).find((candidate) => doc.canReplaceWith(candidate));
|
|
46
|
+
const beforeLines = doc.lineCount;
|
|
47
|
+
if (!next) {
|
|
48
|
+
Logger.rawLog(chalk.yellow(`${doc.path}: the editor returned no shorter abstract, keeping the current file`));
|
|
49
|
+
return { path: doc.path, beforeLines, afterLines: beforeLines, status: "failed" };
|
|
50
|
+
}
|
|
51
|
+
if (next === doc.content.trim())
|
|
52
|
+
return { path: doc.path, beforeLines, afterLines: beforeLines, status: "unchanged" };
|
|
53
|
+
const content = `${next}
|
|
54
|
+
`;
|
|
55
|
+
await this.#sys.writeFile(doc.path, content);
|
|
56
|
+
return { path: doc.path, beforeLines, afterLines: AbstractDoc.lineCountOf(content), status: "compacted" };
|
|
57
|
+
}
|
|
58
|
+
#targetShape(kind) {
|
|
59
|
+
if (kind === "other")
|
|
60
|
+
return " - keep the headings that still carry information and drop the rest; do not impose a new structure";
|
|
61
|
+
return [
|
|
62
|
+
" - `# <name> Abstract` title line",
|
|
63
|
+
" - one declarative sentence naming what this module owns",
|
|
64
|
+
" - `## Rules` \u2014 two to five bullets, each an invariant the code cannot show by itself",
|
|
65
|
+
" - optional `## Workflow` \u2014 the lifecycle as an arrow chain (`draft -> signed -> active`) or a few bullets"
|
|
66
|
+
].join(`
|
|
67
|
+
`);
|
|
68
|
+
}
|
|
69
|
+
#request(doc) {
|
|
70
|
+
return `You are compacting an Akan.js abstract file.
|
|
71
|
+
|
|
72
|
+
An abstract is the summary a coding agent reads before changing a module. Repeated edits have made this one
|
|
73
|
+
bloated, and it has to shrink back to what the source files cannot show by themselves.
|
|
74
|
+
|
|
75
|
+
# Target file
|
|
76
|
+
${this.#sys.type}s/${this.#sys.name}/${doc.path} (${doc.kind} module "${doc.moduleName}", ${doc.lineCount} lines)
|
|
77
|
+
|
|
78
|
+
# Source files in the same folder
|
|
79
|
+
${doc.siblingFiles.join(", ") || "none"}
|
|
80
|
+
|
|
81
|
+
# Current content
|
|
82
|
+
\`\`\`markdown
|
|
83
|
+
${doc.content}
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
# Rules for the compacted file
|
|
87
|
+
- Write it in the SAME language as the current content. Never translate.
|
|
88
|
+
- Keep every invariant, constraint, security reason, and workflow step that the source files cannot show by
|
|
89
|
+
themselves. Merge duplicates instead of dropping either one.
|
|
90
|
+
- Delete what the code already states: field lists, types, labels, signatures, file lists, and imports.
|
|
91
|
+
- Delete scaffold and placeholder wording, changelog or migration history, TODOs, and any instruction about
|
|
92
|
+
reading or updating this file.
|
|
93
|
+
- Never invent a rule that the current content does not state.
|
|
94
|
+
- Keep every bullet to one short line, and stay under ${AbstractDoc.compactMinLines} lines in total.
|
|
95
|
+
- Shape:
|
|
96
|
+
${this.#targetShape(doc.kind)}
|
|
97
|
+
|
|
98
|
+
Respond with exactly one \`\`\`markdown code block holding the whole new file and nothing else.`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
AbstractCompactor
|
|
103
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AgentScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
7
|
-
import"./index-
|
|
4
|
+
} from "./index-zn9rh7sh.js";
|
|
5
|
+
import"./index-v9jqrdd1.js";
|
|
6
|
+
import"./index-pfnh87f9.js";
|
|
7
|
+
import"./index-xftstr5s.js";
|
|
8
8
|
import {
|
|
9
9
|
Workspace,
|
|
10
10
|
command
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
11
|
+
} from "./index-d0h48d2f.js";
|
|
12
|
+
import"./index-xwfg9bam.js";
|
|
13
13
|
import"./index-67546d0j.js";
|
|
14
14
|
import"./index-6pz1j0zj.js";
|
|
15
15
|
import"./index-r24hmh0q.js";
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
AbstractDoc
|
|
4
|
+
} from "./index-0wae5ebk.js";
|
|
2
5
|
import {
|
|
3
6
|
ApplicationScript
|
|
4
|
-
} from "./index-
|
|
7
|
+
} from "./index-fbv96xaw.js";
|
|
5
8
|
import {
|
|
6
9
|
getMobileTargetChoices
|
|
7
10
|
} from "./index-76rn3g2c.js";
|
|
8
|
-
import"./index-
|
|
11
|
+
import"./index-s9s0n5fz.js";
|
|
9
12
|
import {
|
|
10
13
|
App,
|
|
11
14
|
Exec,
|
|
12
15
|
Sys,
|
|
13
16
|
Workspace,
|
|
14
17
|
command
|
|
15
|
-
} from "./index-
|
|
18
|
+
} from "./index-d0h48d2f.js";
|
|
16
19
|
import"./index-fgc8r6dj.js";
|
|
17
|
-
import"./index-
|
|
20
|
+
import"./index-xwfg9bam.js";
|
|
18
21
|
import"./index-67546d0j.js";
|
|
19
22
|
import"./index-bjpxzr6s.js";
|
|
20
23
|
import"./index-6pz1j0zj.js";
|
|
@@ -39,6 +42,13 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
|
|
|
39
42
|
sync: target({ desc: "Sync dependencies and configuration for an app or library" }).with(Sys).exec(async function(sys) {
|
|
40
43
|
await this.applicationScript.sync(sys);
|
|
41
44
|
}),
|
|
45
|
+
compact: target({ desc: "Compact the *.abstract.md files of an app or library with the AI editor" }).with(Sys).option("module", String, { desc: "single module to compact", nullable: true }).option("minLines", Number, {
|
|
46
|
+
flag: "n",
|
|
47
|
+
desc: "only compact abstracts longer than this",
|
|
48
|
+
default: AbstractDoc.compactMinLines
|
|
49
|
+
}).option("interactive", Boolean, { desc: "confirm or refine each rewrite", default: false }).exec(async function(sys, module, minLines, interactive) {
|
|
50
|
+
await this.applicationScript.compact(sys, { module, minLines, interactive });
|
|
51
|
+
}),
|
|
42
52
|
script: target({ desc: "Run a custom script in the application" }).with(App).arg("filename", String, { desc: "name of script", nullable: true }).exec(async function(app, filename) {
|
|
43
53
|
await this.applicationScript.script(app, filename);
|
|
44
54
|
}),
|
package/buildBatch.proc.js
CHANGED
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
selectLocalDevHost,
|
|
25
25
|
sortIosRunTargets,
|
|
26
26
|
writeRootCapacitorConfig
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-zfp1gz9f.js";
|
|
28
28
|
import"./index-76rn3g2c.js";
|
|
29
|
-
import"./index-
|
|
29
|
+
import"./index-xwfg9bam.js";
|
|
30
30
|
import"./index-67546d0j.js";
|
|
31
31
|
import"./index-6pz1j0zj.js";
|
|
32
32
|
import"./index-r24hmh0q.js";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
CloudScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-h6eav7zx.js";
|
|
5
|
+
import"./index-h5cvg9z9.js";
|
|
6
|
+
import"./index-z36qzgzp.js";
|
|
6
7
|
import {
|
|
7
8
|
GlobalConfig
|
|
8
9
|
} from "./index-nsj2ftxj.js";
|
|
9
|
-
import"./index-
|
|
10
|
+
import"./index-fbv96xaw.js";
|
|
10
11
|
import"./index-76rn3g2c.js";
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-31e8cwjq.js";
|
|
12
|
+
import"./index-s9s0n5fz.js";
|
|
13
13
|
import {
|
|
14
14
|
Workspace,
|
|
15
15
|
command
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-d0h48d2f.js";
|
|
17
17
|
import"./index-fgc8r6dj.js";
|
|
18
|
-
import"./index-
|
|
18
|
+
import"./index-xwfg9bam.js";
|
|
19
19
|
import"./index-46tjzh6s.js";
|
|
20
20
|
import"./index-67546d0j.js";
|
|
21
21
|
import"./index-bjpxzr6s.js";
|
package/commandManifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"byCommand":{"create-workspace":"workspace","generate-agent-rules":"workspace","lint":"workspace","lint-all":"workspace","sync-all":"workspace","init":"workspace","agent":"agent","create-application":"application","remove-application":"application","sync":"application","script":"application","console":"application","build":"application","b":"application","typecheck":"application","t":"application","test":"application","build-ios":"application","bi":"application","build-android":"application","ba":"application","start":"application","s":"application","start-ios":"application","si":"application","start-android":"application","sa":"application","release-ios":"application","release-android":"application","release-source":"application","codepush":"application","dbup":"application","dbdown":"application","configure-app":"application","create-library":"library","remove-library":"library","sync-library":"library","install-library":"library","start-registry":"localRegistry","reset-registry":"localRegistry","smoke-registry":"localRegistry","version":"package","create-package":"package","remove-package":"package","sync-package":"package","build-package":"package","verify-dist-package":"package","verify-akan-publish-packages":"package","create-module":"module","remove-module":"module","create-service":"module","create-view":"module","create-unit":"module","create-template":"module","create-crud-page":"page","context":"context","doctor":"context","mcp-install":"context","mcp":"context","mcp-call":"context","login":"cloud","logout":"cloud","set-llm":"cloud","reset-llm":"cloud","ask":"cloud","deploy-akan":"cloud","update":"cloud","download-env":"cloud","upload-env":"cloud","guideline":"guideline","generate-instruction":"guideline","update-instruction":"guideline","generate-document":"guideline","reapply-instruction":"guideline","create-scalar":"scalar","remove-scalar":"scalar","create-ui":"primitive","add-field":"primitive","add-enum-field":"primitive","quality":"quality","repair":"repair","workflow":"workflow"}}
|
|
1
|
+
{"byCommand":{"create-workspace":"workspace","generate-agent-rules":"workspace","lint":"workspace","lint-all":"workspace","sync-all":"workspace","init":"workspace","agent":"agent","create-application":"application","remove-application":"application","sync":"application","compact":"application","script":"application","console":"application","build":"application","b":"application","typecheck":"application","t":"application","test":"application","build-ios":"application","bi":"application","build-android":"application","ba":"application","start":"application","s":"application","start-ios":"application","si":"application","start-android":"application","sa":"application","release-ios":"application","release-android":"application","release-source":"application","codepush":"application","dbup":"application","dbdown":"application","configure-app":"application","create-library":"library","remove-library":"library","sync-library":"library","install-library":"library","start-registry":"localRegistry","reset-registry":"localRegistry","smoke-registry":"localRegistry","version":"package","create-package":"package","remove-package":"package","sync-package":"package","build-package":"package","verify-dist-package":"package","verify-akan-publish-packages":"package","create-module":"module","remove-module":"module","create-service":"module","create-view":"module","create-unit":"module","create-template":"module","create-crud-page":"page","context":"context","doctor":"context","mcp-install":"context","mcp":"context","mcp-call":"context","login":"cloud","logout":"cloud","set-llm":"cloud","reset-llm":"cloud","ask":"cloud","deploy-akan":"cloud","update":"cloud","download-env":"cloud","upload-env":"cloud","guideline":"guideline","generate-instruction":"guideline","update-instruction":"guideline","generate-document":"guideline","reapply-instruction":"guideline","create-scalar":"scalar","remove-scalar":"scalar","create-ui":"primitive","add-field":"primitive","add-enum-field":"primitive","quality":"quality","repair":"repair","workflow":"workflow"}}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ContextScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
4
|
+
} from "./index-y1e79mz3.js";
|
|
5
|
+
import"./index-7ppn9v4n.js";
|
|
6
|
+
import"./index-h971erkm.js";
|
|
7
|
+
import"./index-z5v766nx.js";
|
|
8
|
+
import"./index-acwxfncv.js";
|
|
9
|
+
import"./index-04as43rp.js";
|
|
10
|
+
import"./index-dgeaqwmw.js";
|
|
11
11
|
import"./index-ss469dec.js";
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
12
|
+
import"./index-zfp1gz9f.js";
|
|
13
|
+
import"./index-v9jqrdd1.js";
|
|
14
|
+
import"./index-pfnh87f9.js";
|
|
15
|
+
import"./index-xftstr5s.js";
|
|
16
16
|
import"./index-nsj2ftxj.js";
|
|
17
17
|
import"./index-76rn3g2c.js";
|
|
18
18
|
import {
|
|
19
19
|
Workspace,
|
|
20
20
|
command
|
|
21
|
-
} from "./index-
|
|
22
|
-
import"./index-
|
|
21
|
+
} from "./index-d0h48d2f.js";
|
|
22
|
+
import"./index-xwfg9bam.js";
|
|
23
23
|
import"./index-67546d0j.js";
|
|
24
24
|
import"./index-6pz1j0zj.js";
|
|
25
25
|
import"./index-r24hmh0q.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
Prompter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-xftstr5s.js";
|
|
5
5
|
import {
|
|
6
6
|
AiSession
|
|
7
7
|
} from "./index-nsj2ftxj.js";
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
command,
|
|
11
11
|
runner,
|
|
12
12
|
script
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-d0h48d2f.js";
|
|
14
14
|
import {
|
|
15
15
|
getDirname
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-xwfg9bam.js";
|
|
17
17
|
import {
|
|
18
18
|
FileSys
|
|
19
19
|
} from "./index-67546d0j.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PageScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-dgeaqwmw.js";
|
|
5
5
|
import {
|
|
6
6
|
pluralizeName
|
|
7
7
|
} from "./index-ss469dec.js";
|
|
@@ -12,20 +12,20 @@ import {
|
|
|
12
12
|
generatedFilesForSync,
|
|
13
13
|
moduleSourcePaths,
|
|
14
14
|
sourceFile
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-pfnh87f9.js";
|
|
16
16
|
import {
|
|
17
17
|
Prompter
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-xftstr5s.js";
|
|
19
19
|
import {
|
|
20
20
|
AiSession
|
|
21
21
|
} from "./index-nsj2ftxj.js";
|
|
22
22
|
import {
|
|
23
23
|
runner,
|
|
24
24
|
script
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-d0h48d2f.js";
|
|
26
26
|
import {
|
|
27
27
|
ModuleExecutor
|
|
28
|
-
} from "./index-
|
|
28
|
+
} from "./index-xwfg9bam.js";
|
|
29
29
|
import {
|
|
30
30
|
FileSys
|
|
31
31
|
} from "./index-67546d0j.js";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/abstractDoc.ts
|
|
3
|
+
class AbstractDoc {
|
|
4
|
+
path;
|
|
5
|
+
content;
|
|
6
|
+
siblingFiles;
|
|
7
|
+
static suffix = ".abstract.md";
|
|
8
|
+
static maxLines = 300;
|
|
9
|
+
static compactMinLines = 40;
|
|
10
|
+
static #facetRoots = "{lib,ui,webkit,srvkit,common,plugin}";
|
|
11
|
+
static isAbstractPath(filePath) {
|
|
12
|
+
return filePath.endsWith(AbstractDoc.suffix);
|
|
13
|
+
}
|
|
14
|
+
static lineCountOf(content) {
|
|
15
|
+
return content.split(/\r?\n/).length;
|
|
16
|
+
}
|
|
17
|
+
static kindOf(filePath) {
|
|
18
|
+
const [root, folder, ...rest] = filePath.split("/");
|
|
19
|
+
if (root !== "lib" || !folder)
|
|
20
|
+
return "other";
|
|
21
|
+
if (folder === "__scalar")
|
|
22
|
+
return rest.length === 2 ? "scalar" : "other";
|
|
23
|
+
if (rest.length !== 1)
|
|
24
|
+
return "other";
|
|
25
|
+
return folder.startsWith("_") ? "service" : "domain";
|
|
26
|
+
}
|
|
27
|
+
static async findAll(sys, { module } = {}) {
|
|
28
|
+
const filePaths = (await sys.getAllFiles(`${AbstractDoc.#facetRoots}/**/*${AbstractDoc.suffix}`)).sort();
|
|
29
|
+
const docs = await Promise.all(filePaths.map((filePath) => AbstractDoc.read(sys, filePath)));
|
|
30
|
+
if (!module)
|
|
31
|
+
return docs;
|
|
32
|
+
return docs.filter((doc) => doc.moduleName === module || doc.folderName === module);
|
|
33
|
+
}
|
|
34
|
+
static async read(sys, filePath) {
|
|
35
|
+
const dirPath = filePath.split("/").slice(0, -1).join("/");
|
|
36
|
+
const [content, folderFiles] = await Promise.all([sys.readFile(filePath), sys.readdir(dirPath)]);
|
|
37
|
+
return new AbstractDoc(filePath, content, folderFiles.filter((fileName) => !AbstractDoc.isAbstractPath(fileName)));
|
|
38
|
+
}
|
|
39
|
+
constructor(path, content, siblingFiles) {
|
|
40
|
+
this.path = path;
|
|
41
|
+
this.content = content;
|
|
42
|
+
this.siblingFiles = siblingFiles;
|
|
43
|
+
}
|
|
44
|
+
get kind() {
|
|
45
|
+
return AbstractDoc.kindOf(this.path);
|
|
46
|
+
}
|
|
47
|
+
get folderName() {
|
|
48
|
+
return this.path.split("/").at(-2) ?? "";
|
|
49
|
+
}
|
|
50
|
+
get moduleName() {
|
|
51
|
+
return (this.path.split("/").at(-1) ?? "").slice(0, -AbstractDoc.suffix.length);
|
|
52
|
+
}
|
|
53
|
+
get lineCount() {
|
|
54
|
+
return AbstractDoc.lineCountOf(this.content);
|
|
55
|
+
}
|
|
56
|
+
canReplaceWith(candidate) {
|
|
57
|
+
const next = candidate.trim();
|
|
58
|
+
if (!next.startsWith("#"))
|
|
59
|
+
return false;
|
|
60
|
+
const lineCount = AbstractDoc.lineCountOf(next);
|
|
61
|
+
return lineCount >= 3 && lineCount < this.lineCount;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { AbstractDoc };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AkanContextAnalyzer
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-v9jqrdd1.js";
|
|
5
5
|
import {
|
|
6
6
|
createRepairReport,
|
|
7
7
|
generatedFilePathsForTarget,
|
|
8
8
|
renderRepairReport,
|
|
9
9
|
writeGeneratedSyncState,
|
|
10
10
|
writeWorkflowRunArtifact
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-pfnh87f9.js";
|
|
12
12
|
import {
|
|
13
13
|
runner
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-d0h48d2f.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/cli/repair/repair.runner.ts
|
|
17
17
|
var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ModuleScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-04as43rp.js";
|
|
5
5
|
import {
|
|
6
6
|
addFieldUiPolicyForType,
|
|
7
7
|
coerceFieldDefault,
|
|
@@ -34,15 +34,15 @@ import {
|
|
|
34
34
|
sourceFile,
|
|
35
35
|
validationCommandsForTarget,
|
|
36
36
|
viaBuilderParameterName
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-pfnh87f9.js";
|
|
38
38
|
import {
|
|
39
39
|
script
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-d0h48d2f.js";
|
|
41
41
|
import {
|
|
42
42
|
AppExecutor,
|
|
43
43
|
LibExecutor,
|
|
44
44
|
ModuleExecutor
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-xwfg9bam.js";
|
|
46
46
|
|
|
47
47
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
48
48
|
import { capitalize } from "akanjs/common";
|
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
} from "./index-76rn3g2c.js";
|
|
5
5
|
import {
|
|
6
6
|
LibraryScript
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-s9s0n5fz.js";
|
|
8
8
|
import {
|
|
9
9
|
runner,
|
|
10
10
|
script
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-d0h48d2f.js";
|
|
12
12
|
import {
|
|
13
13
|
AppExecutor,
|
|
14
14
|
LibExecutor,
|
|
15
15
|
PkgExecutor,
|
|
16
16
|
WorkspaceExecutor
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-xwfg9bam.js";
|
|
18
18
|
import {
|
|
19
19
|
HmrWatcher,
|
|
20
20
|
WatchRootResolver
|
|
@@ -1900,7 +1900,8 @@ function openBrowser(url) {
|
|
|
1900
1900
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
1901
1901
|
var loadBuildRunner = async () => (await import("./applicationBuildRunner-554a2vnk.js")).ApplicationBuildRunner;
|
|
1902
1902
|
var loadReleasePackager = async () => (await import("./applicationReleasePackager-pjbxc793.js")).ApplicationReleasePackager;
|
|
1903
|
-
var loadCapacitorApp = async () => (await import("./capacitorApp-
|
|
1903
|
+
var loadCapacitorApp = async () => (await import("./capacitorApp-yg9b4ajz.js")).CapacitorApp;
|
|
1904
|
+
var loadAbstractCompactor = async () => (await import("./abstractCompactor-ghh1q9an.js")).AbstractCompactor;
|
|
1904
1905
|
var loadPrompts = async () => await import("@inquirer/prompts");
|
|
1905
1906
|
|
|
1906
1907
|
class ApplicationRunner extends runner("application") {
|
|
@@ -1978,6 +1979,10 @@ try {
|
|
|
1978
1979
|
async typecheck(app, options = {}) {
|
|
1979
1980
|
await new (await loadBuildRunner())(app).typecheck(options);
|
|
1980
1981
|
}
|
|
1982
|
+
async compact(sys, { module, minLines, interactive } = {}) {
|
|
1983
|
+
const compactor = new (await loadAbstractCompactor())(sys, { minLines, interactive });
|
|
1984
|
+
return await compactor.compactAll({ module });
|
|
1985
|
+
}
|
|
1981
1986
|
async test(exec) {
|
|
1982
1987
|
const isSignalTarget = exec instanceof AppExecutor || exec instanceof LibExecutor;
|
|
1983
1988
|
const preloadPath = isSignalTarget ? await resolveSignalTestPreloadPath(exec) : null;
|
|
@@ -2231,9 +2236,7 @@ ${detail}`
|
|
|
2231
2236
|
const chain = RunnableSequence.from([mainPrompt, chatModel, new StringOutputParser]);
|
|
2232
2237
|
await chain.invoke({ projectName, projectDesc });
|
|
2233
2238
|
spinner.succeed("Loading complete!");
|
|
2234
|
-
//! add path in tsconfig.json
|
|
2235
2239
|
}
|
|
2236
|
-
async testApplication(app) {}
|
|
2237
2240
|
}
|
|
2238
2241
|
|
|
2239
2242
|
// pkgs/@akanjs/cli/application/application.script.ts
|
|
@@ -2331,6 +2334,17 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
2331
2334
|
else
|
|
2332
2335
|
await this.libraryScript.syncLibrary(sys);
|
|
2333
2336
|
}
|
|
2337
|
+
async compact(sys, { module = null, minLines, interactive = false } = {}) {
|
|
2338
|
+
const { scanned, reports } = await this.applicationRunner.compact(sys, { module, minLines, interactive });
|
|
2339
|
+
if (!reports.length) {
|
|
2340
|
+
Logger5.rawLog(`No abstract file long enough to compact in ${sys.name} (${scanned} scanned)`);
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
for (const report of reports)
|
|
2344
|
+
Logger5.rawLog(`${report.status}: ${report.path} (${report.beforeLines} -> ${report.afterLines} lines)`);
|
|
2345
|
+
const compactedNum = reports.filter((report) => report.status === "compacted").length;
|
|
2346
|
+
Logger5.rawLog(`Compacted ${compactedNum}/${reports.length} abstract files in ${sys.name}`);
|
|
2347
|
+
}
|
|
2334
2348
|
async script(app, filename) {
|
|
2335
2349
|
const scriptFilename = filename ?? await this.applicationRunner.getScriptFilename(app);
|
|
2336
2350
|
await app.scanSync();
|
|
@@ -2515,7 +2529,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
2515
2529
|
}
|
|
2516
2530
|
async testApplication(app) {
|
|
2517
2531
|
const spinner = app.spinning("Testing application...");
|
|
2518
|
-
await this.applicationRunner.
|
|
2532
|
+
await this.applicationRunner.test(app);
|
|
2519
2533
|
spinner.succeed(`Application ${app.name} (apps/${app.name}) test is successful`);
|
|
2520
2534
|
}
|
|
2521
2535
|
}
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
} from "./index-nsj2ftxj.js";
|
|
8
8
|
import {
|
|
9
9
|
openBrowser
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-fbv96xaw.js";
|
|
11
11
|
import {
|
|
12
12
|
runner
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-d0h48d2f.js";
|
|
14
14
|
import {
|
|
15
15
|
AppExecutor,
|
|
16
16
|
WorkspaceExecutor
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-xwfg9bam.js";
|
|
18
18
|
|
|
19
19
|
// pkgs/@akanjs/cli/cloud/cloud.runner.ts
|
|
20
20
|
import path from "path";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
CloudRunner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-h5cvg9z9.js";
|
|
5
|
+
import {
|
|
6
|
+
PackageScript
|
|
7
|
+
} from "./index-z36qzgzp.js";
|
|
5
8
|
import {
|
|
6
9
|
AiSession,
|
|
7
10
|
CloudApi,
|
|
@@ -9,16 +12,13 @@ import {
|
|
|
9
12
|
} from "./index-nsj2ftxj.js";
|
|
10
13
|
import {
|
|
11
14
|
ApplicationScript
|
|
12
|
-
} from "./index-
|
|
13
|
-
import {
|
|
14
|
-
PackageScript
|
|
15
|
-
} from "./index-31e8cwjq.js";
|
|
15
|
+
} from "./index-fbv96xaw.js";
|
|
16
16
|
import {
|
|
17
17
|
script
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-d0h48d2f.js";
|
|
19
19
|
import {
|
|
20
20
|
PkgExecutor
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-xwfg9bam.js";
|
|
22
22
|
|
|
23
23
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
24
24
|
import { Logger } from "akanjs/common";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AkanContextAnalyzer
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-v9jqrdd1.js";
|
|
5
5
|
import {
|
|
6
6
|
WorkflowExecutor,
|
|
7
7
|
compactWorkflowInputs,
|
|
@@ -23,10 +23,10 @@ import {
|
|
|
23
23
|
workflowCommandsForPlan,
|
|
24
24
|
workflowPlanApproval,
|
|
25
25
|
writeWorkflowRunArtifact
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-pfnh87f9.js";
|
|
27
27
|
import {
|
|
28
28
|
runner
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-d0h48d2f.js";
|
|
30
30
|
|
|
31
31
|
// pkgs/@akanjs/cli/workflow/workflow.runner.ts
|
|
32
32
|
import { mkdir, readFile, writeFile } from "fs/promises";
|