@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/cli.js
CHANGED
|
@@ -1220,11 +1220,95 @@ var init_beads = __esm({
|
|
|
1220
1220
|
}
|
|
1221
1221
|
/**
|
|
1222
1222
|
* Initialize local .beads directory (works without global beads CLI)
|
|
1223
|
+
* Creates a fully functional beads workspace for OpenCode/Claude Code
|
|
1223
1224
|
*/
|
|
1224
1225
|
async initLocal() {
|
|
1225
1226
|
try {
|
|
1226
1227
|
const beadsDir = paths.beadsDir(this.projectPath);
|
|
1227
1228
|
await mkdir5(beadsDir, { recursive: true });
|
|
1229
|
+
const configYaml = `# Beads Configuration File
|
|
1230
|
+
# This file configures default behavior for all bd commands in this repository
|
|
1231
|
+
# All settings can also be set via environment variables (BD_* prefix)
|
|
1232
|
+
# or overridden with command-line flags
|
|
1233
|
+
|
|
1234
|
+
# Issue prefix for this repository (used by bd init)
|
|
1235
|
+
# If not set, bd init will auto-detect from directory name
|
|
1236
|
+
# issue-prefix: ""
|
|
1237
|
+
|
|
1238
|
+
# Use no-db mode: load from JSONL, no SQLite, write back after each command
|
|
1239
|
+
# When true, bd will use .beads/issues.jsonl as the source of truth
|
|
1240
|
+
# instead of SQLite database
|
|
1241
|
+
# no-db: false
|
|
1242
|
+
|
|
1243
|
+
# Disable daemon for RPC communication (forces direct database access)
|
|
1244
|
+
# no-daemon: false
|
|
1245
|
+
|
|
1246
|
+
# Disable auto-flush of database to JSONL after mutations
|
|
1247
|
+
# no-auto-flush: false
|
|
1248
|
+
|
|
1249
|
+
# Disable auto-import from JSONL when it's newer than database
|
|
1250
|
+
# no-auto-import: false
|
|
1251
|
+
|
|
1252
|
+
# Enable JSON output by default
|
|
1253
|
+
# json: false
|
|
1254
|
+
|
|
1255
|
+
# Default actor for audit trails (overridden by BD_ACTOR or --actor)
|
|
1256
|
+
# actor: ""
|
|
1257
|
+
|
|
1258
|
+
# Path to database (overridden by BEADS_DB or --db)
|
|
1259
|
+
# db: ""
|
|
1260
|
+
|
|
1261
|
+
# Auto-start daemon if not running (can also use BEADS_AUTO_START_DAEMON)
|
|
1262
|
+
# auto-start-daemon: true
|
|
1263
|
+
|
|
1264
|
+
# Debounce interval for auto-flush (can also use BEADS_FLUSH_DEBOUNCE)
|
|
1265
|
+
# flush-debounce: "5s"
|
|
1266
|
+
|
|
1267
|
+
# Git branch for beads commits (bd sync will commit to this branch)
|
|
1268
|
+
# IMPORTANT: Set this for team projects so all clones use the same sync branch.
|
|
1269
|
+
# sync-branch: "beads-sync"
|
|
1270
|
+
`;
|
|
1271
|
+
await writeFile5(join9(beadsDir, "config.yaml"), configYaml);
|
|
1272
|
+
const metadata = {
|
|
1273
|
+
database: "beads.db",
|
|
1274
|
+
jsonl_export: "issues.jsonl"
|
|
1275
|
+
};
|
|
1276
|
+
await writeFile5(join9(beadsDir, "metadata.json"), JSON.stringify(metadata, null, 2));
|
|
1277
|
+
const gitignore = `# SQLite databases
|
|
1278
|
+
*.db
|
|
1279
|
+
*.db?*
|
|
1280
|
+
*.db-journal
|
|
1281
|
+
*.db-wal
|
|
1282
|
+
*.db-shm
|
|
1283
|
+
|
|
1284
|
+
# Daemon runtime files
|
|
1285
|
+
daemon.lock
|
|
1286
|
+
daemon.log
|
|
1287
|
+
daemon.pid
|
|
1288
|
+
bd.sock
|
|
1289
|
+
|
|
1290
|
+
# Local version tracking (prevents upgrade notification spam after git ops)
|
|
1291
|
+
.local_version
|
|
1292
|
+
|
|
1293
|
+
# Legacy database files
|
|
1294
|
+
db.sqlite
|
|
1295
|
+
bd.db
|
|
1296
|
+
|
|
1297
|
+
# Merge artifacts (temporary files from 3-way merge)
|
|
1298
|
+
beads.base.jsonl
|
|
1299
|
+
beads.base.meta.json
|
|
1300
|
+
beads.left.jsonl
|
|
1301
|
+
beads.left.meta.json
|
|
1302
|
+
beads.right.jsonl
|
|
1303
|
+
beads.right.meta.json
|
|
1304
|
+
|
|
1305
|
+
# Keep JSONL exports and config (source of truth for git)
|
|
1306
|
+
!issues.jsonl
|
|
1307
|
+
!metadata.json
|
|
1308
|
+
!config.json
|
|
1309
|
+
`;
|
|
1310
|
+
await writeFile5(join9(beadsDir, ".gitignore"), gitignore);
|
|
1311
|
+
await writeFile5(join9(beadsDir, ".local_version"), "0.32.1\n");
|
|
1228
1312
|
const readmeContent = `# Beads - Task Tracking
|
|
1229
1313
|
|
|
1230
1314
|
This directory contains task beads for tracking work items.
|
|
@@ -1235,14 +1319,17 @@ This directory contains task beads for tracking work items.
|
|
|
1235
1319
|
- Use \`/create\` command to create new tasks
|
|
1236
1320
|
- Use \`/finish\` command to complete tasks with quality gates
|
|
1237
1321
|
|
|
1238
|
-
##
|
|
1239
|
-
|
|
1322
|
+
## Automatic Setup
|
|
1323
|
+
This directory was automatically initialized by AIKit for use with OpenCode/Claude Code.
|
|
1324
|
+
No manual setup required - it's ready to use!
|
|
1325
|
+
|
|
1326
|
+
## Beads CLI (Optional)
|
|
1327
|
+
For advanced functionality, you can install the beads CLI globally:
|
|
1240
1328
|
\`\`\`bash
|
|
1241
1329
|
npm install -g beads
|
|
1242
|
-
bd init
|
|
1243
1330
|
\`\`\`
|
|
1244
1331
|
|
|
1245
|
-
|
|
1332
|
+
Then you can use commands like:
|
|
1246
1333
|
- \`bd ready\` - Show available work
|
|
1247
1334
|
- \`bd show <id>\` - View task details
|
|
1248
1335
|
- \`bd update <id> --status in_progress\` - Update task status
|
|
@@ -4633,30 +4720,27 @@ init_esm_shims();
|
|
|
4633
4720
|
var DRAWIO_COMMANDS = [
|
|
4634
4721
|
{
|
|
4635
4722
|
name: "drawio-interact",
|
|
4636
|
-
description: "Create
|
|
4723
|
+
description: "Create and edit diagrams with Draw.io (manual sync)",
|
|
4637
4724
|
category: "design",
|
|
4638
|
-
usage: "/drawio-interact <create|
|
|
4725
|
+
usage: "/drawio-interact <create|open|sync-to-mmd|sync-to-drawio|list> [diagram-name]",
|
|
4639
4726
|
examples: [
|
|
4640
4727
|
"/drawio-interact create login-flow",
|
|
4641
|
-
"/drawio-interact
|
|
4642
|
-
"/drawio-interact
|
|
4643
|
-
"/drawio-interact
|
|
4644
|
-
"/drawio-interact
|
|
4728
|
+
"/drawio-interact open login-flow",
|
|
4729
|
+
"/drawio-interact sync-to-mmd login-flow",
|
|
4730
|
+
"/drawio-interact sync-to-drawio login-flow",
|
|
4731
|
+
"/drawio-interact list"
|
|
4645
4732
|
],
|
|
4646
|
-
content: `Interactive diagram workflow with AI + Draw.io +
|
|
4733
|
+
content: `Interactive diagram workflow with AI + Draw.io + manual sync.
|
|
4647
4734
|
|
|
4648
4735
|
**User provided**: $ARGUMENTS
|
|
4649
4736
|
|
|
4650
4737
|
## File Locations
|
|
4651
4738
|
|
|
4652
|
-
**
|
|
4653
|
-
- **Mermaid files**: \`mermaid/[name].mmd\` (
|
|
4739
|
+
**Standard locations**:
|
|
4740
|
+
- **Mermaid files**: \`mermaid/[name].mmd\` (version control)
|
|
4654
4741
|
- **Draw.io files**: \`.aikit/assets/drawio/[name].drawio\` (visual editing)
|
|
4655
4742
|
|
|
4656
|
-
**
|
|
4657
|
-
- Auto-syncs changes between both formats
|
|
4658
|
-
- Runs as background service
|
|
4659
|
-
- Detects changes in real-time
|
|
4743
|
+
**Custom paths**: You can also specify full paths to sync any diagram files.
|
|
4660
4744
|
|
|
4661
4745
|
## Workflow
|
|
4662
4746
|
|
|
@@ -4664,10 +4748,10 @@ var DRAWIO_COMMANDS = [
|
|
|
4664
4748
|
|
|
4665
4749
|
Check if user wants to:
|
|
4666
4750
|
- **create** - Generate new diagram and open in Draw.io
|
|
4667
|
-
- **
|
|
4751
|
+
- **open** - Open existing diagram in Draw.io
|
|
4752
|
+
- **sync-to-mmd** - Convert Draw.io \u2192 Mermaid
|
|
4753
|
+
- **sync-to-drawio** - Convert Mermaid \u2192 Draw.io
|
|
4668
4754
|
- **list** - Show all existing diagrams
|
|
4669
|
-
- **start-sync** - Start background sync service
|
|
4670
|
-
- **stop-sync** - Stop background sync service
|
|
4671
4755
|
|
|
4672
4756
|
### Step 2: Create Diagram (if "create")
|
|
4673
4757
|
|
|
@@ -4677,260 +4761,320 @@ Check if user wants to:
|
|
|
4677
4761
|
- "create login-flow" \u2192 name = "login-flow"
|
|
4678
4762
|
- If no name provided, ask user
|
|
4679
4763
|
|
|
4680
|
-
2. **
|
|
4764
|
+
2. **Ensure directories exist**:
|
|
4765
|
+
\`\`\`javascript
|
|
4766
|
+
import { ensureDiagramDirectories } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4767
|
+
ensureDiagramDirectories(projectRoot);
|
|
4768
|
+
\`\`\`
|
|
4769
|
+
|
|
4770
|
+
3. **Generate Mermaid code** based on description:
|
|
4681
4771
|
- Login/auth \u2192 Flowchart with authentication
|
|
4682
4772
|
- Order/purchase \u2192 Flowchart with payment
|
|
4683
4773
|
- API/request \u2192 Sequence diagram
|
|
4684
4774
|
- Generic \u2192 Basic flowchart
|
|
4685
4775
|
|
|
4686
|
-
|
|
4687
|
-
- \`mermaid/[name].mmd\` - Mermaid source
|
|
4688
|
-
- \`.aikit/assets/drawio/[name].drawio\` - Draw.io XML
|
|
4689
|
-
|
|
4690
|
-
4. **Open in Draw.io with auto-sync**:
|
|
4691
|
-
- Use lifecycle manager for automatic sync start/stop
|
|
4692
|
-
- Sync starts when Draw.io opens
|
|
4693
|
-
- Sync stops when Draw.io closes
|
|
4694
|
-
- No manual intervention needed!
|
|
4695
|
-
|
|
4696
|
-
**Implementation**: Use lifecycle manager
|
|
4697
|
-
|
|
4776
|
+
4. **Convert to Draw.io**:
|
|
4698
4777
|
\`\`\`javascript
|
|
4699
|
-
import {
|
|
4700
|
-
import { join } from 'path';
|
|
4778
|
+
import { convertToDrawioFile } from '@tdsoft-tech/aikit/tools/drawio-convert/convert-to-drawio.js';
|
|
4701
4779
|
|
|
4702
|
-
const
|
|
4780
|
+
const mermaidPath = join(projectRoot, 'mermaid', \`\${name}.mmd\`);
|
|
4703
4781
|
const drawioPath = join(projectRoot, '.aikit/assets/drawio', \`\${name}.drawio\`);
|
|
4704
4782
|
|
|
4705
|
-
//
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
//
|
|
4709
|
-
|
|
4710
|
-
await openDrawioWithAutoSync(drawioPath);
|
|
4783
|
+
// Write Mermaid file first
|
|
4784
|
+
fs.writeFileSync(mermaidPath, mermaidCode, 'utf-8');
|
|
4785
|
+
|
|
4786
|
+
// Convert to Draw.io
|
|
4787
|
+
const result = convertToDrawioFile(mermaidPath, drawioPath, name);
|
|
4711
4788
|
\`\`\`
|
|
4712
4789
|
|
|
4713
|
-
**
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
- \u2705 Zero manual intervention!
|
|
4790
|
+
5. **Open in Draw.io**:
|
|
4791
|
+
\`\`\`javascript
|
|
4792
|
+
import { openDiagram } from '@tdsoft-tech/aikit/tools/drawio-convert/open-diagram.js';
|
|
4793
|
+
const openResult = openDiagram(drawioPath);
|
|
4794
|
+
\`\`\`
|
|
4719
4795
|
|
|
4720
|
-
|
|
4796
|
+
6. **Report success**:
|
|
4721
4797
|
- Show generated Mermaid code
|
|
4722
4798
|
- Confirm file locations
|
|
4723
|
-
- Confirm Draw.io opened
|
|
4724
|
-
- Inform user: "
|
|
4799
|
+
- Confirm Draw.io opened
|
|
4800
|
+
- Inform user: "After editing, run /drawio-interact sync-to-mmd [name]"
|
|
4725
4801
|
|
|
4726
|
-
### Step 3:
|
|
4802
|
+
### Step 3: Open Diagram (if "open")
|
|
4727
4803
|
|
|
4728
|
-
**Action**:
|
|
4804
|
+
**Action**: Open existing diagram in Draw.io
|
|
4729
4805
|
|
|
4730
|
-
1. **
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
- \`.aikit/assets/drawio/[name].drawio\`
|
|
4806
|
+
1. **Resolve diagram path**:
|
|
4807
|
+
\`\`\`javascript
|
|
4808
|
+
import { resolveDiagramPath } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4734
4809
|
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
5. **Update Mermaid file**
|
|
4738
|
-
6. **Report changes**
|
|
4810
|
+
const drawioPath = resolveDiagramPath(name, 'drawio', projectRoot);
|
|
4811
|
+
\`\`\`
|
|
4739
4812
|
|
|
4740
|
-
**
|
|
4813
|
+
2. **Check file exists** - If not, ask to create first
|
|
4741
4814
|
|
|
4742
|
-
|
|
4815
|
+
3. **Open in Draw.io**:
|
|
4816
|
+
\`\`\`javascript
|
|
4817
|
+
import { openDiagram } from '@tdsoft-tech/aikit/tools/drawio-convert/open-diagram.js';
|
|
4818
|
+
const result = openDiagram(drawioPath);
|
|
4819
|
+
\`\`\`
|
|
4743
4820
|
|
|
4744
|
-
**
|
|
4821
|
+
4. **Tip**: "After editing, run /drawio-interact sync-to-mmd [name] to update Mermaid"
|
|
4745
4822
|
|
|
4746
|
-
|
|
4747
|
-
|
|
4823
|
+
### Step 4: Sync to Mermaid (if "sync-to-mmd")
|
|
4824
|
+
|
|
4825
|
+
**Action**: Convert Draw.io file \u2192 Mermaid format (update source code)
|
|
4826
|
+
|
|
4827
|
+
1. **Resolve diagram path**:
|
|
4828
|
+
\`\`\`javascript
|
|
4829
|
+
import { resolveDiagramPath } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4830
|
+
|
|
4831
|
+
// Can be name or full path
|
|
4832
|
+
const drawioPath = resolveDiagramPath(input, 'drawio', projectRoot);
|
|
4748
4833
|
\`\`\`
|
|
4749
4834
|
|
|
4750
|
-
|
|
4835
|
+
2. **Validate file exists**
|
|
4751
4836
|
|
|
4752
|
-
|
|
4837
|
+
3. **Convert Draw.io \u2192 Mermaid**:
|
|
4838
|
+
\`\`\`javascript
|
|
4839
|
+
import { convertToMermaidFile } from '@tdsoft-tech/aikit/tools/drawio-convert/convert-to-mermaid.js';
|
|
4840
|
+
import { findPairedDiagram } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4841
|
+
|
|
4842
|
+
// Find paired Mermaid file
|
|
4843
|
+
const mermaidPath = findPairedDiagram(drawioPath, projectRoot);
|
|
4844
|
+
|
|
4845
|
+
// If not found, ask user where to save
|
|
4846
|
+
if (!mermaidPath) {
|
|
4847
|
+
const name = path.basename(drawioPath, '.drawio');
|
|
4848
|
+
mermaidPath = join(projectRoot, 'mermaid', \`\${name}.mmd\`);
|
|
4849
|
+
}
|
|
4753
4850
|
|
|
4754
|
-
|
|
4851
|
+
// Convert
|
|
4852
|
+
const result = convertToMermaidFile(drawioPath, mermaidPath);
|
|
4853
|
+
\`\`\`
|
|
4755
4854
|
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
-
|
|
4759
|
-
- Watch \`.aikit/assets/drawio/*.drawio\`
|
|
4760
|
-
3. **Auto-sync on change**:
|
|
4761
|
-
- Debounce: 500ms
|
|
4762
|
-
- Lock files during sync to prevent loops
|
|
4763
|
-
- Log all changes
|
|
4764
|
-
4. **Report**: "Background sync running"
|
|
4855
|
+
4. **Handle errors**:
|
|
4856
|
+
- If errors: Show exact error with suggestions
|
|
4857
|
+
- If warnings: Show warnings but continue
|
|
4765
4858
|
|
|
4766
|
-
**
|
|
4859
|
+
5. **Report success**:
|
|
4860
|
+
- Show conversion stats (nodes, edges)
|
|
4861
|
+
- Show preview of updated Mermaid (10 lines)
|
|
4862
|
+
- Confirm file updated: "\u2705 Synced: [name].drawio \u2192 [name].mmd"
|
|
4767
4863
|
|
|
4864
|
+
### Step 5: Sync to Draw.io (if "sync-to-drawio")
|
|
4865
|
+
|
|
4866
|
+
**Action**: Convert Mermaid \u2192 Draw.io format (update visual diagram)
|
|
4867
|
+
|
|
4868
|
+
1. **Resolve diagram path**:
|
|
4768
4869
|
\`\`\`javascript
|
|
4769
|
-
import {
|
|
4770
|
-
startSyncService();
|
|
4771
|
-
\`\`\`
|
|
4870
|
+
import { resolveDiagramPath } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4772
4871
|
|
|
4773
|
-
|
|
4872
|
+
const mermaidPath = resolveDiagramPath(input, 'mermaid', projectRoot);
|
|
4873
|
+
\`\`\`
|
|
4774
4874
|
|
|
4775
|
-
**
|
|
4875
|
+
2. **Validate file exists**
|
|
4776
4876
|
|
|
4877
|
+
3. **Convert Mermaid \u2192 Draw.io**:
|
|
4777
4878
|
\`\`\`javascript
|
|
4778
|
-
import {
|
|
4779
|
-
|
|
4879
|
+
import { convertToDrawioFile } from '@tdsoft-tech/aikit/tools/drawio-convert/convert-to-drawio.js';
|
|
4880
|
+
import { findPairedDiagram } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4881
|
+
|
|
4882
|
+
// Find paired Draw.io file
|
|
4883
|
+
const drawioPath = findPairedDiagram(mermaidPath, projectRoot);
|
|
4884
|
+
|
|
4885
|
+
// If not found, ask user where to save
|
|
4886
|
+
if (!drawioPath) {
|
|
4887
|
+
const name = path.basename(mermaidPath, '.mmd');
|
|
4888
|
+
drawioPath = join(projectRoot, '.aikit/assets/drawio', \`\${name}.drawio\`);
|
|
4889
|
+
}
|
|
4890
|
+
|
|
4891
|
+
// Convert
|
|
4892
|
+
const result = convertToDrawioFile(mermaidPath, drawioPath, name);
|
|
4780
4893
|
\`\`\`
|
|
4781
4894
|
|
|
4782
|
-
|
|
4895
|
+
4. **Handle errors**:
|
|
4896
|
+
- If Mermaid syntax errors: Show line number and fix suggestions
|
|
4897
|
+
- If conversion warnings: Show but continue
|
|
4783
4898
|
|
|
4784
|
-
**
|
|
4899
|
+
5. **Report success**:
|
|
4900
|
+
- Show conversion stats
|
|
4901
|
+
- Confirm file updated
|
|
4902
|
+
- **Prompt**: "Open in Draw.io? (y/n)"
|
|
4903
|
+
- If yes: invoke openDiagram()
|
|
4904
|
+
|
|
4905
|
+
### Step 6: List Diagrams (if "list")
|
|
4785
4906
|
|
|
4786
|
-
**
|
|
4787
|
-
- \`mermaid-to-drawio.js\` - Mermaid \u2192 Draw.io conversion
|
|
4788
|
-
- \`drawio-to-mermaid.js\` - Draw.io \u2192 Mermaid conversion
|
|
4789
|
-
- \`sync-service.js\` - Background sync service
|
|
4790
|
-
- \`lifecycle-manager.js\` - **NEW!** Automatic lifecycle (start/stop sync with Draw.io)
|
|
4907
|
+
**Action**: Show all diagrams
|
|
4791
4908
|
|
|
4792
|
-
**Lifecycle Manager Usage** (recommended for "create" command):
|
|
4793
4909
|
\`\`\`javascript
|
|
4794
|
-
import {
|
|
4795
|
-
import { join } from 'path';
|
|
4910
|
+
import { getDiagramList } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
|
|
4796
4911
|
|
|
4797
|
-
const
|
|
4912
|
+
const diagrams = getDiagramList(projectRoot);
|
|
4798
4913
|
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4914
|
+
diagrams.forEach((d, i) => {
|
|
4915
|
+
console.log(\`\${i + 1}. \${d.name}\`);
|
|
4916
|
+
console.log(\` Mermaid: \${d.mermaid || '[missing]'}\`);
|
|
4917
|
+
console.log(\` Drawio: \${d.drawio || '[missing]'}\`);
|
|
4918
|
+
console.log();
|
|
4919
|
+
});
|
|
4803
4920
|
\`\`\`
|
|
4804
4921
|
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4922
|
+
## Error Handling
|
|
4923
|
+
|
|
4924
|
+
### File Not Found
|
|
4925
|
+
\`\`\`
|
|
4926
|
+
\u274C File not found: mermaid/login-flow.mmd
|
|
4809
4927
|
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4928
|
+
Did you mean:
|
|
4929
|
+
- mermaid/auth-flow.mmd
|
|
4930
|
+
- mermaid/login.mmd
|
|
4813
4931
|
|
|
4814
|
-
|
|
4815
|
-
const result = convertDrawioToMermaid(drawioXML);
|
|
4816
|
-
fs.writeFileSync('mermaid/name.mmd', result.code, 'utf-8');
|
|
4932
|
+
Or run: /drawio-interact create login-flow
|
|
4817
4933
|
\`\`\`
|
|
4818
4934
|
|
|
4819
|
-
|
|
4935
|
+
### Invalid Mermaid Syntax
|
|
4936
|
+
\`\`\`
|
|
4937
|
+
\u274C Invalid Mermaid syntax at line 5:
|
|
4938
|
+
|
|
4939
|
+
4: A --> B
|
|
4940
|
+
5: B -- > C \u2190 Missing space before >
|
|
4941
|
+
6: C --> D
|
|
4820
4942
|
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4943
|
+
Common issues:
|
|
4944
|
+
- Use --> for edges (not -- >)
|
|
4945
|
+
- Labels use |text| syntax
|
|
4946
|
+
- Nodes use [name] or {name}
|
|
4947
|
+
|
|
4948
|
+
Validate at: https://mermaid.live
|
|
4949
|
+
\`\`\`
|
|
4950
|
+
|
|
4951
|
+
### Invalid Draw.io XML
|
|
4952
|
+
\`\`\`
|
|
4953
|
+
\u274C Invalid Draw.io file: login-flow.drawio
|
|
4954
|
+
|
|
4955
|
+
Issues:
|
|
4956
|
+
- Missing mxGraphModel tag
|
|
4957
|
+
- Corrupted XML at line 15
|
|
4958
|
+
|
|
4959
|
+
Try:
|
|
4960
|
+
1. Open in Draw.io desktop app
|
|
4961
|
+
2. Save as new file
|
|
4962
|
+
3. Run sync again
|
|
4963
|
+
\`\`\`
|
|
4964
|
+
|
|
4965
|
+
### Conversion Warnings
|
|
4966
|
+
\`\`\`
|
|
4967
|
+
\u26A0\uFE0F Sync completed with warnings:
|
|
4968
|
+
|
|
4969
|
+
- 3 nodes could not be converted (complex shapes)
|
|
4970
|
+
- 2 edges lost styling (curved lines)
|
|
4971
|
+
|
|
4972
|
+
Review mermaid/login-flow.mmd to verify
|
|
4973
|
+
\`\`\`
|
|
4838
4974
|
|
|
4839
4975
|
## Example Session
|
|
4840
4976
|
|
|
4977
|
+
### Create New Diagram
|
|
4841
4978
|
\`\`\`
|
|
4842
|
-
User: /drawio-interact create user-
|
|
4979
|
+
User: /drawio-interact create user-auth
|
|
4843
4980
|
|
|
4844
|
-
AI: Creating diagram: user-
|
|
4981
|
+
AI: Creating diagram: user-auth
|
|
4845
4982
|
|
|
4846
|
-
\u{1F4C4} Generated Mermaid
|
|
4983
|
+
\u{1F4C4} Generated Mermaid code:
|
|
4847
4984
|
graph TD
|
|
4848
4985
|
User[User] -->|Login| Login[Login Page]
|
|
4849
4986
|
Login -->|Success| Dashboard[Dashboard]
|
|
4850
4987
|
|
|
4851
4988
|
\u2705 Files created:
|
|
4852
|
-
- mermaid/user-
|
|
4853
|
-
- .aikit/assets/drawio/user-
|
|
4854
|
-
|
|
4855
|
-
\u{1F504} Starting background sync service...
|
|
4856
|
-
\u2705 Sync service running
|
|
4989
|
+
- mermaid/user-auth.mmd
|
|
4990
|
+
- .aikit/assets/drawio/user-auth.drawio
|
|
4857
4991
|
|
|
4858
|
-
\u{1F3A8} Opening Draw.io...
|
|
4859
|
-
\u{1F440} Monitoring Draw.io app (sync will stop when Draw.io closes)
|
|
4992
|
+
\u{1F3A8} Opening in Draw.io...
|
|
4860
4993
|
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
[User edits in Draw.io, adds "Password Recovery", saves]
|
|
4864
|
-
|
|
4865
|
-
\u{1F504} Background sync detected changes:
|
|
4866
|
-
\u2022 Added nodes: Recovery, ResetEmail
|
|
4867
|
-
\u2022 Modified connections: Login \u2192 Recovery
|
|
4994
|
+
\u{1F4A1} After editing, run: /drawio-interact sync-to-mmd user-auth
|
|
4995
|
+
\`\`\`
|
|
4868
4996
|
|
|
4869
|
-
|
|
4997
|
+
### Edit & Sync (Draw.io \u2192 Mermaid)
|
|
4998
|
+
\`\`\`
|
|
4999
|
+
[User edits in Draw.io, adds "Password Reset" node, saves]
|
|
4870
5000
|
|
|
4871
|
-
|
|
5001
|
+
User: /drawio-interact sync-to-mmd user-auth
|
|
4872
5002
|
|
|
4873
|
-
|
|
4874
|
-
\u2022 Modified Mermaid syntax
|
|
5003
|
+
AI: Syncing Draw.io \u2192 Mermaid...
|
|
4875
5004
|
|
|
4876
|
-
\
|
|
5005
|
+
\u{1F4CA} Reading: .aikit/assets/drawio/user-auth.drawio
|
|
5006
|
+
\u{1F504} Converting...
|
|
5007
|
+
\u2705 Updated: mermaid/user-auth.mmd
|
|
4877
5008
|
|
|
4878
|
-
|
|
5009
|
+
Changes:
|
|
5010
|
+
\u2022 4 nodes
|
|
5011
|
+
\u2022 3 edges
|
|
4879
5012
|
|
|
4880
|
-
|
|
5013
|
+
Preview:
|
|
5014
|
+
graph TD
|
|
5015
|
+
User[User] -->|Login| Login[Login Page]
|
|
5016
|
+
Login -->|Success| Dashboard[Dashboard]
|
|
5017
|
+
Login -->|Forgot Password| Recovery[Password Reset]
|
|
5018
|
+
\`\`\`
|
|
4881
5019
|
|
|
4882
|
-
|
|
4883
|
-
\u2705 Sync service stopped
|
|
5020
|
+
### Edit & Sync (Mermaid \u2192 Draw.io)
|
|
4884
5021
|
\`\`\`
|
|
5022
|
+
[User edits mermaid/user-auth.mmd directly]
|
|
4885
5023
|
|
|
4886
|
-
|
|
5024
|
+
User: /drawio-interact sync-to-drawio user-auth
|
|
4887
5025
|
|
|
4888
|
-
|
|
5026
|
+
AI: Syncing Mermaid \u2192 Draw.io...
|
|
4889
5027
|
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
- **Both formats** stay in sync automatically while Draw.io is open
|
|
4894
|
-
- **Mermaid files** are in project root for version control
|
|
4895
|
-
- **Draw.io files** are in .aikit/assets (can be .gitignored)
|
|
4896
|
-
- **Manual commands** (start-sync/stop-sync) only needed for special cases
|
|
5028
|
+
\u{1F4DD} Reading: mermaid/user-auth.mmd
|
|
5029
|
+
\u{1F504} Converting...
|
|
5030
|
+
\u2705 Updated: .aikit/assets/drawio/user-auth.drawio
|
|
4897
5031
|
|
|
4898
|
-
|
|
5032
|
+
Changes:
|
|
5033
|
+
\u2022 4 nodes
|
|
5034
|
+
\u2022 3 edges
|
|
4899
5035
|
|
|
4900
|
-
|
|
5036
|
+
Open in Draw.io? (y/n): y
|
|
5037
|
+
\u{1F3A8} Opening...
|
|
5038
|
+
\`\`\`
|
|
4901
5039
|
|
|
4902
|
-
|
|
4903
|
-
\`\`\`javascript
|
|
4904
|
-
const platform = process.platform;
|
|
4905
|
-
const projectRoot = process.cwd(); // Get absolute project root
|
|
4906
|
-
const filePath = join(projectRoot, '.aikit/assets/drawio', name + '.drawio');
|
|
4907
|
-
|
|
4908
|
-
if (platform === 'darwin') {
|
|
4909
|
-
// macOS: Use double quotes for path with spaces
|
|
4910
|
-
execSync('open -a "Draw.io" "' + filePath + '"');
|
|
4911
|
-
} else if (platform === 'linux') {
|
|
4912
|
-
// Linux
|
|
4913
|
-
execSync('xdg-open "' + filePath + '"');
|
|
4914
|
-
} else if (platform === 'win32') {
|
|
4915
|
-
// Windows
|
|
4916
|
-
execSync('start "" "' + filePath + '"', { shell: true });
|
|
4917
|
-
}
|
|
5040
|
+
### List Diagrams
|
|
4918
5041
|
\`\`\`
|
|
5042
|
+
User: /drawio-interact list
|
|
4919
5043
|
|
|
4920
|
-
|
|
4921
|
-
- Relative paths depend on current working directory
|
|
4922
|
-
- Claude/AI might execute from wrong directory
|
|
4923
|
-
- Absolute paths always work correctly
|
|
5044
|
+
AI: Diagrams in this project:
|
|
4924
5045
|
|
|
4925
|
-
|
|
5046
|
+
1. user-auth
|
|
5047
|
+
Mermaid: mermaid/user-auth.mmd \u2713
|
|
5048
|
+
Drawio: .aikit/assets/drawio/user-auth.drawio \u2713
|
|
4926
5049
|
|
|
4927
|
-
|
|
5050
|
+
2. order-flow
|
|
5051
|
+
Mermaid: mermaid/order-flow.mmd \u2713
|
|
5052
|
+
Drawio: [missing]
|
|
5053
|
+
Run: /drawio-interact sync-to-drawio order-flow
|
|
5054
|
+
\`\`\`
|
|
4928
5055
|
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
5056
|
+
## Key Differences from Auto-Sync Version
|
|
5057
|
+
|
|
5058
|
+
**Removed:**
|
|
5059
|
+
- \u274C Auto-sync background service
|
|
5060
|
+
- \u274C Lifecycle manager
|
|
5061
|
+
- \u274C File watchers
|
|
5062
|
+
- \u274C Automatic start/stop
|
|
5063
|
+
- \u274C .aikit/tools/drawio-sync directory
|
|
5064
|
+
|
|
5065
|
+
**Added:**
|
|
5066
|
+
- \u2705 Manual sync commands (sync-to-mmd, sync-to-drawio)
|
|
5067
|
+
- \u2705 Explicit user control
|
|
5068
|
+
- \u2705 Deterministic conversions
|
|
5069
|
+
- \u2705 Clear error messages
|
|
5070
|
+
- \u2705 Custom path support
|
|
5071
|
+
|
|
5072
|
+
**Benefits:**
|
|
5073
|
+
- Predictable behavior every time
|
|
5074
|
+
- No background processes
|
|
5075
|
+
- Clear visibility into what changed
|
|
5076
|
+
- Easier debugging
|
|
5077
|
+
- Works on all platforms consistently`
|
|
4934
5078
|
}
|
|
4935
5079
|
];
|
|
4936
5080
|
|