aicm 0.20.5 → 0.20.6

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.
@@ -0,0 +1 @@
1
+ export declare function listCommand(): Promise<void>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.listCommand = listCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const config_1 = require("../utils/config");
9
+ async function listCommand() {
10
+ const config = await (0, config_1.loadConfig)();
11
+ if (!config) {
12
+ console.log(chalk_1.default.red("Configuration file not found!"));
13
+ console.log(`Run ${chalk_1.default.blue("npx aicm init")} to create one.`);
14
+ return;
15
+ }
16
+ const hasRules = config.rules && config.rules.length > 0;
17
+ const hasCommands = config.commands && config.commands.length > 0;
18
+ if (!hasRules && !hasCommands) {
19
+ console.log(chalk_1.default.yellow("No rules or commands defined in configuration."));
20
+ console.log(`Edit your ${chalk_1.default.blue("aicm.json")} file to add rules or commands.`);
21
+ return;
22
+ }
23
+ if (hasRules) {
24
+ console.log(chalk_1.default.blue("Configured Rules:"));
25
+ console.log(chalk_1.default.dim("─".repeat(50)));
26
+ for (const rule of config.rules) {
27
+ console.log(`${chalk_1.default.bold(rule.name)} - ${rule.sourcePath} ${rule.presetName ? `[${rule.presetName}]` : ""}`);
28
+ }
29
+ }
30
+ if (hasCommands) {
31
+ if (hasRules) {
32
+ console.log();
33
+ }
34
+ console.log(chalk_1.default.blue("Configured Commands:"));
35
+ console.log(chalk_1.default.dim("─".repeat(50)));
36
+ for (const command of config.commands) {
37
+ console.log(`${chalk_1.default.bold(command.name)} - ${command.sourcePath} ${command.presetName ? `[${command.presetName}]` : ""}`);
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,118 @@
1
+ import { CosmiconfigResult } from "cosmiconfig";
2
+ import { HooksJson, HookFile } from "./hooks";
3
+ export interface RawConfig {
4
+ rootDir?: string;
5
+ targets?: string[];
6
+ presets?: string[];
7
+ mcpServers?: MCPServers;
8
+ workspaces?: boolean;
9
+ skipInstall?: boolean;
10
+ }
11
+ export interface Config {
12
+ rootDir?: string;
13
+ targets: string[];
14
+ presets?: string[];
15
+ mcpServers?: MCPServers;
16
+ workspaces?: boolean;
17
+ skipInstall?: boolean;
18
+ }
19
+ export type MCPServer = {
20
+ command: string;
21
+ args?: string[];
22
+ env?: Record<string, string>;
23
+ url?: never;
24
+ } | {
25
+ url: string;
26
+ env?: Record<string, string>;
27
+ command?: never;
28
+ args?: never;
29
+ } | false;
30
+ export interface MCPServers {
31
+ [serverName: string]: MCPServer;
32
+ }
33
+ export interface ManagedFile {
34
+ name: string;
35
+ content: string;
36
+ sourcePath: string;
37
+ source: "local" | "preset";
38
+ presetName?: string;
39
+ }
40
+ export interface AssetFile {
41
+ name: string;
42
+ content: Buffer;
43
+ sourcePath: string;
44
+ source: "local" | "preset";
45
+ presetName?: string;
46
+ }
47
+ export type RuleFile = ManagedFile;
48
+ export type CommandFile = ManagedFile;
49
+ export interface SkillFile {
50
+ name: string;
51
+ sourcePath: string;
52
+ source: "local" | "preset";
53
+ presetName?: string;
54
+ }
55
+ export type AgentFile = ManagedFile;
56
+ export interface RuleCollection {
57
+ [target: string]: RuleFile[];
58
+ }
59
+ export interface ResolvedConfig {
60
+ config: Config;
61
+ rules: RuleFile[];
62
+ commands: CommandFile[];
63
+ assets: AssetFile[];
64
+ skills: SkillFile[];
65
+ agents: AgentFile[];
66
+ mcpServers: MCPServers;
67
+ hooks: HooksJson;
68
+ hookFiles: HookFile[];
69
+ }
70
+ export declare const ALLOWED_CONFIG_KEYS: readonly ["rootDir", "targets", "presets", "mcpServers", "workspaces", "skipInstall"];
71
+ export declare const SUPPORTED_TARGETS: readonly ["cursor", "windsurf", "codex", "claude"];
72
+ export type SupportedTarget = (typeof SUPPORTED_TARGETS)[number];
73
+ export declare function detectWorkspacesFromPackageJson(cwd: string): boolean;
74
+ export declare function resolveWorkspaces(config: unknown, configFilePath: string, cwd: string): boolean;
75
+ export declare function applyDefaults(config: RawConfig, workspaces: boolean): Config;
76
+ export declare function validateConfig(config: unknown, configFilePath: string, cwd: string, isWorkspaceMode?: boolean): asserts config is Config;
77
+ export declare function loadRulesFromDirectory(directoryPath: string, source: "local" | "preset", presetName?: string): Promise<RuleFile[]>;
78
+ export declare function loadCommandsFromDirectory(directoryPath: string, source: "local" | "preset", presetName?: string): Promise<CommandFile[]>;
79
+ export declare function loadAssetsFromDirectory(directoryPath: string, source: "local" | "preset", presetName?: string): Promise<AssetFile[]>;
80
+ /**
81
+ * Load skills from a skills/ directory
82
+ * Each direct subdirectory containing a SKILL.md file is considered a skill
83
+ */
84
+ export declare function loadSkillsFromDirectory(directoryPath: string, source: "local" | "preset", presetName?: string): Promise<SkillFile[]>;
85
+ /**
86
+ * Load agents from an agents/ directory
87
+ * Agents are markdown files (.md) with YAML frontmatter
88
+ */
89
+ export declare function loadAgentsFromDirectory(directoryPath: string, source: "local" | "preset", presetName?: string): Promise<AgentFile[]>;
90
+ /**
91
+ * Extract namespace from preset path for directory structure
92
+ * Handles both npm packages and local paths consistently
93
+ */
94
+ export declare function extractNamespaceFromPresetPath(presetPath: string): string[];
95
+ export declare function resolvePresetPath(presetPath: string, cwd: string): string | null;
96
+ export declare function loadPreset(presetPath: string, cwd: string): Promise<{
97
+ config: Config;
98
+ rootDir: string;
99
+ resolvedPath: string;
100
+ }>;
101
+ export declare function loadAllRules(config: Config, cwd: string): Promise<{
102
+ rules: RuleFile[];
103
+ commands: CommandFile[];
104
+ assets: AssetFile[];
105
+ skills: SkillFile[];
106
+ agents: AgentFile[];
107
+ mcpServers: MCPServers;
108
+ hooks: HooksJson;
109
+ hookFiles: HookFile[];
110
+ }>;
111
+ export declare function loadConfigFile(searchFrom?: string): Promise<CosmiconfigResult>;
112
+ /**
113
+ * Check if workspaces mode is enabled without loading all rules/presets
114
+ * This is useful for commands that only need to know the workspace setting
115
+ */
116
+ export declare function checkWorkspacesEnabled(cwd?: string): Promise<boolean>;
117
+ export declare function loadConfig(cwd?: string): Promise<ResolvedConfig | null>;
118
+ export declare function saveConfig(config: Config, cwd?: string): boolean;