@longzai-intelligence-kol-markdown/config 0.0.1
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 +3 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +2 -0
- package/package.json +38 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ConfigLoadError, ConfigLoadOk, ConfigLoadResult } from "@longzai-intelligence-markdown/data-engine";
|
|
3
|
+
//#region src/kol-markdown-config.schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 配置结构(lzi-kol-markdown.config.ts 默认导出形态)
|
|
6
|
+
*/
|
|
7
|
+
declare const KolMarkdownConfigSchema: z.ZodObject<{
|
|
8
|
+
dataRoot: z.ZodString;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
/**
|
|
11
|
+
* 配置类型(schema 推断)
|
|
12
|
+
*/
|
|
13
|
+
type KolMarkdownConfig = z.infer<typeof KolMarkdownConfigSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* 配置工厂:类型收口 + 便于 IDE 推导(全局 ADR 0097 决策 2 defineXXX 收口)
|
|
16
|
+
*
|
|
17
|
+
* @param config - 配置对象
|
|
18
|
+
* @returns 原样返回(运行时校验由加载方执行,此处 identity 语义)
|
|
19
|
+
*/
|
|
20
|
+
declare function defineConfig(config: KolMarkdownConfig): KolMarkdownConfig;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/loader.utils.d.ts
|
|
23
|
+
/**
|
|
24
|
+
* 配置文件约定名(全局 ADR 0090:就地配置一律以工具命名,与 bin/env 前缀三同源)
|
|
25
|
+
*/
|
|
26
|
+
declare const CONFIG_FILENAME = "lzi-kol-markdown.config.ts";
|
|
27
|
+
/**
|
|
28
|
+
* 自 cwd 向上查找配置文件(最多 5 级;显式路径存在则直接采用)
|
|
29
|
+
*
|
|
30
|
+
* @param explicitPath - 显式指定的配置文件路径(可选)
|
|
31
|
+
* @returns 命中的绝对路径;未命中为 undefined
|
|
32
|
+
*/
|
|
33
|
+
declare function discoverConfigPath(explicitPath?: string): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* 加载并校验配置(相对路径以配置文件所在目录为基准绝对化)
|
|
36
|
+
*
|
|
37
|
+
* @param explicitPath - 显式指定的配置文件路径(可选;缺省走向上发现)
|
|
38
|
+
* @returns 成功为绝对路径形态配置与文件路径;失败为可读错误(未找到=配置文件必备违规)
|
|
39
|
+
*/
|
|
40
|
+
declare function loadKolMarkdownConfig(explicitPath?: string): Promise<ConfigLoadResult<KolMarkdownConfig>>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/scaffold.utils.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* 配置骨架生成(config init 与数据仓 init 脚手架共用)
|
|
45
|
+
*
|
|
46
|
+
* defineConfig 工厂导出形态(全局 ADR 0097 决策 2 defineXXX 收口;裸对象过渡形态
|
|
47
|
+
* 废止,参照仓 github-markdown ADR 0009 配方)。骨架依赖目标目录已安装 config 包
|
|
48
|
+
* (`@longzai-intelligence-kol-markdown/config`)——未安装处生成文件不可加载(依赖
|
|
49
|
+
* 就绪门,ADR 0100 先例)。结构仅 dataRoot 单字段(禁 version——代际由包 npm 版本
|
|
50
|
+
* 承载;台账导出根属跨项目路径,走 .env 不进配置文件,全局 ADR 0097 决策 5)。
|
|
51
|
+
* 引擎 ScaffoldTemplate 仅承载裸字面量导出形态,define 工厂包装属域形态,本模块
|
|
52
|
+
* 自持文本生成(非引擎能力分叉)。
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* 骨架入参
|
|
56
|
+
*/
|
|
57
|
+
type ScaffoldParams = {
|
|
58
|
+
/**
|
|
59
|
+
* 数据根(缺省 '.',即就地配置:配置文件放在数据根时自指)
|
|
60
|
+
*/
|
|
61
|
+
readonly dataRoot?: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* 生成配置骨架文本(defineConfig 工厂导出)
|
|
65
|
+
*
|
|
66
|
+
* @param params - 骨架入参(dataRoot 可选覆盖)
|
|
67
|
+
* @returns lzi-kol-markdown.config.ts 全文
|
|
68
|
+
*/
|
|
69
|
+
declare function scaffoldConfigText(params?: ScaffoldParams): string;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { CONFIG_FILENAME, type ConfigLoadError, type ConfigLoadOk, type ConfigLoadResult, KolMarkdownConfig, KolMarkdownConfigSchema, ScaffoldParams, defineConfig, discoverConfigPath, loadKolMarkdownConfig, scaffoldConfigText };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as e from"zod";import{createConfigKit as t}from"@longzai-intelligence-markdown/data-engine";import{resolve as n}from"node:path";const r=e.strictObject({dataRoot:e.string().min(1)});function i(e){return e}const a=`lzi-kol-markdown.config.ts`,o=t({configFilename:a,schema:r,shapeHint:`dataRoot 单字段(禁 version,代际由包 npm 版本承载;台账导出根走 .env 的 LZI_KOL_MARKDOWN_CONTENTS_EXPORT_DIR)`,absolutize:(e,t)=>({...e,dataRoot:n(t,e.dataRoot)})});function s(e){return o.discoverConfigPath(e)}async function c(e){let t=await o.loadConfig(e);return!t.ok&&t.error.code===`CONFIG_NOT_FOUND`?{ok:!1,error:{code:t.error.code,message:`配置文件必备(全局 ADR 0097 决策 9):未找到 ${a}(自 cwd 向上最多 5 级发现,或 --config 显式指定);配置文件不得缺失,.env 不作整体替代——.env 仅承载跨项目路径 LZI_KOL_MARKDOWN_CONTENTS_EXPORT_DIR`}}:t}function l(e={}){return[`// lzi-kol-markdown 就地配置(以工具命名,全局 ADR 0090;defineConfig 工厂收口,全局 ADR 0097 决策 2)。`,`// 相对路径以本文件所在目录为基准——放在数据根时 dataRoot 用 "." 即就地自指。`,`// 台账导出根走 .env 的 LZI_KOL_MARKDOWN_CONTENTS_EXPORT_DIR(跨项目路径零进入库配置,全局 ADR 0097 决策 5)。`,`import { defineConfig } from '@longzai-intelligence-kol-markdown/config';`,``,`export default defineConfig({`,` dataRoot: '${e.dataRoot??`.`}',`,`});`,``].join(`
|
|
2
|
+
`)}export{a as CONFIG_FILENAME,r as KolMarkdownConfigSchema,i as defineConfig,s as discoverConfigPath,c as loadKolMarkdownConfig,l as scaffoldConfigText};
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@longzai-intelligence-kol-markdown/config",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Longzai Intelligence KOL Markdown config - lzi-kol-markdown.config.ts 结构真源与加载器",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "lzi-builder",
|
|
18
|
+
"build:prod": "NODE_ENV=production bun run build",
|
|
19
|
+
"prepublishOnly": "bun run build:prod",
|
|
20
|
+
"typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
|
|
21
|
+
"typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
|
|
22
|
+
"typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
|
|
23
|
+
"typecheck:test": "lzi-tsgo typecheck tsconfig/test.json",
|
|
24
|
+
"lint": "oxlint && oxfmt --check",
|
|
25
|
+
"lint:fix": "oxlint --fix && oxfmt",
|
|
26
|
+
"test": "lzi-bun-cli test",
|
|
27
|
+
"test:watch": "lzi-bun-cli test --watch",
|
|
28
|
+
"test:coverage": "lzi-bun-cli test --coverage",
|
|
29
|
+
"clean": "lzi-dev-cli clean"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@longzai-intelligence-markdown/data-engine": "^0.0.1",
|
|
33
|
+
"zod": "^4.4.3"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/bun": "^1.3.14"
|
|
37
|
+
}
|
|
38
|
+
}
|