@longzai-intelligence-tsconfig/cli 0.0.2 → 0.0.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/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import "./rolldown-runtime-DCIJsbUY.js";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import"./rolldown-runtime-
|
|
3
|
-
`)}function _(e){return`${f.GREEN}✓${f.RESET} tsconfig 形态检测通过——${e} 个单元零违例`}async function v(e){let t=l(e.cwd??`.`),n=await s(t);n===null&&h(`未发现 lzi-tsconfig.config.ts,按零配置继续——接入后经 lzi-tsconfig init 补建,存在性铁律要求配置文件实有`);let r=c({rootDir:t,config:n?.config??{}});e.format===`json`?m(JSON.stringify(r,null,2)):r.violations.length>0?m(g(r)):m(_(r.summary.unitCount));let i=r.summary.errorCount+(e.strict===!0?r.summary.warnCount:0);process.exit(i)}async function y(e){let t=l(e.cwd??`.`),n=l(t,a);u(n)&&(m(`${a} 已存在,拒绝覆盖`),process.exit(1));let r=o();
|
|
2
|
+
import"./rolldown-runtime-DCIJsbUY.js";import{createCli as e,defineCommand as t}from"@longzai-intelligence-cli/core";import{clackInteraction as n,picocolorsColor as r}from"@longzai-intelligence-cli/standard";import*as i from"zod";import{CONFIG_FILE_NAME as a,buildConfigFileContent as o,loadConfig as s}from"@longzai-intelligence-tsconfig/config";import{runCheck as c}from"@longzai-intelligence-tsconfig/core";import{resolve as l}from"node:path";import{existsSync as u,writeFileSync as d}from"node:fs";const f={RED:`\x1B[0;31m`,GREEN:`\x1B[0;32m`,YELLOW:`\x1B[1;33m`,RESET:`\x1B[0m`};function p(e){return e.map(e=>{if(typeof e==`string`)return e;if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch{return String(e)}}).join(` `)}function m(...e){process.stdout.write(`${p(e)}\n`)}function h(...e){process.stderr.write(`${p(e)}\n`)}function g(e){let t=[],n=/* @__PURE__ */ new Map;for(let t of e.violations){let e=n.get(t.unit);e===void 0?n.set(t.unit,[t]):e.push(t)}for(let[e,r]of n){t.push(`${e}:`);for(let e of r)t.push(` ${e.rule} ${e.severity} ${e.file} ${e.message}`);t.push(``)}return t.push(`${e.summary.unitCount} 个单元,${e.summary.errorCount} error、${e.summary.warnCount} warn`),t.join(`
|
|
3
|
+
`)}function _(e){return`${f.GREEN}✓${f.RESET} tsconfig 形态检测通过——${e} 个单元零违例`}async function v(e){let t=l(e.cwd??`.`),n=await s(t);n===null&&h(`未发现 lzi-tsconfig.config.ts,按零配置继续——接入后经 lzi-tsconfig init 补建,存在性铁律要求配置文件实有`);let r=c({rootDir:t,config:n?.config??{}});e.format===`json`?m(JSON.stringify(r,null,2)):r.violations.length>0?m(g(r)):m(_(r.summary.unitCount));let i=r.summary.errorCount+(e.strict===!0?r.summary.warnCount:0);process.exit(i)}async function y(e){let t=l(e.cwd??`.`),n=l(t,a);u(n)&&(m(`${a} 已存在,拒绝覆盖`),process.exit(1));let r=o();e.dryRun===!0?m(`[dry-run] 将写入 ${n}\n${r}`):(d(n,r),m(`已创建 ${n}`))}const b=e({name:`lzi-tsconfig`,description:`Longzai Intelligence tsconfig 形态门禁 CLI`,interaction:n,color:r});t(b,{name:`check`,description:`tsconfig 形态检测——分片实有、references 完整、include 覆盖、extends 合法`,options:[{flags:`--cwd <v>`,description:`目标仓根目录,默认当前目录`},{flags:`--format <v>`,description:`输出格式,text 或 json,默认 text`},{flags:`--strict`,description:`警告也计入退出码`}],schema:i.looseObject({cwd:i.string().optional(),format:i.enum([`text`,`json`]).optional(),strict:i.boolean().optional()}),action:async e=>{await v({...e.cwd===void 0?{}:{cwd:e.cwd},...e.format===void 0?{}:{format:e.format},...e.strict===void 0?{}:{strict:e.strict}})}}),t(b,{name:`init`,description:`生成 lzi-tsconfig.config.ts 配置文件`,options:[{flags:`--cwd <v>`,description:`目标仓根目录,默认当前目录`},{flags:`--dry-run`,description:`仅预览,不写入文件`}],schema:i.looseObject({cwd:i.string().optional(),dryRun:i.boolean().optional()}),action:async e=>{await y({...e.cwd===void 0?{}:{cwd:e.cwd},...e.dryRun===void 0?{}:{dryRun:e.dryRun}})}});async function x(){await b.parseAsync(process.argv)}x().catch(e=>{process.stderr.write(`错误: ${e instanceof Error?e.message:String(e)}\n`),process.exit(1)});export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-tsconfig/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Longzai Intelligence tsconfig 形态门禁 CLI",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@longzai-intelligence-cli/core": "^0.0.10",
|
|
39
39
|
"@longzai-intelligence-cli/standard": "^0.0.10",
|
|
40
|
-
"@longzai-intelligence-tsconfig/config": "0.0.
|
|
41
|
-
"@longzai-intelligence-tsconfig/core": "0.0.
|
|
40
|
+
"@longzai-intelligence-tsconfig/config": "0.0.3",
|
|
41
|
+
"@longzai-intelligence-tsconfig/core": "0.0.3",
|
|
42
42
|
"zod": "^4.4.3"
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"node:module";export{};
|