aicm 0.7.0 → 0.8.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 +7 -0
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/commands/init.js +1 -0
- package/dist/commands/install.d.ts +5 -1
- package/dist/commands/install.js +28 -2
- package/dist/index.js +3 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -192,6 +192,8 @@ Example `aicm.json`:
|
|
|
192
192
|
|
|
193
193
|
- Preset files should contain a `rules` and `mcpServers` objects with the same structure as the main configuration.
|
|
194
194
|
|
|
195
|
+
- **installOnCI**: Boolean flag (default: `false`) that controls whether installation should proceed in CI environments. When set to `true`, rules will be installed even in CI environments.
|
|
196
|
+
|
|
195
197
|
### MCP Server Installation
|
|
196
198
|
|
|
197
199
|
- **Cursor**: MCP server configs are written to `.cursor/mcp.json` (see Cursor docs for latest path).
|
|
@@ -247,6 +249,10 @@ Installs all rules and MCPs configured in your `aicm.json`.
|
|
|
247
249
|
npx aicm install
|
|
248
250
|
```
|
|
249
251
|
|
|
252
|
+
Options:
|
|
253
|
+
|
|
254
|
+
- `--ci`: run in CI environments (default: `false`)
|
|
255
|
+
|
|
250
256
|
## Node.js API
|
|
251
257
|
|
|
252
258
|
In addition to the CLI, aicm can be used programmatically in Node.js applications:
|
|
@@ -289,6 +295,7 @@ Installs rules and MCP servers based on configuration.
|
|
|
289
295
|
|
|
290
296
|
- `cwd`: Base directory to use instead of `process.cwd()`
|
|
291
297
|
- `config`: Custom config object to use instead of loading from file
|
|
298
|
+
- `installOnCI`: Run installation on CI environments (default: `false`)
|
|
292
299
|
|
|
293
300
|
**Returns:**
|
|
294
301
|
|
package/dist/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InstallOptions, InstallResult } from "./commands/install";
|
|
2
2
|
/**
|
|
3
3
|
* Install AICM rules based on configuration
|
|
4
|
-
* @param options
|
|
4
|
+
* @param options Installation options
|
|
5
5
|
* @returns Result of the install operation
|
|
6
6
|
*/
|
|
7
7
|
export declare function install(options?: InstallOptions): Promise<InstallResult>;
|
package/dist/api.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.install = install;
|
|
|
4
4
|
const install_1 = require("./commands/install");
|
|
5
5
|
/**
|
|
6
6
|
* Install AICM rules based on configuration
|
|
7
|
-
* @param options
|
|
7
|
+
* @param options Installation options
|
|
8
8
|
* @returns Result of the install operation
|
|
9
9
|
*/
|
|
10
10
|
async function install(options = {}) {
|
package/dist/commands/init.js
CHANGED
|
@@ -11,6 +11,10 @@ export interface InstallOptions {
|
|
|
11
11
|
* Custom config object to use instead of loading from file
|
|
12
12
|
*/
|
|
13
13
|
config?: Config;
|
|
14
|
+
/**
|
|
15
|
+
* allow installation on CI environments
|
|
16
|
+
*/
|
|
17
|
+
installOnCI?: boolean;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* Result of the install operation
|
|
@@ -35,4 +39,4 @@ export interface InstallResult {
|
|
|
35
39
|
* @returns Result of the install operation
|
|
36
40
|
*/
|
|
37
41
|
export declare function install(options?: InstallOptions): Promise<InstallResult>;
|
|
38
|
-
export declare function installCommand(): Promise<void>;
|
|
42
|
+
export declare function installCommand(installOnCI?: boolean): Promise<void>;
|
package/dist/commands/install.js
CHANGED
|
@@ -12,6 +12,7 @@ const rule_collector_1 = require("../utils/rule-collector");
|
|
|
12
12
|
const rule_writer_1 = require("../utils/rule-writer");
|
|
13
13
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
14
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
+
const ci_info_1 = require("ci-info");
|
|
15
16
|
/**
|
|
16
17
|
* Write MCP servers configuration to IDE targets
|
|
17
18
|
* @param mcpServers The MCP servers configuration
|
|
@@ -33,6 +34,19 @@ function writeMcpServersToTargets(mcpServers, ides, cwd) {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the current environment is a CI environment
|
|
39
|
+
* This function respects any explicit settings in process.env.CI
|
|
40
|
+
*/
|
|
41
|
+
function isInCIEnvironment() {
|
|
42
|
+
// Explicit environment variable settings take precedence
|
|
43
|
+
if (process.env.CI === "true")
|
|
44
|
+
return true;
|
|
45
|
+
if (process.env.CI === "false")
|
|
46
|
+
return false;
|
|
47
|
+
// Fall back to ci-info's detection
|
|
48
|
+
return ci_info_1.isCI;
|
|
49
|
+
}
|
|
36
50
|
/**
|
|
37
51
|
* Core implementation of the rule installation logic
|
|
38
52
|
* @param options Install options
|
|
@@ -40,6 +54,7 @@ function writeMcpServersToTargets(mcpServers, ides, cwd) {
|
|
|
40
54
|
*/
|
|
41
55
|
async function install(options = {}) {
|
|
42
56
|
const cwd = options.cwd || process.cwd();
|
|
57
|
+
const installOnCI = options.installOnCI === true; // Default to false if not specified
|
|
43
58
|
try {
|
|
44
59
|
const originalCwd = process.cwd();
|
|
45
60
|
if (cwd !== originalCwd) {
|
|
@@ -57,6 +72,17 @@ async function install(options = {}) {
|
|
|
57
72
|
installedRuleCount: 0,
|
|
58
73
|
};
|
|
59
74
|
}
|
|
75
|
+
const inCI = isInCIEnvironment();
|
|
76
|
+
if (inCI && !installOnCI && !config.installOnCI) {
|
|
77
|
+
if (cwd !== originalCwd) {
|
|
78
|
+
process.chdir(originalCwd);
|
|
79
|
+
}
|
|
80
|
+
console.log(chalk_1.default.yellow("Detected CI environment, skipping install."));
|
|
81
|
+
return {
|
|
82
|
+
success: true,
|
|
83
|
+
installedRuleCount: 0,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
60
86
|
// Check if rules are defined (either directly or through presets)
|
|
61
87
|
if (!config.rules || Object.keys(config.rules).length === 0) {
|
|
62
88
|
// If there are no presets defined either, show a message
|
|
@@ -146,9 +172,9 @@ async function install(options = {}) {
|
|
|
146
172
|
};
|
|
147
173
|
}
|
|
148
174
|
}
|
|
149
|
-
async function installCommand() {
|
|
175
|
+
async function installCommand(installOnCI) {
|
|
150
176
|
try {
|
|
151
|
-
const result = await install();
|
|
177
|
+
const result = await install({ installOnCI });
|
|
152
178
|
if (!result.success) {
|
|
153
179
|
console.error(chalk_1.default.red(result.error));
|
|
154
180
|
process.exit(1);
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const pkg = require("../package.json");
|
|
|
16
16
|
const args = (0, arg_1.default)({
|
|
17
17
|
"--help": Boolean,
|
|
18
18
|
"--version": Boolean,
|
|
19
|
+
"--ci": Boolean,
|
|
19
20
|
"-h": "--help",
|
|
20
21
|
"-v": "--version",
|
|
21
22
|
}, {
|
|
@@ -35,7 +36,7 @@ switch (command) {
|
|
|
35
36
|
(0, init_1.initCommand)();
|
|
36
37
|
break;
|
|
37
38
|
case "install":
|
|
38
|
-
(0, install_1.installCommand)();
|
|
39
|
+
(0, install_1.installCommand)(args["--ci"]);
|
|
39
40
|
break;
|
|
40
41
|
case "list":
|
|
41
42
|
(0, list_1.listCommand)();
|
|
@@ -60,6 +61,7 @@ ${chalk_1.default.bold("COMMANDS")}
|
|
|
60
61
|
${chalk_1.default.bold("OPTIONS")}
|
|
61
62
|
-h, --help Show this help message
|
|
62
63
|
-v, --version Show version number
|
|
64
|
+
--ci Run in CI environments (default: \`false\`)
|
|
63
65
|
|
|
64
66
|
${chalk_1.default.bold("EXAMPLES")}
|
|
65
67
|
$ aicm init
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aicm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "A TypeScript CLI tool for managing AI IDE rules across different projects and teams",
|
|
5
5
|
"main": "dist/api.js",
|
|
6
6
|
"types": "dist/api.d.ts",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"arg": "^5.0.2",
|
|
42
42
|
"args": "^5.0.3",
|
|
43
43
|
"chalk": "^4.1.2",
|
|
44
|
+
"ci-info": "^4.2.0",
|
|
44
45
|
"cosmiconfig": "^9.0.0",
|
|
45
46
|
"fs-extra": "^11.1.1"
|
|
46
47
|
},
|