lnai 0.2.0 → 0.3.0
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 +1 -1
- package/dist/index.js +41 -45
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
# LNAI
|
|
15
15
|
|
|
16
|
-
Unified AI configuration management CLI. Define your AI tool configurations once in `.ai/` and sync them to native formats for Claude Code, Cursor, OpenCode, and more.
|
|
16
|
+
Unified AI configuration management CLI. Define your AI tool configurations once in `.ai/` and sync them to native formats for Claude Code, Cursor, OpenCode, GitHub Copilot, and more.
|
|
17
17
|
|
|
18
18
|
## Documentation
|
|
19
19
|
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,27 @@
|
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import { initUnifiedConfig, runSyncPipeline, parseUnifiedConfig, validateUnifiedState, pluginRegistry } from '@lnai/core';
|
|
5
|
-
import
|
|
5
|
+
import chalk3 from 'chalk';
|
|
6
6
|
import ora from 'ora';
|
|
7
7
|
|
|
8
|
+
var GITHUB_URL = "https://github.com/KrystianJonca/lnai";
|
|
9
|
+
function formatValidationItem(item, color) {
|
|
10
|
+
const colorFn = color === "red" ? chalk3.red : chalk3.yellow;
|
|
11
|
+
return colorFn(` - ${item.path.join(".")}: ${item.message}`);
|
|
12
|
+
}
|
|
13
|
+
function printValidationItems(items, color) {
|
|
14
|
+
for (const item of items) {
|
|
15
|
+
console.log(formatValidationItem(item, color));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function printGitHubPromo() {
|
|
19
|
+
console.log(
|
|
20
|
+
chalk3.gray("\nIf you find LNAI helpful, please star us on GitHub:")
|
|
21
|
+
);
|
|
22
|
+
console.log(chalk3.blue(GITHUB_URL));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/commands/init.ts
|
|
8
26
|
var initCommand = new Command("init").description("Initialize a new .ai/ configuration directory").option("--force", "Overwrite existing .ai/ directory").option("--minimal", "Create only config.json (no subdirectories)").option("-t, --tools <tools...>", "Enable only specific tools").action(async (options) => {
|
|
9
27
|
const rootDir = process.cwd();
|
|
10
28
|
const spinner = ora("Initializing .ai/ configuration...").start();
|
|
@@ -16,21 +34,18 @@ var initCommand = new Command("init").description("Initialize a new .ai/ configu
|
|
|
16
34
|
force: options.force
|
|
17
35
|
});
|
|
18
36
|
spinner.succeed("Initialized .ai/ configuration");
|
|
19
|
-
console.log(
|
|
37
|
+
console.log(chalk3.gray("\nCreated:"));
|
|
20
38
|
for (const file of result.created) {
|
|
21
|
-
console.log(
|
|
39
|
+
console.log(chalk3.green(` + ${file}`));
|
|
22
40
|
}
|
|
23
41
|
console.log(
|
|
24
|
-
|
|
25
|
-
);
|
|
26
|
-
console.log(
|
|
27
|
-
chalk2.gray("\nIf you find LNAI helpful, please star us on GitHub:")
|
|
42
|
+
chalk3.gray("\nRun ") + chalk3.cyan("lnai sync") + chalk3.gray(" to generate tool configs.")
|
|
28
43
|
);
|
|
29
|
-
|
|
44
|
+
printGitHubPromo();
|
|
30
45
|
} catch (error) {
|
|
31
46
|
spinner.fail("Initialization failed");
|
|
32
47
|
console.error(
|
|
33
|
-
|
|
48
|
+
chalk3.red(error instanceof Error ? error.message : String(error))
|
|
34
49
|
);
|
|
35
50
|
process.exit(1);
|
|
36
51
|
}
|
|
@@ -46,39 +61,32 @@ var syncCommand = new Command("sync").description("Export .ai/ to native configs
|
|
|
46
61
|
});
|
|
47
62
|
spinner.succeed("Sync complete");
|
|
48
63
|
if (results.length === 0) {
|
|
49
|
-
console.log(
|
|
64
|
+
console.log(chalk3.yellow("\nNo tools configured or enabled."));
|
|
50
65
|
return;
|
|
51
66
|
}
|
|
52
67
|
for (const result of results) {
|
|
53
|
-
console.log(
|
|
68
|
+
console.log(chalk3.blue(`
|
|
54
69
|
${result.tool}:`));
|
|
55
70
|
if (result.changes.length === 0) {
|
|
56
|
-
console.log(
|
|
71
|
+
console.log(chalk3.gray(" No changes"));
|
|
57
72
|
}
|
|
58
73
|
for (const change of result.changes) {
|
|
59
|
-
const icon = change.action === "create" ?
|
|
74
|
+
const icon = change.action === "create" ? chalk3.green("+") : change.action === "update" ? chalk3.yellow("~") : change.action === "delete" ? chalk3.red("-") : chalk3.gray("=");
|
|
60
75
|
console.log(` ${icon} ${change.path}`);
|
|
61
76
|
}
|
|
62
77
|
}
|
|
63
78
|
for (const result of results) {
|
|
64
79
|
if (result.validation.warnings.length > 0) {
|
|
65
|
-
console.log(
|
|
80
|
+
console.log(chalk3.yellow(`
|
|
66
81
|
${result.tool} warnings:`));
|
|
67
|
-
|
|
68
|
-
console.log(
|
|
69
|
-
chalk2.yellow(` - ${warning.path.join(".")}: ${warning.message}`)
|
|
70
|
-
);
|
|
71
|
-
}
|
|
82
|
+
printValidationItems(result.validation.warnings, "yellow");
|
|
72
83
|
}
|
|
73
84
|
}
|
|
74
|
-
|
|
75
|
-
chalk2.gray("\nIf you find LNAI helpful, please star us on GitHub:")
|
|
76
|
-
);
|
|
77
|
-
console.log(chalk2.blue("https://github.com/KrystianJonca/lnai"));
|
|
85
|
+
printGitHubPromo();
|
|
78
86
|
} catch (error) {
|
|
79
87
|
spinner.fail("Sync failed");
|
|
80
88
|
console.error(
|
|
81
|
-
|
|
89
|
+
chalk3.red(error instanceof Error ? error.message : String(error))
|
|
82
90
|
);
|
|
83
91
|
process.exit(1);
|
|
84
92
|
}
|
|
@@ -91,12 +99,8 @@ var validateCommand = new Command("validate").description("Validate .ai/ configu
|
|
|
91
99
|
const unifiedResult = validateUnifiedState(state);
|
|
92
100
|
if (!unifiedResult.valid) {
|
|
93
101
|
spinner.fail("Validation failed");
|
|
94
|
-
console.log(
|
|
95
|
-
|
|
96
|
-
console.log(
|
|
97
|
-
chalk2.red(` - ${error.path.join(".")}: ${error.message}`)
|
|
98
|
-
);
|
|
99
|
-
}
|
|
102
|
+
console.log(chalk3.red("\nUnified config errors:"));
|
|
103
|
+
printValidationItems(unifiedResult.errors, "red");
|
|
100
104
|
process.exit(1);
|
|
101
105
|
}
|
|
102
106
|
const tools = options.tools ?? pluginRegistry.getIds();
|
|
@@ -122,37 +126,29 @@ var validateCommand = new Command("validate").description("Validate .ai/ configu
|
|
|
122
126
|
if (toolErrors.length > 0) {
|
|
123
127
|
spinner.fail("Validation failed");
|
|
124
128
|
for (const { plugin, errors } of toolErrors) {
|
|
125
|
-
console.log(
|
|
129
|
+
console.log(chalk3.red(`
|
|
126
130
|
${plugin} errors:`));
|
|
127
|
-
|
|
128
|
-
console.log(
|
|
129
|
-
chalk2.red(` - ${error.path.join(".")}: ${error.message}`)
|
|
130
|
-
);
|
|
131
|
-
}
|
|
131
|
+
printValidationItems(errors, "red");
|
|
132
132
|
}
|
|
133
133
|
process.exit(1);
|
|
134
134
|
}
|
|
135
135
|
spinner.succeed("Validation passed");
|
|
136
136
|
for (const { plugin, warnings } of toolWarnings) {
|
|
137
|
-
console.log(
|
|
137
|
+
console.log(chalk3.yellow(`
|
|
138
138
|
${plugin} warnings:`));
|
|
139
|
-
|
|
140
|
-
console.log(
|
|
141
|
-
chalk2.yellow(` - ${warning.path.join(".")}: ${warning.message}`)
|
|
142
|
-
);
|
|
143
|
-
}
|
|
139
|
+
printValidationItems(warnings, "yellow");
|
|
144
140
|
}
|
|
145
141
|
for (const { plugin, skipped } of toolSkipped) {
|
|
146
|
-
console.log(
|
|
142
|
+
console.log(chalk3.gray(`
|
|
147
143
|
${plugin} skipped features:`));
|
|
148
144
|
for (const item of skipped) {
|
|
149
|
-
console.log(
|
|
145
|
+
console.log(chalk3.gray(` - ${item.feature}: ${item.reason}`));
|
|
150
146
|
}
|
|
151
147
|
}
|
|
152
148
|
} catch (error) {
|
|
153
149
|
spinner.fail("Validation failed");
|
|
154
150
|
console.error(
|
|
155
|
-
|
|
151
|
+
chalk3.red(error instanceof Error ? error.message : String(error))
|
|
156
152
|
);
|
|
157
153
|
process.exit(1);
|
|
158
154
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lnai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "CLI tool that syncs a unified .ai/ config to native formats for AI coding tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"claude",
|
|
22
22
|
"cursor",
|
|
23
23
|
"opencode",
|
|
24
|
+
"copilot",
|
|
25
|
+
"github-copilot",
|
|
24
26
|
"cli",
|
|
25
27
|
"ai-tools",
|
|
26
28
|
"lnai"
|
|
@@ -36,7 +38,7 @@
|
|
|
36
38
|
"chalk": "^5.6.2",
|
|
37
39
|
"commander": "^14.0.2",
|
|
38
40
|
"ora": "^9.1.0",
|
|
39
|
-
"@lnai/core": "0.
|
|
41
|
+
"@lnai/core": "0.3.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"@types/node": "^25.0.10",
|