@akanjs/cli 2.4.2-rc.2 → 3.0.0-alpha.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.
- package/.build-stamp +1 -1
- package/abstractCompactor-rk6twzvj.js +103 -0
- package/{agent.command-ej4g9pbb.js → agent.command-jfz8yfwy.js} +8 -7
- package/{application.command-smn51a28.js → application.command-3smsv7mq.js} +15 -5
- package/{applicationBuildRunner-554a2vnk.js → applicationBuildRunner-aq7mb3z6.js} +2 -1
- package/buildBatch.proc.js +7 -6
- package/{capacitorApp-yg9b4ajz.js → capacitorApp-q3mpmkkz.js} +3 -3
- package/{cloud.command-2v7ga38h.js → cloud.command-rk4e9vrt.js} +10 -10
- package/commandManifest.json +1 -1
- package/{context.command-hhjyjtp7.js → context.command-ygzyb0xb.js} +16 -15
- package/{guideline.command-vj956kfr.js → guideline.command-1m1ctar3.js} +10 -10
- package/guidelines/componentRule/componentRule.instruction.md +2 -2
- package/guidelines/cssRule/cssRule.generate.json +1 -1
- package/guidelines/cssRule/cssRule.instruction.md +57 -34
- package/guidelines/framework/framework.instruction.md +1 -1
- package/guidelines/recipeRule/recipeRule.generate.json +31 -0
- package/guidelines/recipeRule/recipeRule.instruction.md +72 -0
- package/incrementalBuilder.proc.js +5 -5
- package/index-0wae5ebk.js +65 -0
- package/{index-v9jqrdd1.js → index-4yp06pn1.js} +100 -2
- package/{index-pfnh87f9.js → index-4zgs8g1w.js} +1 -1
- package/{index-7ppn9v4n.js → index-b978vs2e.js} +3 -3
- package/{index-s9s0n5fz.js → index-cn24dcqn.js} +2 -2
- package/{index-h971erkm.js → index-csqk9z5j.js} +3 -3
- package/{index-z36qzgzp.js → index-e3qskyt2.js} +3 -4
- package/{index-panyahn4.js → index-ev6rjw9n.js} +27 -13
- package/{index-majzj044.js → index-f4gqk0dd.js} +8 -8
- package/{index-z5v766nx.js → index-fmgbwsr5.js} +6 -6
- package/{index-y1e79mz3.js → index-h0bngh79.js} +13 -13
- package/{index-dgeaqwmw.js → index-hjzr8ja1.js} +1 -1
- package/{index-d0h48d2f.js → index-jk9q6pse.js} +1 -1
- package/{index-xwfg9bam.js → index-jtm86byd.js} +120 -4
- package/{index-j3j3qc9j.js → index-ktprgc5g.js} +4 -4
- package/{index-40w1kqp1.js → index-n0z3f2xg.js} +74 -24
- package/{index-7k9sj7j5.js → index-pyt2b4nw.js} +212 -0
- package/{index-acwxfncv.js → index-r4w8cry5.js} +4 -4
- package/{index-zfp1gz9f.js → index-sggm9qkv.js} +1 -1
- package/{index-04as43rp.js → index-vhv3xnjz.js} +16 -15
- package/index-xjd3rqzj.js +129 -0
- package/{index-xftstr5s.js → index-xwgm94zr.js} +1 -1
- package/index-xys926f2.js +136 -0
- package/index.js +19 -19
- package/{library.command-68ah07a3.js → library.command-pwfx8dx2.js} +4 -4
- package/{localRegistry.command-nmyc5vwv.js → localRegistry.command-bxhqmd1d.js} +11 -11
- package/{module.command-t68xhamx.js → module.command-0t3ewata.js} +8 -8
- package/{package.command-00ncttab.js → package.command-7hmkxvpa.js} +4 -4
- package/package.json +2 -3
- package/{page.command-1096s18n.js → page.command-st6r4s0q.js} +4 -4
- package/{primitive.command-02eqpx6t.js → primitive.command-1qkxpzsn.js} +9 -9
- package/{quality.command-vap6xegb.js → quality.command-hy5vt1bh.js} +31 -6
- package/recipeScanner-tghkzrrt.js +12 -0
- package/{repair.command-7dynpnf1.js → repair.command-nakkq2zp.js} +7 -6
- package/{scalar.command-3kxy3fkh.js → scalar.command-fjq272gs.js} +7 -7
- package/templates/app/page/_index.tsx +55 -52
- package/templates/app/page/styles.css.template +12 -71
- package/templates/appSample/lib/task/Task.Template.tsx +2 -2
- package/templates/appSample/lib/task/Task.Unit.tsx +11 -11
- package/templates/appSample/lib/task/Task.Util.tsx +27 -28
- package/templates/appSample/lib/task/Task.View.tsx +22 -19
- package/templates/appSample/lib/task/Task.Zone.tsx +3 -3
- package/templates/appSample/page/task/[taskId]/_index.tsx +3 -3
- package/templates/appSample/page/task/[taskId]/edit.tsx +5 -5
- package/templates/appSample/page/task/_index.tsx +4 -4
- package/templates/appSample/page/task/_layout.tsx +1 -1
- package/templates/appSample/page/task/new.tsx +5 -5
- package/templates/appSample/ui/GlobalLoading.tsx +4 -4
- package/templates/appSample/ui/QuantityControl.tsx +5 -4
- package/templates/crudPages/[__model__Id]/page.tsx +1 -1
- package/templates/crudPages/page.tsx +1 -1
- package/templates/crudSinglePage/page.tsx +1 -1
- package/templates/module/__Model__.Template.tsx +2 -1
- package/templates/module/__Model__.Unit.tsx +2 -1
- package/templates/module/__Model__.Util.tsx +2 -1
- package/templates/module/__Model__.View.tsx +4 -3
- package/templates/module/__Model__.Zone.tsx +2 -1
- package/templates/workspaceRoot/AGENTS.md.template +11 -13
- package/templates/workspaceRoot/biome.json.template +1 -1
- package/{workflow.command-yy0d9gk3.js → workflow.command-jswbgk90.js} +15 -14
- package/{workspace.command-hq1x5605.js → workspace.command-p9r9nckg.js} +89 -29
- package/{applicationReleasePackager-pjbxc793.js → applicationReleasePackager-yrrhbkv3.js} +3 -3
- package/{index-nsj2ftxj.js → index-3pgtw35d.js} +3 -3
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PageScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-hjzr8ja1.js";
|
|
5
5
|
import {
|
|
6
6
|
pluralizeName
|
|
7
7
|
} from "./index-ss469dec.js";
|
|
8
|
+
import {
|
|
9
|
+
AiSession
|
|
10
|
+
} from "./index-3pgtw35d.js";
|
|
8
11
|
import {
|
|
9
12
|
bilingualDescriptionForField,
|
|
10
13
|
bilingualLabelForField,
|
|
@@ -12,20 +15,17 @@ import {
|
|
|
12
15
|
generatedFilesForSync,
|
|
13
16
|
moduleSourcePaths,
|
|
14
17
|
sourceFile
|
|
15
|
-
} from "./index-
|
|
18
|
+
} from "./index-4zgs8g1w.js";
|
|
16
19
|
import {
|
|
17
20
|
Prompter
|
|
18
|
-
} from "./index-
|
|
19
|
-
import {
|
|
20
|
-
AiSession
|
|
21
|
-
} from "./index-nsj2ftxj.js";
|
|
21
|
+
} from "./index-xwgm94zr.js";
|
|
22
22
|
import {
|
|
23
23
|
runner,
|
|
24
24
|
script
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-jk9q6pse.js";
|
|
26
26
|
import {
|
|
27
27
|
ModuleExecutor
|
|
28
|
-
} from "./index-
|
|
28
|
+
} from "./index-jtm86byd.js";
|
|
29
29
|
import {
|
|
30
30
|
FileSys
|
|
31
31
|
} from "./index-67546d0j.js";
|
|
@@ -352,9 +352,9 @@ var requestTemplate = ({
|
|
|
352
352
|
\uCF54\uB529 \uADDC\uCE59
|
|
353
353
|
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
354
354
|
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
355
|
-
- CSS: tailwind
|
|
355
|
+
- CSS: tailwind + akanjs/ui \uD504\uB9AC\uBBF8\uD2F0\uBE0C(Button/Badge/Input \uB4F1) + \uC2DC\uB9E8\uD2F1 \uD1A0\uD070(bg-background/text-foreground/bg-primary \uB4F1) \uC0AC\uC6A9 (DaisyUI \uAE08\uC9C0)
|
|
356
356
|
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
357
|
-
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4:
|
|
357
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: cn \uD568\uC218 \uC0AC\uC6A9 (akanjs/client, cond && 'x' \uD615\uD0DC \u2014 \uAC1D\uCCB4 \uBB38\uBC95 \uC5C6\uC74C)
|
|
358
358
|
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
359
359
|
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
360
360
|
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
@@ -410,9 +410,9 @@ var requestView = ({
|
|
|
410
410
|
\uCF54\uB529 \uADDC\uCE59
|
|
411
411
|
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
412
412
|
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
413
|
-
- CSS: tailwind
|
|
413
|
+
- CSS: tailwind + akanjs/ui \uD504\uB9AC\uBBF8\uD2F0\uBE0C(Button/Badge/Input \uB4F1) + \uC2DC\uB9E8\uD2F1 \uD1A0\uD070(bg-background/text-foreground/bg-primary \uB4F1) \uC0AC\uC6A9 (DaisyUI \uAE08\uC9C0)
|
|
414
414
|
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
415
|
-
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4:
|
|
415
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: cn \uD568\uC218 \uC0AC\uC6A9 (akanjs/client, cond && 'x' \uD615\uD0DC \u2014 \uAC1D\uCCB4 \uBB38\uBC95 \uC5C6\uC74C)
|
|
416
416
|
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
417
417
|
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
418
418
|
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
@@ -471,9 +471,9 @@ var requestUnit = ({
|
|
|
471
471
|
\uCF54\uB529 \uADDC\uCE59
|
|
472
472
|
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
473
473
|
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
474
|
-
- CSS: tailwind
|
|
474
|
+
- CSS: tailwind + akanjs/ui \uD504\uB9AC\uBBF8\uD2F0\uBE0C(Button/Badge/Input \uB4F1) + \uC2DC\uB9E8\uD2F1 \uD1A0\uD070(bg-background/text-foreground/bg-primary \uB4F1) \uC0AC\uC6A9 (DaisyUI \uAE08\uC9C0)
|
|
475
475
|
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
476
|
-
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4:
|
|
476
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: cn \uD568\uC218 \uC0AC\uC6A9 (akanjs/client, cond && 'x' \uD615\uD0DC \u2014 \uAC1D\uCCB4 \uBB38\uBC95 \uC5C6\uC74C)
|
|
477
477
|
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
478
478
|
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
479
479
|
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
@@ -579,7 +579,7 @@ class ModuleRunner extends runner("module") {
|
|
|
579
579
|
await module.sys.applyTemplate({
|
|
580
580
|
basePath: `./lib/${module.name}`,
|
|
581
581
|
template: `module/__Model__.${capitalize2(type)}.tsx`,
|
|
582
|
-
dict: { model: module.name,
|
|
582
|
+
dict: { model: module.name, sysName: module.sys.name, sysType: module.sys.type }
|
|
583
583
|
});
|
|
584
584
|
return {
|
|
585
585
|
component: {
|
|
@@ -612,6 +612,7 @@ class ModuleRunner extends runner("module") {
|
|
|
612
612
|
model: module.name,
|
|
613
613
|
models: names,
|
|
614
614
|
sysName: module.sys.name,
|
|
615
|
+
sysType: module.sys.type,
|
|
615
616
|
modelLabelEn: modelLabel.en,
|
|
616
617
|
modelLabelKo: modelLabel.ko,
|
|
617
618
|
modelDescEn: modelDescription.en,
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/frontendBuild/styleContract.ts
|
|
3
|
+
var countBlocking = (v) => v.style.filter((s) => s.severity === "error").length + v.theme.length;
|
|
4
|
+
var formatStyleContract = (v) => {
|
|
5
|
+
const lines = [];
|
|
6
|
+
for (const s of v.style) {
|
|
7
|
+
lines.push(` [${s.severity}] ${s.rule} ${s.path}:${s.line}`);
|
|
8
|
+
lines.push(` ${s.snippet}`);
|
|
9
|
+
lines.push(` \u2192 ${s.suggestion}`);
|
|
10
|
+
}
|
|
11
|
+
for (const t of v.theme) {
|
|
12
|
+
lines.push(` [error] contrast ${t.scope} ${t.pair} = ${t.ratio}:1 (min ${t.threshold}:1)`);
|
|
13
|
+
lines.push(` \u2192 ${t.suggestion}`);
|
|
14
|
+
}
|
|
15
|
+
return lines.join(`
|
|
16
|
+
`);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// pkgs/@akanjs/devkit/frontendBuild/themeValidator.ts
|
|
20
|
+
var PAIRS = [
|
|
21
|
+
{ base: "background", fg: "foreground", threshold: 4.5 },
|
|
22
|
+
{ base: "primary", fg: "primary-foreground", threshold: 4.5 },
|
|
23
|
+
{ base: "secondary", fg: "secondary-foreground", threshold: 4.5 },
|
|
24
|
+
{ base: "accent", fg: "accent-foreground", threshold: 4.5 },
|
|
25
|
+
{ base: "neutral", fg: "neutral-foreground", threshold: 4.5 },
|
|
26
|
+
{ base: "card", fg: "card-foreground", threshold: 4.5 },
|
|
27
|
+
{ base: "popover", fg: "popover-foreground", threshold: 4.5 },
|
|
28
|
+
{ base: "muted", fg: "muted-foreground", threshold: 3 },
|
|
29
|
+
{ base: "info", fg: "info-foreground", threshold: 3 },
|
|
30
|
+
{ base: "success", fg: "success-foreground", threshold: 3 },
|
|
31
|
+
{ base: "warning", fg: "warning-foreground", threshold: 3 },
|
|
32
|
+
{ base: "destructive", fg: "destructive-foreground", threshold: 3 },
|
|
33
|
+
{ base: "open", fg: "open-foreground", threshold: 3 }
|
|
34
|
+
];
|
|
35
|
+
var THEME_SCOPES = new Set([":root", '[data-theme="dark"]', '[data-theme="light"]']);
|
|
36
|
+
|
|
37
|
+
class ThemeValidator {
|
|
38
|
+
validate(css) {
|
|
39
|
+
const tokensByScope = ThemeValidator.parseThemeTokens(css);
|
|
40
|
+
const violations = [];
|
|
41
|
+
for (const [scope, tokens] of Object.entries(tokensByScope)) {
|
|
42
|
+
if (!THEME_SCOPES.has(scope))
|
|
43
|
+
continue;
|
|
44
|
+
violations.push(...this.validateScope(tokens, scope));
|
|
45
|
+
}
|
|
46
|
+
return violations;
|
|
47
|
+
}
|
|
48
|
+
validateScope(tokens, scope) {
|
|
49
|
+
const violations = [];
|
|
50
|
+
for (const { base, fg, threshold } of PAIRS) {
|
|
51
|
+
const bg = tokens[base];
|
|
52
|
+
const front = tokens[fg];
|
|
53
|
+
if (!bg || !front)
|
|
54
|
+
continue;
|
|
55
|
+
const bgRgb = ThemeValidator.parseHex(bg);
|
|
56
|
+
const fgRgb = ThemeValidator.parseHex(front);
|
|
57
|
+
if (!bgRgb || !fgRgb)
|
|
58
|
+
continue;
|
|
59
|
+
const ratio = ThemeValidator.contrastRatio(bgRgb, fgRgb);
|
|
60
|
+
if (ratio >= threshold)
|
|
61
|
+
continue;
|
|
62
|
+
violations.push({
|
|
63
|
+
scope,
|
|
64
|
+
pair: `${base} / ${fg}`,
|
|
65
|
+
background: bg,
|
|
66
|
+
foreground: front,
|
|
67
|
+
ratio: Math.round(ratio * 100) / 100,
|
|
68
|
+
threshold,
|
|
69
|
+
suggestion: `${scope}\uC758 --${base}(${bg})\uC640 --${fg}(${front}) \uB300\uBE44\uAC00 ${ratio.toFixed(2)}:1 \uB85C \uCD5C\uC18C ${threshold}:1 \uBBF8\uB9CC\uC785\uB2C8\uB2E4. \uD55C\uCABD\uC744 \uB354 \uBC1D\uAC8C/\uC5B4\uB461\uAC8C \uC870\uC815\uD574 \uB300\uBE44\uB97C \uD655\uBCF4\uD558\uC138\uC694.`
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return violations;
|
|
73
|
+
}
|
|
74
|
+
static parseThemeTokens(css) {
|
|
75
|
+
const result = {};
|
|
76
|
+
const blockRe = /(?:^|})\s*([^{}@]+?)\s*\{([^{}]*)\}/g;
|
|
77
|
+
for (const block of css.matchAll(blockRe)) {
|
|
78
|
+
const selectors = block[1].split(",").map((s) => s.trim());
|
|
79
|
+
const relevant = selectors.filter((s) => THEME_SCOPES.has(ThemeValidator.#normalizeScope(s)));
|
|
80
|
+
if (relevant.length === 0)
|
|
81
|
+
continue;
|
|
82
|
+
const decls = {};
|
|
83
|
+
for (const decl of block[2].matchAll(/--([\w-]+)\s*:\s*([^;]+?)\s*(?:;|$)/g)) {
|
|
84
|
+
decls[decl[1]] = decl[2].trim();
|
|
85
|
+
}
|
|
86
|
+
for (const selector of relevant) {
|
|
87
|
+
const scope = ThemeValidator.#normalizeScope(selector);
|
|
88
|
+
result[scope] = { ...result[scope] ?? {}, ...decls };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
static #normalizeScope(selector) {
|
|
94
|
+
return selector.replace(/\[data-theme=['"]?([\w-]+)['"]?\]/g, '[data-theme="$1"]').trim();
|
|
95
|
+
}
|
|
96
|
+
static parseHex(value) {
|
|
97
|
+
const v = value.trim();
|
|
98
|
+
if (!v.startsWith("#"))
|
|
99
|
+
return null;
|
|
100
|
+
const hex = v.slice(1);
|
|
101
|
+
let full;
|
|
102
|
+
if (hex.length === 3 || hex.length === 4)
|
|
103
|
+
full = hex.slice(0, 3).split("").map((c) => c + c).join("");
|
|
104
|
+
else if (hex.length === 6 || hex.length === 8)
|
|
105
|
+
full = hex.slice(0, 6);
|
|
106
|
+
else
|
|
107
|
+
return null;
|
|
108
|
+
if (!/^[0-9a-fA-F]{6}$/.test(full))
|
|
109
|
+
return null;
|
|
110
|
+
const n = Number.parseInt(full, 16);
|
|
111
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
112
|
+
}
|
|
113
|
+
static #relativeLuminance([r, g, b]) {
|
|
114
|
+
const channel = (c) => {
|
|
115
|
+
const s = c / 255;
|
|
116
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
117
|
+
};
|
|
118
|
+
return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
|
|
119
|
+
}
|
|
120
|
+
static contrastRatio(a, b) {
|
|
121
|
+
const la = ThemeValidator.#relativeLuminance(a);
|
|
122
|
+
const lb = ThemeValidator.#relativeLuminance(b);
|
|
123
|
+
const hi = Math.max(la, lb);
|
|
124
|
+
const lo = Math.min(la, lb);
|
|
125
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { countBlocking, formatStyleContract, ThemeValidator };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/recipeScanner.ts
|
|
3
|
+
import { readdir } from "fs/promises";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
var collectRecipeSources = async (uiDirPath, importFrom, basename = "Recipe") => {
|
|
6
|
+
const read = async (filePath) => {
|
|
7
|
+
const content = await Bun.file(filePath).text().catch(() => "");
|
|
8
|
+
return content ? { path: filePath, content, importFrom } : null;
|
|
9
|
+
};
|
|
10
|
+
const flat = await read(`${uiDirPath}/${basename}.ts`);
|
|
11
|
+
const dirEntries = await readdir(`${uiDirPath}/${basename}`).catch(() => []);
|
|
12
|
+
const fromDir = await Promise.all(dirEntries.filter((entry) => entry.endsWith(".ts") && entry !== "index.ts" && !/\.(test|spec)\.ts$/.test(entry)).sort().map((entry) => read(`${uiDirPath}/${basename}/${entry}`)));
|
|
13
|
+
return [flat, ...fromDir].filter((source) => !!source);
|
|
14
|
+
};
|
|
15
|
+
var scanRecipes = (sources) => {
|
|
16
|
+
const recipes = [];
|
|
17
|
+
for (const source of sources) {
|
|
18
|
+
const sourceFile = ts.createSourceFile(source.path, source.content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
19
|
+
for (const statement of sourceFile.statements) {
|
|
20
|
+
if (!ts.isVariableStatement(statement) || !isExported(statement))
|
|
21
|
+
continue;
|
|
22
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
23
|
+
if (!ts.isIdentifier(declaration.name) || !declaration.initializer)
|
|
24
|
+
continue;
|
|
25
|
+
const parsed = parseRecipeCall(declaration.initializer);
|
|
26
|
+
if (!parsed)
|
|
27
|
+
continue;
|
|
28
|
+
recipes.push({
|
|
29
|
+
name: declaration.name.text,
|
|
30
|
+
importFrom: source.importFrom,
|
|
31
|
+
variants: parsed.variants,
|
|
32
|
+
...parsed.defaultVariants ? { defaultVariants: parsed.defaultVariants } : {},
|
|
33
|
+
...getLeadingDoc(source.content, statement) ? { doc: getLeadingDoc(source.content, statement) } : {},
|
|
34
|
+
...parsed.base ? { base: parsed.base } : {}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return recipes;
|
|
40
|
+
};
|
|
41
|
+
var isExported = (statement) => statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false;
|
|
42
|
+
var parseRecipeCall = (initializer) => {
|
|
43
|
+
if (!ts.isCallExpression(initializer))
|
|
44
|
+
return null;
|
|
45
|
+
if (!ts.isIdentifier(initializer.expression) || initializer.expression.text !== "recipe")
|
|
46
|
+
return null;
|
|
47
|
+
const tvCall = initializer.arguments[0];
|
|
48
|
+
if (!tvCall || !ts.isCallExpression(tvCall))
|
|
49
|
+
return null;
|
|
50
|
+
if (!ts.isIdentifier(tvCall.expression) || tvCall.expression.text !== "tv")
|
|
51
|
+
return null;
|
|
52
|
+
const config = tvCall.arguments[0];
|
|
53
|
+
if (!config || !ts.isObjectLiteralExpression(config))
|
|
54
|
+
return null;
|
|
55
|
+
return extractVariants(config);
|
|
56
|
+
};
|
|
57
|
+
var extractVariants = (config) => {
|
|
58
|
+
const variants = {};
|
|
59
|
+
let defaultVariants;
|
|
60
|
+
let base;
|
|
61
|
+
for (const property of config.properties) {
|
|
62
|
+
if (!ts.isPropertyAssignment(property) || !isNamed(property.name))
|
|
63
|
+
continue;
|
|
64
|
+
const key = propName(property.name);
|
|
65
|
+
if (key === "base" && ts.isStringLiteral(property.initializer)) {
|
|
66
|
+
base = property.initializer.text;
|
|
67
|
+
} else if (key === "variants" && ts.isObjectLiteralExpression(property.initializer)) {
|
|
68
|
+
for (const variant of property.initializer.properties) {
|
|
69
|
+
if (!ts.isPropertyAssignment(variant) || !isNamed(variant.name))
|
|
70
|
+
continue;
|
|
71
|
+
if (!ts.isObjectLiteralExpression(variant.initializer))
|
|
72
|
+
continue;
|
|
73
|
+
variants[propName(variant.name)] = variant.initializer.properties.filter((option) => ts.isPropertyAssignment(option) && isNamed(option.name)).map((option) => propName(option.name));
|
|
74
|
+
}
|
|
75
|
+
} else if (key === "defaultVariants" && ts.isObjectLiteralExpression(property.initializer)) {
|
|
76
|
+
defaultVariants = {};
|
|
77
|
+
for (const preset of property.initializer.properties) {
|
|
78
|
+
if (!ts.isPropertyAssignment(preset) || !isNamed(preset.name))
|
|
79
|
+
continue;
|
|
80
|
+
defaultVariants[propName(preset.name)] = ts.isStringLiteral(preset.initializer) ? preset.initializer.text : preset.initializer.getText();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return { variants, defaultVariants, base };
|
|
85
|
+
};
|
|
86
|
+
var isNamed = (name) => ts.isIdentifier(name) || ts.isStringLiteral(name);
|
|
87
|
+
var propName = (name) => name.text;
|
|
88
|
+
var DUPLICATE_TOKEN_RATIO = 0.7;
|
|
89
|
+
var MIN_FINGERPRINT_TOKENS = 3;
|
|
90
|
+
var findInlineRecipeDuplicates = (recipes, files) => {
|
|
91
|
+
const fingerprints = recipes.map((recipe) => ({ recipe: recipe.name, tokens: (recipe.base ?? "").split(/\s+/).filter(Boolean) })).filter((fingerprint) => fingerprint.tokens.length >= MIN_FINGERPRINT_TOKENS).map((fingerprint) => ({ ...fingerprint, needed: Math.ceil(fingerprint.tokens.length * DUPLICATE_TOKEN_RATIO) }));
|
|
92
|
+
if (fingerprints.length === 0)
|
|
93
|
+
return [];
|
|
94
|
+
const duplicates = [];
|
|
95
|
+
for (const file of files) {
|
|
96
|
+
const sourceFile = ts.createSourceFile(file.path, file.content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
97
|
+
const visit = (node) => {
|
|
98
|
+
if (ts.isJsxAttribute(node) && node.name.getText(sourceFile) === "className" && node.initializer) {
|
|
99
|
+
for (const value of stringValuesIn(node.initializer)) {
|
|
100
|
+
const classSet = new Set(value.split(/\s+/));
|
|
101
|
+
for (const fingerprint of fingerprints) {
|
|
102
|
+
const matched = fingerprint.tokens.filter((token) => classSet.has(token)).length;
|
|
103
|
+
if (matched >= fingerprint.needed) {
|
|
104
|
+
const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
|
|
105
|
+
duplicates.push({ recipe: fingerprint.recipe, path: file.path, line: line + 1, className: value });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
node.forEachChild(visit);
|
|
111
|
+
};
|
|
112
|
+
visit(sourceFile);
|
|
113
|
+
}
|
|
114
|
+
return duplicates;
|
|
115
|
+
};
|
|
116
|
+
var stringValuesIn = (node) => {
|
|
117
|
+
const values = [];
|
|
118
|
+
const visit = (child) => {
|
|
119
|
+
if (ts.isStringLiteral(child) || ts.isNoSubstitutionTemplateLiteral(child) || ts.isTemplateHead(child) || ts.isTemplateMiddle(child) || ts.isTemplateTail(child))
|
|
120
|
+
values.push(child.text);
|
|
121
|
+
child.forEachChild(visit);
|
|
122
|
+
};
|
|
123
|
+
visit(node);
|
|
124
|
+
return values;
|
|
125
|
+
};
|
|
126
|
+
var getLeadingDoc = (fullText, node) => {
|
|
127
|
+
const ranges = ts.getLeadingCommentRanges(fullText, node.getFullStart());
|
|
128
|
+
if (!ranges?.length)
|
|
129
|
+
return;
|
|
130
|
+
const { pos, end } = ranges[ranges.length - 1];
|
|
131
|
+
const line = fullText.slice(pos, end).replace(/^\/\*\*?/, "").replace(/\*\/\s*$/, "").replace(/^\/\/+/gm, "").split(`
|
|
132
|
+
`).map((row) => row.replace(/^\s*\*\s?/, "").trim()).find((row) => row.length > 0);
|
|
133
|
+
return line || undefined;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export { collectRecipeSources, scanRecipes, findInlineRecipeDuplicates };
|
package/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
getTargetCommandNames,
|
|
5
5
|
getTargetMetas,
|
|
6
6
|
runCommands
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-67546d0j.js";
|
|
7
|
+
} from "./index-jk9q6pse.js";
|
|
8
|
+
import"./index-jtm86byd.js";
|
|
10
9
|
import"./index-6pz1j0zj.js";
|
|
10
|
+
import"./index-67546d0j.js";
|
|
11
11
|
import {
|
|
12
12
|
__require
|
|
13
13
|
} from "./index-r24hmh0q.js";
|
|
@@ -17,22 +17,22 @@ import path from "path";
|
|
|
17
17
|
|
|
18
18
|
// pkgs/@akanjs/cli/commandModules.ts
|
|
19
19
|
var commandModules = {
|
|
20
|
-
workspace: async () => (await import("./workspace.command-
|
|
21
|
-
agent: async () => (await import("./agent.command-
|
|
22
|
-
application: async () => (await import("./application.command-
|
|
23
|
-
library: async () => (await import("./library.command-
|
|
24
|
-
localRegistry: async () => (await import("./localRegistry.command-
|
|
25
|
-
package: async () => (await import("./package.command-
|
|
26
|
-
module: async () => (await import("./module.command-
|
|
27
|
-
page: async () => (await import("./page.command-
|
|
28
|
-
context: async () => (await import("./context.command-
|
|
29
|
-
cloud: async () => (await import("./cloud.command-
|
|
30
|
-
guideline: async () => (await import("./guideline.command-
|
|
31
|
-
scalar: async () => (await import("./scalar.command-
|
|
32
|
-
primitive: async () => (await import("./primitive.command-
|
|
33
|
-
quality: async () => (await import("./quality.command-
|
|
34
|
-
repair: async () => (await import("./repair.command-
|
|
35
|
-
workflow: async () => (await import("./workflow.command-
|
|
20
|
+
workspace: async () => (await import("./workspace.command-p9r9nckg.js")).WorkspaceCommand,
|
|
21
|
+
agent: async () => (await import("./agent.command-jfz8yfwy.js")).AgentCommand,
|
|
22
|
+
application: async () => (await import("./application.command-3smsv7mq.js")).ApplicationCommand,
|
|
23
|
+
library: async () => (await import("./library.command-pwfx8dx2.js")).LibraryCommand,
|
|
24
|
+
localRegistry: async () => (await import("./localRegistry.command-bxhqmd1d.js")).LocalRegistryCommand,
|
|
25
|
+
package: async () => (await import("./package.command-7hmkxvpa.js")).PackageCommand,
|
|
26
|
+
module: async () => (await import("./module.command-0t3ewata.js")).ModuleCommand,
|
|
27
|
+
page: async () => (await import("./page.command-st6r4s0q.js")).PageCommand,
|
|
28
|
+
context: async () => (await import("./context.command-ygzyb0xb.js")).ContextCommand,
|
|
29
|
+
cloud: async () => (await import("./cloud.command-rk4e9vrt.js")).CloudCommand,
|
|
30
|
+
guideline: async () => (await import("./guideline.command-1m1ctar3.js")).GuidelineCommand,
|
|
31
|
+
scalar: async () => (await import("./scalar.command-fjq272gs.js")).ScalarCommand,
|
|
32
|
+
primitive: async () => (await import("./primitive.command-1qkxpzsn.js")).PrimitiveCommand,
|
|
33
|
+
quality: async () => (await import("./quality.command-hy5vt1bh.js")).QualityCommand,
|
|
34
|
+
repair: async () => (await import("./repair.command-nakkq2zp.js")).RepairCommand,
|
|
35
|
+
workflow: async () => (await import("./workflow.command-jswbgk90.js")).WorkflowCommand
|
|
36
36
|
};
|
|
37
37
|
var commandModuleIds = Object.keys(commandModules);
|
|
38
38
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
LibraryScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-cn24dcqn.js";
|
|
5
5
|
import {
|
|
6
6
|
Lib,
|
|
7
7
|
Workspace,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-67546d0j.js";
|
|
9
|
+
} from "./index-jk9q6pse.js";
|
|
10
|
+
import"./index-jtm86byd.js";
|
|
12
11
|
import"./index-6pz1j0zj.js";
|
|
12
|
+
import"./index-67546d0j.js";
|
|
13
13
|
import"./index-r24hmh0q.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/library/library.command.ts
|
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CloudRunner,
|
|
4
4
|
getNpmRegistryUrl
|
|
5
|
-
} from "./index-
|
|
6
|
-
import
|
|
5
|
+
} from "./index-ktprgc5g.js";
|
|
6
|
+
import {
|
|
7
|
+
PackageScript
|
|
8
|
+
} from "./index-e3qskyt2.js";
|
|
9
|
+
import"./index-3pgtw35d.js";
|
|
7
10
|
import {
|
|
8
11
|
ApplicationScript
|
|
9
|
-
} from "./index-
|
|
12
|
+
} from "./index-ev6rjw9n.js";
|
|
10
13
|
import"./index-76rn3g2c.js";
|
|
11
|
-
import"./index-
|
|
12
|
-
import {
|
|
13
|
-
PackageScript
|
|
14
|
-
} from "./index-z36qzgzp.js";
|
|
14
|
+
import"./index-cn24dcqn.js";
|
|
15
15
|
import {
|
|
16
16
|
Workspace,
|
|
17
17
|
command,
|
|
18
18
|
runner,
|
|
19
19
|
script
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-jk9q6pse.js";
|
|
21
21
|
import"./index-fgc8r6dj.js";
|
|
22
|
+
import"./index-bjpxzr6s.js";
|
|
22
23
|
import {
|
|
23
24
|
PkgExecutor
|
|
24
|
-
} from "./index-
|
|
25
|
+
} from "./index-jtm86byd.js";
|
|
26
|
+
import"./index-6pz1j0zj.js";
|
|
25
27
|
import"./index-46tjzh6s.js";
|
|
26
28
|
import"./index-67546d0j.js";
|
|
27
|
-
import"./index-bjpxzr6s.js";
|
|
28
|
-
import"./index-6pz1j0zj.js";
|
|
29
29
|
import"./index-r24hmh0q.js";
|
|
30
30
|
|
|
31
31
|
// pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ModuleScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-vhv3xnjz.js";
|
|
5
|
+
import"./index-hjzr8ja1.js";
|
|
6
6
|
import"./index-ss469dec.js";
|
|
7
|
+
import"./index-3pgtw35d.js";
|
|
7
8
|
import {
|
|
8
9
|
renderPrimitiveReport
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-nsj2ftxj.js";
|
|
10
|
+
} from "./index-4zgs8g1w.js";
|
|
11
|
+
import"./index-xwgm94zr.js";
|
|
12
12
|
import {
|
|
13
13
|
Module,
|
|
14
14
|
Sys,
|
|
15
15
|
command
|
|
16
|
-
} from "./index-
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-67546d0j.js";
|
|
16
|
+
} from "./index-jk9q6pse.js";
|
|
17
|
+
import"./index-jtm86byd.js";
|
|
19
18
|
import"./index-6pz1j0zj.js";
|
|
19
|
+
import"./index-67546d0j.js";
|
|
20
20
|
import"./index-r24hmh0q.js";
|
|
21
21
|
|
|
22
22
|
// pkgs/@akanjs/cli/module/module.command.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PackageScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-e3qskyt2.js";
|
|
5
5
|
import {
|
|
6
6
|
Pkg,
|
|
7
7
|
Workspace,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
} from "./index-jk9q6pse.js";
|
|
10
|
+
import"./index-jtm86byd.js";
|
|
11
|
+
import"./index-6pz1j0zj.js";
|
|
11
12
|
import"./index-46tjzh6s.js";
|
|
12
13
|
import"./index-67546d0j.js";
|
|
13
|
-
import"./index-6pz1j0zj.js";
|
|
14
14
|
import"./index-r24hmh0q.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/cli/package/package.command.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,10 +34,9 @@
|
|
|
34
34
|
"@langchain/openai": "^1.4.6",
|
|
35
35
|
"@tailwindcss/node": "^4.3.0",
|
|
36
36
|
"@trapezedev/project": "^7.1.4",
|
|
37
|
-
"akanjs": "
|
|
37
|
+
"akanjs": "3.0.0-alpha.0",
|
|
38
38
|
"chalk": "^5.6.2",
|
|
39
39
|
"commander": "^14.0.3",
|
|
40
|
-
"daisyui": "5.5.23",
|
|
41
40
|
"dayjs": "^1.11.20",
|
|
42
41
|
"fontaine": "^0.8.0",
|
|
43
42
|
"fonteditor-core": "^2.6.3",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PageScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-hjzr8ja1.js";
|
|
5
5
|
import {
|
|
6
6
|
App,
|
|
7
7
|
Module,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-67546d0j.js";
|
|
9
|
+
} from "./index-jk9q6pse.js";
|
|
10
|
+
import"./index-jtm86byd.js";
|
|
12
11
|
import"./index-6pz1j0zj.js";
|
|
12
|
+
import"./index-67546d0j.js";
|
|
13
13
|
import"./index-r24hmh0q.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/page/page.command.ts
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PrimitiveScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
4
|
+
} from "./index-r4w8cry5.js";
|
|
5
|
+
import"./index-vhv3xnjz.js";
|
|
6
|
+
import"./index-hjzr8ja1.js";
|
|
7
7
|
import"./index-ss469dec.js";
|
|
8
|
+
import"./index-3pgtw35d.js";
|
|
8
9
|
import {
|
|
9
10
|
renderPrimitiveReport
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-nsj2ftxj.js";
|
|
11
|
+
} from "./index-4zgs8g1w.js";
|
|
12
|
+
import"./index-xwgm94zr.js";
|
|
13
13
|
import {
|
|
14
14
|
Workspace,
|
|
15
15
|
command
|
|
16
|
-
} from "./index-
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-67546d0j.js";
|
|
16
|
+
} from "./index-jk9q6pse.js";
|
|
17
|
+
import"./index-jtm86byd.js";
|
|
19
18
|
import"./index-6pz1j0zj.js";
|
|
19
|
+
import"./index-67546d0j.js";
|
|
20
20
|
import"./index-r24hmh0q.js";
|
|
21
21
|
|
|
22
22
|
// pkgs/@akanjs/cli/primitive/primitive.command.ts
|