@longzai-intelligence-agent-tools/core 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,9 +1,155 @@
1
+ //#region src/types.d.ts
1
2
  /**
2
- * @longzai-intelligence-agent-tools/core
3
+ * 支持的 AI Agent 类型
3
4
  *
4
- * Agent Tools 核心包,提供 Agent 类型、合成规则表与配置类型定义。
5
+ * 决定合成规则与输出目标文件。
5
6
  */
6
- export type { AgentToolsConfig, AgentType, SynthesisRule } from './types';
7
- export { DEFAULT_SOURCES } from './defaults';
8
- export { BUILTIN_PLACEHOLDERS, COMMON_SOURCE, ENV_KEYS, LZI_DIR, SYNTHESIS_RULES, VALID_AGENTS, } from './rules';
9
- //# sourceMappingURL=index.d.ts.map
7
+ type AgentType = 'claude' | 'trae' | 'zcode';
8
+ /**
9
+ * 单条合成规则
10
+ *
11
+ * 描述一个输出文件由哪些源 markdown 合成而来。
12
+ */
13
+ type SynthesisRule = {
14
+ /**
15
+ * 输出文件的相对路径
16
+ *
17
+ * 相对于项目根目录。
18
+ */
19
+ readonly output: string;
20
+ /**
21
+ * 共同部分源文件名
22
+ *
23
+ * 位于 .lzi/ 目录下,默认 'agent.md'。
24
+ */
25
+ readonly commonSource: string;
26
+ /**
27
+ * 独有部分源文件名
28
+ *
29
+ * 位于 .lzi/ 目录下,形如 'agent.<type>.md'。
30
+ */
31
+ readonly agentSource: string;
32
+ };
33
+ /**
34
+ * 配置类别
35
+ *
36
+ * .lzi/ 下的一个子目录,对应一类 IDE 指令配置。
37
+ * 扫描 .lzi/ 子目录发现,不枚举。常见值:agents / commands / rules / skills。
38
+ */
39
+ type Category = string;
40
+ /**
41
+ * 合成模式
42
+ *
43
+ * 决定共同部分与独有部分的拼接方式。
44
+ */
45
+ type SynthesisMode = 'append' | 'prepend';
46
+ /**
47
+ * 厂商规则
48
+ *
49
+ * 描述某 IDE 对某配置类别的处理方式:输出到哪个根目录、合成模式。
50
+ * 源自 docs/vendors/<ide>.md 记录的厂商真实机制。
51
+ */
52
+ type VendorRule = {
53
+ /**
54
+ * 该 IDE 的配置根目录名
55
+ *
56
+ * 如 '.claude' / '.trae' / '.zcode'。
57
+ */
58
+ readonly ideRoot: string;
59
+ /**
60
+ * 合成模式
61
+ *
62
+ * append:共同 + 独有尾部拼接(agents / commands 默认)。
63
+ * prepend:独有 frontmatter 前置到共同正文前(rules,保证 YAML 在文件首)。
64
+ */
65
+ readonly mode: SynthesisMode;
66
+ };
67
+ /**
68
+ * 类别同步规则
69
+ *
70
+ * 描述某类别在各 IDE 下的厂商规则。
71
+ */
72
+ type CategoryRule = Readonly<Record<AgentType, VendorRule>>;
73
+ /**
74
+ * Agent Tools 配置
75
+ *
76
+ * 通过 lzi.config.ts 的 agentTools 字段提供。
77
+ */
78
+ type AgentToolsConfig = {
79
+ /**
80
+ * 占位符值
81
+ *
82
+ * 替换源 markdown 中的 {{KEY}}。机器特定绝对路径应写在此处。
83
+ */
84
+ readonly placeholders?: Record<string, string>;
85
+ };
86
+ //#endregion
87
+ //#region src/defaults.d.ts
88
+ /**
89
+ * 源文件名 → 默认骨架内容映射
90
+ *
91
+ * init 命令遍历此映射创建文件。
92
+ */
93
+ declare const DEFAULT_SOURCES: Readonly<Record<string, string>>;
94
+ //#endregion
95
+ //#region src/rules.d.ts
96
+ /**
97
+ * 工作区源文件目录
98
+ *
99
+ * 所有工具的源文件放在此目录下,按前缀命名空间区分。
100
+ */
101
+ declare const LZI_DIR: '.lzi';
102
+ /**
103
+ * 共同部分源文件名(根指令文件)
104
+ *
105
+ * 位于 .lzi/agents/ 目录下。
106
+ */
107
+ declare const COMMON_SOURCE: 'agents/agent.md';
108
+ /**
109
+ * 各 IDE 的配置根目录名
110
+ *
111
+ * IDE 读取指令文件的根目录,源自 docs/vendors/<ide>.md。
112
+ */
113
+ declare const IDE_OUTPUT_DIRS: Readonly<Record<AgentType, string>>;
114
+ /**
115
+ * 内置合成规则表
116
+ *
117
+ * 每个 Agent 对应一条或多条合成规则,每条规则描述一个输出文件由
118
+ * agents/agent.md(共同部分)+ agents/agent.<type>.md(独有部分)合成而来。
119
+ *
120
+ * 规则固定不可配,确保所有项目的合成行为一致。
121
+ */
122
+ declare const SYNTHESIS_RULES: Readonly<Record<AgentType, readonly SynthesisRule[]>>;
123
+ /**
124
+ * 类别厂商规则表
125
+ *
126
+ * 描述某配置类别在各 IDE 下的处理方式(输出根目录、合成模式)。
127
+ * 源自 docs/vendors/<ide>.md 记录的厂商真实机制,固定不可配。
128
+ *
129
+ * 类别由扫描 .lzi/ 子目录发现,此表为已知类别提供厂商规则。
130
+ * 新增类别需在此表补条目(对齐 vendors 文档),不在此表的类别跳过分发。
131
+ */
132
+ declare const CATEGORY_RULES: Readonly<Record<string, CategoryRule>>;
133
+ /**
134
+ * 所有合法的 Agent 类型值
135
+ *
136
+ * 用于校验环境变量 LZI_AGENT_TYPE。
137
+ */
138
+ declare const VALID_AGENTS: readonly AgentType[];
139
+ /**
140
+ * 环境变量名称常量
141
+ */
142
+ declare const ENV_KEYS: {
143
+ /** 当前 Agent 类型 */
144
+ readonly AGENT_TYPE: 'LZI_AGENT_TYPE';
145
+ /** 占位符环境变量前缀 */
146
+ readonly PLACEHOLDER_PREFIX: 'LZI_PLACEHOLDER_';
147
+ };
148
+ /**
149
+ * 内置占位符
150
+ *
151
+ * 始终可用,无需在配置中声明。
152
+ */
153
+ declare const BUILTIN_PLACEHOLDERS: Readonly<Record<string, () => string>>;
154
+ //#endregion
155
+ export { type AgentToolsConfig, type AgentType, BUILTIN_PLACEHOLDERS, CATEGORY_RULES, COMMON_SOURCE, type Category, type CategoryRule, DEFAULT_SOURCES, ENV_KEYS, IDE_OUTPUT_DIRS, LZI_DIR, SYNTHESIS_RULES, type SynthesisMode, type SynthesisRule, VALID_AGENTS, type VendorRule };
package/dist/index.js CHANGED
@@ -1,8 +1,42 @@
1
- /**
2
- * @longzai-intelligence-agent-tools/core
3
- *
4
- * Agent Tools 核心包,提供 Agent 类型、合成规则表与配置类型定义。
5
- */
6
- export { DEFAULT_SOURCES } from './defaults';
7
- export { BUILTIN_PLACEHOLDERS, COMMON_SOURCE, ENV_KEYS, LZI_DIR, SYNTHESIS_RULES, VALID_AGENTS, } from './rules';
8
- //# sourceMappingURL=index.js.map
1
+ const e={"agents/agent.md":`# 共同部分
2
+
3
+ 所有 AI IDE 都会读取此文件的内容。此文件与各 IDE 独有部分(agent.<ide>.md)拼接后,
4
+ 分别输出为 CLAUDE.md / AGENTS.md。
5
+
6
+ ## 项目上下文
7
+
8
+ - LZI项目特指: {{LZI_ROOT}}/longzai-intelligence
9
+
10
+ ## 语言
11
+
12
+ - 日志、错误、注释、测试描述都要使用中文。
13
+
14
+ ## 技术栈
15
+
16
+ - Bun / Bunx / OxLint / OxFmt
17
+ - 禁止使用: npm, pnpm, yarn, npx, pnpx
18
+ - 禁止使用: rm -rf
19
+ `,"agents/agent.claude.md":`# Claude 专属指令
20
+
21
+ 此文件的内容仅出现在 CLAUDE.md 中(claude 和 trae 场景)。
22
+
23
+ <!-- 在此添加 Claude 专属的指令 -->
24
+ `,"agents/agent.trae.md":`# Trae 专属指令
25
+
26
+ 此文件的内容仅出现在 trae 场景的 AGENTS.md 中。
27
+
28
+ <!-- 在此添加 Trae 专属的指令 -->
29
+ `,"agents/agent.zcode.md":`# ZCode 专属指令
30
+
31
+ 此文件的内容仅出现在 zcode 场景的 AGENTS.md 中。
32
+
33
+ <!-- 在此添加 ZCode 专属的指令 -->
34
+ `,"commands/.gitkeep":`# 此目录存放自定义命令真源
35
+ # 命名约定:<base>.md(共同)+ <base>.<type>.md(某 IDE 独有)
36
+ # 子目录原样分发到各 IDE 的 commands/ 目录
37
+ `,"rules/.gitkeep":`# 此目录存放项目规则真源
38
+ # 命名约定:<base>.md(共同正文)+ <base>.<type>.md(某 IDE 独有 frontmatter)
39
+ # frontmatter 各 IDE 不同(claude paths / trae alwaysApply+globs),见 docs/vendors/
40
+ `,"skills/.gitkeep":`# 此目录存放技能真源
41
+ # 命名约定:<base>.md(共同)+ <base>.<type>.md(某 IDE 独有)
42
+ `},t=`.lzi`,n=`agents/agent.md`,r={claude:`.claude`,trae:`.trae`,zcode:`.zcode`},i={claude:[{output:`CLAUDE.md`,commonSource:n,agentSource:`agents/agent.claude.md`}],trae:[{output:`CLAUDE.md`,commonSource:n,agentSource:`agents/agent.claude.md`},{output:`AGENTS.md`,commonSource:n,agentSource:`agents/agent.trae.md`}],zcode:[{output:`AGENTS.md`,commonSource:n,agentSource:`agents/agent.zcode.md`}]},a={commands:{claude:{ideRoot:r.claude,mode:`append`},trae:{ideRoot:r.trae,mode:`append`},zcode:{ideRoot:r.zcode,mode:`append`}},rules:{claude:{ideRoot:r.claude,mode:`prepend`},trae:{ideRoot:r.trae,mode:`prepend`},zcode:{ideRoot:r.zcode,mode:`prepend`}},skills:{claude:{ideRoot:r.claude,mode:`append`},trae:{ideRoot:r.trae,mode:`append`},zcode:{ideRoot:r.zcode,mode:`append`}}},o=[`claude`,`trae`,`zcode`],s={AGENT_TYPE:`LZI_AGENT_TYPE`,PLACEHOLDER_PREFIX:`LZI_PLACEHOLDER_`},c={DATE:()=>new Date().toISOString().slice(0,10),PROJECT_NAME:()=>process.cwd().split(`/`).pop()??``};export{c as BUILTIN_PLACEHOLDERS,a as CATEGORY_RULES,n as COMMON_SOURCE,e as DEFAULT_SOURCES,s as ENV_KEYS,r as IDE_OUTPUT_DIRS,t as LZI_DIR,i as SYNTHESIS_RULES,o as VALID_AGENTS};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-agent-tools/core",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -16,8 +16,8 @@
16
16
  "dist"
