@notehub.md/cli 0.1.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.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/khton-tech/notehub.md/main/logos/plugin-bundle-background.svg" alt="Notehub Plugin" width="128" />
3
+ </p>
4
+
5
+ <h1 align="center">@notehub.md/cli</h1>
6
+
7
+ <p align="center">
8
+ <strong>🔧 CLI tool for building Notehub.md plugins</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@notehub.md/cli">
13
+ <img src="https://img.shields.io/npm/v/@notehub.md/cli?style=flat-square&color=blueviolet" alt="npm version" />
14
+ </a>
15
+ <a href="https://github.com/khton-tech/notehub.md/blob/main/LICENSE">
16
+ <img src="https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square" alt="License" />
17
+ </a>
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## 🚀 Quick Start
23
+
24
+ ### Create a new plugin
25
+
26
+ ```bash
27
+ npx @notehub.md/cli create ext.my-plugin
28
+ ```
29
+
30
+ This will scaffold a complete plugin project with:
31
+ - `manifest.json` — Plugin metadata
32
+ - `package.json` — Project configuration
33
+ - `tsconfig.json` — TypeScript config
34
+ - `src/index.ts` — Plugin entry point
35
+ - `PLUGIN_GUIDE.md` — Quick start guide
36
+ - `docs/index.html` — Beautiful documentation page
37
+
38
+ ### Build your plugin
39
+
40
+ ```bash
41
+ cd ext.my-plugin
42
+ npm install
43
+ npx @notehub.md/cli build
44
+ ```
45
+
46
+ This creates `ext.my-plugin.nhp` — a ready-to-install plugin archive.
47
+
48
+ ---
49
+
50
+ ## 📖 Commands
51
+
52
+ ### `nhp create <id>`
53
+
54
+ Create a new plugin from template.
55
+
56
+ ```bash
57
+ nhp create ext.my-plugin # Basic creation
58
+ nhp create ext.my-plugin --name "My Plugin" # With custom name
59
+ nhp create ext.my-plugin --with-styles # Include styles.css
60
+ ```
61
+
62
+ **Options:**
63
+ - `-n, --name <name>` — Human-readable plugin name
64
+ - `-s, --with-styles` — Include `styles.css` template
65
+
66
+ ### `nhp build`
67
+
68
+ Build and package the plugin in the current directory.
69
+
70
+ ```bash
71
+ nhp build # Standard build
72
+ nhp build --no-minify # Disable minification
73
+ nhp build --sourcemap # Include source maps
74
+ nhp build --watch # Watch mode
75
+ nhp build -o ./releases # Custom output directory
76
+ ```
77
+
78
+ **Options:**
79
+ - `-o, --output <dir>` — Output directory (default: `.`)
80
+ - `--no-minify` — Disable minification
81
+ - `--sourcemap` — Generate inline source maps
82
+ - `-w, --watch` — Watch mode (rebuild on changes)
83
+
84
+ ---
85
+
86
+ ## 📚 Documentation
87
+
88
+ Full documentation for plugin development:
89
+
90
+ | Language | Link |
91
+ |----------|------|
92
+ | 🇬🇧 English | **[Plugin Developer Guide](https://github.com/khton-tech/notehub.md/tree/main/docs/forPluginMakers/en)** |
93
+ | 🇷🇺 Русский | **[Руководство разработчика плагинов](https://github.com/khton-tech/notehub.md/tree/main/docs/forPluginMakers/ru)** |
94
+
95
+ ---
96
+
97
+ ## 🔌 Plugin Example
98
+
99
+ ```typescript
100
+ import { NotehubPlugin, PluginContext } from '@notehub/api';
101
+
102
+ class MyPlugin extends NotehubPlugin {
103
+ async onload(ctx: PluginContext): Promise<void> {
104
+ // Register an API
105
+ ctx.registerApi('my-plugin:greet', (name: string) => {
106
+ return `Hello, ${name}!`;
107
+ });
108
+
109
+ // Subscribe to events
110
+ ctx.subscribe('explorer:file-selected', (payload) => {
111
+ console.log('File selected:', payload.path);
112
+ });
113
+ }
114
+ }
115
+
116
+ export default new MyPlugin();
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 📄 License
122
+
123
+ **AGPL-3.0** — See [LICENSE](https://github.com/khton-tech/notehub.md/blob/main/LICENSE)
124
+
125
+ ---
126
+
127
+ <p align="center">
128
+ <strong>Made with ❤️ by <a href="https://github.com/khton-tech">khton-tech</a></strong>
129
+ </p>
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @fileoverview Build Command Implementation
3
+ *
4
+ * Builds a Notehub plugin using Vite in library mode and packages
5
+ * it into a .nhp (ZIP) archive.
6
+ *
7
+ * Build Process:
8
+ * 1. Read manifest.json from current directory
9
+ * 2. Run Vite build with SystemJS output format
10
+ * 3. Create ZIP archive with manifest.json, dist/main.js, styles.css (if exists)
11
+ * 4. Rename to [plugin-id].nhp
12
+ */
13
+ /**
14
+ * Build command options
15
+ */
16
+ export interface BuildOptions {
17
+ /** Output directory for the .nhp file */
18
+ outputDir: string;
19
+ /** Whether to minify the output */
20
+ minify: boolean;
21
+ /** Whether to generate source maps */
22
+ sourcemap: boolean;
23
+ /** Whether to watch for changes */
24
+ watch: boolean;
25
+ }
26
+ /**
27
+ * Execute the build command
28
+ */
29
+ export declare function buildCommand(options: BuildOptions): Promise<void>;
30
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,sCAAsC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC;CAClB;AAaD;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuKvE"}
@@ -0,0 +1,202 @@
1
+ /**
2
+ * @fileoverview Build Command Implementation
3
+ *
4
+ * Builds a Notehub plugin using Vite in library mode and packages
5
+ * it into a .nhp (ZIP) archive.
6
+ *
7
+ * Build Process:
8
+ * 1. Read manifest.json from current directory
9
+ * 2. Run Vite build with SystemJS output format
10
+ * 3. Create ZIP archive with manifest.json, dist/main.js, styles.css (if exists)
11
+ * 4. Rename to [plugin-id].nhp
12
+ */
13
+ import { build as viteBuild } from 'vite';
14
+ import archiver from 'archiver';
15
+ import chalk from 'chalk';
16
+ import { existsSync, readFileSync, createWriteStream, unlinkSync, statSync } from 'node:fs';
17
+ import { resolve, join } from 'node:path';
18
+ /**
19
+ * Execute the build command
20
+ */
21
+ export async function buildCommand(options) {
22
+ const cwd = process.cwd();
23
+ const startTime = Date.now();
24
+ console.log(chalk.cyan('\n📦 Notehub Plugin Builder\n'));
25
+ console.log(chalk.gray(`Working directory: ${cwd}\n`));
26
+ // Step 1: Read and validate manifest
27
+ const manifestPath = join(cwd, 'manifest.json');
28
+ if (!existsSync(manifestPath)) {
29
+ console.error(chalk.red('✖ Error: manifest.json not found in current directory'));
30
+ console.error(chalk.gray(' Make sure you are in a plugin directory'));
31
+ process.exit(1);
32
+ }
33
+ let manifest;
34
+ try {
35
+ manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
36
+ }
37
+ catch (error) {
38
+ console.error(chalk.red('✖ Error: Invalid manifest.json'));
39
+ console.error(chalk.gray(` ${error instanceof Error ? error.message : error}`));
40
+ process.exit(1);
41
+ }
42
+ if (!manifest.id || !manifest.name || !manifest.version) {
43
+ console.error(chalk.red('✖ Error: manifest.json must have id, name, and version fields'));
44
+ process.exit(1);
45
+ }
46
+ // Validate plugin ID format
47
+ const validIdPattern = /^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+$/;
48
+ if (!validIdPattern.test(manifest.id)) {
49
+ console.error(chalk.red('✖ Error: Invalid plugin ID format'));
50
+ console.error(chalk.gray(' Use format: ext.my-plugin or my-org.plugin-name'));
51
+ console.error(chalk.gray(' Only lowercase letters, numbers, dots, and hyphens allowed'));
52
+ process.exit(1);
53
+ }
54
+ console.log(chalk.white(`Plugin: ${chalk.bold(manifest.name)} (${manifest.id})`));
55
+ console.log(chalk.white(`Version: ${manifest.version}\n`));
56
+ // Step 2: Determine entry point
57
+ const entryPoint = manifest.main || 'src/index.ts';
58
+ const entryPath = join(cwd, entryPoint);
59
+ // Try common entry points if the default doesn't exist
60
+ const possibleEntries = [entryPoint, 'src/index.ts', 'src/index.tsx', 'src/main.ts', 'src/main.tsx', 'index.ts'];
61
+ let actualEntry = null;
62
+ for (const entry of possibleEntries) {
63
+ const fullPath = join(cwd, entry);
64
+ if (existsSync(fullPath)) {
65
+ actualEntry = fullPath;
66
+ break;
67
+ }
68
+ }
69
+ if (!actualEntry) {
70
+ console.error(chalk.red('✖ Error: No entry point found'));
71
+ console.error(chalk.gray(` Tried: ${possibleEntries.join(', ')}`));
72
+ process.exit(1);
73
+ }
74
+ console.log(chalk.gray(`Entry: ${actualEntry}\n`));
75
+ // Step 3: Run Vite build
76
+ console.log(chalk.yellow('⚙ Building with Vite...'));
77
+ const viteConfig = {
78
+ root: cwd,
79
+ build: {
80
+ lib: {
81
+ entry: actualEntry,
82
+ // NOTE: Do NOT set 'name' here - it would create a named System.register()
83
+ // which fails when loaded dynamically via Blob URL
84
+ formats: ['system'],
85
+ fileName: () => 'main.js',
86
+ },
87
+ outDir: 'dist',
88
+ emptyOutDir: true,
89
+ minify: options.minify ? 'esbuild' : false,
90
+ sourcemap: options.sourcemap ? 'inline' : false,
91
+ rollupOptions: {
92
+ external: [
93
+ 'react',
94
+ 'react-dom',
95
+ 'react-dom/client',
96
+ 'react/jsx-runtime',
97
+ '@notehub/api',
98
+ '@notehub/core',
99
+ '@notehub/ui',
100
+ 'lucide-react',
101
+ ],
102
+ output: {
103
+ format: 'system',
104
+ entryFileNames: 'main.js',
105
+ // Don't use named exports - we need anonymous module
106
+ exports: 'auto',
107
+ },
108
+ },
109
+ // Watch mode configuration
110
+ watch: options.watch ? {} : null,
111
+ // Suppress console output from Vite
112
+ reportCompressedSize: false,
113
+ },
114
+ logLevel: 'warn',
115
+ };
116
+ try {
117
+ if (options.watch) {
118
+ console.log(chalk.cyan('👁 Watch mode enabled - press Ctrl+C to stop\n'));
119
+ }
120
+ await viteBuild(viteConfig);
121
+ }
122
+ catch (error) {
123
+ console.error(chalk.red('\n✖ Build failed'));
124
+ console.error(chalk.gray(` ${error instanceof Error ? error.message : error}`));
125
+ process.exit(1);
126
+ }
127
+ // In watch mode, don't continue to packaging
128
+ if (options.watch) {
129
+ return;
130
+ }
131
+ console.log(chalk.green('✓ Build complete\n'));
132
+ // Step 4: Verify dist/main.js exists
133
+ const distMainPath = join(cwd, 'dist', 'main.js');
134
+ if (!existsSync(distMainPath)) {
135
+ console.error(chalk.red('✖ Error: dist/main.js not found after build'));
136
+ process.exit(1);
137
+ }
138
+ // Step 5: Create ZIP archive
139
+ console.log(chalk.yellow('📦 Packaging...'));
140
+ const outputFileName = `${manifest.id}.nhp`;
141
+ const outputPath = resolve(options.outputDir, outputFileName);
142
+ // Remove existing .nhp if present
143
+ if (existsSync(outputPath)) {
144
+ unlinkSync(outputPath);
145
+ }
146
+ await createNhpArchive(cwd, outputPath, manifest);
147
+ // Step 6: Print summary
148
+ const fileSize = statSync(outputPath).size;
149
+ const duration = ((Date.now() - startTime) / 1000).toFixed(2);
150
+ console.log(chalk.green('\n✓ Plugin packaged successfully!\n'));
151
+ console.log(chalk.white(' Output: ') + chalk.cyan(outputPath));
152
+ console.log(chalk.white(' Size: ') + chalk.cyan(formatFileSize(fileSize)));
153
+ console.log(chalk.white(' Time: ') + chalk.cyan(`${duration}s`));
154
+ console.log();
155
+ // Print contents
156
+ console.log(chalk.gray(' Contents:'));
157
+ console.log(chalk.gray(' • manifest.json'));
158
+ console.log(chalk.gray(' • main.js'));
159
+ const stylesPath = join(cwd, 'styles.css');
160
+ if (existsSync(stylesPath)) {
161
+ console.log(chalk.gray(' • styles.css'));
162
+ }
163
+ console.log();
164
+ }
165
+ /**
166
+ * Create the .nhp ZIP archive
167
+ */
168
+ async function createNhpArchive(sourceDir, outputPath, manifest) {
169
+ return new Promise((resolve, reject) => {
170
+ const output = createWriteStream(outputPath);
171
+ const archive = archiver('zip', { zlib: { level: 9 } });
172
+ output.on('close', () => resolve());
173
+ archive.on('error', (err) => reject(err));
174
+ archive.pipe(output);
175
+ // Add manifest.json
176
+ archive.file(join(sourceDir, 'manifest.json'), { name: 'manifest.json' });
177
+ // Add dist/main.js as main.js (flatten structure)
178
+ archive.file(join(sourceDir, 'dist', 'main.js'), { name: 'main.js' });
179
+ // Add styles.css if exists
180
+ const stylesPath = join(sourceDir, 'styles.css');
181
+ if (existsSync(stylesPath)) {
182
+ archive.file(stylesPath, { name: 'styles.css' });
183
+ }
184
+ // Also check for dist/style.css (Vite's default CSS output)
185
+ const distStylesPath = join(sourceDir, 'dist', 'style.css');
186
+ if (existsSync(distStylesPath) && !existsSync(stylesPath)) {
187
+ archive.file(distStylesPath, { name: 'styles.css' });
188
+ }
189
+ archive.finalize();
190
+ });
191
+ }
192
+ /**
193
+ * Format file size in human-readable format
194
+ */
195
+ function formatFileSize(bytes) {
196
+ if (bytes < 1024)
197
+ return `${bytes} B`;
198
+ if (bytes < 1024 * 1024)
199
+ return `${(bytes / 1024).toFixed(1)} KB`;
200
+ return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
201
+ }
202
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAuB,MAAM,MAAM,CAAC;AAC/D,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA2B1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAqB;IACpD,MAAM,GAAG,GAAG,OAAO,CAAC,GA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AE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QAEtE,2BAA2B;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QACjD,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QACrD,CAAC;QAED,4DAA4D;QAC5D,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAC5D,IAAI,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACxD,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,KAAa;IACjC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACtD,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @fileoverview Create Command Implementation
3
+ *
4
+ * Scaffolds a new Notehub plugin with the standard directory structure
5
+ * and template files.
6
+ *
7
+ * Generated Structure:
8
+ * ├── manifest.json
9
+ * ├── package.json
10
+ * ├── tsconfig.json
11
+ * ├── PLUGIN_GUIDE.md
12
+ * ├── src/
13
+ * │ └── index.ts
14
+ * ├── docs/
15
+ * │ └── index.html
16
+ * └── styles.css (optional)
17
+ */
18
+ /**
19
+ * Create command options
20
+ */
21
+ export interface CreateOptions {
22
+ /** Plugin ID (e.g., ext.my-plugin) */
23
+ id: string;
24
+ /** Human-readable plugin name */
25
+ name?: string;
26
+ /** Include styles.css template */
27
+ withStyles?: boolean;
28
+ }
29
+ /**
30
+ * Execute the create command
31
+ */
32
+ export declare function createCommand(options: CreateOptions): Promise<void>;
33
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFzE"}
@@ -0,0 +1,236 @@
1
+ /**
2
+ * @fileoverview Create Command Implementation
3
+ *
4
+ * Scaffolds a new Notehub plugin with the standard directory structure
5
+ * and template files.
6
+ *
7
+ * Generated Structure:
8
+ * ├── manifest.json
9
+ * ├── package.json
10
+ * ├── tsconfig.json
11
+ * ├── PLUGIN_GUIDE.md
12
+ * ├── src/
13
+ * │ └── index.ts
14
+ * ├── docs/
15
+ * │ └── index.html
16
+ * └── styles.css (optional)
17
+ */
18
+ import chalk from 'chalk';
19
+ import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';
20
+ import { join, resolve, dirname } from 'node:path';
21
+ import { fileURLToPath } from 'node:url';
22
+ // Get templates directory path
23
+ const __filename = fileURLToPath(import.meta.url);
24
+ const __dirname = dirname(__filename);
25
+ const TEMPLATES_DIR = resolve(__dirname, '..', '..', 'templates');
26
+ /**
27
+ * Execute the create command
28
+ */
29
+ export async function createCommand(options) {
30
+ const { id, name = toTitleCase(id), withStyles = false } = options;
31
+ // Validate ID format
32
+ if (!isValidPluginId(id)) {
33
+ console.error(chalk.red('✖ Invalid plugin ID'));
34
+ console.error(chalk.gray(' Use format: ext.my-plugin or my-org.plugin-name'));
35
+ console.error(chalk.gray(' Only lowercase letters, numbers, dots, and hyphens allowed'));
36
+ process.exit(1);
37
+ }
38
+ const targetDir = resolve(process.cwd(), id);
39
+ console.log(chalk.cyan('\n🚀 Notehub Plugin Generator\n'));
40
+ // Check if directory already exists
41
+ if (existsSync(targetDir)) {
42
+ console.error(chalk.red(`✖ Directory already exists: ${targetDir}`));
43
+ process.exit(1);
44
+ }
45
+ console.log(chalk.white(`Creating plugin: ${chalk.bold(name)} (${id})`));
46
+ console.log(chalk.gray(`Location: ${targetDir}\n`));
47
+ // Create directory structure
48
+ mkdirSync(targetDir, { recursive: true });
49
+ mkdirSync(join(targetDir, 'src'), { recursive: true });
50
+ mkdirSync(join(targetDir, 'docs'), { recursive: true });
51
+ // Generate files
52
+ writeFileSync(join(targetDir, 'manifest.json'), generateManifest(id, name));
53
+ console.log(chalk.green(' ✓ manifest.json'));
54
+ writeFileSync(join(targetDir, 'package.json'), generatePackageJson(id, name));
55
+ console.log(chalk.green(' ✓ package.json'));
56
+ writeFileSync(join(targetDir, 'tsconfig.json'), generateTsConfig());
57
+ console.log(chalk.green(' ✓ tsconfig.json'));
58
+ writeFileSync(join(targetDir, 'src', 'index.ts'), generateEntryPoint(id, name));
59
+ console.log(chalk.green(' ✓ src/index.ts'));
60
+ if (withStyles) {
61
+ writeFileSync(join(targetDir, 'styles.css'), generateStyles(id));
62
+ console.log(chalk.green(' ✓ styles.css'));
63
+ }
64
+ // Copy template files
65
+ try {
66
+ const pluginGuide = readFileSync(join(TEMPLATES_DIR, 'PLUGIN_GUIDE.md'), 'utf-8');
67
+ writeFileSync(join(targetDir, 'PLUGIN_GUIDE.md'), pluginGuide);
68
+ console.log(chalk.green(' ✓ PLUGIN_GUIDE.md'));
69
+ }
70
+ catch {
71
+ console.log(chalk.yellow(' ⚠ PLUGIN_GUIDE.md (template not found)'));
72
+ }
73
+ try {
74
+ const docsHtml = readFileSync(join(TEMPLATES_DIR, 'docs.html'), 'utf-8');
75
+ writeFileSync(join(targetDir, 'docs', 'index.html'), docsHtml);
76
+ console.log(chalk.green(' ✓ docs/index.html'));
77
+ }
78
+ catch {
79
+ console.log(chalk.yellow(' ⚠ docs/index.html (template not found)'));
80
+ }
81
+ // Print next steps
82
+ console.log(chalk.green('\n✓ Plugin created successfully!\n'));
83
+ console.log(chalk.white('Next steps:'));
84
+ console.log(chalk.gray(` 1. cd ${id}`));
85
+ console.log(chalk.gray(' 2. npm install'));
86
+ console.log(chalk.gray(' 3. npm run build'));
87
+ console.log(chalk.gray(' 4. nhp build'));
88
+ console.log(chalk.gray(' 5. Open docs/index.html for documentation'));
89
+ console.log();
90
+ }
91
+ /**
92
+ * Validate plugin ID format
93
+ */
94
+ function isValidPluginId(id) {
95
+ // Must be: lowercase, can contain dots, hyphens, numbers
96
+ // Must have at least one dot (namespace.name)
97
+ return /^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+$/.test(id);
98
+ }
99
+ /**
100
+ * Convert plugin ID to title case name
101
+ */
102
+ function toTitleCase(id) {
103
+ // ext.my-cool-plugin -> My Cool Plugin
104
+ const parts = id.split('.');
105
+ const lastPart = parts[parts.length - 1];
106
+ return lastPart
107
+ .split('-')
108
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
109
+ .join(' ');
110
+ }
111
+ /**
112
+ * Generate manifest.json content
113
+ */
114
+ function generateManifest(id, name) {
115
+ const manifest = {
116
+ id,
117
+ name,
118
+ version: '0.1.0',
119
+ description: `${name} plugin for Notehub.md`,
120
+ author: '',
121
+ main: 'main.js',
122
+ };
123
+ return JSON.stringify(manifest, null, 4) + '\n';
124
+ }
125
+ /**
126
+ * Generate package.json content
127
+ */
128
+ function generatePackageJson(id, name) {
129
+ const packageName = id.replace(/\./g, '-');
130
+ const pkg = {
131
+ name: packageName,
132
+ version: '0.1.0',
133
+ description: `${name} plugin for Notehub.md`,
134
+ type: 'module',
135
+ main: './dist/main.js',
136
+ scripts: {
137
+ build: 'nhp build',
138
+ dev: 'tsc --watch',
139
+ },
140
+ dependencies: {},
141
+ devDependencies: {
142
+ '@notehub/api': 'workspace:*',
143
+ '@types/react': '^18.3.0',
144
+ typescript: '^5.6.0',
145
+ },
146
+ peerDependencies: {
147
+ react: '^18.3.0',
148
+ },
149
+ };
150
+ return JSON.stringify(pkg, null, 4) + '\n';
151
+ }
152
+ /**
153
+ * Generate tsconfig.json content
154
+ */
155
+ function generateTsConfig() {
156
+ const config = {
157
+ compilerOptions: {
158
+ target: 'ES2022',
159
+ module: 'ESNext',
160
+ moduleResolution: 'bundler',
161
+ lib: ['ES2022', 'DOM'],
162
+ jsx: 'react-jsx',
163
+ strict: true,
164
+ esModuleInterop: true,
165
+ skipLibCheck: true,
166
+ forceConsistentCasingInFileNames: true,
167
+ declaration: false,
168
+ outDir: './dist',
169
+ rootDir: './src',
170
+ },
171
+ include: ['src/**/*'],
172
+ exclude: ['node_modules', 'dist'],
173
+ };
174
+ return JSON.stringify(config, null, 4) + '\n';
175
+ }
176
+ /**
177
+ * Generate src/index.ts entry point
178
+ */
179
+ function generateEntryPoint(id, name) {
180
+ return `/**
181
+ * ${name} Plugin
182
+ *
183
+ * @module ${id}
184
+ */
185
+
186
+ import { NotehubPlugin, PluginContext } from '@notehub/api';
187
+
188
+ class ${toPascalCase(id)}Plugin extends NotehubPlugin {
189
+ async onload(ctx: PluginContext): Promise<void> {
190
+ console.log('${name} plugin loaded!');
191
+
192
+ // Register an API endpoint
193
+ // ctx.registerApi('${id}:hello', (name: string) => \`Hello, \${name}!\`);
194
+
195
+ // Subscribe to events
196
+ // ctx.subscribe('note:saved', (payload) => {
197
+ // console.log('Note saved:', payload);
198
+ // });
199
+ }
200
+
201
+ async onunload(): Promise<void> {
202
+ console.log('${name} plugin unloaded!');
203
+ // Cleanup is automatic for APIs and subscriptions
204
+ }
205
+ }
206
+
207
+ export default new ${toPascalCase(id)}Plugin();
208
+ `;
209
+ }
210
+ /**
211
+ * Generate styles.css template
212
+ */
213
+ function generateStyles(id) {
214
+ return `/**
215
+ * Styles for ${id}
216
+ *
217
+ * These styles are automatically injected when the plugin loads.
218
+ * Use plugin-specific class names to avoid conflicts.
219
+ */
220
+
221
+ .${id.replace(/\./g, '-')} {
222
+ /* Your styles here */
223
+ }
224
+ `;
225
+ }
226
+ /**
227
+ * Convert plugin ID to PascalCase class name
228
+ */
229
+ function toPascalCase(id) {
230
+ // ext.my-cool-plugin -> MyCoolPlugin
231
+ return id
232
+ .split(/[.-]/)
233
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
234
+ .join('');
235
+ }
236
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,+BAA+B;AAC/B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAclE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAsB;IACt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