@majkapp/plugin-kit 3.3.1 → 3.3.2
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/generator/cli.js +50 -0
- package/package.json +1 -1
package/dist/generator/cli.js
CHANGED
|
@@ -39,6 +39,43 @@ const path = __importStar(require("path"));
|
|
|
39
39
|
const fs = __importStar(require("fs"));
|
|
40
40
|
const child_process_1 = require("child_process");
|
|
41
41
|
const generator_1 = require("./generator");
|
|
42
|
+
// Check args BEFORE commander parses to intercept for documentation
|
|
43
|
+
const args = process.argv.slice(2);
|
|
44
|
+
// If -h or --help, let commander handle it normally (show generator help)
|
|
45
|
+
const isHelpRequest = args.includes('-h') || args.includes('--help');
|
|
46
|
+
if (!isHelpRequest) {
|
|
47
|
+
// Check if this is a documentation request
|
|
48
|
+
const llmArg = args.find(arg => arg.startsWith('--llm'));
|
|
49
|
+
const isDefaultDocs = args.length === 0; // No args = show docs by default
|
|
50
|
+
if (isDefaultDocs || llmArg) {
|
|
51
|
+
// Delegate to promptable CLI for documentation
|
|
52
|
+
const promptablePath = path.join(__dirname, '../../bin/promptable-cli.js');
|
|
53
|
+
let promptableArgs;
|
|
54
|
+
if (isDefaultDocs || llmArg === '--llm') {
|
|
55
|
+
// Default to quick start
|
|
56
|
+
promptableArgs = ['--llm'];
|
|
57
|
+
}
|
|
58
|
+
else if (llmArg && llmArg.startsWith('--llm:')) {
|
|
59
|
+
// Extract view name: --llm:functions -> --functions
|
|
60
|
+
const view = llmArg.split(':')[1];
|
|
61
|
+
promptableArgs = [`--${view}`];
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
promptableArgs = ['--llm'];
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
(0, child_process_1.execSync)(`node "${promptablePath}" ${promptableArgs.join(' ')}`, {
|
|
68
|
+
stdio: 'inherit',
|
|
69
|
+
cwd: process.cwd()
|
|
70
|
+
});
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Normal commander behavior (generator commands)
|
|
42
79
|
commander_1.program
|
|
43
80
|
.name('plugin-kit')
|
|
44
81
|
.version('1.0.20')
|
|
@@ -126,6 +163,19 @@ commander_1.program
|
|
|
126
163
|
await generate();
|
|
127
164
|
}
|
|
128
165
|
});
|
|
166
|
+
// Add documentation options to help
|
|
167
|
+
commander_1.program
|
|
168
|
+
.option('--llm', 'Show plugin development documentation (quick start)')
|
|
169
|
+
.option('--llm:functions', 'Show function patterns documentation')
|
|
170
|
+
.option('--llm:screens', 'Show screen configuration documentation')
|
|
171
|
+
.option('--llm:hooks', 'Show generated hooks documentation')
|
|
172
|
+
.option('--llm:context', 'Show context API documentation')
|
|
173
|
+
.option('--llm:services', 'Show service grouping documentation')
|
|
174
|
+
.option('--llm:lifecycle', 'Show lifecycle hooks documentation')
|
|
175
|
+
.option('--llm:testing', 'Show testing guide')
|
|
176
|
+
.option('--llm:config', 'Show project configuration guide')
|
|
177
|
+
.option('--llm:api', 'Show API reference')
|
|
178
|
+
.option('--llm:full', 'Show complete reference');
|
|
129
179
|
commander_1.program.parse();
|
|
130
180
|
async function extractMetadata(entryPath) {
|
|
131
181
|
// Create a temp file for the output
|
package/package.json
CHANGED