@longzai-intelligence-agent-tools/core 0.0.6 → 0.0.7
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 +29 -1
- package/dist/index.js +2 -2
- package/dist/rolldown-runtime-BqT_7tdF.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
1
2
|
//#region src/types.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* 支持的 AI Agent 类型
|
|
@@ -76,6 +77,13 @@ type CategoryRule = Readonly<Record<AgentType, VendorRule>>;
|
|
|
76
77
|
* 通过 lzi.config.ts 的 agentTools 字段提供。
|
|
77
78
|
*/
|
|
78
79
|
type AgentToolsConfig = {
|
|
80
|
+
/**
|
|
81
|
+
* 目标 Agent 类型输入串
|
|
82
|
+
*
|
|
83
|
+
* 支持单值(claude)、多值(逗号分隔,如 claude,trae)或 auto(按真源推断)。
|
|
84
|
+
* 优先级低于环境变量 LZI_AGENT_TYPE,高于默认 auto。
|
|
85
|
+
*/
|
|
86
|
+
readonly agentType?: string;
|
|
79
87
|
/**
|
|
80
88
|
* 占位符值
|
|
81
89
|
*
|
|
@@ -122,6 +130,7 @@ declare const GENERATED_FILE_SUFFIX: '.generated';
|
|
|
122
130
|
* 根指令文件入口引导文本
|
|
123
131
|
*
|
|
124
132
|
* 根指令文件(CLAUDE.md / AGENTS.md)生成两份:
|
|
133
|
+
*
|
|
125
134
|
* 1. <原名>.generated.md:真正的合成产物(共同 + 独有内容),文件名带后缀标识。
|
|
126
135
|
* 2. <原名>(如 CLAUDE.md):入口文件,正文为此引导文本,指向对应的 .generated.md。
|
|
127
136
|
*
|
|
@@ -173,5 +182,24 @@ declare const ENV_KEYS: {
|
|
|
173
182
|
* 始终可用,无需在配置中声明。
|
|
174
183
|
*/
|
|
175
184
|
declare const BUILTIN_PLACEHOLDERS: Readonly<Record<string, () => string>>;
|
|
185
|
+
/**
|
|
186
|
+
* auto 关键词
|
|
187
|
+
*
|
|
188
|
+
* 当 LZI_AGENT_TYPE / --agent / lzi.config.ts.agentType 未配置时,默认进入 auto 模式,
|
|
189
|
+
* 由 detectAgentTypes 按真源自动推断目标 Agent 集合。auto 与显式 type 值互斥,不可混用。
|
|
190
|
+
*/
|
|
191
|
+
declare const AUTO_AGENT_KEYWORD: 'auto';
|
|
192
|
+
/**
|
|
193
|
+
* 按真源自动推断目标 Agent 类型集合
|
|
194
|
+
*
|
|
195
|
+
* 遍历 VALID_AGENTS,对每个 type 检查其 SYNTHESIS_RULES 中任一规则的 agentSource
|
|
196
|
+
* (即 agents/agent.<type>.md)是否存在;存在则纳入。返回按 VALID_AGENTS 固定顺序的结果。
|
|
197
|
+
*
|
|
198
|
+
* 用于 auto 模式:用户未显式指定时,按 .lzi/ 实际真源决定为哪些 IDE 生成产物。
|
|
199
|
+
*
|
|
200
|
+
* @param projectRoot - 项目根目录绝对路径
|
|
201
|
+
* @returns 推断出的目标 Agent 类型集合(按 VALID_AGENTS 顺序)
|
|
202
|
+
*/
|
|
203
|
+
declare const detectAgentTypes: (projectRoot: string) => Promise<readonly AgentType[]>;
|
|
176
204
|
//#endregion
|
|
177
|
-
export { type AgentToolsConfig, type AgentType, BUILTIN_PLACEHOLDERS, CATEGORY_RULES, COMMON_SOURCE, type Category, type CategoryRule, DEFAULT_SOURCES, ENV_KEYS, GENERATED_FILE_SUFFIX, IDE_OUTPUT_DIRS, LZI_DIR, ROOT_ENTRY_TEMPLATE, SYNTHESIS_RULES, type SynthesisMode, type SynthesisRule, VALID_AGENTS, type VendorRule };
|
|
205
|
+
export { AUTO_AGENT_KEYWORD, type AgentToolsConfig, type AgentType, BUILTIN_PLACEHOLDERS, CATEGORY_RULES, COMMON_SOURCE, type Category, type CategoryRule, DEFAULT_SOURCES, ENV_KEYS, GENERATED_FILE_SUFFIX, IDE_OUTPUT_DIRS, LZI_DIR, ROOT_ENTRY_TEMPLATE, SYNTHESIS_RULES, type SynthesisMode, type SynthesisRule, VALID_AGENTS, type VendorRule, detectAgentTypes };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{stat as e}from"node:fs/promises";import{join as t}from"node:path";const n={"agents/agent.md":`# 共同部分
|
|
2
2
|
|
|
3
3
|
所有 AI IDE 都会读取此文件的内容。此文件与各 IDE 独有部分(agent.<ide>.md)拼接后,
|
|
4
4
|
分别输出为 CLAUDE.md / AGENTS.md。
|
|
@@ -39,4 +39,4 @@ const e={"agents/agent.md":`# 共同部分
|
|
|
39
39
|
# frontmatter 各 IDE 不同(claude paths / trae alwaysApply+globs),见 docs/vendors/
|
|
40
40
|
`,"skills/.gitkeep":`# 此目录存放技能真源
|
|
41
41
|
# 命名约定:<base>.md(共同)+ <base>.<type>.md(某 IDE 独有)
|
|
42
|
-
`},
|
|
42
|
+
`},r=`.lzi`,i=`agents/agent.md`,a={claude:`.claude`,trae:`.trae`,zcode:`.zcode`},o=`.generated`,s=`必须阅读 {{generatedFile}}。`,c={claude:[{output:`CLAUDE.md`,commonSource:i,agentSource:`agents/agent.claude.md`}],trae:[{output:`CLAUDE.md`,commonSource:i,agentSource:`agents/agent.claude.md`},{output:`AGENTS.md`,commonSource:i,agentSource:`agents/agent.trae.md`}],zcode:[{output:`AGENTS.md`,commonSource:i,agentSource:`agents/agent.zcode.md`}]},l={commands:{claude:{ideRoot:a.claude,mode:`append`},trae:{ideRoot:a.trae,mode:`append`},zcode:{ideRoot:a.zcode,mode:`append`}},rules:{claude:{ideRoot:a.claude,mode:`prepend`},trae:{ideRoot:a.trae,mode:`prepend`},zcode:{ideRoot:a.zcode,mode:`prepend`}},skills:{claude:{ideRoot:a.claude,mode:`append`},trae:{ideRoot:a.trae,mode:`append`},zcode:{ideRoot:a.zcode,mode:`append`}}},u=[`claude`,`trae`,`zcode`],d={AGENT_TYPE:`LZI_AGENT_TYPE`,PLACEHOLDER_PREFIX:`LZI_PLACEHOLDER_`},f={DATE:()=>new Date().toISOString().slice(0,10),PROJECT_NAME:()=>process.cwd().split(`/`).pop()??``},p=`auto`,m=async t=>{try{return await e(t),!0}catch{return!1}},h=async e=>{let n=t(e,r);if(!await m(n))return[];let i=[];for(let e of u){let r=c[e];(await Promise.all(r.map(async e=>m(t(n,e.agentSource))))).some(e=>e)&&i.push(e)}return i};export{p as AUTO_AGENT_KEYWORD,f as BUILTIN_PLACEHOLDERS,l as CATEGORY_RULES,i as COMMON_SOURCE,n as DEFAULT_SOURCES,d as ENV_KEYS,o as GENERATED_FILE_SUFFIX,a as IDE_OUTPUT_DIRS,r as LZI_DIR,s as ROOT_ENTRY_TEMPLATE,c as SYNTHESIS_RULES,u as VALID_AGENTS,h as detectAgentTypes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:module";export{};
|