project-iris 0.0.14 → 0.0.15

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.
@@ -1,5 +1,8 @@
1
1
  const ToolInstaller = require('./ToolInstaller');
2
2
  const path = require('path');
3
+ const fs = require('fs-extra');
4
+ const CLIUtils = require('../cli-utils');
5
+ const { theme } = CLIUtils;
3
6
 
4
7
  class AntigravityInstaller extends ToolInstaller {
5
8
  get key() {
@@ -17,6 +20,93 @@ class AntigravityInstaller extends ToolInstaller {
17
20
  get detectPath() {
18
21
  return '.agent';
19
22
  }
23
+
24
+ /**
25
+ * Extract a description from markdown content.
26
+ * Uses the first H1 heading text as the description.
27
+ * @param {string} content - Markdown content
28
+ * @returns {string} Description text
29
+ */
30
+ extractDescription(content) {
31
+ // Look for first H1 heading
32
+ const h1Match = content.match(/^#\s+(.+)$/m);
33
+ if (h1Match) {
34
+ return h1Match[1].trim();
35
+ }
36
+ // Fallback: use first non-empty line
37
+ const lines = content.split('\n').filter(line => line.trim());
38
+ return lines[0] ? lines[0].replace(/^#+\s*/, '').trim() : 'IRIS workflow';
39
+ }
40
+
41
+ /**
42
+ * Check if content already has YAML frontmatter
43
+ * @param {string} content - Markdown content
44
+ * @returns {boolean}
45
+ */
46
+ hasFrontmatter(content) {
47
+ return content.trimStart().startsWith('---');
48
+ }
49
+
50
+ /**
51
+ * Add YAML frontmatter to content for Antigravity workflow format
52
+ * @param {string} content - Original markdown content
53
+ * @returns {string} Content with frontmatter
54
+ */
55
+ addFrontmatter(content) {
56
+ if (this.hasFrontmatter(content)) {
57
+ return content; // Already has frontmatter
58
+ }
59
+
60
+ const description = this.extractDescription(content);
61
+ const frontmatter = `---
62
+ description: ${description}
63
+ ---
64
+ `;
65
+ return frontmatter + content;
66
+ }
67
+
68
+ /**
69
+ * Override installCommands to add YAML frontmatter for Antigravity workflows.
70
+ * Antigravity requires workflows to have YAML frontmatter with a description field.
71
+ */
72
+ async installCommands(flowPath, config) {
73
+ const targetCommandsDir = this.commandsDir;
74
+ console.log(theme.dim(` Installing workflows to ${targetCommandsDir}/...`));
75
+ await fs.ensureDir(targetCommandsDir);
76
+
77
+ const commandsSourceDir = path.join(flowPath, 'commands');
78
+
79
+ if (!await fs.pathExists(commandsSourceDir)) {
80
+ console.log(theme.warning(` No commands folder found at ${commandsSourceDir}`));
81
+ return [];
82
+ }
83
+
84
+ const commandFiles = await fs.readdir(commandsSourceDir);
85
+ const installedFiles = [];
86
+
87
+ for (const cmdFile of commandFiles) {
88
+ if (cmdFile.endsWith('.md')) {
89
+ try {
90
+ const sourcePath = path.join(commandsSourceDir, cmdFile);
91
+ const prefix = (config && config.command && config.command.prefix) ? `${config.command.prefix}-` : '';
92
+ const targetFileName = `iris-${prefix}${cmdFile}`;
93
+ const targetPath = path.join(targetCommandsDir, targetFileName);
94
+
95
+ // Read content and add YAML frontmatter for Antigravity
96
+ let content = await fs.readFile(sourcePath, 'utf8');
97
+ content = this.addFrontmatter(content);
98
+
99
+ await fs.outputFile(targetPath, content, 'utf8');
100
+ installedFiles.push(targetFileName);
101
+ } catch (err) {
102
+ console.log(theme.warning(` Failed to install ${cmdFile}: ${err.message}`));
103
+ }
104
+ }
105
+ }
106
+
107
+ CLIUtils.displayStatus('', `Installed ${installedFiles.length} workflows for ${this.name}`, 'success');
108
+ return installedFiles;
109
+ }
20
110
  }
21
111
 
22
112
  module.exports = AntigravityInstaller;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-iris",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Multi-agent orchestration system for AI-native software development. Delivers AI-DLC, Agile, and custom SDLC flows as markdown-based agent systems.",
5
5
  "main": "lib/installer.js",
6
6
  "bin": {
@@ -115,4 +115,4 @@
115
115
  ]
116
116
  ]
117
117
  }
118
- }
118
+ }