@mediaproc/cli 0.1.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 +381 -54
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +24 -9
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +108 -39
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +86 -27
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/convert.d.ts +7 -0
- package/dist/commands/convert.d.ts.map +1 -0
- package/dist/commands/convert.js +96 -0
- package/dist/commands/convert.js.map +1 -0
- package/dist/commands/help.js +2 -2
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/info.d.ts +7 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +117 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +25 -47
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +90 -17
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/optimize.d.ts +7 -0
- package/dist/commands/optimize.d.ts.map +1 -0
- package/dist/commands/optimize.js +196 -0
- package/dist/commands/optimize.js.map +1 -0
- package/dist/commands/plugins.d.ts +4 -0
- package/dist/commands/plugins.d.ts.map +1 -0
- package/dist/commands/plugins.js +79 -0
- package/dist/commands/plugins.js.map +1 -0
- package/dist/commands/remove.d.ts.map +1 -1
- package/dist/commands/remove.js +92 -11
- package/dist/commands/remove.js.map +1 -1
- package/dist/config-manager.d.ts +110 -0
- package/dist/config-manager.d.ts.map +1 -0
- package/dist/config-manager.js +201 -0
- package/dist/config-manager.js.map +1 -0
- package/dist/plugin-manager.d.ts +31 -7
- package/dist/plugin-manager.d.ts.map +1 -1
- package/dist/plugin-manager.js +75 -44
- package/dist/plugin-manager.js.map +1 -1
- package/dist/plugin-registry.d.ts +9 -0
- package/dist/plugin-registry.d.ts.map +1 -1
- package/dist/plugin-registry.js +41 -6
- package/dist/plugin-registry.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { getPluginsByCategory } from '../plugin-registry.js';
|
|
3
|
+
export function pluginsCommand(program, pluginManager) {
|
|
4
|
+
program
|
|
5
|
+
.command('plugins')
|
|
6
|
+
.alias('marketplace')
|
|
7
|
+
.description('Show all available plugins from registry')
|
|
8
|
+
.action(() => {
|
|
9
|
+
const grouped = getPluginsByCategory();
|
|
10
|
+
const loadedPlugins = new Set(pluginManager.getLoadedPlugins());
|
|
11
|
+
console.log(chalk.bold('\nš¦ Available MediaProc Plugins\n'));
|
|
12
|
+
console.log(chalk.dim('Official plugins from the MediaProc ecosystem\n'));
|
|
13
|
+
// Core plugins
|
|
14
|
+
if (grouped.core && grouped.core.length > 0) {
|
|
15
|
+
console.log(chalk.bold('šÆ Core Media Plugins:\n'));
|
|
16
|
+
const seen = new Set();
|
|
17
|
+
grouped.core.forEach((entry) => {
|
|
18
|
+
if (seen.has(entry.package))
|
|
19
|
+
return;
|
|
20
|
+
seen.add(entry.package);
|
|
21
|
+
const isInstalled = loadedPlugins.has(entry.package);
|
|
22
|
+
const status = isInstalled ? chalk.green('ā INSTALLED') : chalk.dim('Not installed');
|
|
23
|
+
console.log(`${chalk.cyan(entry.name.padEnd(12))} ${status}`);
|
|
24
|
+
console.log(chalk.dim(` ${entry.description}`));
|
|
25
|
+
if (entry.systemRequirements && entry.systemRequirements.length > 0) {
|
|
26
|
+
console.log(chalk.yellow(` Requirements: ${entry.systemRequirements.join(', ')}`));
|
|
27
|
+
}
|
|
28
|
+
console.log(chalk.dim(` Install: ${chalk.white(`mediaproc add ${entry.name}`)}`));
|
|
29
|
+
console.log('');
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// Advanced plugins
|
|
33
|
+
if (grouped.advanced && grouped.advanced.length > 0) {
|
|
34
|
+
console.log(chalk.bold('š Advanced Plugins:\n'));
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
grouped.advanced.forEach((entry) => {
|
|
37
|
+
if (seen.has(entry.package))
|
|
38
|
+
return;
|
|
39
|
+
seen.add(entry.package);
|
|
40
|
+
const isInstalled = loadedPlugins.has(entry.package);
|
|
41
|
+
const status = isInstalled ? chalk.green('ā INSTALLED') : chalk.dim('Not installed');
|
|
42
|
+
console.log(`${chalk.cyan(entry.name.padEnd(12))} ${status}`);
|
|
43
|
+
console.log(chalk.dim(` ${entry.description}`));
|
|
44
|
+
if (entry.systemRequirements && entry.systemRequirements.length > 0) {
|
|
45
|
+
console.log(chalk.yellow(` Requirements: ${entry.systemRequirements.join(', ')}`));
|
|
46
|
+
}
|
|
47
|
+
console.log(chalk.dim(` Install: ${chalk.white(`mediaproc add ${entry.name}`)}`));
|
|
48
|
+
console.log('');
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Future-proof plugins
|
|
52
|
+
if (grouped['future-proof'] && grouped['future-proof'].length > 0) {
|
|
53
|
+
console.log(chalk.bold('š® Future-Proof Plugins:\n'));
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
grouped['future-proof'].forEach((entry) => {
|
|
56
|
+
if (seen.has(entry.package))
|
|
57
|
+
return;
|
|
58
|
+
seen.add(entry.package);
|
|
59
|
+
const isInstalled = loadedPlugins.has(entry.package);
|
|
60
|
+
const status = isInstalled ? chalk.green('ā INSTALLED') : chalk.dim('Not installed');
|
|
61
|
+
console.log(`${chalk.cyan(entry.name.padEnd(12))} ${status}`);
|
|
62
|
+
console.log(chalk.dim(` ${entry.description}`));
|
|
63
|
+
if (entry.systemRequirements && entry.systemRequirements.length > 0) {
|
|
64
|
+
console.log(chalk.yellow(` Requirements: ${entry.systemRequirements.join(', ')}`));
|
|
65
|
+
}
|
|
66
|
+
console.log(chalk.dim(` Install: ${chalk.white(`mediaproc add ${entry.name}`)}`));
|
|
67
|
+
console.log('');
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
console.log(chalk.dim('š” Plugin Types:'));
|
|
71
|
+
console.log(chalk.dim(' ⨠Official: @mediaproc/* packages (maintained by MediaProc team)'));
|
|
72
|
+
console.log(chalk.dim(' š Community: mediaproc-* packages (community-maintained)'));
|
|
73
|
+
console.log(chalk.dim(' š¦ Third-party: Other npm packages'));
|
|
74
|
+
console.log(chalk.dim('\nš„ Install any plugin: ') + chalk.white('mediaproc add <plugin-name>'));
|
|
75
|
+
console.log(chalk.dim('š Show installed plugins: ') + chalk.white('mediaproc list'));
|
|
76
|
+
console.log('');
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/commands/plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,MAAM,UAAU,cAAc,CAAC,OAAgB,EAAE,aAA4B;IAC3E,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,KAAK,CAAC,aAAa,CAAC;SACpB,WAAW,CAAC,0CAA0C,CAAC;SACvD,MAAM,CAAC,GAAG,EAAE;QACX,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;QACvC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAEhE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC,CAAC;QAE1E,eAAe;QACf,IAAI,OAAO,CAAC,IAAI,I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AAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/commands/remove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA2B1D,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,GAAG,IAAI,CAiGlF"}
|
package/dist/commands/remove.js
CHANGED
|
@@ -1,31 +1,112 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import { execa } from 'execa';
|
|
4
|
+
/**
|
|
5
|
+
* Check if a plugin is installed globally
|
|
6
|
+
*/
|
|
7
|
+
async function isPluginGlobal(pluginName) {
|
|
8
|
+
try {
|
|
9
|
+
// Try npm list -g
|
|
10
|
+
const { stdout } = await execa('npm', ['list', '-g', '--depth=0', pluginName], {
|
|
11
|
+
stdio: 'pipe',
|
|
12
|
+
reject: false
|
|
13
|
+
});
|
|
14
|
+
return stdout.includes(pluginName);
|
|
15
|
+
}
|
|
16
|
+
catch { }
|
|
17
|
+
try {
|
|
18
|
+
// Try pnpm list -g
|
|
19
|
+
const { stdout } = await execa('pnpm', ['list', '-g', '--depth=0', pluginName], {
|
|
20
|
+
stdio: 'pipe',
|
|
21
|
+
reject: false
|
|
22
|
+
});
|
|
23
|
+
return stdout.includes(pluginName);
|
|
24
|
+
}
|
|
25
|
+
catch { }
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
4
28
|
export function removeCommand(program, pluginManager) {
|
|
5
29
|
program
|
|
6
30
|
.command('remove <plugin>')
|
|
7
31
|
.alias('rm')
|
|
8
32
|
.description('Uninstall a mediaproc plugin')
|
|
9
|
-
.option('-g, --global', '
|
|
33
|
+
.option('-g, --global', 'Force global uninstall')
|
|
34
|
+
.option('-l, --local', 'Force local uninstall')
|
|
10
35
|
.action(async (plugin, options) => {
|
|
11
36
|
const spinner = ora(`Removing ${chalk.cyan(plugin)}...`).start();
|
|
12
37
|
try {
|
|
13
|
-
// Ensure plugin name
|
|
38
|
+
// Ensure plugin name is properly formatted
|
|
14
39
|
const pluginName = plugin.startsWith('@mediaproc/')
|
|
15
40
|
? plugin
|
|
16
41
|
: `@mediaproc/${plugin}`;
|
|
42
|
+
// Check if plugin is loaded and is marked as built-in (shouldn't happen, but safety check)
|
|
43
|
+
const pluginInstance = pluginManager.getPlugin(pluginName);
|
|
44
|
+
if (pluginInstance?.isBuiltIn) {
|
|
45
|
+
spinner.fail(chalk.red(`Cannot remove plugin: ${chalk.cyan(plugin)}`));
|
|
46
|
+
console.log(chalk.dim('This plugin is marked as built-in and cannot be removed'));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
17
49
|
// Check if plugin is currently loaded
|
|
18
50
|
const wasLoaded = pluginManager.isPluginLoaded(pluginName);
|
|
19
51
|
if (wasLoaded) {
|
|
20
|
-
spinner.info(chalk.dim(`
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
52
|
+
spinner.info(chalk.dim(`Unloading plugin ${pluginName}...`));
|
|
53
|
+
pluginManager.unloadPlugin(pluginName);
|
|
54
|
+
spinner.start(`Removing ${chalk.cyan(pluginName)}...`);
|
|
55
|
+
}
|
|
56
|
+
// Determine installation scope
|
|
57
|
+
let uninstallGlobally = false;
|
|
58
|
+
if (options.global) {
|
|
59
|
+
uninstallGlobally = true;
|
|
60
|
+
}
|
|
61
|
+
else if (options.local) {
|
|
62
|
+
uninstallGlobally = false;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
// Auto-detect: check if plugin is installed globally
|
|
66
|
+
spinner.text = 'Detecting installation scope...';
|
|
67
|
+
uninstallGlobally = await isPluginGlobal(pluginName);
|
|
68
|
+
spinner.text = `Removing ${chalk.cyan(pluginName)}${uninstallGlobally ? ' (global)' : ' (local)'}...`;
|
|
69
|
+
}
|
|
70
|
+
// Determine package manager (prefer pnpm, fallback to npm)
|
|
71
|
+
let packageManager = 'pnpm';
|
|
72
|
+
try {
|
|
73
|
+
await execa('pnpm', ['--version'], { stdio: 'pipe' });
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
packageManager = 'npm';
|
|
77
|
+
}
|
|
78
|
+
// Build uninstall command
|
|
79
|
+
const args = [];
|
|
80
|
+
if (packageManager === 'pnpm') {
|
|
81
|
+
args.push('remove');
|
|
82
|
+
if (uninstallGlobally)
|
|
83
|
+
args.push('-g');
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
args.push('uninstall');
|
|
87
|
+
if (uninstallGlobally)
|
|
88
|
+
args.push('-g');
|
|
89
|
+
}
|
|
90
|
+
args.push(pluginName);
|
|
91
|
+
// Set working directory for local uninstalls
|
|
92
|
+
const uninstallOptions = {
|
|
93
|
+
stdio: 'pipe',
|
|
94
|
+
reject: false
|
|
95
|
+
};
|
|
96
|
+
if (!uninstallGlobally) {
|
|
97
|
+
uninstallOptions.cwd = process.cwd();
|
|
98
|
+
}
|
|
99
|
+
await execa(packageManager, args, uninstallOptions);
|
|
100
|
+
const scope = uninstallGlobally ? 'globally' : 'locally';
|
|
101
|
+
spinner.succeed(chalk.green(`ā Successfully removed ${pluginName} (${scope})`));
|
|
102
|
+
// Update config to remove from installed and loaded
|
|
103
|
+
const configManager = pluginManager.getConfigManager();
|
|
104
|
+
configManager.removeInstalledPlugin(pluginName);
|
|
105
|
+
if (wasLoaded) {
|
|
106
|
+
console.log(chalk.green('ā Plugin unloaded and cleaned up'));
|
|
107
|
+
}
|
|
108
|
+
console.log(chalk.dim(`\nPlugin has been completely removed ${scope}`));
|
|
109
|
+
console.log(chalk.dim('View remaining plugins: ') + chalk.white('mediaproc list'));
|
|
29
110
|
}
|
|
30
111
|
catch (error) {
|
|
31
112
|
spinner.fail(chalk.red(`Failed to remove ${plugin}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/commands/remove.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,aAA4B;IAC1E,OAAO;SACJ,OAAO,CAAC,iBAAiB,CAAC;SAC1B,KAAK,CAAC,IAAI,CAAC;SACX,WAAW,CAAC,8BAA8B,CAAC;SAC3C,MAAM,CAAC,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/commands/remove.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B;;GAEG;AACH,KAAK,UAAU,cAAc,CAAC,UAAkB;IAC9C,IAAI,CAAC;QACH,kBAAkB;QAClB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE;YAC7E,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,IAAI,CAAC;QACH,mBAAmB;QACnB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE;YAC9E,KAAK,EAAE,M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AAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,MAAM,EAAE,CAAC,CAAC,CAAC;YACtD,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5E,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration structure for MediaProc
|
|
3
|
+
*/
|
|
4
|
+
export interface MediaProcConfig {
|
|
5
|
+
version: string;
|
|
6
|
+
installedPlugins: string[];
|
|
7
|
+
loadedPlugins: string[];
|
|
8
|
+
defaults?: {
|
|
9
|
+
[plugin: string]: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
pipelines?: {
|
|
14
|
+
[name: string]: {
|
|
15
|
+
name: string;
|
|
16
|
+
steps: Array<{
|
|
17
|
+
plugin: string;
|
|
18
|
+
command: string;
|
|
19
|
+
options?: Record<string, any>;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
lastUpdated?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Configuration manager for MediaProc
|
|
27
|
+
* Handles reading/writing config from ~/.mediaproc/config.json
|
|
28
|
+
*/
|
|
29
|
+
export declare class ConfigManager {
|
|
30
|
+
private static readonly CONFIG_DIR;
|
|
31
|
+
private static readonly CONFIG_FILE;
|
|
32
|
+
private config;
|
|
33
|
+
/**
|
|
34
|
+
* Get the config directory path
|
|
35
|
+
*/
|
|
36
|
+
static getConfigDir(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get the config file path
|
|
39
|
+
*/
|
|
40
|
+
static getConfigPath(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Ensure config directory exists
|
|
43
|
+
*/
|
|
44
|
+
private ensureConfigDir;
|
|
45
|
+
/**
|
|
46
|
+
* Load config from file
|
|
47
|
+
*/
|
|
48
|
+
load(): MediaProcConfig;
|
|
49
|
+
/**
|
|
50
|
+
* Create default config
|
|
51
|
+
*/
|
|
52
|
+
private createDefaultConfig;
|
|
53
|
+
/**
|
|
54
|
+
* Save config to file
|
|
55
|
+
*/
|
|
56
|
+
save(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get current config
|
|
59
|
+
*/
|
|
60
|
+
get(): MediaProcConfig;
|
|
61
|
+
/**
|
|
62
|
+
* Check if a plugin is installed
|
|
63
|
+
*/
|
|
64
|
+
isPluginInstalled(pluginName: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check if a plugin is loaded
|
|
67
|
+
*/
|
|
68
|
+
isPluginLoaded(pluginName: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Add plugin to installed list
|
|
71
|
+
*/
|
|
72
|
+
addInstalledPlugin(pluginName: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Remove plugin from installed list
|
|
75
|
+
*/
|
|
76
|
+
removeInstalledPlugin(pluginName: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* Add plugin to loaded list
|
|
79
|
+
*/
|
|
80
|
+
addLoadedPlugin(pluginName: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Remove plugin from loaded list
|
|
83
|
+
*/
|
|
84
|
+
removeLoadedPlugin(pluginName: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Get list of installed plugins
|
|
87
|
+
*/
|
|
88
|
+
getInstalledPlugins(): string[];
|
|
89
|
+
/**
|
|
90
|
+
* Get list of loaded plugins
|
|
91
|
+
*/
|
|
92
|
+
getLoadedPlugins(): string[];
|
|
93
|
+
/**
|
|
94
|
+
* Set a configuration value
|
|
95
|
+
*/
|
|
96
|
+
set(key: string, value: any): void;
|
|
97
|
+
/**
|
|
98
|
+
* Get a configuration value
|
|
99
|
+
*/
|
|
100
|
+
getValue(key: string): any;
|
|
101
|
+
/**
|
|
102
|
+
* Reset config to defaults
|
|
103
|
+
*/
|
|
104
|
+
reset(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Check if config file exists
|
|
107
|
+
*/
|
|
108
|
+
exists(): boolean;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=config-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../src/config-manager.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG;YACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;SACtB,CAAC;KACL,CAAC;IACF,SAAS,CAAC,EAAE;QACR,CAAC,IAAI,EAAE,MAAM,GAAG;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,KAAK,CAAC;gBACT,MAAM,EAAE,MAAM,CAAC;gBACf,OAAO,EAAE,MAAM,CAAC;gBAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aACjC,CAAC,CAAC;SACN,CAAC;KACL,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAiC;IACnE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAiD;IAEpF,OAAO,CAAC,MAAM,CAAgC;IAE9C;;OAEG;IACH,MAAM,CAAC,YAAY,IAAI,MAAM;IAI7B;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,MAAM;IAI9B;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,IAAI,IAAI,eAAe;IA0BvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;OAEG;IACH,IAAI,IAAI,IAAI;IAeZ;;OAEG;IACH,GAAG,IAAI,eAAe;IAOtB;;OAEG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAK9C;;OAEG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAK3C;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAQ5C;;OAEG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAO/C;;OAEG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAQzC;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAM5C;;OAEG;IACH,mBAAmB,IAAI,MAAM,EAAE;IAK/B;;OAEG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAK5B;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAgBlC;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG;IAe1B;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,MAAM,IAAI,OAAO;CAGpB"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { homedir } from 'os';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration manager for MediaProc
|
|
6
|
+
* Handles reading/writing config from ~/.mediaproc/config.json
|
|
7
|
+
*/
|
|
8
|
+
export class ConfigManager {
|
|
9
|
+
static CONFIG_DIR = join(homedir(), '.mediaproc');
|
|
10
|
+
static CONFIG_FILE = join(ConfigManager.CONFIG_DIR, 'config.json');
|
|
11
|
+
config = null;
|
|
12
|
+
/**
|
|
13
|
+
* Get the config directory path
|
|
14
|
+
*/
|
|
15
|
+
static getConfigDir() {
|
|
16
|
+
return ConfigManager.CONFIG_DIR;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get the config file path
|
|
20
|
+
*/
|
|
21
|
+
static getConfigPath() {
|
|
22
|
+
return ConfigManager.CONFIG_FILE;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Ensure config directory exists
|
|
26
|
+
*/
|
|
27
|
+
ensureConfigDir() {
|
|
28
|
+
if (!existsSync(ConfigManager.CONFIG_DIR)) {
|
|
29
|
+
mkdirSync(ConfigManager.CONFIG_DIR, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Load config from file
|
|
34
|
+
*/
|
|
35
|
+
load() {
|
|
36
|
+
if (this.config) {
|
|
37
|
+
return this.config;
|
|
38
|
+
}
|
|
39
|
+
this.ensureConfigDir();
|
|
40
|
+
if (!existsSync(ConfigManager.CONFIG_FILE)) {
|
|
41
|
+
// Create default config
|
|
42
|
+
this.config = this.createDefaultConfig();
|
|
43
|
+
this.save();
|
|
44
|
+
return this.config;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const data = readFileSync(ConfigManager.CONFIG_FILE, 'utf-8');
|
|
48
|
+
this.config = JSON.parse(data);
|
|
49
|
+
return this.config;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error('Failed to parse config file, creating new one');
|
|
53
|
+
this.config = this.createDefaultConfig();
|
|
54
|
+
this.save();
|
|
55
|
+
return this.config;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create default config
|
|
60
|
+
*/
|
|
61
|
+
createDefaultConfig() {
|
|
62
|
+
return {
|
|
63
|
+
version: '1.0',
|
|
64
|
+
installedPlugins: [],
|
|
65
|
+
loadedPlugins: [],
|
|
66
|
+
defaults: {},
|
|
67
|
+
pipelines: {},
|
|
68
|
+
lastUpdated: new Date().toISOString(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Save config to file
|
|
73
|
+
*/
|
|
74
|
+
save() {
|
|
75
|
+
if (!this.config) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.ensureConfigDir();
|
|
79
|
+
this.config.lastUpdated = new Date().toISOString();
|
|
80
|
+
writeFileSync(ConfigManager.CONFIG_FILE, JSON.stringify(this.config, null, 2), 'utf-8');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get current config
|
|
84
|
+
*/
|
|
85
|
+
get() {
|
|
86
|
+
if (!this.config) {
|
|
87
|
+
return this.load();
|
|
88
|
+
}
|
|
89
|
+
return this.config;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if a plugin is installed
|
|
93
|
+
*/
|
|
94
|
+
isPluginInstalled(pluginName) {
|
|
95
|
+
const config = this.get();
|
|
96
|
+
return config.installedPlugins.includes(pluginName);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Check if a plugin is loaded
|
|
100
|
+
*/
|
|
101
|
+
isPluginLoaded(pluginName) {
|
|
102
|
+
const config = this.get();
|
|
103
|
+
return config.loadedPlugins.includes(pluginName);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Add plugin to installed list
|
|
107
|
+
*/
|
|
108
|
+
addInstalledPlugin(pluginName) {
|
|
109
|
+
const config = this.get();
|
|
110
|
+
if (!config.installedPlugins.includes(pluginName)) {
|
|
111
|
+
config.installedPlugins.push(pluginName);
|
|
112
|
+
this.save();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Remove plugin from installed list
|
|
117
|
+
*/
|
|
118
|
+
removeInstalledPlugin(pluginName) {
|
|
119
|
+
const config = this.get();
|
|
120
|
+
config.installedPlugins = config.installedPlugins.filter(p => p !== pluginName);
|
|
121
|
+
config.loadedPlugins = config.loadedPlugins.filter(p => p !== pluginName);
|
|
122
|
+
this.save();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Add plugin to loaded list
|
|
126
|
+
*/
|
|
127
|
+
addLoadedPlugin(pluginName) {
|
|
128
|
+
const config = this.get();
|
|
129
|
+
if (!config.loadedPlugins.includes(pluginName)) {
|
|
130
|
+
config.loadedPlugins.push(pluginName);
|
|
131
|
+
this.save();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Remove plugin from loaded list
|
|
136
|
+
*/
|
|
137
|
+
removeLoadedPlugin(pluginName) {
|
|
138
|
+
const config = this.get();
|
|
139
|
+
config.loadedPlugins = config.loadedPlugins.filter(p => p !== pluginName);
|
|
140
|
+
this.save();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get list of installed plugins
|
|
144
|
+
*/
|
|
145
|
+
getInstalledPlugins() {
|
|
146
|
+
const config = this.get();
|
|
147
|
+
return [...config.installedPlugins];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get list of loaded plugins
|
|
151
|
+
*/
|
|
152
|
+
getLoadedPlugins() {
|
|
153
|
+
const config = this.get();
|
|
154
|
+
return [...config.loadedPlugins];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Set a configuration value
|
|
158
|
+
*/
|
|
159
|
+
set(key, value) {
|
|
160
|
+
const config = this.get();
|
|
161
|
+
const keys = key.split('.');
|
|
162
|
+
let current = config;
|
|
163
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
164
|
+
if (!current[keys[i]]) {
|
|
165
|
+
current[keys[i]] = {};
|
|
166
|
+
}
|
|
167
|
+
current = current[keys[i]];
|
|
168
|
+
}
|
|
169
|
+
current[keys[keys.length - 1]] = value;
|
|
170
|
+
this.save();
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get a configuration value
|
|
174
|
+
*/
|
|
175
|
+
getValue(key) {
|
|
176
|
+
const config = this.get();
|
|
177
|
+
const keys = key.split('.');
|
|
178
|
+
let current = config;
|
|
179
|
+
for (const k of keys) {
|
|
180
|
+
if (current[k] === undefined) {
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
current = current[k];
|
|
184
|
+
}
|
|
185
|
+
return current;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Reset config to defaults
|
|
189
|
+
*/
|
|
190
|
+
reset() {
|
|
191
|
+
this.config = this.createDefaultConfig();
|
|
192
|
+
this.save();
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Check if config file exists
|
|
196
|
+
*/
|
|
197
|
+
exists() {
|
|
198
|
+
return existsSync(ConfigManager.CONFIG_FILE);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=config-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../src/config-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AA2B7B;;;GAGG;AACH,MAAM,OAAO,aAAa;IACd,MAAM,CAAU,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;IAC3D,MAAM,CAAU,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAE5E,MAAM,GAA2B,IAAI,CAAC;IAE9C;;OAEG;IACH,MAAM,CAAC,YAAY;QACf,OAAO,aAAa,CAAC,UAAU,CAAC;IACpC,CAAC;IAED;;OA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IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzC,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,MAAM;QACF,OAAO,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC"}
|
package/dist/plugin-manager.d.ts
CHANGED
|
@@ -1,31 +1,55 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import type { MediaProcPlugin } from './types.js';
|
|
3
|
+
import { ConfigManager } from './config-manager.js';
|
|
3
4
|
export declare class PluginManager {
|
|
4
5
|
private plugins;
|
|
5
6
|
private readonly pluginPrefix;
|
|
7
|
+
private configManager;
|
|
8
|
+
constructor();
|
|
9
|
+
private readonly officialPlugins;
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
11
|
+
* Check if a plugin is official (@mediaproc/* package)
|
|
8
12
|
*/
|
|
9
|
-
|
|
13
|
+
isOfficialPlugin(pluginName: string): boolean;
|
|
10
14
|
/**
|
|
11
|
-
*
|
|
15
|
+
* Get the plugin prefix
|
|
12
16
|
*/
|
|
13
|
-
|
|
17
|
+
getPluginPrefix(): string;
|
|
14
18
|
/**
|
|
15
19
|
* Load a specific plugin and register its commands
|
|
16
20
|
*/
|
|
17
|
-
loadPlugin(pluginName: string, program: Command): Promise<boolean>;
|
|
21
|
+
loadPlugin(pluginName: string, program: Command, isBuiltIn?: boolean): Promise<boolean>;
|
|
18
22
|
/**
|
|
19
|
-
* Get list of loaded plugins
|
|
23
|
+
* Get list of loaded plugins (currently in memory)
|
|
20
24
|
*/
|
|
21
25
|
getLoadedPlugins(): string[];
|
|
22
26
|
/**
|
|
23
|
-
*
|
|
27
|
+
* Get list of installed plugins from config
|
|
28
|
+
*/
|
|
29
|
+
getInstalledPlugins(): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Check if a plugin is installed (from config)
|
|
32
|
+
*/
|
|
33
|
+
isPluginInstalled(pluginName: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Get official plugins list
|
|
36
|
+
*/
|
|
37
|
+
getOfficialPlugins(): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Check if a plugin is loaded (in memory)
|
|
24
40
|
*/
|
|
25
41
|
isPluginLoaded(pluginName: string): boolean;
|
|
26
42
|
/**
|
|
27
43
|
* Get plugin instance
|
|
28
44
|
*/
|
|
29
45
|
getPlugin(pluginName: string): MediaProcPlugin | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Unload a plugin (remove from registry)
|
|
48
|
+
*/
|
|
49
|
+
unloadPlugin(pluginName: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Get the config manager instance
|
|
52
|
+
*/
|
|
53
|
+
getConfigManager(): ConfigManager;
|
|
30
54
|
}
|
|
31
55
|
//# sourceMappingURL=plugin-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-manager.d.ts","sourceRoot":"","sources":["../src/plugin-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-manager.d.ts","sourceRoot":"","sources":["../src/plugin-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAA2C;IAC1D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiB;IAC9C,OAAO,CAAC,aAAa,CAAgB;;IAOrC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAW9B;IAEF;;OAEG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAK7C;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,UAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAgC3F;;OAEG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAI5B;;OAEG;IACH,mBAAmB,IAAI,MAAM,EAAE;IAI/B;;OAEG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI9C;;OAEG;IACH,kBAAkB,IAAI,MAAM,EAAE;IAI9B;;OAEG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI3C;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI1D;;OAEG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAUzC;;OAEG;IACH,gBAAgB,IAAI,aAAa;CAGlC"}
|