@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.
- package/LICENSE +63 -0
- package/README.md +348 -0
- package/dist/cli.js +337 -193
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +337 -193
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +337 -193
- package/dist/mcp-server.js.map +1 -1
- package/dist/tools/drawio-convert/convert-to-drawio.d.ts +300 -0
- package/dist/tools/drawio-convert/convert-to-drawio.js +264 -0
- package/dist/tools/drawio-convert/convert-to-drawio.js.map +1 -0
- package/dist/tools/drawio-convert/convert-to-mermaid.d.ts +249 -0
- package/dist/tools/drawio-convert/convert-to-mermaid.js +216 -0
- package/dist/tools/drawio-convert/convert-to-mermaid.js.map +1 -0
- package/dist/tools/drawio-convert/diagram-utils.d.ts +270 -0
- package/dist/tools/drawio-convert/diagram-utils.js +180 -0
- package/dist/tools/drawio-convert/diagram-utils.js.map +1 -0
- package/dist/tools/drawio-convert/open-diagram.d.ts +118 -0
- package/dist/tools/drawio-convert/open-diagram.js +88 -0
- package/dist/tools/drawio-convert/open-diagram.js.map +1 -0
- package/package.json +3 -3
package/dist/mcp-server.js
CHANGED
|
@@ -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
|
-
##
|
|
1233
|
-
|
|
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
|
-
|
|
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
|
|
4027
|
+
description: "Create and edit diagrams with Draw.io (manual sync)",
|
|
3941
4028
|
category: "design",
|
|
3942
|
-
usage: "/drawio-interact <create|
|
|
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
|
|
3946
|
-
"/drawio-interact
|
|
3947
|
-
"/drawio-interact
|
|
3948
|
-
"/drawio-interact
|
|
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 +
|
|
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
|
-
**
|
|
3957
|
-
- **Mermaid files**: \`mermaid/[name].mmd\` (
|
|
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
|
-
**
|
|
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
|
-
- **
|
|
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. **
|
|
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
|
-
|
|
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 {
|
|
4004
|
-
import { join } from 'path';
|
|
4082
|
+
import { convertToDrawioFile } from '@tdsoft-tech/aikit/tools/drawio-convert/convert-to-drawio.js';
|
|
4005
4083
|
|
|
4006
|
-
const
|
|
4084
|
+
const mermaidPath = join(projectRoot, 'mermaid', \`\${name}.mmd\`);
|
|
4007
4085
|
const drawioPath = join(projectRoot, '.aikit/assets/drawio', \`\${name}.drawio\`);
|
|
4008
4086
|
|
|
4009
|
-
//
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
//
|
|
4013
|
-
|
|
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
|
-
**
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
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
|
-
|
|
4100
|
+
6. **Report success**:
|
|
4025
4101
|
- Show generated Mermaid code
|
|
4026
4102
|
- Confirm file locations
|
|
4027
|
-
- Confirm Draw.io opened
|
|
4028
|
-
- Inform user: "
|
|
4103
|
+
- Confirm Draw.io opened
|
|
4104
|
+
- Inform user: "After editing, run /drawio-interact sync-to-mmd [name]"
|
|
4029
4105
|
|
|
4030
|
-
### Step 3:
|
|
4106
|
+
### Step 3: Open Diagram (if "open")
|
|
4031
4107
|
|
|
4032
|
-
**Action**:
|
|
4108
|
+
**Action**: Open existing diagram in Draw.io
|
|
4033
4109
|
|
|
4034
|
-
1. **
|
|
4035
|
-
|
|
4036
|
-
|
|
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
|
-
|
|
4040
|
-
|
|
4041
|
-
5. **Update Mermaid file**
|
|
4042
|
-
6. **Report changes**
|
|
4114
|
+
const drawioPath = resolveDiagramPath(name, 'drawio', projectRoot);
|
|
4115
|
+
\`\`\`
|
|
4043
4116
|
|
|
4044
|
-
**
|
|
4117
|
+
2. **Check file exists** - If not, ask to create first
|
|
4045
4118
|
|
|
4046
|
-
|
|
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
|
-
**
|
|
4125
|
+
4. **Tip**: "After editing, run /drawio-interact sync-to-mmd [name] to update Mermaid"
|
|
4049
4126
|
|
|
4050
|
-
|
|
4051
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4146
|
+
// Find paired Mermaid file
|
|
4147
|
+
const mermaidPath = findPairedDiagram(drawioPath, projectRoot);
|
|
4057
4148
|
|
|
4058
|
-
|
|
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
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
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
|
-
**
|
|
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 {
|
|
4074
|
-
startSyncService();
|
|
4075
|
-
\`\`\`
|
|
4174
|
+
import { resolveDiagramPath } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4076
4175
|
|
|
4077
|
-
|
|
4176
|
+
const mermaidPath = resolveDiagramPath(input, 'mermaid', projectRoot);
|
|
4177
|
+
\`\`\`
|
|
4078
4178
|
|
|
4079
|
-
**
|
|
4179
|
+
2. **Validate file exists**
|
|
4080
4180
|
|
|
4181
|
+
3. **Convert Mermaid \u2192 Draw.io**:
|
|
4081
4182
|
\`\`\`javascript
|
|
4082
|
-
import {
|
|
4083
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4209
|
+
### Step 6: List Diagrams (if "list")
|
|
4089
4210
|
|
|
4090
|
-
**
|
|
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 {
|
|
4099
|
-
import { join } from 'path';
|
|
4214
|
+
import { getDiagramList } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4100
4215
|
|
|
4101
|
-
const
|
|
4216
|
+
const diagrams = getDiagramList(projectRoot);
|
|
4102
4217
|
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
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
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4226
|
+
## Error Handling
|
|
4227
|
+
|
|
4228
|
+
### File Not Found
|
|
4229
|
+
\`\`\`
|
|
4230
|
+
\u274C File not found: mermaid/login-flow.mmd
|
|
4113
4231
|
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4232
|
+
Did you mean:
|
|
4233
|
+
- mermaid/auth-flow.mmd
|
|
4234
|
+
- mermaid/login.mmd
|
|
4117
4235
|
|
|
4118
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
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-
|
|
4283
|
+
User: /drawio-interact create user-auth
|
|
4147
4284
|
|
|
4148
|
-
AI: Creating diagram: user-
|
|
4285
|
+
AI: Creating diagram: user-auth
|
|
4149
4286
|
|
|
4150
|
-
\u{1F4C4} Generated Mermaid
|
|
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-
|
|
4157
|
-
- .aikit/assets/drawio/user-
|
|
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
|
-
|
|
4301
|
+
### Edit & Sync (Draw.io \u2192 Mermaid)
|
|
4302
|
+
\`\`\`
|
|
4303
|
+
[User edits in Draw.io, adds "Password Reset" node, saves]
|
|
4174
4304
|
|
|
4175
|
-
|
|
4305
|
+
User: /drawio-interact sync-to-mmd user-auth
|
|
4176
4306
|
|
|
4177
|
-
|
|
4178
|
-
\u2022 Modified Mermaid syntax
|
|
4307
|
+
AI: Syncing Draw.io \u2192 Mermaid...
|
|
4179
4308
|
|
|
4180
|
-
\
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4328
|
+
User: /drawio-interact sync-to-drawio user-auth
|
|
4191
4329
|
|
|
4192
|
-
|
|
4330
|
+
AI: Syncing Mermaid \u2192 Draw.io...
|
|
4193
4331
|
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
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
|
-
|
|
4336
|
+
Changes:
|
|
4337
|
+
\u2022 4 nodes
|
|
4338
|
+
\u2022 3 edges
|
|
4203
4339
|
|
|
4204
|
-
|
|
4340
|
+
Open in Draw.io? (y/n): y
|
|
4341
|
+
\u{1F3A8} Opening...
|
|
4342
|
+
\`\`\`
|
|
4205
4343
|
|
|
4206
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4350
|
+
1. user-auth
|
|
4351
|
+
Mermaid: mermaid/user-auth.mmd \u2713
|
|
4352
|
+
Drawio: .aikit/assets/drawio/user-auth.drawio \u2713
|
|
4230
4353
|
|
|
4231
|
-
|
|
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
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
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
|
|