Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 84e3f20

Browse files
committed
```
feat(config): enhance plugin management and dependency updates This commit introduces enhancements to the plugin management system and updates various dependencies. The plugin management is enhanced by: - Introducing a status indicator for plugins. - Handling errors during plugin registration by setting the plugin status to "inactive". - Displaying both active and inactive plugins in the plugin list. Dependency updates include: - Upgrading `@its_4_nik/gitai` to version 1.1.14. - Upgrading `@types/dockerode` to version 3.3.41. - Upgrading `@types/node` to version 22.15.32. The changes improve the robustness and manageability of plugins and ensure the project is using the latest versions of its dependencies. ```
1 parent 93f3f79 commit 84e3f20

5 files changed

Lines changed: 771 additions & 742 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
},
4545
"devDependencies": {
4646
"@biomejs/biome": "1.9.4",
47-
"@its_4_nik/gitai": "^1.0.10",
47+
"@its_4_nik/gitai": "^1.1.14",
4848
"@types/bun": "latest",
49-
"@types/dockerode": "^3.3.40",
49+
"@types/dockerode": "^3.3.41",
5050
"@types/js-yaml": "^4.0.9",
51-
"@types/node": "^22.15.31",
51+
"@types/node": "^22.15.32",
5252
"@types/split2": "^4.2.3",
5353
"bun-types": "latest",
5454
"cross-env": "^7.0.3",

src/core/plugins/loader.ts

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,50 @@ import { logger } from "../utils/logger";
55
import { pluginManager } from "./plugin-manager";
66

77
export async function loadPlugins(pluginDir: string) {
8-
const pluginPath = path.join(process.cwd(), pluginDir);
9-
10-
logger.debug(`Loading plugins (${pluginPath})`);
11-
12-
if (!fs.existsSync(pluginPath)) {
13-
throw new Error("Failed to check plugin directory");
14-
}
15-
logger.debug("Plugin directory exists");
16-
17-
let pluginCount = 0;
18-
let files: string[];
19-
try {
20-
files = fs.readdirSync(pluginPath);
21-
logger.debug(`Found ${files.length} files in plugin directory`);
22-
} catch (error) {
23-
throw new Error(`Failed to read plugin-directory: ${error}`);
24-
}
25-
26-
if (!files) {
27-
logger.info(`No plugins found in ${pluginPath}`);
28-
return;
29-
}
30-
31-
for (const file of files) {
32-
if (!file.endsWith(".plugin.ts")) {
33-
logger.debug(`Skipping non-plugin file: ${file}`);
34-
continue;
35-
}
36-
37-
const absolutePath = path.join(pluginPath, file);
38-
logger.info(`Loading plugin: ${absolutePath}`);
39-
try {
40-
await checkFileForChangeMe(absolutePath);
41-
const module = await import(absolutePath);
42-
const plugin = module.default;
43-
pluginManager.register(plugin);
44-
pluginCount++;
45-
} catch (error) {
46-
logger.error(
47-
`Error while importing plugin ${absolutePath}: ${error as string}`,
48-
);
49-
}
50-
}
51-
52-
logger.info(`Registered ${pluginCount} plugin(s)`);
8+
const pluginPath = path.join(process.cwd(), pluginDir);
9+
10+
logger.debug(`Loading plugins (${pluginPath})`);
11+
12+
if (!fs.existsSync(pluginPath)) {
13+
throw new Error("Failed to check plugin directory");
14+
}
15+
logger.debug("Plugin directory exists");
16+
17+
let pluginCount = 0;
18+
let files: string[];
19+
try {
20+
files = fs.readdirSync(pluginPath);
21+
logger.debug(`Found ${files.length} files in plugin directory`);
22+
} catch (error) {
23+
throw new Error(`Failed to read plugin-directory: ${error}`);
24+
}
25+
26+
if (!files) {
27+
logger.info(`No plugins found in ${pluginPath}`);
28+
return;
29+
}
30+
31+
for (const file of files) {
32+
if (!file.endsWith(".plugin.ts")) {
33+
logger.debug(`Skipping non-plugin file: ${file}`);
34+
continue;
35+
}
36+
37+
const absolutePath = path.join(pluginPath, file);
38+
logger.info(`Loading plugin: ${absolutePath}`);
39+
try {
40+
await checkFileForChangeMe(absolutePath);
41+
const module = await import(absolutePath);
42+
const plugin = module.default;
43+
pluginManager.register(plugin);
44+
pluginCount++;
45+
} catch (error) {
46+
pluginManager.fail({ name: file });
47+
logger.error(
48+
`Error while registering plugin ${absolutePath}: ${error as string}`
49+
);
50+
}
51+
}
52+
53+
logger.info(`Registered ${pluginCount} plugin(s)`);
5354
}

0 commit comments

Comments
 (0)