@lnai/core 0.6.6 → 0.6.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.
Files changed (2) hide show
  1. package/dist/index.js +47 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ var CONFIG_DIRS = {
25
25
  skills: "skills",
26
26
  subagents: "subagents"
27
27
  };
28
+ var CROSS_TOOL_SKILLS_DIR = ".agents";
28
29
  var TOOL_OUTPUT_DIRS = {
29
30
  claudeCode: ".claude",
30
31
  opencode: ".opencode",
@@ -579,7 +580,6 @@ ${rule.content}
579
580
 
580
581
  // src/plugins/codex/index.ts
581
582
  var OUTPUT_DIR2 = TOOL_OUTPUT_DIRS.codex;
582
- var SKILLS_DIR = ".agents";
583
583
  var codexPlugin = {
584
584
  id: "codex",
585
585
  name: "Codex",
@@ -607,7 +607,7 @@ var codexPlugin = {
607
607
  content: combinedContent
608
608
  });
609
609
  }
610
- files.push(...createSkillSymlinks(state, SKILLS_DIR));
610
+ files.push(...createSkillSymlinks(state, CROSS_TOOL_SKILLS_DIR));
611
611
  const configToml = buildCodexConfigToml(state.settings?.mcpServers);
612
612
  if (configToml) {
613
613
  files.push({
@@ -1257,7 +1257,6 @@ function parsePermissionRuleForOpenCode(rule) {
1257
1257
 
1258
1258
  // src/plugins/opencode/index.ts
1259
1259
  var OUTPUT_DIR6 = TOOL_OUTPUT_DIRS.opencode;
1260
- var SKILLS_DIR2 = ".agents";
1261
1260
  var opencodePlugin = {
1262
1261
  id: "opencode",
1263
1262
  name: "OpenCode",
@@ -1280,7 +1279,7 @@ var opencodePlugin = {
1280
1279
  target: `../${UNIFIED_DIR}/rules`
1281
1280
  });
1282
1281
  }
1283
- files.push(...createSkillSymlinks(state, SKILLS_DIR2));
1282
+ files.push(...createSkillSymlinks(state, CROSS_TOOL_SKILLS_DIR));
1284
1283
  const config = {
1285
1284
  $schema: "https://opencode.ai/config.json"
1286
1285
  };
@@ -1692,23 +1691,6 @@ function createEmptyManifest() {
1692
1691
  }
1693
1692
 
1694
1693
  // src/pipeline/index.ts
1695
- function getToolsToSync(config, requestedTools) {
1696
- if (requestedTools && requestedTools.length > 0) {
1697
- return requestedTools.filter((tool) => pluginRegistry.has(tool));
1698
- }
1699
- const enabledTools = [];
1700
- if (config.tools) {
1701
- for (const [toolId, toolConfig] of Object.entries(config.tools)) {
1702
- if (toolConfig?.enabled && pluginRegistry.has(toolId)) {
1703
- enabledTools.push(toolId);
1704
- }
1705
- }
1706
- }
1707
- if (enabledTools.length === 0) {
1708
- return pluginRegistry.getIds();
1709
- }
1710
- return enabledTools;
1711
- }
1712
1694
  async function runSyncPipeline(options) {
1713
1695
  const {
1714
1696
  rootDir,
@@ -1771,13 +1753,54 @@ async function runSyncPipeline(options) {
1771
1753
  }
1772
1754
  if (!dryRun) {
1773
1755
  await writeManifest(rootDir, manifest);
1774
- const pathsToIgnore = Object.entries(manifest.tools).flatMap(
1775
- ([toolId, toolManifest]) => !state.config.tools?.[toolId]?.versionControl && toolManifest?.files ? toolManifest.files.map((file) => file.path) : []
1776
- );
1756
+ const pathsToIgnore = computePathsToIgnore(manifest, state.config.tools);
1777
1757
  await updateGitignore(rootDir, pathsToIgnore);
1778
1758
  }
1779
1759
  return results;
1780
1760
  }
1761
+ function getToolsToSync(config, requestedTools) {
1762
+ if (requestedTools && requestedTools.length > 0) {
1763
+ return requestedTools.filter((tool) => pluginRegistry.has(tool));
1764
+ }
1765
+ const enabledTools = [];
1766
+ if (config.tools) {
1767
+ for (const [toolId, toolConfig] of Object.entries(config.tools)) {
1768
+ if (toolConfig?.enabled && pluginRegistry.has(toolId)) {
1769
+ enabledTools.push(toolId);
1770
+ }
1771
+ }
1772
+ }
1773
+ if (enabledTools.length === 0) {
1774
+ return pluginRegistry.getIds();
1775
+ }
1776
+ return enabledTools;
1777
+ }
1778
+ function computePathsToIgnore(manifest, toolConfigs) {
1779
+ const pathToTools = /* @__PURE__ */ new Map();
1780
+ for (const [toolId, toolManifest] of Object.entries(manifest.tools)) {
1781
+ if (!toolManifest?.files) {
1782
+ continue;
1783
+ }
1784
+ for (const file of toolManifest.files) {
1785
+ let tools = pathToTools.get(file.path);
1786
+ if (!tools) {
1787
+ tools = /* @__PURE__ */ new Set();
1788
+ pathToTools.set(file.path, tools);
1789
+ }
1790
+ tools.add(toolId);
1791
+ }
1792
+ }
1793
+ const result = [];
1794
+ for (const [filePath, toolIds] of pathToTools) {
1795
+ const anyVersionControlled = [...toolIds].some(
1796
+ (toolId) => toolConfigs?.[toolId]?.versionControl === true
1797
+ );
1798
+ if (!anyVersionControlled) {
1799
+ result.push(filePath);
1800
+ }
1801
+ }
1802
+ return result;
1803
+ }
1781
1804
  async function initUnifiedConfig(options) {
1782
1805
  const {
1783
1806
  rootDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lnai/core",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "Core library for LNAI - unified AI config management",
5
5
  "type": "module",
6
6
  "license": "MIT",