@tdsoft-tech/aikit 0.1.19 → 0.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.
@@ -1214,11 +1214,95 @@ var init_beads = __esm({
1214
1214
  }
1215
1215
  /**
1216
1216
  * Initialize local .beads directory (works without global beads CLI)
1217
+ * Creates a fully functional beads workspace for OpenCode/Claude Code
1217
1218
  */
1218
1219
  async initLocal() {
1219
1220
  try {
1220
1221
  const beadsDir = paths.beadsDir(this.projectPath);
1221
1222
  await mkdir5(beadsDir, { recursive: true });
1223
+ const configYaml = `# Beads Configuration File
1224
+ # This file configures default behavior for all bd commands in this repository
1225
+ # All settings can also be set via environment variables (BD_* prefix)
1226
+ # or overridden with command-line flags
1227
+
1228
+ # Issue prefix for this repository (used by bd init)
1229
+ # If not set, bd init will auto-detect from directory name
1230
+ # issue-prefix: ""
1231
+
1232
+ # Use no-db mode: load from JSONL, no SQLite, write back after each command
1233
+ # When true, bd will use .beads/issues.jsonl as the source of truth
1234
+ # instead of SQLite database
1235
+ # no-db: false
1236
+
1237
+ # Disable daemon for RPC communication (forces direct database access)
1238
+ # no-daemon: false
1239
+
1240
+ # Disable auto-flush of database to JSONL after mutations
1241
+ # no-auto-flush: false
1242
+
1243
+ # Disable auto-import from JSONL when it's newer than database
1244
+ # no-auto-import: false
1245
+
1246
+ # Enable JSON output by default
1247
+ # json: false
1248
+
1249
+ # Default actor for audit trails (overridden by BD_ACTOR or --actor)
1250
+ # actor: ""
1251
+
1252
+ # Path to database (overridden by BEADS_DB or --db)
1253
+ # db: ""
1254
+
1255
+ # Auto-start daemon if not running (can also use BEADS_AUTO_START_DAEMON)
1256
+ # auto-start-daemon: true
1257
+
1258
+ # Debounce interval for auto-flush (can also use BEADS_FLUSH_DEBOUNCE)
1259
+ # flush-debounce: "5s"
1260
+
1261
+ # Git branch for beads commits (bd sync will commit to this branch)
1262
+ # IMPORTANT: Set this for team projects so all clones use the same sync branch.
1263
+ # sync-branch: "beads-sync"
1264
+ `;
1265
+ await writeFile5(join9(beadsDir, "config.yaml"), configYaml);
1266
+ const metadata = {
1267
+ database: "beads.db",
1268
+ jsonl_export: "issues.jsonl"
1269
+ };
1270
+ await writeFile5(join9(beadsDir, "metadata.json"), JSON.stringify(metadata, null, 2));
1271
+ const gitignore = `# SQLite databases
1272
+ *.db
1273
+ *.db?*
1274
+ *.db-journal
1275
+ *.db-wal
1276
+ *.db-shm
1277
+
1278
+ # Daemon runtime files
1279
+ daemon.lock
1280
+ daemon.log
1281
+ daemon.pid
1282
+ bd.sock
1283
+
1284
+ # Local version tracking (prevents upgrade notification spam after git ops)
1285
+ .local_version
1286
+
1287
+ # Legacy database files
1288
+ db.sqlite
1289
+ bd.db
1290
+
1291
+ # Merge artifacts (temporary files from 3-way merge)
1292
+ beads.base.jsonl
1293
+ beads.base.meta.json
1294
+ beads.left.jsonl
1295
+ beads.left.meta.json
1296
+ beads.right.jsonl
1297
+ beads.right.meta.json
1298
+
1299
+ # Keep JSONL exports and config (source of truth for git)
1300
+ !issues.jsonl
1301
+ !metadata.json
1302
+ !config.json
1303
+ `;
1304
+ await writeFile5(join9(beadsDir, ".gitignore"), gitignore);
1305
+ await writeFile5(join9(beadsDir, ".local_version"), "0.32.1\n");
1222
1306
  const readmeContent = `# Beads - Task Tracking
1223
1307
 
1224
1308
  This directory contains task beads for tracking work items.
@@ -1229,14 +1313,17 @@ This directory contains task beads for tracking work items.
1229
1313
  - Use \`/create\` command to create new tasks
1230
1314
  - Use \`/finish\` command to complete tasks with quality gates
1231
1315
 
1232
- ## Beads CLI
1233
- For full functionality, install beads globally:
1316
+ ## Automatic Setup
1317
+ This directory was automatically initialized by AIKit for use with OpenCode/Claude Code.
1318
+ No manual setup required - it's ready to use!
1319
+
1320
+ ## Beads CLI (Optional)
1321
+ For advanced functionality, you can install the beads CLI globally:
1234
1322
  \`\`\`bash
1235
1323
  npm install -g beads
1236
- bd init
1237
1324
  \`\`\`
1238
1325
 
1239
- ## Available Commands
1326
+ Then you can use commands like:
1240
1327
  - \`bd ready\` - Show available work
1241
1328
  - \`bd show <id>\` - View task details
1242
1329
  - \`bd update <id> --status in_progress\` - Update task status
@@ -3937,30 +4024,27 @@ init_esm_shims();
3937
4024
  var DRAWIO_COMMANDS = [
3938
4025
  {
3939
4026
  name: "drawio-interact",
3940
- description: "Create/edit diagrams with AI + Draw.io + auto-sync",
4027
+ description: "Create and edit diagrams with Draw.io (manual sync)",
3941
4028
  category: "design",
3942
- usage: "/drawio-interact <create|modify|list|start-sync|stop-sync> [diagram-name]",
4029
+ usage: "/drawio-interact <create|open|sync-to-mmd|sync-to-drawio|list> [diagram-name]",
3943
4030
  examples: [
3944
4031
  "/drawio-interact create login-flow",
3945
- "/drawio-interact modify login-flow",
3946
- "/drawio-interact list",
3947
- "/drawio-interact start-sync",
3948
- "/drawio-interact stop-sync"
4032
+ "/drawio-interact open login-flow",
4033
+ "/drawio-interact sync-to-mmd login-flow",
4034
+ "/drawio-interact sync-to-drawio login-flow",
4035
+ "/drawio-interact list"
3949
4036
  ],
3950
- content: `Interactive diagram workflow with AI + Draw.io + background sync.
4037
+ content: `Interactive diagram workflow with AI + Draw.io + manual sync.
3951
4038
 
3952
4039
  **User provided**: $ARGUMENTS
3953
4040
 
3954
4041
  ## File Locations
3955
4042
 
3956
- **NEW STRUCTURE**:
3957
- - **Mermaid files**: \`mermaid/[name].mmd\` (project root, version control)
4043
+ **Standard locations**:
4044
+ - **Mermaid files**: \`mermaid/[name].mmd\` (version control)
3958
4045
  - **Draw.io files**: \`.aikit/assets/drawio/[name].drawio\` (visual editing)
3959
4046
 
3960
- **Background Sync**:
3961
- - Auto-syncs changes between both formats
3962
- - Runs as background service
3963
- - Detects changes in real-time
4047
+ **Custom paths**: You can also specify full paths to sync any diagram files.
3964
4048
 
3965
4049
  ## Workflow
3966
4050
 
@@ -3968,10 +4052,10 @@ var DRAWIO_COMMANDS = [
3968
4052
 
3969
4053
  Check if user wants to:
3970
4054
  - **create** - Generate new diagram and open in Draw.io
3971
- - **modify** - Manual sync (if background sync not running)
4055
+ - **open** - Open existing diagram in Draw.io
4056
+ - **sync-to-mmd** - Convert Draw.io \u2192 Mermaid
4057
+ - **sync-to-drawio** - Convert Mermaid \u2192 Draw.io
3972
4058
  - **list** - Show all existing diagrams
3973
- - **start-sync** - Start background sync service
3974
- - **stop-sync** - Stop background sync service
3975
4059
 
3976
4060
  ### Step 2: Create Diagram (if "create")
3977
4061
 
@@ -3981,260 +4065,320 @@ Check if user wants to:
3981
4065
  - "create login-flow" \u2192 name = "login-flow"
3982
4066
  - If no name provided, ask user
3983
4067
 
3984
- 2. **Generate Mermaid code** based on description:
4068
+ 2. **Ensure directories exist**:
4069
+ \`\`\`javascript
4070
+ import { ensureDiagramDirectories } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4071
+ ensureDiagramDirectories(projectRoot);
4072
+ \`\`\`
4073
+
4074
+ 3. **Generate Mermaid code** based on description:
3985
4075
  - Login/auth \u2192 Flowchart with authentication
3986
4076
  - Order/purchase \u2192 Flowchart with payment
3987
4077
  - API/request \u2192 Sequence diagram
3988
4078
  - Generic \u2192 Basic flowchart
3989
4079
 
3990
- 3. **Create files**:
3991
- - \`mermaid/[name].mmd\` - Mermaid source
3992
- - \`.aikit/assets/drawio/[name].drawio\` - Draw.io XML
3993
-
3994
- 4. **Open in Draw.io with auto-sync**:
3995
- - Use lifecycle manager for automatic sync start/stop
3996
- - Sync starts when Draw.io opens
3997
- - Sync stops when Draw.io closes
3998
- - No manual intervention needed!
3999
-
4000
- **Implementation**: Use lifecycle manager
4001
-
4080
+ 4. **Convert to Draw.io**:
4002
4081
  \`\`\`javascript
4003
- import { openDrawioWithAutoSync } from '.aikit/tools/drawio-sync/lifecycle-manager.js';
4004
- import { join } from 'path';
4082
+ import { convertToDrawioFile } from '@tdsoft-tech/aikit/tools/drawio-convert/convert-to-drawio.js';
4005
4083
 
4006
- const projectRoot = process.cwd();
4084
+ const mermaidPath = join(projectRoot, 'mermaid', \`\${name}.mmd\`);
4007
4085
  const drawioPath = join(projectRoot, '.aikit/assets/drawio', \`\${name}.drawio\`);
4008
4086
 
4009
- // This will:
4010
- // 1. Start sync service automatically
4011
- // 2. Open Draw.io app
4012
- // 3. Monitor Draw.io process
4013
- // 4. Stop sync when Draw.io closes
4014
- await openDrawioWithAutoSync(drawioPath);
4087
+ // Write Mermaid file first
4088
+ fs.writeFileSync(mermaidPath, mermaidCode, 'utf-8');
4089
+
4090
+ // Convert to Draw.io
4091
+ const result = convertToDrawioFile(mermaidPath, drawioPath, name);
4015
4092
  \`\`\`
4016
4093
 
4017
- **What happens**:
4018
- - \u2705 Sync service starts automatically
4019
- - \u2705 Draw.io opens
4020
- - \u2705 Files stay in sync while editing
4021
- - \u2705 Sync stops automatically when Draw.io closes
4022
- - \u2705 Zero manual intervention!
4094
+ 5. **Open in Draw.io**:
4095
+ \`\`\`javascript
4096
+ import { openDiagram } from '@tdsoft-tech/aikit/tools/drawio-convert/open-diagram.js';
4097
+ const openResult = openDiagram(drawioPath);
4098
+ \`\`\`
4023
4099
 
4024
- 5. **Report success**:
4100
+ 6. **Report success**:
4025
4101
  - Show generated Mermaid code
4026
4102
  - Confirm file locations
4027
- - Confirm Draw.io opened with auto-sync
4028
- - Inform user: "Sync will stop automatically when you close Draw.io"
4103
+ - Confirm Draw.io opened
4104
+ - Inform user: "After editing, run /drawio-interact sync-to-mmd [name]"
4029
4105
 
4030
- ### Step 3: Modify Diagram (if "modify")
4106
+ ### Step 3: Open Diagram (if "open")
4031
4107
 
4032
- **Action**: Manual one-time sync (use if background sync not running)
4108
+ **Action**: Open existing diagram in Draw.io
4033
4109
 
4034
- 1. **Extract diagram name**
4035
- 2. **Read files**:
4036
- - \`mermaid/[name].mmd\`
4037
- - \`.aikit/assets/drawio/[name].drawio\`
4110
+ 1. **Resolve diagram path**:
4111
+ \`\`\`javascript
4112
+ import { resolveDiagramPath } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4038
4113
 
4039
- 3. **Convert Draw.io \u2192 Mermaid**
4040
- 4. **Detect changes**
4041
- 5. **Update Mermaid file**
4042
- 6. **Report changes**
4114
+ const drawioPath = resolveDiagramPath(name, 'drawio', projectRoot);
4115
+ \`\`\`
4043
4116
 
4044
- **Note**: If background sync is running, this is automatic!
4117
+ 2. **Check file exists** - If not, ask to create first
4045
4118
 
4046
- ### Step 4: List Diagrams (if "list")
4119
+ 3. **Open in Draw.io**:
4120
+ \`\`\`javascript
4121
+ import { openDiagram } from '@tdsoft-tech/aikit/tools/drawio-convert/open-diagram.js';
4122
+ const result = openDiagram(drawioPath);
4123
+ \`\`\`
4047
4124
 
4048
- **Action**: Show all diagrams
4125
+ 4. **Tip**: "After editing, run /drawio-interact sync-to-mmd [name] to update Mermaid"
4049
4126
 
4050
- \`\`\`bash
4051
- ls mermaid/*.mmd 2>/dev/null | sed 's/mermaid\\///' | sed 's/.mmd$//'
4127
+ ### Step 4: Sync to Mermaid (if "sync-to-mmd")
4128
+
4129
+ **Action**: Convert Draw.io file \u2192 Mermaid format (update source code)
4130
+
4131
+ 1. **Resolve diagram path**:
4132
+ \`\`\`javascript
4133
+ import { resolveDiagramPath } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4134
+
4135
+ // Can be name or full path
4136
+ const drawioPath = resolveDiagramPath(input, 'drawio', projectRoot);
4052
4137
  \`\`\`
4053
4138
 
4054
- Format as numbered list with file info.
4139
+ 2. **Validate file exists**
4140
+
4141
+ 3. **Convert Draw.io \u2192 Mermaid**:
4142
+ \`\`\`javascript
4143
+ import { convertToMermaidFile } from '@tdsoft-tech/aikit/tools/drawio-convert/convert-to-mermaid.js';
4144
+ import { findPairedDiagram } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4055
4145
 
4056
- ### Step 5: Start Sync (if "start-sync")
4146
+ // Find paired Mermaid file
4147
+ const mermaidPath = findPairedDiagram(drawioPath, projectRoot);
4057
4148
 
4058
- **Action**: Start background sync service
4149
+ // If not found, ask user where to save
4150
+ if (!mermaidPath) {
4151
+ const name = path.basename(drawioPath, '.drawio');
4152
+ mermaidPath = join(projectRoot, 'mermaid', \`\${name}.mmd\`);
4153
+ }
4059
4154
 
4060
- 1. **Check if service already running**
4061
- 2. **Start Chokidar file watcher**:
4062
- - Watch \`mermaid/*.mmd\`
4063
- - Watch \`.aikit/assets/drawio/*.drawio\`
4064
- 3. **Auto-sync on change**:
4065
- - Debounce: 500ms
4066
- - Lock files during sync to prevent loops
4067
- - Log all changes
4068
- 4. **Report**: "Background sync running"
4155
+ // Convert
4156
+ const result = convertToMermaidFile(drawioPath, mermaidPath);
4157
+ \`\`\`
4069
4158
 
4070
- **Implementation**: Use .aikit/tools/drawio-sync/sync-service.js
4159
+ 4. **Handle errors**:
4160
+ - If errors: Show exact error with suggestions
4161
+ - If warnings: Show warnings but continue
4071
4162
 
4163
+ 5. **Report success**:
4164
+ - Show conversion stats (nodes, edges)
4165
+ - Show preview of updated Mermaid (10 lines)
4166
+ - Confirm file updated: "\u2705 Synced: [name].drawio \u2192 [name].mmd"
4167
+
4168
+ ### Step 5: Sync to Draw.io (if "sync-to-drawio")
4169
+
4170
+ **Action**: Convert Mermaid \u2192 Draw.io format (update visual diagram)
4171
+
4172
+ 1. **Resolve diagram path**:
4072
4173
  \`\`\`javascript
4073
- import { startSyncService } from '.aikit/tools/drawio-sync/sync-service.js';
4074
- startSyncService();
4075
- \`\`\`
4174
+ import { resolveDiagramPath } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4076
4175
 
4077
- ### Step 6: Stop Sync (if "stop-sync")
4176
+ const mermaidPath = resolveDiagramPath(input, 'mermaid', projectRoot);
4177
+ \`\`\`
4078
4178
 
4079
- **Action**: Stop background sync service
4179
+ 2. **Validate file exists**
4080
4180
 
4181
+ 3. **Convert Mermaid \u2192 Draw.io**:
4081
4182
  \`\`\`javascript
4082
- import { stopSyncService } from '.aikit/tools/drawio-sync/sync-service.js';
4083
- stopSyncService();
4183
+ import { convertToDrawioFile } from '@tdsoft-tech/aikit/tools/drawio-convert/convert-to-drawio.js';
4184
+ import { findPairedDiagram } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4185
+
4186
+ // Find paired Draw.io file
4187
+ const drawioPath = findPairedDiagram(mermaidPath, projectRoot);
4188
+
4189
+ // If not found, ask user where to save
4190
+ if (!drawioPath) {
4191
+ const name = path.basename(mermaidPath, '.mmd');
4192
+ drawioPath = join(projectRoot, '.aikit/assets/drawio', \`\${name}.drawio\`);
4193
+ }
4194
+
4195
+ // Convert
4196
+ const result = convertToDrawioFile(mermaidPath, drawioPath, name);
4084
4197
  \`\`\`
4085
4198
 
4086
- ## Conversion Tools
4199
+ 4. **Handle errors**:
4200
+ - If Mermaid syntax errors: Show line number and fix suggestions
4201
+ - If conversion warnings: Show but continue
4202
+
4203
+ 5. **Report success**:
4204
+ - Show conversion stats
4205
+ - Confirm file updated
4206
+ - **Prompt**: "Open in Draw.io? (y/n)"
4207
+ - If yes: invoke openDiagram()
4087
4208
 
4088
- **Location**: \`.aikit/tools/drawio-sync/\`
4209
+ ### Step 6: List Diagrams (if "list")
4089
4210
 
4090
- **Modules**:
4091
- - \`mermaid-to-drawio.js\` - Mermaid \u2192 Draw.io conversion
4092
- - \`drawio-to-mermaid.js\` - Draw.io \u2192 Mermaid conversion
4093
- - \`sync-service.js\` - Background sync service
4094
- - \`lifecycle-manager.js\` - **NEW!** Automatic lifecycle (start/stop sync with Draw.io)
4211
+ **Action**: Show all diagrams
4095
4212
 
4096
- **Lifecycle Manager Usage** (recommended for "create" command):
4097
4213
  \`\`\`javascript
4098
- import { openDrawioWithAutoSync } from '.aikit/tools/drawio-sync/lifecycle-manager.js';
4099
- import { join } from 'path';
4214
+ import { getDiagramList } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4100
4215
 
4101
- const drawioPath = join(process.cwd(), '.aikit/assets/drawio', name + '.drawio');
4216
+ const diagrams = getDiagramList(projectRoot);
4102
4217
 
4103
- // Automatically:
4104
- // - Starts sync when Draw.io opens
4105
- // - Stops sync when Draw.io closes
4106
- await openDrawioWithAutoSync(drawioPath);
4218
+ diagrams.forEach((d, i) => {
4219
+ console.log(\`\${i + 1}. \${d.name}\`);
4220
+ console.log(\` Mermaid: \${d.mermaid || '[missing]'}\`);
4221
+ console.log(\` Drawio: \${d.drawio || '[missing]'}\`);
4222
+ console.log();
4223
+ });
4107
4224
  \`\`\`
4108
4225
 
4109
- **Manual Conversion** (for "modify" command):
4110
- \`\`\`javascript
4111
- import { convertMermaidToDrawio } from '.aikit/tools/drawio-sync/mermaid-to-drawio.js';
4112
- import { convertDrawioToMermaid } from '.aikit/tools/drawio-sync/drawio-to-mermaid.js';
4226
+ ## Error Handling
4227
+
4228
+ ### File Not Found
4229
+ \`\`\`
4230
+ \u274C File not found: mermaid/login-flow.mmd
4113
4231
 
4114
- // Mermaid \u2192 Draw.io
4115
- const result = convertMermaidToDrawio(mermaidCode, diagramName);
4116
- fs.writeFileSync('.aikit/assets/drawio/name.drawio', result.xml, 'utf-8');
4232
+ Did you mean:
4233
+ - mermaid/auth-flow.mmd
4234
+ - mermaid/login.mmd
4117
4235
 
4118
- // Draw.io \u2192 Mermaid
4119
- const result = convertDrawioToMermaid(drawioXML);
4120
- fs.writeFileSync('mermaid/name.mmd', result.code, 'utf-8');
4236
+ Or run: /drawio-interact create login-flow
4121
4237
  \`\`\`
4122
4238
 
4123
- ## Error Handling
4239
+ ### Invalid Mermaid Syntax
4240
+ \`\`\`
4241
+ \u274C Invalid Mermaid syntax at line 5:
4242
+
4243
+ 4: A --> B
4244
+ 5: B -- > C \u2190 Missing space before >
4245
+ 6: C --> D
4124
4246
 
4125
- **If sync fails**:
4126
- 1. Log error to console
4127
- 2. Show notification: "Sync failed for [name]"
4128
- 3. **Ask user**:
4129
- - Ignore this error?
4130
- - Retry sync?
4131
- - Let AI fix it?
4132
-
4133
- **AI Fix Option**:
4134
- - Analyze error
4135
- - Attempt to fix common issues:
4136
- - Malformed Mermaid syntax
4137
- - Invalid XML characters
4138
- - Encoding issues
4139
- - Missing nodes
4140
- - Retry sync after fix
4141
- - Report result
4247
+ Common issues:
4248
+ - Use --> for edges (not -- >)
4249
+ - Labels use |text| syntax
4250
+ - Nodes use [name] or {name}
4251
+
4252
+ Validate at: https://mermaid.live
4253
+ \`\`\`
4254
+
4255
+ ### Invalid Draw.io XML
4256
+ \`\`\`
4257
+ \u274C Invalid Draw.io file: login-flow.drawio
4258
+
4259
+ Issues:
4260
+ - Missing mxGraphModel tag
4261
+ - Corrupted XML at line 15
4262
+
4263
+ Try:
4264
+ 1. Open in Draw.io desktop app
4265
+ 2. Save as new file
4266
+ 3. Run sync again
4267
+ \`\`\`
4268
+
4269
+ ### Conversion Warnings
4270
+ \`\`\`
4271
+ \u26A0\uFE0F Sync completed with warnings:
4272
+
4273
+ - 3 nodes could not be converted (complex shapes)
4274
+ - 2 edges lost styling (curved lines)
4275
+
4276
+ Review mermaid/login-flow.mmd to verify
4277
+ \`\`\`
4142
4278
 
4143
4279
  ## Example Session
4144
4280
 
4281
+ ### Create New Diagram
4145
4282
  \`\`\`
4146
- User: /drawio-interact create user-authentication
4283
+ User: /drawio-interact create user-auth
4147
4284
 
4148
- AI: Creating diagram: user-authentication
4285
+ AI: Creating diagram: user-auth
4149
4286
 
4150
- \u{1F4C4} Generated Mermaid Code:
4287
+ \u{1F4C4} Generated Mermaid code:
4151
4288
  graph TD
4152
4289
  User[User] -->|Login| Login[Login Page]
4153
4290
  Login -->|Success| Dashboard[Dashboard]
4154
4291
 
4155
4292
  \u2705 Files created:
4156
- - mermaid/user-authentication.mmd
4157
- - .aikit/assets/drawio/user-authentication.drawio
4158
-
4159
- \u{1F504} Starting background sync service...
4160
- \u2705 Sync service running
4293
+ - mermaid/user-auth.mmd
4294
+ - .aikit/assets/drawio/user-auth.drawio
4161
4295
 
4162
- \u{1F3A8} Opening Draw.io...
4163
- \u{1F440} Monitoring Draw.io app (sync will stop when Draw.io closes)
4296
+ \u{1F3A8} Opening in Draw.io...
4164
4297
 
4165
- ---
4166
-
4167
- [User edits in Draw.io, adds "Password Recovery", saves]
4168
-
4169
- \u{1F504} Background sync detected changes:
4170
- \u2022 Added nodes: Recovery, ResetEmail
4171
- \u2022 Modified connections: Login \u2192 Recovery
4298
+ \u{1F4A1} After editing, run: /drawio-interact sync-to-mmd user-auth
4299
+ \`\`\`
4172
4300
 
4173
- \u2705 Updated: mermaid/user-authentication.mmd
4301
+ ### Edit & Sync (Draw.io \u2192 Mermaid)
4302
+ \`\`\`
4303
+ [User edits in Draw.io, adds "Password Reset" node, saves]
4174
4304
 
4175
- [Or user edits mermaid/user-authentication.mmd directly]
4305
+ User: /drawio-interact sync-to-mmd user-auth
4176
4306
 
4177
- \u{1F504} Background sync detected changes:
4178
- \u2022 Modified Mermaid syntax
4307
+ AI: Syncing Draw.io \u2192 Mermaid...
4179
4308
 
4180
- \u2705 Updated: .aikit/assets/drawio/user-authentication.drawio
4309
+ \u{1F4CA} Reading: .aikit/assets/drawio/user-auth.drawio
4310
+ \u{1F504} Converting...
4311
+ \u2705 Updated: mermaid/user-auth.mmd
4181
4312
 
4182
- ---
4313
+ Changes:
4314
+ \u2022 4 nodes
4315
+ \u2022 3 edges
4183
4316
 
4184
- [User closes Draw.io app]
4317
+ Preview:
4318
+ graph TD
4319
+ User[User] -->|Login| Login[Login Page]
4320
+ Login -->|Success| Dashboard[Dashboard]
4321
+ Login -->|Forgot Password| Recovery[Password Reset]
4322
+ \`\`\`
4185
4323
 
4186
- \u{1F3A8} Draw.io closed - stopping sync service
4187
- \u2705 Sync service stopped
4324
+ ### Edit & Sync (Mermaid \u2192 Draw.io)
4188
4325
  \`\`\`
4326
+ [User edits mermaid/user-auth.mmd directly]
4189
4327
 
4190
- **Key Point**: Sync starts automatically when Draw.io opens, and stops automatically when Draw.io closes. No manual commands needed!
4328
+ User: /drawio-interact sync-to-drawio user-auth
4191
4329
 
4192
- ## Important Notes
4330
+ AI: Syncing Mermaid \u2192 Draw.io...
4193
4331
 
4194
- - **Auto-sync lifecycle** - Sync starts when Draw.io opens, stops when it closes
4195
- - **Zero manual intervention** - No need to run start/stop commands
4196
- - **Draw.io app** opens automatically on "create"
4197
- - **Both formats** stay in sync automatically while Draw.io is open
4198
- - **Mermaid files** are in project root for version control
4199
- - **Draw.io files** are in .aikit/assets (can be .gitignored)
4200
- - **Manual commands** (start-sync/stop-sync) only needed for special cases
4332
+ \u{1F4DD} Reading: mermaid/user-auth.mmd
4333
+ \u{1F504} Converting...
4334
+ \u2705 Updated: .aikit/assets/drawio/user-auth.drawio
4201
4335
 
4202
- ## Auto-Open Commands
4336
+ Changes:
4337
+ \u2022 4 nodes
4338
+ \u2022 3 edges
4203
4339
 
4204
- **IMPORTANT**: Always use absolute paths!
4340
+ Open in Draw.io? (y/n): y
4341
+ \u{1F3A8} Opening...
4342
+ \`\`\`
4205
4343
 
4206
- **Example code**:
4207
- \`\`\`javascript
4208
- const platform = process.platform;
4209
- const projectRoot = process.cwd(); // Get absolute project root
4210
- const filePath = join(projectRoot, '.aikit/assets/drawio', name + '.drawio');
4211
-
4212
- if (platform === 'darwin') {
4213
- // macOS: Use double quotes for path with spaces
4214
- execSync('open -a "Draw.io" "' + filePath + '"');
4215
- } else if (platform === 'linux') {
4216
- // Linux
4217
- execSync('xdg-open "' + filePath + '"');
4218
- } else if (platform === 'win32') {
4219
- // Windows
4220
- execSync('start "" "' + filePath + '"', { shell: true });
4221
- }
4344
+ ### List Diagrams
4222
4345
  \`\`\`
4346
+ User: /drawio-interact list
4223
4347
 
4224
- **Why absolute paths?**
4225
- - Relative paths depend on current working directory
4226
- - Claude/AI might execute from wrong directory
4227
- - Absolute paths always work correctly
4348
+ AI: Diagrams in this project:
4228
4349
 
4229
- **Fallback**: If Draw.io app not found, open https://app.diagrams.net/
4350
+ 1. user-auth
4351
+ Mermaid: mermaid/user-auth.mmd \u2713
4352
+ Drawio: .aikit/assets/drawio/user-auth.drawio \u2713
4230
4353
 
4231
- ## Directory Setup
4354
+ 2. order-flow
4355
+ Mermaid: mermaid/order-flow.mmd \u2713
4356
+ Drawio: [missing]
4357
+ Run: /drawio-interact sync-to-drawio order-flow
4358
+ \`\`\`
4232
4359
 
4233
- Ensure directories exist:
4234
- \`\`\`bash
4235
- mkdir -p mermaid
4236
- mkdir -p .aikit/assets/drawio
4237
- \`\`\``
4360
+ ## Key Differences from Auto-Sync Version
4361
+
4362
+ **Removed:**
4363
+ - \u274C Auto-sync background service
4364
+ - \u274C Lifecycle manager
4365
+ - \u274C File watchers
4366
+ - \u274C Automatic start/stop
4367
+ - \u274C .aikit/tools/drawio-sync directory
4368
+
4369
+ **Added:**
4370
+ - \u2705 Manual sync commands (sync-to-mmd, sync-to-drawio)
4371
+ - \u2705 Explicit user control
4372
+ - \u2705 Deterministic conversions
4373
+ - \u2705 Clear error messages
4374
+ - \u2705 Custom path support
4375
+
4376
+ **Benefits:**
4377
+ - Predictable behavior every time
4378
+ - No background processes
4379
+ - Clear visibility into what changed
4380
+ - Easier debugging
4381
+ - Works on all platforms consistently`
4238
4382
  }
4239
4383
  ];
4240
4384