uilint 0.2.29 → 0.2.30
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/bin/uilint.js +29 -0
- package/dist/{chunk-VNANPKR2.js → chunk-NAO64XXO.js} +9 -7
- package/dist/chunk-NAO64XXO.js.map +1 -0
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/{install-ui-GZBZK2XI.js → install-ui-UPHDMZWG.js} +91 -42
- package/dist/install-ui-UPHDMZWG.js.map +1 -0
- package/dist/{plan-5WHKVACB.js → plan-QAONO66T.js} +81 -3
- package/dist/plan-QAONO66T.js.map +1 -0
- package/package.json +9 -8
- package/dist/chunk-VNANPKR2.js.map +0 -1
- package/dist/install-ui-GZBZK2XI.js.map +0 -1
- package/dist/plan-5WHKVACB.js.map +0 -1
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
pc,
|
|
16
16
|
select,
|
|
17
17
|
uninstallEslintPlugin
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NAO64XXO.js";
|
|
19
19
|
import {
|
|
20
20
|
GENSTYLEGUIDE_COMMAND_MD,
|
|
21
21
|
loadSkill,
|
|
@@ -1726,15 +1726,15 @@ async function analyze(projectPath = process.cwd()) {
|
|
|
1726
1726
|
|
|
1727
1727
|
// src/commands/install/execute.ts
|
|
1728
1728
|
import {
|
|
1729
|
-
existsSync as
|
|
1729
|
+
existsSync as existsSync11,
|
|
1730
1730
|
mkdirSync,
|
|
1731
|
-
writeFileSync as
|
|
1732
|
-
readFileSync as
|
|
1731
|
+
writeFileSync as writeFileSync5,
|
|
1732
|
+
readFileSync as readFileSync9,
|
|
1733
1733
|
unlinkSync,
|
|
1734
1734
|
chmodSync,
|
|
1735
1735
|
rmSync
|
|
1736
1736
|
} from "fs";
|
|
1737
|
-
import { dirname as dirname4, join as
|
|
1737
|
+
import { dirname as dirname4, join as join11 } from "path";
|
|
1738
1738
|
|
|
1739
1739
|
// src/utils/react-inject.ts
|
|
1740
1740
|
import { existsSync as existsSync5, readFileSync as readFileSync5, writeFileSync } from "fs";
|
|
@@ -3301,6 +3301,35 @@ function touchFiles(filePaths) {
|
|
|
3301
3301
|
|
|
3302
3302
|
// src/commands/install/execute.ts
|
|
3303
3303
|
import { findWorkspaceRoot as findWorkspaceRoot2 } from "uilint-core/node";
|
|
3304
|
+
|
|
3305
|
+
// src/utils/tsconfig-inject.ts
|
|
3306
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
|
|
3307
|
+
import { join as join10 } from "path";
|
|
3308
|
+
function injectTsconfigExclusion(projectPath) {
|
|
3309
|
+
const tsconfigPath = join10(projectPath, "tsconfig.json");
|
|
3310
|
+
if (!existsSync10(tsconfigPath)) {
|
|
3311
|
+
return { modified: false };
|
|
3312
|
+
}
|
|
3313
|
+
try {
|
|
3314
|
+
const content = readFileSync8(tsconfigPath, "utf-8");
|
|
3315
|
+
const tsconfig = JSON.parse(content);
|
|
3316
|
+
const exclude = tsconfig.exclude ?? [];
|
|
3317
|
+
if (exclude.includes(".uilint")) {
|
|
3318
|
+
return { modified: false, tsconfigPath };
|
|
3319
|
+
}
|
|
3320
|
+
tsconfig.exclude = [...exclude, ".uilint"];
|
|
3321
|
+
writeFileSync4(tsconfigPath, JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
|
|
3322
|
+
return { modified: true, tsconfigPath };
|
|
3323
|
+
} catch (err) {
|
|
3324
|
+
return {
|
|
3325
|
+
modified: false,
|
|
3326
|
+
tsconfigPath,
|
|
3327
|
+
error: err instanceof Error ? err.message : String(err)
|
|
3328
|
+
};
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
// src/commands/install/execute.ts
|
|
3304
3333
|
async function executeAction(action, options) {
|
|
3305
3334
|
const { dryRun = false } = options;
|
|
3306
3335
|
try {
|
|
@@ -3313,7 +3342,7 @@ async function executeAction(action, options) {
|
|
|
3313
3342
|
wouldDo: `Create directory: ${action.path}`
|
|
3314
3343
|
};
|
|
3315
3344
|
}
|
|
3316
|
-
if (!
|
|
3345
|
+
if (!existsSync11(action.path)) {
|
|
3317
3346
|
mkdirSync(action.path, { recursive: true });
|
|
3318
3347
|
}
|
|
3319
3348
|
return { action, success: true };
|
|
@@ -3327,10 +3356,10 @@ async function executeAction(action, options) {
|
|
|
3327
3356
|
};
|
|
3328
3357
|
}
|
|
3329
3358
|
const dir = dirname4(action.path);
|
|
3330
|
-
if (!
|
|
3359
|
+
if (!existsSync11(dir)) {
|
|
3331
3360
|
mkdirSync(dir, { recursive: true });
|
|
3332
3361
|
}
|
|
3333
|
-
|
|
3362
|
+
writeFileSync5(action.path, action.content, "utf-8");
|
|
3334
3363
|
if (action.permissions) {
|
|
3335
3364
|
chmodSync(action.path, action.permissions);
|
|
3336
3365
|
}
|
|
@@ -3345,18 +3374,18 @@ async function executeAction(action, options) {
|
|
|
3345
3374
|
};
|
|
3346
3375
|
}
|
|
3347
3376
|
let existing = {};
|
|
3348
|
-
if (
|
|
3377
|
+
if (existsSync11(action.path)) {
|
|
3349
3378
|
try {
|
|
3350
|
-
existing = JSON.parse(
|
|
3379
|
+
existing = JSON.parse(readFileSync9(action.path, "utf-8"));
|
|
3351
3380
|
} catch {
|
|
3352
3381
|
}
|
|
3353
3382
|
}
|
|
3354
3383
|
const merged = deepMerge(existing, action.merge);
|
|
3355
3384
|
const dir = dirname4(action.path);
|
|
3356
|
-
if (!
|
|
3385
|
+
if (!existsSync11(dir)) {
|
|
3357
3386
|
mkdirSync(dir, { recursive: true });
|
|
3358
3387
|
}
|
|
3359
|
-
|
|
3388
|
+
writeFileSync5(action.path, JSON.stringify(merged, null, 2), "utf-8");
|
|
3360
3389
|
return { action, success: true };
|
|
3361
3390
|
}
|
|
3362
3391
|
case "delete_file": {
|
|
@@ -3367,7 +3396,7 @@ async function executeAction(action, options) {
|
|
|
3367
3396
|
wouldDo: `Delete file: ${action.path}`
|
|
3368
3397
|
};
|
|
3369
3398
|
}
|
|
3370
|
-
if (
|
|
3399
|
+
if (existsSync11(action.path)) {
|
|
3371
3400
|
unlinkSync(action.path);
|
|
3372
3401
|
}
|
|
3373
3402
|
return { action, success: true };
|
|
@@ -3380,12 +3409,12 @@ async function executeAction(action, options) {
|
|
|
3380
3409
|
wouldDo: `Append to file: ${action.path}`
|
|
3381
3410
|
};
|
|
3382
3411
|
}
|
|
3383
|
-
if (
|
|
3384
|
-
const content =
|
|
3412
|
+
if (existsSync11(action.path)) {
|
|
3413
|
+
const content = readFileSync9(action.path, "utf-8");
|
|
3385
3414
|
if (action.ifNotContains && content.includes(action.ifNotContains)) {
|
|
3386
3415
|
return { action, success: true };
|
|
3387
3416
|
}
|
|
3388
|
-
|
|
3417
|
+
writeFileSync5(action.path, content + action.content, "utf-8");
|
|
3389
3418
|
}
|
|
3390
3419
|
return { action, success: true };
|
|
3391
3420
|
}
|
|
@@ -3404,6 +3433,9 @@ async function executeAction(action, options) {
|
|
|
3404
3433
|
case "inject_vitest_coverage": {
|
|
3405
3434
|
return await executeInjectVitestCoverage(action, options);
|
|
3406
3435
|
}
|
|
3436
|
+
case "inject_tsconfig": {
|
|
3437
|
+
return await executeInjectTsconfig(action, options);
|
|
3438
|
+
}
|
|
3407
3439
|
case "install_next_routes": {
|
|
3408
3440
|
return await executeInstallNextRoutes(action, options);
|
|
3409
3441
|
}
|
|
@@ -3540,6 +3572,23 @@ async function executeInjectVitestCoverage(action, options) {
|
|
|
3540
3572
|
modifiedFiles: modified ? [vitestConfigPath] : void 0
|
|
3541
3573
|
};
|
|
3542
3574
|
}
|
|
3575
|
+
async function executeInjectTsconfig(action, options) {
|
|
3576
|
+
const { dryRun = false } = options;
|
|
3577
|
+
if (dryRun) {
|
|
3578
|
+
return {
|
|
3579
|
+
action,
|
|
3580
|
+
success: true,
|
|
3581
|
+
wouldDo: `Add .uilint to tsconfig.json exclude: ${action.projectPath}`
|
|
3582
|
+
};
|
|
3583
|
+
}
|
|
3584
|
+
const result = injectTsconfigExclusion(action.projectPath);
|
|
3585
|
+
return {
|
|
3586
|
+
action,
|
|
3587
|
+
success: true,
|
|
3588
|
+
// Soft failure - don't fail install if tsconfig not found
|
|
3589
|
+
modifiedFiles: result.modified && result.tsconfigPath ? [result.tsconfigPath] : void 0
|
|
3590
|
+
};
|
|
3591
|
+
}
|
|
3543
3592
|
async function executeInjectNextConfig(action, options) {
|
|
3544
3593
|
const { dryRun = false } = options;
|
|
3545
3594
|
if (dryRun) {
|
|
@@ -3682,7 +3731,7 @@ async function executeRemoveDirectory(action, options) {
|
|
|
3682
3731
|
wouldDo: `Remove directory: ${action.path}`
|
|
3683
3732
|
};
|
|
3684
3733
|
}
|
|
3685
|
-
if (
|
|
3734
|
+
if (existsSync11(action.path)) {
|
|
3686
3735
|
rmSync(action.path, { recursive: true, force: true });
|
|
3687
3736
|
}
|
|
3688
3737
|
return { action, success: true };
|
|
@@ -3831,14 +3880,14 @@ function getProjectPathFromActions(actionsPerformed) {
|
|
|
3831
3880
|
}
|
|
3832
3881
|
function normalizePnpmWorkspaceUilintSpecs(packagePath, packages) {
|
|
3833
3882
|
const workspaceRoot = findWorkspaceRoot2(packagePath);
|
|
3834
|
-
if (!
|
|
3883
|
+
if (!existsSync11(join11(workspaceRoot, "pnpm-workspace.yaml"))) return packages;
|
|
3835
3884
|
const touchesUilint = packages.some((p) => p === "uilint-eslint" || p.startsWith("uilint-"));
|
|
3836
3885
|
if (!touchesUilint) return packages;
|
|
3837
|
-
const pkgJsonPath =
|
|
3838
|
-
if (!
|
|
3886
|
+
const pkgJsonPath = join11(packagePath, "package.json");
|
|
3887
|
+
if (!existsSync11(pkgJsonPath)) return packages;
|
|
3839
3888
|
let pkg = null;
|
|
3840
3889
|
try {
|
|
3841
|
-
pkg = JSON.parse(
|
|
3890
|
+
pkg = JSON.parse(readFileSync9(pkgJsonPath, "utf-8"));
|
|
3842
3891
|
} catch {
|
|
3843
3892
|
return packages;
|
|
3844
3893
|
}
|
|
@@ -3950,7 +3999,7 @@ async function execute(plan, options = {}) {
|
|
|
3950
3999
|
import { ruleRegistry as ruleRegistry3 } from "uilint-eslint";
|
|
3951
4000
|
|
|
3952
4001
|
// src/commands/install/installers/genstyleguide.ts
|
|
3953
|
-
import { join as
|
|
4002
|
+
import { join as join12 } from "path";
|
|
3954
4003
|
var genstyleguideInstaller = {
|
|
3955
4004
|
id: "genstyleguide",
|
|
3956
4005
|
name: "/genstyleguide command",
|
|
@@ -3960,7 +4009,7 @@ var genstyleguideInstaller = {
|
|
|
3960
4009
|
return true;
|
|
3961
4010
|
},
|
|
3962
4011
|
getTargets(project) {
|
|
3963
|
-
const commandPath =
|
|
4012
|
+
const commandPath = join12(project.cursorDir.path, "commands", "genstyleguide.md");
|
|
3964
4013
|
const isInstalled = project.commands.genstyleguide;
|
|
3965
4014
|
return [
|
|
3966
4015
|
{
|
|
@@ -3973,7 +4022,7 @@ var genstyleguideInstaller = {
|
|
|
3973
4022
|
},
|
|
3974
4023
|
plan(targets, config, project) {
|
|
3975
4024
|
const actions = [];
|
|
3976
|
-
const commandsDir =
|
|
4025
|
+
const commandsDir = join12(project.cursorDir.path, "commands");
|
|
3977
4026
|
if (!project.cursorDir.exists) {
|
|
3978
4027
|
actions.push({
|
|
3979
4028
|
type: "create_directory",
|
|
@@ -3986,7 +4035,7 @@ var genstyleguideInstaller = {
|
|
|
3986
4035
|
});
|
|
3987
4036
|
actions.push({
|
|
3988
4037
|
type: "create_file",
|
|
3989
|
-
path:
|
|
4038
|
+
path: join12(commandsDir, "genstyleguide.md"),
|
|
3990
4039
|
content: GENSTYLEGUIDE_COMMAND_MD
|
|
3991
4040
|
});
|
|
3992
4041
|
return {
|
|
@@ -4015,7 +4064,7 @@ var genstyleguideInstaller = {
|
|
|
4015
4064
|
},
|
|
4016
4065
|
planUninstall(targets, project) {
|
|
4017
4066
|
const actions = [];
|
|
4018
|
-
const commandPath =
|
|
4067
|
+
const commandPath = join12(project.cursorDir.path, "commands", "genstyleguide.md");
|
|
4019
4068
|
actions.push({
|
|
4020
4069
|
type: "delete_file",
|
|
4021
4070
|
path: commandPath
|
|
@@ -4025,8 +4074,8 @@ var genstyleguideInstaller = {
|
|
|
4025
4074
|
};
|
|
4026
4075
|
|
|
4027
4076
|
// src/commands/install/installers/skill.ts
|
|
4028
|
-
import { existsSync as
|
|
4029
|
-
import { join as
|
|
4077
|
+
import { existsSync as existsSync12 } from "fs";
|
|
4078
|
+
import { join as join13 } from "path";
|
|
4030
4079
|
var skillInstaller = {
|
|
4031
4080
|
id: "skill",
|
|
4032
4081
|
name: "UI Consistency Agent skill",
|
|
@@ -4036,9 +4085,9 @@ var skillInstaller = {
|
|
|
4036
4085
|
return true;
|
|
4037
4086
|
},
|
|
4038
4087
|
getTargets(project) {
|
|
4039
|
-
const skillsDir =
|
|
4040
|
-
const skillMdPath =
|
|
4041
|
-
const isInstalled =
|
|
4088
|
+
const skillsDir = join13(project.cursorDir.path, "skills", "ui-consistency-enforcer");
|
|
4089
|
+
const skillMdPath = join13(skillsDir, "SKILL.md");
|
|
4090
|
+
const isInstalled = existsSync12(skillMdPath);
|
|
4042
4091
|
return [
|
|
4043
4092
|
{
|
|
4044
4093
|
id: "ui-consistency-skill",
|
|
@@ -4057,21 +4106,21 @@ var skillInstaller = {
|
|
|
4057
4106
|
path: project.cursorDir.path
|
|
4058
4107
|
});
|
|
4059
4108
|
}
|
|
4060
|
-
const skillsDir =
|
|
4109
|
+
const skillsDir = join13(project.cursorDir.path, "skills");
|
|
4061
4110
|
actions.push({
|
|
4062
4111
|
type: "create_directory",
|
|
4063
4112
|
path: skillsDir
|
|
4064
4113
|
});
|
|
4065
4114
|
try {
|
|
4066
4115
|
const skill = loadSkill("ui-consistency-enforcer");
|
|
4067
|
-
const skillDir =
|
|
4116
|
+
const skillDir = join13(skillsDir, skill.name);
|
|
4068
4117
|
actions.push({
|
|
4069
4118
|
type: "create_directory",
|
|
4070
4119
|
path: skillDir
|
|
4071
4120
|
});
|
|
4072
4121
|
for (const file of skill.files) {
|
|
4073
|
-
const filePath =
|
|
4074
|
-
const fileDir =
|
|
4122
|
+
const filePath = join13(skillDir, file.relativePath);
|
|
4123
|
+
const fileDir = join13(
|
|
4075
4124
|
skillDir,
|
|
4076
4125
|
file.relativePath.split("/").slice(0, -1).join("/")
|
|
4077
4126
|
);
|
|
@@ -4127,7 +4176,7 @@ var skillInstaller = {
|
|
|
4127
4176
|
},
|
|
4128
4177
|
planUninstall(targets, project) {
|
|
4129
4178
|
const actions = [];
|
|
4130
|
-
const skillDir =
|
|
4179
|
+
const skillDir = join13(project.cursorDir.path, "skills", "ui-consistency-enforcer");
|
|
4131
4180
|
actions.push({
|
|
4132
4181
|
type: "remove_directory",
|
|
4133
4182
|
path: skillDir
|
|
@@ -4137,7 +4186,7 @@ var skillInstaller = {
|
|
|
4137
4186
|
};
|
|
4138
4187
|
|
|
4139
4188
|
// src/commands/install/installers/eslint.ts
|
|
4140
|
-
import { join as
|
|
4189
|
+
import { join as join14 } from "path";
|
|
4141
4190
|
import { ruleRegistry as ruleRegistry2, getRulesByCategory as getRulesByCategory2 } from "uilint-eslint";
|
|
4142
4191
|
function getUpgradeInfo(configuredRuleIds) {
|
|
4143
4192
|
const configuredSet = new Set(configuredRuleIds);
|
|
@@ -4326,7 +4375,7 @@ var eslintInstaller = {
|
|
|
4326
4375
|
for (const target of targets) {
|
|
4327
4376
|
const pkgInfo = project.packages.find((p) => p.path === target.path);
|
|
4328
4377
|
if (!pkgInfo || !pkgInfo.eslintConfigPath) continue;
|
|
4329
|
-
const rulesDir =
|
|
4378
|
+
const rulesDir = join14(target.path, ".uilint", "rules");
|
|
4330
4379
|
actions.push({
|
|
4331
4380
|
type: "create_directory",
|
|
4332
4381
|
path: rulesDir
|
|
@@ -4351,7 +4400,7 @@ var eslintInstaller = {
|
|
|
4351
4400
|
hasExistingRules: pkgInfo.hasUilintRules
|
|
4352
4401
|
});
|
|
4353
4402
|
}
|
|
4354
|
-
const gitignorePath =
|
|
4403
|
+
const gitignorePath = join14(project.workspaceRoot, ".gitignore");
|
|
4355
4404
|
actions.push({
|
|
4356
4405
|
type: "append_to_file",
|
|
4357
4406
|
path: gitignorePath,
|
|
@@ -4393,7 +4442,7 @@ var eslintInstaller = {
|
|
|
4393
4442
|
packagePath: target.path,
|
|
4394
4443
|
configPath: pkgInfo.eslintConfigPath
|
|
4395
4444
|
});
|
|
4396
|
-
const rulesDir =
|
|
4445
|
+
const rulesDir = join14(target.path, ".uilint", "rules");
|
|
4397
4446
|
actions.push({
|
|
4398
4447
|
type: "remove_directory",
|
|
4399
4448
|
path: rulesDir
|
|
@@ -4701,7 +4750,7 @@ async function installUI(options = {}, executeOptions = {}) {
|
|
|
4701
4750
|
console.log("\nNo changes selected");
|
|
4702
4751
|
process.exit(0);
|
|
4703
4752
|
}
|
|
4704
|
-
const { createPlan } = await import("./plan-
|
|
4753
|
+
const { createPlan } = await import("./plan-QAONO66T.js");
|
|
4705
4754
|
const plan = createPlan(project, choices, { force: options.force });
|
|
4706
4755
|
if (hasUninstalls && uninstallSelections) {
|
|
4707
4756
|
for (const selection of uninstallSelections) {
|
|
@@ -4753,4 +4802,4 @@ ${pc.blue("Running tests with coverage...")}`);
|
|
|
4753
4802
|
export {
|
|
4754
4803
|
installUI
|
|
4755
4804
|
};
|
|
4756
|
-
//# sourceMappingURL=install-ui-
|
|
4805
|
+
//# sourceMappingURL=install-ui-UPHDMZWG.js.map
|