@ruyfranca/myskills 1.0.25 → 1.0.27

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.
Files changed (2) hide show
  1. package/index.js +112 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -175,19 +175,21 @@ program
175
175
  .option('-w, --workflows', 'Atualiza apenas os workflows')
176
176
  .action(async (options) => {
177
177
  const updateAll = !options.skills && !options.agents && !options.workflows;
178
+ const destRoot = process.cwd();
179
+ const srcRoot = __dirname;
178
180
 
179
181
  console.log(chalk.cyan('\n🔄 Atualizando kit do Antigravity...\n'));
180
182
 
181
183
  const tasks = [];
182
184
 
183
185
  if (updateAll || options.skills) {
184
- tasks.push({ label: 'skills', src: path.join(__dirname, '.agent', 'skills'), dest: path.join(process.cwd(), '.agent', 'skills') });
186
+ tasks.push({ label: 'skills', src: path.join(srcRoot, '.agent', 'skills'), dest: path.join(destRoot, '.agent', 'skills') });
185
187
  }
186
188
  if (updateAll || options.agents) {
187
- tasks.push({ label: 'agents', src: path.join(__dirname, '.agent', 'agents'), dest: path.join(process.cwd(), '.agent', 'agents') });
189
+ tasks.push({ label: 'agents', src: path.join(srcRoot, '.agent', 'agents'), dest: path.join(destRoot, '.agent', 'agents') });
188
190
  }
189
191
  if (updateAll || options.workflows) {
190
- tasks.push({ label: 'workflows', src: path.join(__dirname, '.agent', 'workflows'), dest: path.join(process.cwd(), '.agent', 'workflows') });
192
+ tasks.push({ label: 'workflows', src: path.join(srcRoot, '.agent', 'workflows'), dest: path.join(destRoot, '.agent', 'workflows') });
191
193
  }
192
194
 
193
195
  for (const task of tasks) {
@@ -198,15 +200,119 @@ program
198
200
  try {
199
201
  await fs.ensureDir(task.dest);
200
202
  await fs.copy(task.src, task.dest, { overwrite: true });
201
- console.log(chalk.green(` ✅ ${task.label}: atualizado com sucesso`));
203
+ console.log(chalk.green(` ✅ ${task.label}: copiado`));
202
204
  } catch (err) {
203
- console.error(chalk.red(` ❌ ${task.label}: erro — ${err.message}`));
205
+ console.error(chalk.red(` ❌ ${task.label}: erro na cópia — ${err.message}`));
206
+ continue;
207
+ }
208
+ }
209
+
210
+ // Rewrite hardcoded paths (file:///...mySkills...) to point to the dest project
211
+ if (destRoot !== srcRoot) {
212
+ console.log(chalk.cyan('\n🔧 Corrigindo paths nos arquivos copiados...\n'));
213
+
214
+ const srcPathEncoded = `file://${srcRoot}`;
215
+ const destPathEncoded = `file://${destRoot}`;
216
+
217
+ const dirsToFix = [
218
+ path.join(destRoot, '.agent', 'workflows'),
219
+ path.join(destRoot, '.agent', 'agents'),
220
+ path.join(destRoot, '.agent', 'rules'),
221
+ path.join(destRoot, '.agent', 'skills'),
222
+ ];
223
+
224
+ let fixedFiles = 0;
225
+
226
+ for (const dir of dirsToFix) {
227
+ if (!await fs.pathExists(dir)) continue;
228
+
229
+ const walk = async (currentDir) => {
230
+ const entries = await fs.readdir(currentDir, { withFileTypes: true });
231
+ for (const entry of entries) {
232
+ const fullPath = path.join(currentDir, entry.name);
233
+ if (entry.isDirectory()) {
234
+ await walk(fullPath);
235
+ } else if (['.md', '.txt', '.json'].includes(path.extname(entry.name))) {
236
+ try {
237
+ const content = await fs.readFile(fullPath, 'utf8');
238
+ if (content.includes(srcPathEncoded)) {
239
+ const fixed = content.replaceAll(srcPathEncoded, destPathEncoded);
240
+ await fs.writeFile(fullPath, fixed, 'utf8');
241
+ fixedFiles++;
242
+ }
243
+ } catch {
244
+ // ignorar arquivos binários ou inacessíveis
245
+ }
246
+ }
247
+ }
248
+ };
249
+
250
+ await walk(dir);
251
+ }
252
+
253
+ if (fixedFiles > 0) {
254
+ console.log(chalk.green(` ✅ paths: ${fixedFiles} arquivo(s) corrigido(s)`));
255
+ } else {
256
+ console.log(chalk.gray(' ℹ️ paths: nenhuma substituição necessária'));
257
+ }
258
+ }
259
+
260
+ // Instalar workflows globalmente para aparecerem no / do Antigravity
261
+ if (updateAll || options.workflows) {
262
+ const homeDir = process.env.HOME || process.env.USERPROFILE || '';
263
+ const globalWorkflowsDir = path.join(homeDir, '.gemini', 'antigravity', 'global_workflows');
264
+ const workflowsSrc = path.join(srcRoot, '.agent', 'workflows');
265
+
266
+ if (await fs.pathExists(workflowsSrc)) {
267
+ try {
268
+ await fs.ensureDir(globalWorkflowsDir);
269
+ const files = await fs.readdir(workflowsSrc);
270
+ let copied = 0;
271
+ for (const file of files) {
272
+ if (file.endsWith('.md')) {
273
+ await fs.copy(path.join(workflowsSrc, file), path.join(globalWorkflowsDir, file), { overwrite: true });
274
+ copied++;
275
+ }
276
+ }
277
+ console.log(chalk.green(` ✅ global_workflows: ${copied} workflow(s) instalados em ~/.gemini/antigravity/global_workflows/`));
278
+ } catch (err) {
279
+ console.log(chalk.yellow(` ⚠️ global_workflows: ${err.message}`));
280
+ }
204
281
  }
205
282
  }
206
283
 
207
284
  console.log(chalk.cyan.bold('\n✨ Atualização concluída!\n'));
208
- console.log(chalk.gray('💡 Dica: reinicie o Antigravity para carregar as novas skills/workflows.\n'));
285
+ console.log(chalk.gray('💡 Dica: reinicie o Antigravity para que o / exiba os workflows.\n'));
209
286
  });