17
17
  ],
18
18
  "scripts": {
19
- "build": "tsgo --build tsconfig/build.json && resolve-aliases -p tsconfig/build.json",
20
- "build:prod": "NODE_ENV=production bun run build",
19
+ "build": "lzi-builder",
20
+ "build:prod": "NODE_ENV=production lzi-builder",
21
21
  "prepublishOnly": "bun run build:prod",
22
22
  "typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
23
23
  "typecheck:app": "tsgo --noEmit -p tsconfig/app.json",
@@ -28,7 +28,7 @@
28
28
  "test": "bun test",
29
29
  "test:watch": "bun test --watch",
30
30
  "test:coverage": "bun test --coverage",
31
- "clean": "rimraf dist out .cache"
31
+ "clean": "lzi-dev-cli clean"
32
32
  },
33
33
  "dependencies": {}
34
34
  }
@@ -1,36 +0,0 @@
1
- /**
2
- * init 命令生成的源文件默认骨架
3
- *
4
- * 每个源文件创建时的初始内容,引导用户填写。
5
- */
6
- /**
7
- * 共同部分骨架
8
- *
9
- * 所有 IDE 都会读取的指令,写入 .lzi/agent.md。
10
- */
11
- export declare const DEFAULT_AGENT_MD = "# \u5171\u540C\u90E8\u5206\n\n\u6240\u6709 AI IDE \u90FD\u4F1A\u8BFB\u53D6\u6B64\u6587\u4EF6\u7684\u5185\u5BB9\u3002\u6B64\u6587\u4EF6\u4E0E\u5404 IDE \u72EC\u6709\u90E8\u5206\uFF08agent.<ide>.md\uFF09\u62FC\u63A5\u540E\uFF0C\n\u5206\u522B\u8F93\u51FA\u4E3A CLAUDE.md / AGENTS.md\u3002\n\n## \u9879\u76EE\u4E0A\u4E0B\u6587\n\n- LZI\u9879\u76EE\u7279\u6307: {{LZI_ROOT}}/longzai-intelligence\n\n## \u8BED\u8A00\n\n- \u65E5\u5FD7\u3001\u9519\u8BEF\u3001\u6CE8\u91CA\u3001\u6D4B\u8BD5\u63CF\u8FF0\u90FD\u8981\u4F7F\u7528\u4E2D\u6587\u3002\n\n## \u6280\u672F\u6808\n\n- Bun / Bunx / OxLint / OxFmt\n- \u7981\u6B62\u4F7F\u7528: npm, pnpm, yarn, npx, pnpx\n- \u7981\u6B62\u4F7F\u7528: rm -rf\n";
12
- /**
13
- * claude 独有部分骨架
14
- *
15
- * 写入 .lzi/agent.claude.md,仅 claude 和 trae 场景输出的 CLAUDE.md 会包含此内容。
16
- */
17
- export declare const DEFAULT_AGENT_CLAUDE_MD = "# Claude \u4E13\u5C5E\u6307\u4EE4\n\n\u6B64\u6587\u4EF6\u7684\u5185\u5BB9\u4EC5\u51FA\u73B0\u5728 CLAUDE.md \u4E2D\uFF08claude \u548C trae \u573A\u666F\uFF09\u3002\n\n<!-- \u5728\u6B64\u6DFB\u52A0 Claude \u4E13\u5C5E\u7684\u6307\u4EE4 -->\n";
18
- /**
19
- * trae 独有部分骨架
20
- *
21
- * 写入 .lzi/agent.trae.md,仅 trae 场景输出的 AGENTS.md 会包含此内容。
22
- */
23
- export declare const DEFAULT_AGENT_TRAE_MD = "# Trae \u4E13\u5C5E\u6307\u4EE4\n\n\u6B64\u6587\u4EF6\u7684\u5185\u5BB9\u4EC5\u51FA\u73B0\u5728 trae \u573A\u666F\u7684 AGENTS.md \u4E2D\u3002\n\n<!-- \u5728\u6B64\u6DFB\u52A0 Trae \u4E13\u5C5E\u7684\u6307\u4EE4 -->\n";
24
- /**
25
- * zcode 独有部分骨架
26
- *
27
- * 写入 .lzi/agent.zcode.md,仅 zcode 场景输出的 AGENTS.md 会包含此内容。
28
- */
29
- export declare const DEFAULT_AGENT_ZCODE_MD = "# ZCode \u4E13\u5C5E\u6307\u4EE4\n\n\u6B64\u6587\u4EF6\u7684\u5185\u5BB9\u4EC5\u51FA\u73B0\u5728 zcode \u573A\u666F\u7684 AGENTS.md \u4E2D\u3002\n\n<!-- \u5728\u6B64\u6DFB\u52A0 ZCode \u4E13\u5C5E\u7684\u6307\u4EE4 -->\n";
30
- /**
31
- * 源文件名 → 默认骨架内容映射
32
- *
33
- * init 命令遍历此映射创建文件。
34
- */
35
- export declare const DEFAULT_SOURCES: Readonly<Record<string, string>>;
36
- //# sourceMappingURL=defaults.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,orBAkB5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,qPAKnC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,8NAKjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,iOAKlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKnD,CAAC"}
package/dist/defaults.js DELETED
@@ -1,74 +0,0 @@
1
- /**
2
- * init 命令生成的源文件默认骨架
3
- *
4
- * 每个源文件创建时的初始内容,引导用户填写。
5
- */
6
- /**
7
- * 共同部分骨架
8
- *
9
- * 所有 IDE 都会读取的指令,写入 .lzi/agent.md。
10
- */
11
- export const DEFAULT_AGENT_MD = `# 共同部分
12
-
13
- 所有 AI IDE 都会读取此文件的内容。此文件与各 IDE 独有部分(agent.<ide>.md)拼接后,
14
- 分别输出为 CLAUDE.md / AGENTS.md。
15
-
16
- ## 项目上下文
17
-
18
- - LZI项目特指: {{LZI_ROOT}}/longzai-intelligence
19
-
20
- ## 语言
21
-
22
- - 日志、错误、注释、测试描述都要使用中文。
23
-
24
- ## 技术栈
25
-
26
- - Bun / Bunx / OxLint / OxFmt
27
- - 禁止使用: npm, pnpm, yarn, npx, pnpx
28
- - 禁止使用: rm -rf
29
- `;
30
- /**
31
- * claude 独有部分骨架
32
- *
33
- * 写入 .lzi/agent.claude.md,仅 claude 和 trae 场景输出的 CLAUDE.md 会包含此内容。
34
- */
35
- export const DEFAULT_AGENT_CLAUDE_MD = `# Claude 专属指令
36
-
37
- 此文件的内容仅出现在 CLAUDE.md 中(claude 和 trae 场景)。
38
-
39
- <!-- 在此添加 Claude 专属的指令 -->
40
- `;
41
- /**
42
- * trae 独有部分骨架
43
- *
44
- * 写入 .lzi/agent.trae.md,仅 trae 场景输出的 AGENTS.md 会包含此内容。
45
- */
46
- export const DEFAULT_AGENT_TRAE_MD = `# Trae 专属指令
47
-
48
- 此文件的内容仅出现在 trae 场景的 AGENTS.md 中。
49
-
50
- <!-- 在此添加 Trae 专属的指令 -->
51
- `;
52
- /**
53
- * zcode 独有部分骨架
54
- *
55
- * 写入 .lzi/agent.zcode.md,仅 zcode 场景输出的 AGENTS.md 会包含此内容。
56
- */
57
- export const DEFAULT_AGENT_ZCODE_MD = `# ZCode 专属指令
58
-
59
- 此文件的内容仅出现在 zcode 场景的 AGENTS.md 中。
60
-
61
- <!-- 在此添加 ZCode 专属的指令 -->
62
- `;
63
- /**
64
- * 源文件名 → 默认骨架内容映射
65
- *
66
- * init 命令遍历此映射创建文件。
67
- */
68
- export const DEFAULT_SOURCES = {
69
- 'agent.md': DEFAULT_AGENT_MD,
70
- 'agent.claude.md': DEFAULT_AGENT_CLAUDE_MD,
71
- 'agent.trae.md': DEFAULT_AGENT_TRAE_MD,
72
- 'agent.zcode.md': DEFAULT_AGENT_ZCODE_MD,
73
- };
74
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;CAkB/B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;CAKtC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;CAKpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;CAKrC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAqC;IAC/D,UAAU,EAAE,gBAAgB;IAC5B,iBAAiB,EAAE,uBAAuB;IAC1C,eAAe,EAAE,qBAAqB;IACtC,gBAAgB,EAAE,sBAAsB;CAChC,CAAC","sourcesContent":["/**\n * init 命令生成的源文件默认骨架\n *\n * 每个源文件创建时的初始内容,引导用户填写。\n */\n\n/**\n * 共同部分骨架\n *\n * 所有 IDE 都会读取的指令,写入 .lzi/agent.md。\n */\nexport const DEFAULT_AGENT_MD = `# 共同部分\n\n所有 AI IDE 都会读取此文件的内容。此文件与各 IDE 独有部分(agent.<ide>.md)拼接后,\n分别输出为 CLAUDE.md / AGENTS.md。\n\n## 项目上下文\n\n- LZI项目特指: {{LZI_ROOT}}/longzai-intelligence\n\n## 语言\n\n- 日志、错误、注释、测试描述都要使用中文。\n\n## 技术栈\n\n- Bun / Bunx / OxLint / OxFmt\n- 禁止使用: npm, pnpm, yarn, npx, pnpx\n- 禁止使用: rm -rf\n`;\n\n/**\n * claude 独有部分骨架\n *\n * 写入 .lzi/agent.claude.md,仅 claude 和 trae 场景输出的 CLAUDE.md 会包含此内容。\n */\nexport const DEFAULT_AGENT_CLAUDE_MD = `# Claude 专属指令\n\n此文件的内容仅出现在 CLAUDE.md 中(claude 和 trae 场景)。\n\n<!-- 在此添加 Claude 专属的指令 -->\n`;\n\n/**\n * trae 独有部分骨架\n *\n * 写入 .lzi/agent.trae.md,仅 trae 场景输出的 AGENTS.md 会包含此内容。\n */\nexport const DEFAULT_AGENT_TRAE_MD = `# Trae 专属指令\n\n此文件的内容仅出现在 trae 场景的 AGENTS.md 中。\n\n<!-- 在此添加 Trae 专属的指令 -->\n`;\n\n/**\n * zcode 独有部分骨架\n *\n * 写入 .lzi/agent.zcode.md,仅 zcode 场景输出的 AGENTS.md 会包含此内容。\n */\nexport const DEFAULT_AGENT_ZCODE_MD = `# ZCode 专属指令\n\n此文件的内容仅出现在 zcode 场景的 AGENTS.md 中。\n\n<!-- 在此添加 ZCode 专属的指令 -->\n`;\n\n/**\n * 源文件名 → 默认骨架内容映射\n *\n * init 命令遍历此映射创建文件。\n */\nexport const DEFAULT_SOURCES: Readonly<Record<string, string>> = {\n 'agent.md': DEFAULT_AGENT_MD,\n 'agent.claude.md': DEFAULT_AGENT_CLAUDE_MD,\n 'agent.trae.md': DEFAULT_AGENT_TRAE_MD,\n 'agent.zcode.md': DEFAULT_AGENT_ZCODE_MD,\n} as const;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,OAAO,EACP,eAAe,EACf,YAAY,GACb,MAAM,SAAS,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,OAAO,EACP,eAAe,EACf,YAAY,GACb,MAAM,SAAS,CAAC","sourcesContent":["/**\n * @longzai-intelligence-agent-tools/core\n *\n * Agent Tools 核心包,提供 Agent 类型、合成规则表与配置类型定义。\n */\n\nexport type { AgentToolsConfig, AgentType, SynthesisRule } from '@/types';\n\nexport { DEFAULT_SOURCES } from '@/defaults';\n\nexport {\n BUILTIN_PLACEHOLDERS,\n COMMON_SOURCE,\n ENV_KEYS,\n LZI_DIR,\n SYNTHESIS_RULES,\n VALID_AGENTS,\n} from '@/rules';\n"]}
package/dist/rules.d.ts DELETED
@@ -1,42 +0,0 @@
1
- import type { AgentType, SynthesisRule } from './types';
2
- /**
3
- * 工作区源文件目录
4
- *
5
- * 所有工具的源文件放在此目录下,按前缀命名空间区分。
6
- */
7
- export declare const LZI_DIR: '.lzi';
8
- /**
9
- * 共同部分源文件名
10
- */
11
- export declare const COMMON_SOURCE: 'agent.md';
12
- /**
13
- * 内置合成规则表
14
- *
15
- * 每个 Agent 对应一条或多条合成规则,每条规则描述一个输出文件由
16
- * agent.md(共同部分)+ agent.<type>.md(独有部分)合成而来。
17
- *
18
- * 规则固定不可配,确保所有项目的合成行为一致。
19
- */
20
- export declare const SYNTHESIS_RULES: Readonly<Record<AgentType, readonly SynthesisRule[]>>;
21
- /**
22
- * 所有合法的 Agent 类型值
23
- *
24
- * 用于校验环境变量 LZI_AGENT_TYPE。
25
- */
26
- export declare const VALID_AGENTS: readonly AgentType[];
27
- /**
28
- * 环境变量名称常量
29
- */
30
- export declare const ENV_KEYS: {
31
- /** 当前 Agent 类型 */
32
- readonly AGENT_TYPE: 'LZI_AGENT_TYPE';
33
- /** 占位符环境变量前缀 */
34
- readonly PLACEHOLDER_PREFIX: 'LZI_PLACEHOLDER_';
35
- };
36
- /**
37
- * 内置占位符
38
- *
39
- * 始终可用,无需在配置中声明。
40
- */
41
- export declare const BUILTIN_PLACEHOLDERS: Readonly<Record<string, () => string>>;
42
- //# sourceMappingURL=rules.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAG,MAAe,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,aAAa,EAAG,UAAmB,CAAC;AAEjD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC,CAsCxE,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,SAAS,EAAyC,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB,kBAAkB;aAClB,UAAU,EAAE,gBAAgB;IAC5B,gBAAgB;aAChB,kBAAkB,EAAE,kBAAkB;CAC9B,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC,CAG9D,CAAC"}
package/dist/rules.js DELETED
@@ -1,80 +0,0 @@
1
- /**
2
- * 工作区源文件目录
3
- *
4
- * 所有工具的源文件放在此目录下,按前缀命名空间区分。
5
- */
6
- export const LZI_DIR = '.lzi';
7
- /**
8
- * 共同部分源文件名
9
- */
10
- export const COMMON_SOURCE = 'agent.md';
11
- /**
12
- * 内置合成规则表
13
- *
14
- * 每个 Agent 对应一条或多条合成规则,每条规则描述一个输出文件由
15
- * agent.md(共同部分)+ agent.<type>.md(独有部分)合成而来。
16
- *
17
- * 规则固定不可配,确保所有项目的合成行为一致。
18
- */
19
- export const SYNTHESIS_RULES = {
20
- /**
21
- * claude:仅输出 CLAUDE.md
22
- */
23
- claude: [
24
- {
25
- output: 'CLAUDE.md',
26
- commonSource: COMMON_SOURCE,
27
- agentSource: 'agent.claude.md',
28
- },
29
- ],
30
- /**
31
- * trae:同时输出 CLAUDE.md 和 AGENTS.md
32
- */
33
- trae: [
34
- {
35
- output: 'CLAUDE.md',
36
- commonSource: COMMON_SOURCE,
37
- agentSource: 'agent.claude.md',
38
- },
39
- {
40
- output: 'AGENTS.md',
41
- commonSource: COMMON_SOURCE,
42
- agentSource: 'agent.trae.md',
43
- },
44
- ],
45
- /**
46
- * zcode:仅输出 AGENTS.md
47
- */
48
- zcode: [
49
- {
50
- output: 'AGENTS.md',
51
- commonSource: COMMON_SOURCE,
52
- agentSource: 'agent.zcode.md',
53
- },
54
- ],
55
- };
56
- /**
57
- * 所有合法的 Agent 类型值
58
- *
59
- * 用于校验环境变量 LZI_AGENT_TYPE。
60
- */
61
- export const VALID_AGENTS = ['claude', 'trae', 'zcode'];
62
- /**
63
- * 环境变量名称常量
64
- */
65
- export const ENV_KEYS = {
66
- /** 当前 Agent 类型 */
67
- AGENT_TYPE: 'LZI_AGENT_TYPE',
68
- /** 占位符环境变量前缀 */
69
- PLACEHOLDER_PREFIX: 'LZI_PLACEHOLDER_',
70
- };
71
- /**
72
- * 内置占位符
73
- *
74
- * 始终可用,无需在配置中声明。
75
- */
76
- export const BUILTIN_PLACEHOLDERS = {
77
- DATE: () => new Date().toISOString().slice(0, 10),
78
- PROJECT_NAME: () => process.cwd().split('/').pop() ?? '',
79
- };
80
- //# sourceMappingURL=rules.js.map
package/dist/rules.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAmB,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAA0D;IACpF;;OAEG;IACH,MAAM,EAAE;QACN;YACE,MAAM,EAAE,WAAW;YACnB,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,iBAAiB;SAC/B;KACF;IAED;;OAEG;IACH,IAAI,EAAE;QACJ;YACE,MAAM,EAAE,WAAW;YACnB,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,iBAAiB;SAC/B;QACD;YACE,MAAM,EAAE,WAAW;YACnB,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,eAAe;SAC7B;KACF;IAED;;OAEG;IACH,KAAK,EAAE;QACL;YACE,MAAM,EAAE,WAAW;YACnB,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,gBAAgB;SAC9B;KACF;CACO,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,kBAAkB;IAClB,UAAU,EAAE,gBAAgB;IAC5B,gBAAgB;IAChB,kBAAkB,EAAE,kBAAkB;CAC9B,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA2C;IAC1E,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;IACjD,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE;CAChD,CAAC","sourcesContent":["import type { AgentType, SynthesisRule } from '@/types';\n\n/**\n * 工作区源文件目录\n *\n * 所有工具的源文件放在此目录下,按前缀命名空间区分。\n */\nexport const LZI_DIR = '.lzi' as const;\n\n/**\n * 共同部分源文件名\n */\nexport const COMMON_SOURCE = 'agent.md' as const;\n\n/**\n * 内置合成规则表\n *\n * 每个 Agent 对应一条或多条合成规则,每条规则描述一个输出文件由\n * agent.md(共同部分)+ agent.<type>.md(独有部分)合成而来。\n *\n * 规则固定不可配,确保所有项目的合成行为一致。\n */\nexport const SYNTHESIS_RULES: Readonly<Record<AgentType, readonly SynthesisRule[]>> = {\n /**\n * claude:仅输出 CLAUDE.md\n */\n claude: [\n {\n output: 'CLAUDE.md',\n commonSource: COMMON_SOURCE,\n agentSource: 'agent.claude.md',\n },\n ],\n\n /**\n * trae:同时输出 CLAUDE.md 和 AGENTS.md\n */\n trae: [\n {\n output: 'CLAUDE.md',\n commonSource: COMMON_SOURCE,\n agentSource: 'agent.claude.md',\n },\n {\n output: 'AGENTS.md',\n commonSource: COMMON_SOURCE,\n agentSource: 'agent.trae.md',\n },\n ],\n\n /**\n * zcode:仅输出 AGENTS.md\n */\n zcode: [\n {\n output: 'AGENTS.md',\n commonSource: COMMON_SOURCE,\n agentSource: 'agent.zcode.md',\n },\n ],\n} as const;\n\n/**\n * 所有合法的 Agent 类型值\n *\n * 用于校验环境变量 LZI_AGENT_TYPE。\n */\nexport const VALID_AGENTS: readonly AgentType[] = ['claude', 'trae', 'zcode'] as const;\n\n/**\n * 环境变量名称常量\n */\nexport const ENV_KEYS = {\n /** 当前 Agent 类型 */\n AGENT_TYPE: 'LZI_AGENT_TYPE',\n /** 占位符环境变量前缀 */\n PLACEHOLDER_PREFIX: 'LZI_PLACEHOLDER_',\n} as const;\n\n/**\n * 内置占位符\n *\n * 始终可用,无需在配置中声明。\n */\nexport const BUILTIN_PLACEHOLDERS: Readonly<Record<string, () => string>> = {\n DATE: () => new Date().toISOString().slice(0, 10),\n PROJECT_NAME: () => process.cwd().split('/').pop() ?? '',\n} as const;\n"]}
package/dist/types.d.ts DELETED
@@ -1,45 +0,0 @@
1
- /**
2
- * 支持的 AI Agent 类型
3
- *
4
- * 决定合成规则与输出目标文件。
5
- */
6
- export type AgentType = 'claude' | 'trae' | 'zcode';
7
- /**
8
- * 单条合成规则
9
- *
10
- * 描述一个输出文件由哪些源 markdown 合成而来。
11
- */
12
- export type SynthesisRule = {
13
- /**
14
- * 输出文件的相对路径
15
- *
16
- * 相对于项目根目录。
17
- */
18
- readonly output: string;
19
- /**
20
- * 共同部分源文件名
21
- *
22
- * 位于 .lzi/ 目录下,默认 'agent.md'。
23
- */
24
- readonly commonSource: string;
25
- /**
26
- * 独有部分源文件名
27
- *
28
- * 位于 .lzi/ 目录下,形如 'agent.<type>.md'。
29
- */
30
- readonly agentSource: string;
31
- };
32
- /**
33
- * Agent Tools 配置
34
- *
35
- * 通过 lzi.config.ts 的 agentTools 字段提供。
36
- */
37
- export type AgentToolsConfig = {
38
- /**
39
- * 占位符值
40
- *
41
- * 替换源 markdown 中的 {{KEY}}。机器特定绝对路径应写在此处。
42
- */
43
- readonly placeholders?: Record<string, string>;
44
- };
45
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD,CAAC"}
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * 支持的 AI Agent 类型\n *\n * 决定合成规则与输出目标文件。\n */\nexport type AgentType = 'claude' | 'trae' | 'zcode';\n\n/**\n * 单条合成规则\n *\n * 描述一个输出文件由哪些源 markdown 合成而来。\n */\nexport type SynthesisRule = {\n /**\n * 输出文件的相对路径\n *\n * 相对于项目根目录。\n */\n readonly output: string;\n\n /**\n * 共同部分源文件名\n *\n * 位于 .lzi/ 目录下,默认 'agent.md'。\n */\n readonly commonSource: string;\n\n /**\n * 独有部分源文件名\n *\n * 位于 .lzi/ 目录下,形如 'agent.<type>.md'。\n */\n readonly agentSource: string;\n};\n\n/**\n * Agent Tools 配置\n *\n * 通过 lzi.config.ts 的 agentTools 字段提供。\n */\nexport type AgentToolsConfig = {\n /**\n * 占位符值\n *\n * 替换源 markdown 中的 {{KEY}}。机器特定绝对路径应写在此处。\n */\n readonly placeholders?: Record<string, string>;\n};\n"]}