@akanjs/cli 3.0.0-alpha.77 → 3.0.0-alpha.78
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/agent.command-q2rgd8jz.js +1 -1
- package/{application.command-tfrqva07.js → application.command-kd5zj0k9.js} +4 -2
- package/{cloud.command-pjtg4azj.js → cloud.command-v60xnfdx.js} +6 -4
- package/commandManifest.json +1 -1
- package/{context.command-zx88k7e0.js → context.command-hac3x83c.js} +5 -5
- package/fleet.command-jv24wcae.js +793 -0
- package/index-19nz5chq.js +76 -0
- package/{index-7x5ks4ph.js → index-47zynjx7.js} +1 -1
- package/{index-ym4xqjhy.js → index-7605ykh6.js} +4 -68
- package/{index-hffr3myr.js → index-dz1q44m8.js} +1 -1
- package/index-jn9b717k.js +109 -0
- package/{index-e00k7eme.js → index-psx0z6hb.js} +2 -2
- package/{index-kpxg3p1v.js → index-pzsryyjv.js} +6 -6
- package/{index-4930mtpt.js → index-zp0cmfgd.js} +5 -105
- package/index.js +11 -10
- package/{library.command-sjnqhzn2.js → library.command-nvp0wetm.js} +2 -1
- package/{localRegistry.command-02dy0h6v.js → localRegistry.command-dnefn893.js} +5 -3
- package/{module.command-8vfy9pgk.js → module.command-xs6ded4j.js} +2 -2
- package/package.json +2 -2
- package/{primitive.command-63b8ytkf.js → primitive.command-qjf4mbth.js} +3 -3
- package/{scalar.command-8ampjwsr.js → scalar.command-ax8taqh1.js} +2 -2
- package/{workflow.command-jkfmkbzh.js → workflow.command-gwkw0jae.js} +4 -4
- package/{workspace.command-pg2qfpn7.js → workspace.command-53qpkgzp.js} +11 -9
- package/{index-ws5zt62x.js → index-pj3hk9kt.js} +3 -3
- package/{index-0cdwa7qj.js → index-ta1mk0xh.js} +3 -3
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/libSource.ts
|
|
3
|
+
class LibSource {
|
|
4
|
+
static manifestKey = "akan";
|
|
5
|
+
static unhashedDirs = ["env"];
|
|
6
|
+
#lib;
|
|
7
|
+
constructor(lib) {
|
|
8
|
+
this.#lib = lib;
|
|
9
|
+
}
|
|
10
|
+
get #prefix() {
|
|
11
|
+
return `libs/${this.#lib.name}/`;
|
|
12
|
+
}
|
|
13
|
+
#isHashed(file) {
|
|
14
|
+
const relative = file.slice(this.#prefix.length);
|
|
15
|
+
return !LibSource.unhashedDirs.includes(relative.split("/")[0] ?? "");
|
|
16
|
+
}
|
|
17
|
+
async#hashableContent(file) {
|
|
18
|
+
const content = await this.#lib.workspace.readFile(file);
|
|
19
|
+
if (file !== `${this.#prefix}package.json`)
|
|
20
|
+
return content;
|
|
21
|
+
const manifest = JSON.parse(content);
|
|
22
|
+
delete manifest[LibSource.manifestKey];
|
|
23
|
+
return JSON.stringify(manifest);
|
|
24
|
+
}
|
|
25
|
+
async computeHash() {
|
|
26
|
+
const files = (await this.#lib.workspace.listGitFiles([`libs/${this.#lib.name}`], { untracked: true })).filter((file) => this.#isHashed(file));
|
|
27
|
+
const hasher = new Bun.CryptoHasher("sha256");
|
|
28
|
+
for (const file of files) {
|
|
29
|
+
hasher.update(file);
|
|
30
|
+
hasher.update("\x00");
|
|
31
|
+
hasher.update(await this.#hashableContent(file));
|
|
32
|
+
hasher.update("\x00");
|
|
33
|
+
}
|
|
34
|
+
return hasher.digest("hex").slice(0, 32);
|
|
35
|
+
}
|
|
36
|
+
async read() {
|
|
37
|
+
const manifest = await this.#lib.getPackageJson();
|
|
38
|
+
const akan = manifest[LibSource.manifestKey];
|
|
39
|
+
return akan?.source ?? null;
|
|
40
|
+
}
|
|
41
|
+
async write({ origin, sha }) {
|
|
42
|
+
const [manifest, hash] = await Promise.all([this.#lib.getPackageJson(), this.computeHash()]);
|
|
43
|
+
const akan = manifest[LibSource.manifestKey] ?? {};
|
|
44
|
+
const stamp = { origin, sha, hash, syncedAt: new Date().toISOString() };
|
|
45
|
+
await this.#lib.setPackageJson({ ...manifest, [LibSource.manifestKey]: { ...akan, source: stamp } });
|
|
46
|
+
return stamp;
|
|
47
|
+
}
|
|
48
|
+
async syncStamp({ origin, sha }) {
|
|
49
|
+
const [current, hash] = await Promise.all([this.read(), this.computeHash()]);
|
|
50
|
+
if (current?.origin === origin && current.sha === sha && current.hash === hash)
|
|
51
|
+
return { stamp: current, changed: false };
|
|
52
|
+
return { stamp: await this.write({ origin, sha }), changed: true };
|
|
53
|
+
}
|
|
54
|
+
async status() {
|
|
55
|
+
const [stamp, hash] = await Promise.all([this.read(), this.computeHash()]);
|
|
56
|
+
const drift = !stamp ? "unstamped" : stamp.hash === hash ? "clean" : "drifted";
|
|
57
|
+
return { lib: this.#lib.name, drift, stamp, hash };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function formatLibStatuses(statuses) {
|
|
61
|
+
const marks = { clean: "clean ", drifted: "DRIFTED ", unstamped: "unstamped" };
|
|
62
|
+
const sections = [
|
|
63
|
+
"Akan Library Source Status",
|
|
64
|
+
"",
|
|
65
|
+
...statuses.map((status) => {
|
|
66
|
+
const origin = status.stamp ? `${status.stamp.origin}@${status.stamp.sha}` : "no akan.source in package.json";
|
|
67
|
+
return ` ${marks[status.drift]} libs/${status.lib} ${origin}`;
|
|
68
|
+
}),
|
|
69
|
+
"",
|
|
70
|
+
`drifted: ${statuses.filter((status) => status.drift === "drifted").length} / ${statuses.length}`
|
|
71
|
+
];
|
|
72
|
+
return sections.join(`
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { LibSource, formatLibStatuses };
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
LibSource,
|
|
4
|
+
formatLibStatuses
|
|
5
|
+
} from "./index-19nz5chq.js";
|
|
2
6
|
import {
|
|
3
7
|
runner,
|
|
4
8
|
script
|
|
@@ -7,74 +11,6 @@ import {
|
|
|
7
11
|
LibExecutor
|
|
8
12
|
} from "./index-zkrzv21w.js";
|
|
9
13
|
|
|
10
|
-
// pkgs/@akanjs/devkit/libSource.ts
|
|
11
|
-
class LibSource {
|
|
12
|
-
static manifestKey = "akan";
|
|
13
|
-
static unhashedDirs = ["env"];
|
|
14
|
-
#lib;
|
|
15
|
-
constructor(lib) {
|
|
16
|
-
this.#lib = lib;
|
|
17
|
-
}
|
|
18
|
-
get #prefix() {
|
|
19
|
-
return `libs/${this.#lib.name}/`;
|
|
20
|
-
}
|
|
21
|
-
#isHashed(file) {
|
|
22
|
-
const relative = file.slice(this.#prefix.length);
|
|
23
|
-
return !LibSource.unhashedDirs.includes(relative.split("/")[0] ?? "");
|
|
24
|
-
}
|
|
25
|
-
async#hashableContent(file) {
|
|
26
|
-
const content = await this.#lib.workspace.readFile(file);
|
|
27
|
-
if (file !== `${this.#prefix}package.json`)
|
|
28
|
-
return content;
|
|
29
|
-
const manifest = JSON.parse(content);
|
|
30
|
-
delete manifest[LibSource.manifestKey];
|
|
31
|
-
return JSON.stringify(manifest);
|
|
32
|
-
}
|
|
33
|
-
async computeHash() {
|
|
34
|
-
const files = (await this.#lib.workspace.listGitFiles([`libs/${this.#lib.name}`], { untracked: true })).filter((file) => this.#isHashed(file));
|
|
35
|
-
const hasher = new Bun.CryptoHasher("sha256");
|
|
36
|
-
for (const file of files) {
|
|
37
|
-
hasher.update(file);
|
|
38
|
-
hasher.update("\x00");
|
|
39
|
-
hasher.update(await this.#hashableContent(file));
|
|
40
|
-
hasher.update("\x00");
|
|
41
|
-
}
|
|
42
|
-
return hasher.digest("hex").slice(0, 32);
|
|
43
|
-
}
|
|
44
|
-
async read() {
|
|
45
|
-
const manifest = await this.#lib.getPackageJson();
|
|
46
|
-
const akan = manifest[LibSource.manifestKey];
|
|
47
|
-
return akan?.source ?? null;
|
|
48
|
-
}
|
|
49
|
-
async write({ origin, sha }) {
|
|
50
|
-
const [manifest, hash] = await Promise.all([this.#lib.getPackageJson(), this.computeHash()]);
|
|
51
|
-
const akan = manifest[LibSource.manifestKey] ?? {};
|
|
52
|
-
const stamp = { origin, sha, hash, syncedAt: new Date().toISOString() };
|
|
53
|
-
await this.#lib.setPackageJson({ ...manifest, [LibSource.manifestKey]: { ...akan, source: stamp } });
|
|
54
|
-
return stamp;
|
|
55
|
-
}
|
|
56
|
-
async status() {
|
|
57
|
-
const [stamp, hash] = await Promise.all([this.read(), this.computeHash()]);
|
|
58
|
-
const drift = !stamp ? "unstamped" : stamp.hash === hash ? "clean" : "drifted";
|
|
59
|
-
return { lib: this.#lib.name, drift, stamp, hash };
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function formatLibStatuses(statuses) {
|
|
63
|
-
const marks = { clean: "clean ", drifted: "DRIFTED ", unstamped: "unstamped" };
|
|
64
|
-
const sections = [
|
|
65
|
-
"Akan Library Source Status",
|
|
66
|
-
"",
|
|
67
|
-
...statuses.map((status) => {
|
|
68
|
-
const origin = status.stamp ? `${status.stamp.origin}@${status.stamp.sha}` : "no akan.source in package.json";
|
|
69
|
-
return ` ${marks[status.drift]} libs/${status.lib} ${origin}`;
|
|
70
|
-
}),
|
|
71
|
-
"",
|
|
72
|
-
`drifted: ${statuses.filter((status) => status.drift === "drifted").length} / ${statuses.length}`
|
|
73
|
-
];
|
|
74
|
-
return sections.join(`
|
|
75
|
-
`);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
14
|
// pkgs/@akanjs/cli/library/library.script.ts
|
|
79
15
|
import { Logger } from "akanjs/common";
|
|
80
16
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
AppInfo
|
|
4
|
+
} from "./index-zkrzv21w.js";
|
|
5
|
+
|
|
6
|
+
// pkgs/@akanjs/devkit/slicePlanner.ts
|
|
7
|
+
class SlicePlanner {
|
|
8
|
+
static memberDirs = ["apps", "libs", "pkgs"];
|
|
9
|
+
static toolchainDependencies = [
|
|
10
|
+
"@akanjs/cli",
|
|
11
|
+
"@akanjs/devkit",
|
|
12
|
+
"@biomejs/biome",
|
|
13
|
+
"@types/bun",
|
|
14
|
+
"akanjs",
|
|
15
|
+
"typescript"
|
|
16
|
+
];
|
|
17
|
+
#app;
|
|
18
|
+
constructor(app) {
|
|
19
|
+
this.#app = app;
|
|
20
|
+
}
|
|
21
|
+
async#trackedFiles(paths) {
|
|
22
|
+
return await this.#app.workspace.listGitFiles(paths);
|
|
23
|
+
}
|
|
24
|
+
async#untrackedFiles(paths) {
|
|
25
|
+
const [tracked, all] = await Promise.all([
|
|
26
|
+
this.#app.workspace.listGitFiles(paths),
|
|
27
|
+
this.#app.workspace.listGitFiles(paths, { untracked: true })
|
|
28
|
+
]);
|
|
29
|
+
const trackedSet = new Set(tracked);
|
|
30
|
+
return all.filter((file) => !trackedSet.has(file));
|
|
31
|
+
}
|
|
32
|
+
#isMemberFile(file) {
|
|
33
|
+
return SlicePlanner.memberDirs.includes(file.split("/")[0] ?? "");
|
|
34
|
+
}
|
|
35
|
+
static #requiredDependencies(appInfo) {
|
|
36
|
+
const scanResults = [
|
|
37
|
+
appInfo.getScanResult(),
|
|
38
|
+
...[...appInfo.getLibInfos().values()].map((lib) => lib.getScanResult())
|
|
39
|
+
];
|
|
40
|
+
return new Set([
|
|
41
|
+
...SlicePlanner.toolchainDependencies,
|
|
42
|
+
...scanResults.flatMap((scanResult) => [
|
|
43
|
+
...scanResult.dependencies,
|
|
44
|
+
...scanResult.devDependencies,
|
|
45
|
+
...scanResult.pkgDeps
|
|
46
|
+
])
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
async#patchWarnings(packageJson) {
|
|
50
|
+
const patchedDependencies = packageJson.patchedDependencies ?? {};
|
|
51
|
+
const missing = (await Promise.all(Object.entries(patchedDependencies).map(async ([spec, patchPath]) => await this.#app.workspace.exists(patchPath) ? null : `${spec} -> ${patchPath}`))).filter((entry) => !!entry);
|
|
52
|
+
return missing.length ? [`patchedDependencies references a missing patch file: ${missing.join(", ")}`] : [];
|
|
53
|
+
}
|
|
54
|
+
async plan() {
|
|
55
|
+
const appInfo = await AppInfo.fromExecutor(this.#app);
|
|
56
|
+
const libs = appInfo.getLibs();
|
|
57
|
+
const slicePaths = [`apps/${this.#app.name}`, ...libs.map((lib) => `libs/${lib}`)];
|
|
58
|
+
const [appFiles, allTracked, untracked, rootPackageJson] = await Promise.all([
|
|
59
|
+
this.#trackedFiles([`apps/${this.#app.name}`]),
|
|
60
|
+
this.#trackedFiles(["."]),
|
|
61
|
+
this.#untrackedFiles(slicePaths),
|
|
62
|
+
this.#app.workspace.getPackageJson()
|
|
63
|
+
]);
|
|
64
|
+
const libFiles = Object.fromEntries(await Promise.all(libs.map(async (lib) => [lib, await this.#trackedFiles([`libs/${lib}`])])));
|
|
65
|
+
const rootFiles = allTracked.filter((file) => !this.#isMemberFile(file));
|
|
66
|
+
const required = SlicePlanner.#requiredDependencies(appInfo);
|
|
67
|
+
const rootDependencies = { ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies };
|
|
68
|
+
const unusedDependencies = Object.keys(rootDependencies).filter((dep) => !required.has(dep)).sort();
|
|
69
|
+
const { workspaces: _workspaces, ...slicePackageJson } = rootPackageJson;
|
|
70
|
+
const warnings = [
|
|
71
|
+
...untracked.length ? [`${untracked.length} untracked file(s) under the slice paths: ${untracked.join(", ")}`] : [],
|
|
72
|
+
...rootPackageJson.workspaces ? ["root `workspaces` dropped \u2014 a slice consumes akanjs from the registry"] : [],
|
|
73
|
+
...await this.#patchWarnings(rootPackageJson)
|
|
74
|
+
];
|
|
75
|
+
return {
|
|
76
|
+
app: this.#app.name,
|
|
77
|
+
libs,
|
|
78
|
+
appFiles,
|
|
79
|
+
libFiles,
|
|
80
|
+
rootFiles,
|
|
81
|
+
packageJson: slicePackageJson,
|
|
82
|
+
unusedDependencies,
|
|
83
|
+
warnings
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
var rootEntriesOf = (rootFiles) => [...new Set(rootFiles.map((file) => file.split("/")[0] ?? file))].sort();
|
|
88
|
+
function formatSlicePlan(plan) {
|
|
89
|
+
const libCounts = Object.entries(plan.libFiles).map(([lib, files]) => ` - libs/${lib}: ${files.length} files`);
|
|
90
|
+
const sections = [
|
|
91
|
+
"Akan Slice Plan",
|
|
92
|
+
`app: ${plan.app} (apps/${plan.app}: ${plan.appFiles.length} files)`,
|
|
93
|
+
`libs: ${plan.libs.length ? plan.libs.join(", ") : "(none)"}`,
|
|
94
|
+
...libCounts,
|
|
95
|
+
`workspace shell: ${plan.rootFiles.length} files across ${rootEntriesOf(plan.rootFiles).join(", ")}`,
|
|
96
|
+
"",
|
|
97
|
+
`Unused root dependencies (${plan.unusedDependencies.length}) \u2014 prune candidates, not pruned:`,
|
|
98
|
+
"",
|
|
99
|
+
...plan.unusedDependencies.length ? plan.unusedDependencies.map((dep) => ` - ${dep}`) : [" (none)"],
|
|
100
|
+
"",
|
|
101
|
+
`Warnings (${plan.warnings.length}):`,
|
|
102
|
+
"",
|
|
103
|
+
...plan.warnings.length ? plan.warnings.map((warning) => ` - ${warning}`) : [" (none)"]
|
|
104
|
+
];
|
|
105
|
+
return sections.join(`
|
|
106
|
+
`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { SlicePlanner, formatSlicePlan };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
CloudRunner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-dz1q44m8.js";
|
|
5
5
|
import {
|
|
6
6
|
PackageScript
|
|
7
7
|
} from "./index-ffrhjdwd.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./index-safgeq9a.js";
|
|
13
13
|
import {
|
|
14
14
|
ApplicationScript
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-zp0cmfgd.js";
|
|
16
16
|
import {
|
|
17
17
|
script
|
|
18
18
|
} from "./index-1szrbtj9.js";
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
} from "./index-egng0kc4.js";
|
|
8
8
|
import {
|
|
9
9
|
ScalarScript
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-ta1mk0xh.js";
|
|
11
11
|
import {
|
|
12
12
|
PrimitiveScript
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-47zynjx7.js";
|
|
14
14
|
import {
|
|
15
15
|
ModuleScript
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-pj3hk9kt.js";
|
|
17
17
|
import {
|
|
18
18
|
isPlaceholderAppId
|
|
19
19
|
} from "./index-zec5gcx0.js";
|
|
@@ -28,6 +28,9 @@ import {
|
|
|
28
28
|
renderDoctorText,
|
|
29
29
|
upsertCodexMcpServerBlock
|
|
30
30
|
} from "./index-w0g7hcr7.js";
|
|
31
|
+
import {
|
|
32
|
+
Prompter
|
|
33
|
+
} from "./index-k7731a4v.js";
|
|
31
34
|
import {
|
|
32
35
|
buildAkanModuleContextIndex,
|
|
33
36
|
createWorkflowBaselineSummary,
|
|
@@ -35,9 +38,6 @@ import {
|
|
|
35
38
|
jsonText,
|
|
36
39
|
toolingRolloutGate
|
|
37
40
|
} from "./index-6w77v5df.js";
|
|
38
|
-
import {
|
|
39
|
-
Prompter
|
|
40
|
-
} from "./index-k7731a4v.js";
|
|
41
41
|
import {
|
|
42
42
|
getMobileTargets
|
|
43
43
|
} from "./index-76rn3g2c.js";
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
LibraryScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-7605ykh6.js";
|
|
5
|
+
import {
|
|
6
|
+
SlicePlanner,
|
|
7
|
+
formatSlicePlan
|
|
8
|
+
} from "./index-jn9b717k.js";
|
|
5
9
|
import {
|
|
6
10
|
resolveMobileTargets
|
|
7
11
|
} from "./index-76rn3g2c.js";
|
|
@@ -15,7 +19,6 @@ import {
|
|
|
15
19
|
} from "./index-5vy2jzar.js";
|
|
16
20
|
import {
|
|
17
21
|
AppExecutor,
|
|
18
|
-
AppInfo,
|
|
19
22
|
LibExecutor,
|
|
20
23
|
PkgExecutor,
|
|
21
24
|
WorkspaceExecutor
|
|
@@ -69,109 +72,6 @@ Caused by: ${ApplicationBuildReporter.formatError(error.cause)}` : "";
|
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
// pkgs/@akanjs/devkit/slicePlanner.ts
|
|
73
|
-
class SlicePlanner {
|
|
74
|
-
static memberDirs = ["apps", "libs", "pkgs"];
|
|
75
|
-
static toolchainDependencies = [
|
|
76
|
-
"@akanjs/cli",
|
|
77
|
-
"@akanjs/devkit",
|
|
78
|
-
"@biomejs/biome",
|
|
79
|
-
"@types/bun",
|
|
80
|
-
"akanjs",
|
|
81
|
-
"typescript"
|
|
82
|
-
];
|
|
83
|
-
#app;
|
|
84
|
-
constructor(app) {
|
|
85
|
-
this.#app = app;
|
|
86
|
-
}
|
|
87
|
-
async#trackedFiles(paths) {
|
|
88
|
-
return await this.#app.workspace.listGitFiles(paths);
|
|
89
|
-
}
|
|
90
|
-
async#untrackedFiles(paths) {
|
|
91
|
-
const [tracked, all] = await Promise.all([
|
|
92
|
-
this.#app.workspace.listGitFiles(paths),
|
|
93
|
-
this.#app.workspace.listGitFiles(paths, { untracked: true })
|
|
94
|
-
]);
|
|
95
|
-
const trackedSet = new Set(tracked);
|
|
96
|
-
return all.filter((file) => !trackedSet.has(file));
|
|
97
|
-
}
|
|
98
|
-
#isMemberFile(file) {
|
|
99
|
-
return SlicePlanner.memberDirs.includes(file.split("/")[0] ?? "");
|
|
100
|
-
}
|
|
101
|
-
static #requiredDependencies(appInfo) {
|
|
102
|
-
const scanResults = [
|
|
103
|
-
appInfo.getScanResult(),
|
|
104
|
-
...[...appInfo.getLibInfos().values()].map((lib) => lib.getScanResult())
|
|
105
|
-
];
|
|
106
|
-
return new Set([
|
|
107
|
-
...SlicePlanner.toolchainDependencies,
|
|
108
|
-
...scanResults.flatMap((scanResult) => [
|
|
109
|
-
...scanResult.dependencies,
|
|
110
|
-
...scanResult.devDependencies,
|
|
111
|
-
...scanResult.pkgDeps
|
|
112
|
-
])
|
|
113
|
-
]);
|
|
114
|
-
}
|
|
115
|
-
async#patchWarnings(packageJson) {
|
|
116
|
-
const patchedDependencies = packageJson.patchedDependencies ?? {};
|
|
117
|
-
const missing = (await Promise.all(Object.entries(patchedDependencies).map(async ([spec, patchPath]) => await this.#app.workspace.exists(patchPath) ? null : `${spec} -> ${patchPath}`))).filter((entry) => !!entry);
|
|
118
|
-
return missing.length ? [`patchedDependencies references a missing patch file: ${missing.join(", ")}`] : [];
|
|
119
|
-
}
|
|
120
|
-
async plan() {
|
|
121
|
-
const appInfo = await AppInfo.fromExecutor(this.#app);
|
|
122
|
-
const libs = appInfo.getLibs();
|
|
123
|
-
const slicePaths = [`apps/${this.#app.name}`, ...libs.map((lib) => `libs/${lib}`)];
|
|
124
|
-
const [appFiles, allTracked, untracked, rootPackageJson] = await Promise.all([
|
|
125
|
-
this.#trackedFiles([`apps/${this.#app.name}`]),
|
|
126
|
-
this.#trackedFiles(["."]),
|
|
127
|
-
this.#untrackedFiles(slicePaths),
|
|
128
|
-
this.#app.workspace.getPackageJson()
|
|
129
|
-
]);
|
|
130
|
-
const libFiles = Object.fromEntries(await Promise.all(libs.map(async (lib) => [lib, await this.#trackedFiles([`libs/${lib}`])])));
|
|
131
|
-
const rootFiles = allTracked.filter((file) => !this.#isMemberFile(file));
|
|
132
|
-
const required = SlicePlanner.#requiredDependencies(appInfo);
|
|
133
|
-
const rootDependencies = { ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies };
|
|
134
|
-
const unusedDependencies = Object.keys(rootDependencies).filter((dep) => !required.has(dep)).sort();
|
|
135
|
-
const { workspaces: _workspaces, ...slicePackageJson } = rootPackageJson;
|
|
136
|
-
const warnings = [
|
|
137
|
-
...untracked.length ? [`${untracked.length} untracked file(s) under the slice paths: ${untracked.join(", ")}`] : [],
|
|
138
|
-
...rootPackageJson.workspaces ? ["root `workspaces` dropped \u2014 a slice consumes akanjs from the registry"] : [],
|
|
139
|
-
...await this.#patchWarnings(rootPackageJson)
|
|
140
|
-
];
|
|
141
|
-
return {
|
|
142
|
-
app: this.#app.name,
|
|
143
|
-
libs,
|
|
144
|
-
appFiles,
|
|
145
|
-
libFiles,
|
|
146
|
-
rootFiles,
|
|
147
|
-
packageJson: slicePackageJson,
|
|
148
|
-
unusedDependencies,
|
|
149
|
-
warnings
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
var rootEntriesOf = (rootFiles) => [...new Set(rootFiles.map((file) => file.split("/")[0] ?? file))].sort();
|
|
154
|
-
function formatSlicePlan(plan) {
|
|
155
|
-
const libCounts = Object.entries(plan.libFiles).map(([lib, files]) => ` - libs/${lib}: ${files.length} files`);
|
|
156
|
-
const sections = [
|
|
157
|
-
"Akan Slice Plan",
|
|
158
|
-
`app: ${plan.app} (apps/${plan.app}: ${plan.appFiles.length} files)`,
|
|
159
|
-
`libs: ${plan.libs.length ? plan.libs.join(", ") : "(none)"}`,
|
|
160
|
-
...libCounts,
|
|
161
|
-
`workspace shell: ${plan.rootFiles.length} files across ${rootEntriesOf(plan.rootFiles).join(", ")}`,
|
|
162
|
-
"",
|
|
163
|
-
`Unused root dependencies (${plan.unusedDependencies.length}) \u2014 prune candidates, not pruned:`,
|
|
164
|
-
"",
|
|
165
|
-
...plan.unusedDependencies.length ? plan.unusedDependencies.map((dep) => ` - ${dep}`) : [" (none)"],
|
|
166
|
-
"",
|
|
167
|
-
`Warnings (${plan.warnings.length}):`,
|
|
168
|
-
"",
|
|
169
|
-
...plan.warnings.length ? plan.warnings.map((warning) => ` - ${warning}`) : [" (none)"]
|
|
170
|
-
];
|
|
171
|
-
return sections.join(`
|
|
172
|
-
`);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
75
|
// pkgs/@akanjs/cli/application/application.script.ts
|
|
176
76
|
import { confirm } from "@inquirer/prompts";
|
|
177
77
|
import { Logger as Logger5 } from "akanjs/common";
|
package/index.js
CHANGED
|
@@ -19,22 +19,23 @@ import path from "path";
|
|
|
19
19
|
|
|
20
20
|
// pkgs/@akanjs/cli/commandModules.ts
|
|
21
21
|
var commandModules = {
|
|
22
|
-
workspace: async () => (await import("./workspace.command-
|
|
22
|
+
workspace: async () => (await import("./workspace.command-53qpkgzp.js")).WorkspaceCommand,
|
|
23
23
|
agent: async () => (await import("./agent.command-q2rgd8jz.js")).AgentCommand,
|
|
24
|
-
application: async () => (await import("./application.command-
|
|
25
|
-
library: async () => (await import("./library.command-
|
|
26
|
-
localRegistry: async () => (await import("./localRegistry.command-
|
|
24
|
+
application: async () => (await import("./application.command-kd5zj0k9.js")).ApplicationCommand,
|
|
25
|
+
library: async () => (await import("./library.command-nvp0wetm.js")).LibraryCommand,
|
|
26
|
+
localRegistry: async () => (await import("./localRegistry.command-dnefn893.js")).LocalRegistryCommand,
|
|
27
27
|
package: async () => (await import("./package.command-af8sxhff.js")).PackageCommand,
|
|
28
|
-
module: async () => (await import("./module.command-
|
|
28
|
+
module: async () => (await import("./module.command-xs6ded4j.js")).ModuleCommand,
|
|
29
29
|
page: async () => (await import("./page.command-gr6rbz17.js")).PageCommand,
|
|
30
|
-
context: async () => (await import("./context.command-
|
|
31
|
-
cloud: async () => (await import("./cloud.command-
|
|
30
|
+
context: async () => (await import("./context.command-hac3x83c.js")).ContextCommand,
|
|
31
|
+
cloud: async () => (await import("./cloud.command-v60xnfdx.js")).CloudCommand,
|
|
32
|
+
fleet: async () => (await import("./fleet.command-jv24wcae.js")).FleetCommand,
|
|
32
33
|
guideline: async () => (await import("./guideline.command-85x1tvjb.js")).GuidelineCommand,
|
|
33
|
-
scalar: async () => (await import("./scalar.command-
|
|
34
|
-
primitive: async () => (await import("./primitive.command-
|
|
34
|
+
scalar: async () => (await import("./scalar.command-ax8taqh1.js")).ScalarCommand,
|
|
35
|
+
primitive: async () => (await import("./primitive.command-qjf4mbth.js")).PrimitiveCommand,
|
|
35
36
|
quality: async () => (await import("./quality.command-9xhaxzm1.js")).QualityCommand,
|
|
36
37
|
repair: async () => (await import("./repair.command-a2z4d5a0.js")).RepairCommand,
|
|
37
|
-
workflow: async () => (await import("./workflow.command-
|
|
38
|
+
workflow: async () => (await import("./workflow.command-gwkw0jae.js")).WorkflowCommand
|
|
38
39
|
};
|
|
39
40
|
var commandModuleIds = Object.keys(commandModules);
|
|
40
41
|
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CloudRunner,
|
|
4
4
|
getNpmRegistryUrl
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-dz1q44m8.js";
|
|
6
6
|
import {
|
|
7
7
|
PackageScript
|
|
8
8
|
} from "./index-ffrhjdwd.js";
|
|
9
9
|
import"./index-safgeq9a.js";
|
|
10
10
|
import {
|
|
11
11
|
ApplicationScript
|
|
12
|
-
} from "./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
} from "./index-zp0cmfgd.js";
|
|
13
|
+
import"./index-7605ykh6.js";
|
|
14
|
+
import"./index-jn9b717k.js";
|
|
15
|
+
import"./index-19nz5chq.js";
|
|
14
16
|
import"./index-76rn3g2c.js";
|
|
15
17
|
import {
|
|
16
18
|
Workspace,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ModuleScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-pj3hk9kt.js";
|
|
5
5
|
import"./index-ss469dec.js";
|
|
6
6
|
import"./index-yz8988we.js";
|
|
7
7
|
import"./index-safgeq9a.js";
|
|
8
|
+
import"./index-k7731a4v.js";
|
|
8
9
|
import {
|
|
9
10
|
renderPrimitiveReport
|
|
10
11
|
} from "./index-6w77v5df.js";
|
|
11
|
-
import"./index-k7731a4v.js";
|
|
12
12
|
import {
|
|
13
13
|
Module,
|
|
14
14
|
Sys,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.78",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@langchain/openai": "^1.4.6",
|
|
34
34
|
"@tailwindcss/node": "^4.3.0",
|
|
35
35
|
"@trapezedev/project": "^7.1.4",
|
|
36
|
-
"akanjs": "3.0.0-alpha.
|
|
36
|
+
"akanjs": "3.0.0-alpha.78",
|
|
37
37
|
"chalk": "^5.6.2",
|
|
38
38
|
"commander": "^14.0.3",
|
|
39
39
|
"dayjs": "^1.11.20",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PrimitiveScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-47zynjx7.js";
|
|
5
|
+
import"./index-pj3hk9kt.js";
|
|
6
6
|
import"./index-ss469dec.js";
|
|
7
7
|
import"./index-yz8988we.js";
|
|
8
8
|
import"./index-safgeq9a.js";
|
|
9
|
+
import"./index-k7731a4v.js";
|
|
9
10
|
import {
|
|
10
11
|
renderPrimitiveReport
|
|
11
12
|
} from "./index-6w77v5df.js";
|
|
12
|
-
import"./index-k7731a4v.js";
|
|
13
13
|
import {
|
|
14
14
|
Workspace,
|
|
15
15
|
command
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ScalarScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-ta1mk0xh.js";
|
|
5
5
|
import"./index-ss469dec.js";
|
|
6
6
|
import"./index-safgeq9a.js";
|
|
7
|
+
import"./index-k7731a4v.js";
|
|
7
8
|
import {
|
|
8
9
|
renderPrimitiveReport
|
|
9
10
|
} from "./index-6w77v5df.js";
|
|
10
|
-
import"./index-k7731a4v.js";
|
|
11
11
|
import {
|
|
12
12
|
Sys,
|
|
13
13
|
command
|
|
@@ -4,21 +4,21 @@ import {
|
|
|
4
4
|
} from "./index-egng0kc4.js";
|
|
5
5
|
import {
|
|
6
6
|
ScalarScript
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-ta1mk0xh.js";
|
|
8
8
|
import {
|
|
9
9
|
PrimitiveScript
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-47zynjx7.js";
|
|
11
11
|
import {
|
|
12
12
|
ModuleScript
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-pj3hk9kt.js";
|
|
14
14
|
import"./index-ss469dec.js";
|
|
15
15
|
import"./index-yz8988we.js";
|
|
16
16
|
import"./index-safgeq9a.js";
|
|
17
17
|
import"./index-w0g7hcr7.js";
|
|
18
|
+
import"./index-k7731a4v.js";
|
|
18
19
|
import {
|
|
19
20
|
createWorkflowStepRegistry
|
|
20
21
|
} from "./index-6w77v5df.js";
|
|
21
|
-
import"./index-k7731a4v.js";
|
|
22
22
|
import {
|
|
23
23
|
Workspace,
|
|
24
24
|
command,
|