210
287
 
288
+ program
289
+ .command('install-global')
290
+ .description('Instala os workflows globalmente para aparecerem no / em qualquer projeto do Antigravity')
291
+ .action(async () => {
292
+ const homeDir = process.env.HOME || process.env.USERPROFILE || '';
293
+ const globalWorkflowsDir = path.join(homeDir, '.gemini', 'antigravity', 'global_workflows');
294
+ const workflowsSrc = path.join(__dirname, '.agent', 'workflows');
295
+
296
+ console.log(chalk.cyan('\n🌐 Instalando workflows globalmente...\n'));
297
+
298
+ try {
299
+ await fs.ensureDir(globalWorkflowsDir);
300
+ const files = await fs.readdir(workflowsSrc);
301
+ let copied = 0;
302
+ for (const file of files) {
303
+ if (file.endsWith('.md')) {
304
+ await fs.copy(path.join(workflowsSrc, file), path.join(globalWorkflowsDir, file), { overwrite: true });
305
+ copied++;
306
+ }
307
+ }
308
+ console.log(chalk.green(` ✅ ${copied} workflows instalados em ${globalWorkflowsDir}`));
309
+ console.log(chalk.cyan.bold('\n✨ Feito! Reinicie o Antigravity e use / para ver os workflows.\n'));
310
+ } catch (err) {
311
+ console.error(chalk.red(` ❌ Erro: ${err.message}`));
312
+ }
313
+ });
314
+
315
+
316
+
211
317
  program.parse();
212
318
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruyfranca/myskills",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "Biblioteca de skills customizadas para Antigravity / Claude Code",
5
5
  "main": "index.js",
6
6
  "bin": {