@longzai-intelligence-github-markdown/config 0.0.2
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 +14 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +2 -0
- package/dist/rolldown-runtime-BqT_7tdF.js +1 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @longzai-intelligence-github-markdown/config
|
|
2
|
+
|
|
3
|
+
Longzai Intelligence Github Markdown 的配置结构真源包,为引擎与命令行提供统一的配置契约与配置入口。
|
|
4
|
+
|
|
5
|
+
## 简介
|
|
6
|
+
|
|
7
|
+
治理本工具的配置口径:定义数据根配置项的结构契约,支持配置文件的发现、校验与初始生成,使工具仓远程与数据根就地两种运行位置共用同一份配置语义(仓 ADR 0009:配置文件必备、单字段结构、跨项目路径走 .env)。
|
|
8
|
+
|
|
9
|
+
## 能力
|
|
10
|
+
|
|
11
|
+
- 配置契约:定义数据根配置项的结构与校验规则(仅 `dataRoot` 单字段——禁 `version`,结构代际由包 npm 版本承载)
|
|
12
|
+
- 配置加载:发现并加载配置文件,校验通过后解析为统一配置对象;配置文件必备,缺失即报错不整体回落
|
|
13
|
+
- 配置生成:生成初始配置文件骨架,支持数据根就地自指形态(数据根即配置文件所在目录)
|
|
14
|
+
- 消费支撑:向引擎与命令行提供统一配置入口;本地克隆根属跨项目路径,由 `.env` 的 `LZI_GITHUB_MARKDOWN_CLONES_ROOT` 承载(字段级分工,不作整体替代)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import { ConfigLoadError, ConfigLoadOk, ConfigLoadResult } from "@longzai-intelligence-markdown/data-engine";
|
|
4
|
+
//#region src/github-markdown-config.schema.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* 配置结构(lzi-github-markdown.config.ts 默认导出形态)
|
|
7
|
+
*/
|
|
8
|
+
declare const GithubMarkdownConfigSchema: z.ZodObject<{
|
|
9
|
+
dataRoot: z.ZodString;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
/**
|
|
12
|
+
* 配置类型(schema 推断)
|
|
13
|
+
*/
|
|
14
|
+
type GithubMarkdownConfig = z.infer<typeof GithubMarkdownConfigSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* 配置工厂:类型收口 + 便于 IDE 推导
|
|
17
|
+
*
|
|
18
|
+
* @param config - 配置对象
|
|
19
|
+
* @returns 原样返回(运行时校验由加载方执行,此处 identity 语义)
|
|
20
|
+
*/
|
|
21
|
+
declare function defineGithubMarkdownConfig(config: GithubMarkdownConfig): GithubMarkdownConfig;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/loader.utils.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* 配置文件约定名(全局 ADR 0090:就地配置一律以工具命名,与 bin/env 前缀三同源)
|
|
26
|
+
*/
|
|
27
|
+
declare const CONFIG_FILENAME = "lzi-github-markdown.config.ts";
|
|
28
|
+
/**
|
|
29
|
+
* 自 cwd 向上查找配置文件(最多 5 级;显式路径存在则直接采用)
|
|
30
|
+
*
|
|
31
|
+
* @param explicitPath - 显式指定的配置文件路径(可选)
|
|
32
|
+
* @returns 命中的绝对路径;未命中为 undefined
|
|
33
|
+
*/
|
|
34
|
+
declare function discoverConfigPath(explicitPath?: string): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* 加载并校验配置(相对路径以配置文件所在目录为基准绝对化)
|
|
37
|
+
*
|
|
38
|
+
* @param explicitPath - 显式指定的配置文件路径(可选;缺省走向上发现)
|
|
39
|
+
* @returns 成功为绝对路径形态配置与文件路径;失败为可读错误(未找到=配置文件必备违规)
|
|
40
|
+
*/
|
|
41
|
+
declare function loadGithubMarkdownConfig(explicitPath?: string): Promise<ConfigLoadResult<GithubMarkdownConfig>>;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/scaffold.utils.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* 配置骨架生成(config init 用)
|
|
46
|
+
*
|
|
47
|
+
* defineGithubMarkdownConfig 工厂导出形态(全局 ADR 0097 决策 2 defineXXX 收口;
|
|
48
|
+
* 用户裁定 2026-09-25 就地配置不得为裸对象过渡形态)。骨架依赖目标目录已安装
|
|
49
|
+
* config 包(`@longzai-intelligence-github-markdown/config`)——未安装处生成文件不可加载(依赖
|
|
50
|
+
* 就绪门,ADR 0100 先例;仓 ADR 0009 勘误注记)。结构仅 dataRoot 单字段(禁
|
|
51
|
+
* version——代际由包 npm 版本承载;克隆根属跨项目路径,走 .env 不进配置文件)。
|
|
52
|
+
* 引擎 ScaffoldTemplate 仅承载裸字面量导出形态,define 工厂包装属域形态,本模块
|
|
53
|
+
* 自持文本生成(非引擎能力分叉)。
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* 骨架入参
|
|
57
|
+
*/
|
|
58
|
+
type ScaffoldParams = {
|
|
59
|
+
/**
|
|
60
|
+
* 数据根(缺省 '.',即就地配置:配置文件放在数据根时自指)
|
|
61
|
+
*/
|
|
62
|
+
readonly dataRoot?: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 生成配置骨架文本(defineGithubMarkdownConfig 工厂导出)
|
|
66
|
+
*
|
|
67
|
+
* @param params - 骨架入参(dataRoot 可选覆盖)
|
|
68
|
+
* @returns lzi-github-markdown.config.ts 全文
|
|
69
|
+
*/
|
|
70
|
+
declare function scaffoldConfigText(params?: ScaffoldParams): string;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { CONFIG_FILENAME, type ConfigLoadError, type ConfigLoadOk, type ConfigLoadResult, GithubMarkdownConfig, GithubMarkdownConfigSchema, ScaffoldParams, defineGithubMarkdownConfig, discoverConfigPath, loadGithubMarkdownConfig, scaffoldConfigText };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";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-github-markdown.config.ts`,o=t({configFilename:a,schema:r,shapeHint:`dataRoot 单字段(禁 version,代际由包 npm 版本承载;克隆根走 .env 的 LZI_GITHUB_MARKDOWN_CLONES_ROOT)`,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_GITHUB_MARKDOWN_CLONES_ROOT`}}:t}function l(e={}){return[`// lzi-github-markdown 就地配置(以工具命名,全局 ADR 0090;defineGithubMarkdownConfig 工厂收口,全局 ADR 0097 决策 2)。`,`// 相对路径以本文件所在目录为基准——放在数据根时 dataRoot 用 "." 即就地自指。`,`// 本地克隆根走 .env 的 LZI_GITHUB_MARKDOWN_CLONES_ROOT(跨项目路径零进入库配置,全局 ADR 0097 决策 5)。`,`import { defineGithubMarkdownConfig } from '@longzai-intelligence-github-markdown/config';`,``,`export default defineGithubMarkdownConfig({`,` dataRoot: '${e.dataRoot??`.`}',`,`});`,``].join(`
|
|
2
|
+
`)}export{a as CONFIG_FILENAME,r as GithubMarkdownConfigSchema,i as defineGithubMarkdownConfig,s as discoverConfigPath,c as loadGithubMarkdownConfig,l as scaffoldConfigText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:module";export{};
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@longzai-intelligence-github-markdown/config",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Longzai Intelligence Github Markdown config - lzi-github-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
|
+
}
|