@glock-org/glock 1.1.29 → 1.1.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glock-org/glock",
3
- "version": "1.1.29",
3
+ "version": "1.1.30",
4
4
  "description": "Glock - AI Coding Assistant CLI",
5
5
  "keywords": [
6
6
  "glock",
@@ -119,6 +119,9 @@ async function downloadBinary() {
119
119
  // Install Python dependencies
120
120
  await installPythonDependencies();
121
121
 
122
+ // Initialize plugins (copy example rules)
123
+ await initializePlugins();
124
+
122
125
  console.log('Glock installed successfully!');
123
126
  console.log('');
124
127
  console.log('Run `glock` to start an interactive session.');
@@ -183,6 +186,57 @@ async function installPythonDependencies() {
183
186
  }
184
187
  }
185
188
 
189
+ /**
190
+ * Initialize plugins by copying example rules to ~/.glock/
191
+ */
192
+ async function initializePlugins() {
193
+ const glockHome = path.join(os.homedir(), '.glock');
194
+ const glockDir = path.join(glockHome, '.glock');
195
+
196
+ // The binary should extract plugins to ~/.glock/glock-plugins/
197
+ const pluginsDir = path.join(glockHome, 'glock-plugins');
198
+ const hookifyExamples = path.join(pluginsDir, 'hookify', 'examples');
199
+
200
+ // Check if hookify examples exist (from binary bundle)
201
+ if (!fs.existsSync(hookifyExamples)) {
202
+ // Plugins not yet extracted - binary will handle on first run
203
+ return;
204
+ }
205
+
206
+ console.log('Initializing plugins...');
207
+
208
+ try {
209
+ // Ensure .glock directory exists
210
+ fs.mkdirSync(glockDir, { recursive: true });
211
+
212
+ // Copy hookify example rules
213
+ const exampleFiles = fs.readdirSync(hookifyExamples)
214
+ .filter(f => f.endsWith('.local.md'));
215
+
216
+ let copied = 0;
217
+ for (const file of exampleFiles) {
218
+ // Rename to hookify.<name>.local.md format
219
+ const baseName = file.replace('.local.md', '');
220
+ const destName = `hookify.${baseName}.local.md`;
221
+ const destPath = path.join(glockDir, destName);
222
+
223
+ // Only copy if doesn't exist (preserve user customizations)
224
+ if (!fs.existsSync(destPath)) {
225
+ const srcPath = path.join(hookifyExamples, file);
226
+ fs.copyFileSync(srcPath, destPath);
227
+ copied++;
228
+ }
229
+ }
230
+
231
+ if (copied > 0) {
232
+ console.log(`Hookify example rules initialized (${copied} rules).`);
233
+ }
234
+ } catch (err) {
235
+ // Non-fatal - plugins can be initialized on first run
236
+ console.log('Note: Could not initialize plugins. They will be set up on first run.');
237
+ }
238
+ }
239
+
186
240
  // Only run if not in CI or if explicitly requested
187
241
  const skipDownload = process.env.GLOCK_SKIP_BINARY_DOWNLOAD === '1';
188
242
  const isCI = process.env.CI === 'true';