@anatolykoptev/krolik-cli 0.1.1 → 0.1.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/README.md +81 -392
- package/dist/bin/cli.js +32 -23
- package/dist/bin/cli.js.map +1 -1
- package/dist/{chunk-DTDOBWO6.js → chunk-6KHNWBXV.js} +2 -2
- package/dist/{chunk-DTDOBWO6.js.map → chunk-6KHNWBXV.js.map} +1 -1
- package/dist/config/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/bin/cli.js
CHANGED
|
@@ -54,7 +54,7 @@ var KROLIK_VERSION, TEMPLATE_VERSION;
|
|
|
54
54
|
var init_version = __esm({
|
|
55
55
|
"src/version.ts"() {
|
|
56
56
|
init_esm_shims();
|
|
57
|
-
KROLIK_VERSION = "0.1.
|
|
57
|
+
KROLIK_VERSION = "0.1.3";
|
|
58
58
|
TEMPLATE_VERSION = "4.0.0";
|
|
59
59
|
}
|
|
60
60
|
});
|
|
@@ -1257,7 +1257,9 @@ function detectPackageType(name, pkgPath) {
|
|
|
1257
1257
|
const isAppsDir = pkgPath.includes("/apps/") || pkgPath.startsWith("apps/");
|
|
1258
1258
|
if (isAppsDir) {
|
|
1259
1259
|
for (const type of ["web", "mobile"]) {
|
|
1260
|
-
|
|
1260
|
+
const patterns = NAME_PATTERNS[type];
|
|
1261
|
+
if (!patterns) continue;
|
|
1262
|
+
for (const pattern of patterns) {
|
|
1261
1263
|
if (pattern.test(nameLower) || pattern.test(dirName)) {
|
|
1262
1264
|
return type;
|
|
1263
1265
|
}
|
|
@@ -1272,7 +1274,9 @@ function detectPackageType(name, pkgPath) {
|
|
|
1272
1274
|
const depNames = Object.keys(allDeps);
|
|
1273
1275
|
if (isAppsDir) {
|
|
1274
1276
|
for (const type of ["web", "mobile"]) {
|
|
1275
|
-
|
|
1277
|
+
const indicators = DEP_INDICATORS[type];
|
|
1278
|
+
if (!indicators) continue;
|
|
1279
|
+
for (const indicator of indicators) {
|
|
1276
1280
|
if (depNames.some((dep) => dep.startsWith(indicator) || dep === indicator)) {
|
|
1277
1281
|
return type;
|
|
1278
1282
|
}
|
|
@@ -5265,7 +5269,8 @@ function analyzeTask(task) {
|
|
|
5265
5269
|
taskType = primary.type;
|
|
5266
5270
|
confidence = Math.min(primary.score / 3, 1);
|
|
5267
5271
|
keywords = primary.keywords;
|
|
5268
|
-
|
|
5272
|
+
const second = detectedTypes[1];
|
|
5273
|
+
if (detectedTypes.length >= 2 && second && second.score >= 2) {
|
|
5269
5274
|
taskType = "multi-domain";
|
|
5270
5275
|
confidence = 0.8;
|
|
5271
5276
|
keywords = detectedTypes.flatMap((d) => d.keywords);
|
|
@@ -8984,9 +8989,11 @@ function analyzeFileMetricsRegex(content) {
|
|
|
8984
8989
|
const items = match[1]?.split(",").map(
|
|
8985
8990
|
(s) => s.trim().split(/\s+as\s+/)[0]?.trim()
|
|
8986
8991
|
);
|
|
8987
|
-
items
|
|
8988
|
-
|
|
8989
|
-
|
|
8992
|
+
if (items) {
|
|
8993
|
+
items.forEach((item) => {
|
|
8994
|
+
if (item) exportNames.push(item);
|
|
8995
|
+
});
|
|
8996
|
+
}
|
|
8990
8997
|
}
|
|
8991
8998
|
}
|
|
8992
8999
|
}
|
|
@@ -9048,7 +9055,7 @@ function groupFunctionsByPrefix(names) {
|
|
|
9048
9055
|
const prefixMatch = name.match(
|
|
9049
9056
|
/^(get|set|create|update|delete|handle|on|use|is|has|can|should|validate|parse|format|render|load|save|fetch|find|build|make|init|reset|clear|add|remove)/i
|
|
9050
9057
|
);
|
|
9051
|
-
const prefix = prefixMatch
|
|
9058
|
+
const prefix = prefixMatch?.[1]?.toLowerCase() ?? "misc";
|
|
9052
9059
|
const existing = groups.get(prefix) ?? [];
|
|
9053
9060
|
existing.push(name);
|
|
9054
9061
|
groups.set(prefix, existing);
|
|
@@ -11526,17 +11533,20 @@ function parseFile(filePath, content, options = {}) {
|
|
|
11526
11533
|
}
|
|
11527
11534
|
function parseSyncWithOptions(filePath, content, options) {
|
|
11528
11535
|
const syntax = options.syntax ?? "typescript";
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11536
|
+
const tsx = options.tsx ?? filePath.endsWith(".tsx");
|
|
11537
|
+
const jsx = options.jsx ?? filePath.endsWith(".jsx");
|
|
11538
|
+
const target = options.target ?? "es2022";
|
|
11539
|
+
if (syntax === "ecmascript") {
|
|
11540
|
+
return parseSync(content, {
|
|
11541
|
+
syntax: "ecmascript",
|
|
11542
|
+
jsx,
|
|
11543
|
+
target
|
|
11544
|
+
});
|
|
11534
11545
|
}
|
|
11535
11546
|
return parseSync(content, {
|
|
11536
|
-
syntax,
|
|
11547
|
+
syntax: "typescript",
|
|
11537
11548
|
tsx,
|
|
11538
|
-
|
|
11539
|
-
target: options.target
|
|
11549
|
+
target
|
|
11540
11550
|
});
|
|
11541
11551
|
}
|
|
11542
11552
|
function getNodeSpan(node) {
|
|
@@ -17047,7 +17057,7 @@ function formatPreCommitSection(lines) {
|
|
|
17047
17057
|
lines.push(" <pre-commit>");
|
|
17048
17058
|
lines.push(" <check>pnpm typecheck</check>");
|
|
17049
17059
|
lines.push(" <check>pnpm lint:fix</check>");
|
|
17050
|
-
lines.push(" <check>pnpm test --
|
|
17060
|
+
lines.push(" <check>pnpm test -- [domain]</check>");
|
|
17051
17061
|
lines.push(" <check>pnpm build</check>");
|
|
17052
17062
|
lines.push(" </pre-commit>");
|
|
17053
17063
|
}
|
|
@@ -19879,7 +19889,7 @@ function parseTypesFileSwc(filePath) {
|
|
|
19879
19889
|
const { ast } = parseFile(filePath, content);
|
|
19880
19890
|
visitNodeWithCallbacks(ast, {
|
|
19881
19891
|
onTsInterfaceDeclaration: (node, context) => {
|
|
19882
|
-
if (!context
|
|
19892
|
+
if (!context?.isExported) {
|
|
19883
19893
|
return;
|
|
19884
19894
|
}
|
|
19885
19895
|
const interfaceNode = node;
|
|
@@ -19915,7 +19925,7 @@ function parseTypesFileSwc(filePath) {
|
|
|
19915
19925
|
types.push(type);
|
|
19916
19926
|
},
|
|
19917
19927
|
onTsTypeAliasDeclaration: (node, context) => {
|
|
19918
|
-
if (!context
|
|
19928
|
+
if (!context?.isExported) {
|
|
19919
19929
|
return;
|
|
19920
19930
|
}
|
|
19921
19931
|
const typeAliasNode = node;
|
|
@@ -20137,7 +20147,7 @@ function parseSchemaFileSwc(filePath) {
|
|
|
20137
20147
|
const { ast } = parseFile(filePath, content);
|
|
20138
20148
|
visitNodeWithCallbacks(ast, {
|
|
20139
20149
|
onVariableDeclaration: (node, context) => {
|
|
20140
|
-
if (!context
|
|
20150
|
+
if (!context?.isExported) return;
|
|
20141
20151
|
const varDecl = node;
|
|
20142
20152
|
for (const decl of varDecl.declarations) {
|
|
20143
20153
|
const varName = decl.id.type === "Identifier" ? decl.id.value : null;
|
|
@@ -21033,10 +21043,9 @@ async function runDocsSearch(ctx) {
|
|
|
21033
21043
|
` <content>${r.section.content.slice(0, 300)}${r.section.content.length > 300 ? "..." : ""}</content>`
|
|
21034
21044
|
);
|
|
21035
21045
|
if (r.section.codeSnippets.length > 0) {
|
|
21046
|
+
const firstSnippet = r.section.codeSnippets[0];
|
|
21036
21047
|
lines.push(` <code-snippets count="${r.section.codeSnippets.length}">`);
|
|
21037
|
-
lines.push(
|
|
21038
|
-
` ${r.section.codeSnippets[0].slice(0, 200)}${r.section.codeSnippets[0].length > 200 ? "..." : ""}`
|
|
21039
|
-
);
|
|
21048
|
+
lines.push(` ${firstSnippet.slice(0, 200)}${firstSnippet.length > 200 ? "..." : ""}`);
|
|
21040
21049
|
lines.push(` </code-snippets>`);
|
|
21041
21050
|
}
|
|
21042
21051
|
lines.push(` </result>`);
|