aicm 0.14.0 → 0.14.1
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/commands/install.js +3 -1
- package/dist/utils/config.d.ts +2 -1
- package/dist/utils/config.js +12 -8
- package/package.json +1 -1
package/dist/commands/install.js
CHANGED
|
@@ -479,7 +479,9 @@ async function install(options = {}) {
|
|
|
479
479
|
else {
|
|
480
480
|
resolvedConfig = await (0, config_1.loadConfig)(cwd);
|
|
481
481
|
}
|
|
482
|
-
|
|
482
|
+
const shouldUseWorkspaces = (resolvedConfig === null || resolvedConfig === void 0 ? void 0 : resolvedConfig.config.workspaces) ||
|
|
483
|
+
(!resolvedConfig && (0, config_1.detectWorkspacesFromPackageJson)(cwd));
|
|
484
|
+
if (shouldUseWorkspaces) {
|
|
483
485
|
return await installWorkspaces(cwd, installOnCI, options.verbose);
|
|
484
486
|
}
|
|
485
487
|
return installPackage(options);
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -46,8 +46,9 @@ export interface ResolvedConfig {
|
|
|
46
46
|
}
|
|
47
47
|
export declare const SUPPORTED_TARGETS: readonly ["cursor", "windsurf", "codex"];
|
|
48
48
|
export type SupportedTarget = (typeof SUPPORTED_TARGETS)[number];
|
|
49
|
+
export declare function detectWorkspacesFromPackageJson(cwd: string): boolean;
|
|
49
50
|
export declare function applyDefaults(config: RawConfig, cwd?: string): Config;
|
|
50
|
-
export declare function validateConfig(config: unknown, configFilePath: string, cwd: string): asserts config is Config;
|
|
51
|
+
export declare function validateConfig(config: unknown, configFilePath: string, cwd: string, isWorkspaceMode?: boolean): asserts config is Config;
|
|
51
52
|
export declare function loadRulesFromDirectory(rulesDir: string, source: "local" | "preset", presetName?: string): Promise<RuleFile[]>;
|
|
52
53
|
export declare function resolvePresetPath(presetPath: string, cwd: string): string | null;
|
|
53
54
|
export declare function loadPreset(presetPath: string, cwd: string): Promise<{
|
package/dist/utils/config.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SUPPORTED_TARGETS = void 0;
|
|
7
|
+
exports.detectWorkspacesFromPackageJson = detectWorkspacesFromPackageJson;
|
|
7
8
|
exports.applyDefaults = applyDefaults;
|
|
8
9
|
exports.validateConfig = validateConfig;
|
|
9
10
|
exports.loadRulesFromDirectory = loadRulesFromDirectory;
|
|
@@ -47,7 +48,7 @@ function applyDefaults(config, cwd) {
|
|
|
47
48
|
workspaces,
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
function validateConfig(config, configFilePath, cwd) {
|
|
51
|
+
function validateConfig(config, configFilePath, cwd, isWorkspaceMode = false) {
|
|
51
52
|
if (typeof config !== "object" || config === null) {
|
|
52
53
|
throw new Error(`Config is not an object at ${configFilePath}`);
|
|
53
54
|
}
|
|
@@ -56,7 +57,9 @@ function validateConfig(config, configFilePath, cwd) {
|
|
|
56
57
|
const hasPresets = "presets" in config &&
|
|
57
58
|
Array.isArray(config.presets) &&
|
|
58
59
|
config.presets.length > 0;
|
|
59
|
-
|
|
60
|
+
// In workspace mode, root config doesn't need rulesDir or presets
|
|
61
|
+
// since packages will have their own configurations
|
|
62
|
+
if (!isWorkspaceMode && !hasRulesDir && !hasPresets) {
|
|
60
63
|
throw new Error(`Either rulesDir or presets must be specified in config at ${configFilePath}`);
|
|
61
64
|
}
|
|
62
65
|
// Validate rulesDir if provided
|
|
@@ -253,15 +256,16 @@ async function loadConfig(cwd) {
|
|
|
253
256
|
if (!(configResult === null || configResult === void 0 ? void 0 : configResult.config)) {
|
|
254
257
|
return null;
|
|
255
258
|
}
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
+
const configWithDefaults = applyDefaults(configResult.config, workingDir);
|
|
260
|
+
const isWorkspaceMode = configWithDefaults.workspaces;
|
|
261
|
+
validateConfig(configResult.config, configResult.filepath, workingDir, isWorkspaceMode);
|
|
262
|
+
const { rules, mcpServers } = await loadAllRules(configWithDefaults, workingDir);
|
|
259
263
|
let rulesWithOverrides = rules;
|
|
260
|
-
if (
|
|
261
|
-
rulesWithOverrides = applyOverrides(rules,
|
|
264
|
+
if (configWithDefaults.overrides) {
|
|
265
|
+
rulesWithOverrides = applyOverrides(rules, configWithDefaults.overrides, workingDir);
|
|
262
266
|
}
|
|
263
267
|
return {
|
|
264
|
-
config,
|
|
268
|
+
config: configWithDefaults,
|
|
265
269
|
rules: rulesWithOverrides,
|
|
266
270
|
mcpServers,
|
|
267
271
|
};
|