@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/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
- ## Beads CLI
1239
- For full functionality, install beads globally:
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
- ## Available Commands
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/edit diagrams with AI + Draw.io + auto-sync",
4723
+ description: "Create and edit diagrams with Draw.io (manual sync)",
4637
4724
  category: "design",
4638
- usage: "/drawio-interact <create|modify|list|start-sync|stop-sync> [diagram-name]",
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 modify login-flow",
4642
- "/drawio-interact list",
4643
- "/drawio-interact start-sync",
4644
- "/drawio-interact stop-sync"
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 + background sync.
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
- **NEW STRUCTURE**:
4653
- - **Mermaid files**: \`mermaid/[name].mmd\` (project root, version control)
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
- **Background Sync**:
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
- - **modify** - Manual sync (if background sync not running)
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. **Generate Mermaid code** based on description:
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
- 3. **Create files**:
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 { openDrawioWithAutoSync } from '.aikit/tools/drawio-sync/lifecycle-manager.js';
4700
- import { join } from 'path';
4778
+ import { convertToDrawioFile } from '@tdsoft-tech/aikit/tools/drawio-convert/convert-to-drawio.js';
4701
4779
 
4702
- const projectRoot = process.cwd();
4780
+ const mermaidPath = join(projectRoot, 'mermaid', \`\${name}.mmd\`);
4703
4781
  const drawioPath = join(projectRoot, '.aikit/assets/drawio', \`\${name}.drawio\`);
4704
4782
 
4705
- // This will:
4706
- // 1. Start sync service automatically
4707
- // 2. Open Draw.io app
4708
- // 3. Monitor Draw.io process
4709
- // 4. Stop sync when Draw.io closes
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
- **What happens**:
4714
- - \u2705 Sync service starts automatically
4715
- - \u2705 Draw.io opens
4716
- - \u2705 Files stay in sync while editing
4717
- - \u2705 Sync stops automatically when Draw.io closes
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
- 5. **Report success**:
4796
+ 6. **Report success**:
4721
4797
  - Show generated Mermaid code
4722
4798
  - Confirm file locations
4723
- - Confirm Draw.io opened with auto-sync
4724
- - Inform user: "Sync will stop automatically when you close Draw.io"
4799
+ - Confirm Draw.io opened
4800
+ - Inform user: "After editing, run /drawio-interact sync-to-mmd [name]"
4725
4801
 
4726
- ### Step 3: Modify Diagram (if "modify")
4802
+ ### Step 3: Open Diagram (if "open")
4727
4803
 
4728
- **Action**: Manual one-time sync (use if background sync not running)
4804
+ **Action**: Open existing diagram in Draw.io
4729
4805
 
4730
- 1. **Extract diagram name**
4731
- 2. **Read files**:
4732
- - \`mermaid/[name].mmd\`
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
- 3. **Convert Draw.io \u2192 Mermaid**
4736
- 4. **Detect changes**
4737
- 5. **Update Mermaid file**
4738
- 6. **Report changes**
4810
+ const drawioPath = resolveDiagramPath(name, 'drawio', projectRoot);
4811
+ \`\`\`
4739
4812
 
4740
- **Note**: If background sync is running, this is automatic!
4813
+ 2. **Check file exists** - If not, ask to create first
4741
4814
 
4742
- ### Step 4: List Diagrams (if "list")
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
- **Action**: Show all diagrams
4821
+ 4. **Tip**: "After editing, run /drawio-interact sync-to-mmd [name] to update Mermaid"
4745
4822
 
4746
- \`\`\`bash
4747
- ls mermaid/*.mmd 2>/dev/null | sed 's/mermaid\\///' | sed 's/.mmd$//'
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
- Format as numbered list with file info.
4835
+ 2. **Validate file exists**
4751
4836
 
4752
- ### Step 5: Start Sync (if "start-sync")
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
- **Action**: Start background sync service
4851
+ // Convert
4852
+ const result = convertToMermaidFile(drawioPath, mermaidPath);
4853
+ \`\`\`
4755
4854
 
4756
- 1. **Check if service already running**
4757
- 2. **Start Chokidar file watcher**:
4758
- - Watch \`mermaid/*.mmd\`
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
- **Implementation**: Use .aikit/tools/drawio-sync/sync-service.js
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 { startSyncService } from '.aikit/tools/drawio-sync/sync-service.js';
4770
- startSyncService();
4771
- \`\`\`
4870
+ import { resolveDiagramPath } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4772
4871
 
4773
- ### Step 6: Stop Sync (if "stop-sync")
4872
+ const mermaidPath = resolveDiagramPath(input, 'mermaid', projectRoot);
4873
+ \`\`\`
4774
4874
 
4775
- **Action**: Stop background sync service
4875
+ 2. **Validate file exists**
4776
4876
 
4877
+ 3. **Convert Mermaid \u2192 Draw.io**:
4777
4878
  \`\`\`javascript
4778
- import { stopSyncService } from '.aikit/tools/drawio-sync/sync-service.js';
4779
- stopSyncService();
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
- ## Conversion Tools
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
- **Location**: \`.aikit/tools/drawio-sync/\`
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
- **Modules**:
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 { openDrawioWithAutoSync } from '.aikit/tools/drawio-sync/lifecycle-manager.js';
4795
- import { join } from 'path';
4910
+ import { getDiagramList } from '@tdsoft-tech/aikit/tools/drawio-convert/diagram-utils.js';
4796
4911
 
4797
- const drawioPath = join(process.cwd(), '.aikit/assets/drawio', name + '.drawio');
4912
+ const diagrams = getDiagramList(projectRoot);
4798
4913
 
4799
- // Automatically:
4800
- // - Starts sync when Draw.io opens
4801
- // - Stops sync when Draw.io closes
4802
- await openDrawioWithAutoSync(drawioPath);
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
- **Manual Conversion** (for "modify" command):
4806
- \`\`\`javascript
4807
- import { convertMermaidToDrawio } from '.aikit/tools/drawio-sync/mermaid-to-drawio.js';
4808
- import { convertDrawioToMermaid } from '.aikit/tools/drawio-sync/drawio-to-mermaid.js';
4922
+ ## Error Handling
4923
+
4924
+ ### File Not Found
4925
+ \`\`\`
4926
+ \u274C File not found: mermaid/login-flow.mmd
4809
4927
 
4810
- // Mermaid \u2192 Draw.io
4811
- const result = convertMermaidToDrawio(mermaidCode, diagramName);
4812
- fs.writeFileSync('.aikit/assets/drawio/name.drawio', result.xml, 'utf-8');
4928
+ Did you mean:
4929
+ - mermaid/auth-flow.mmd
4930
+ - mermaid/login.mmd
4813
4931
 
4814
- // Draw.io \u2192 Mermaid
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
- ## Error Handling
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
- **If sync fails**:
4822
- 1. Log error to console
4823
- 2. Show notification: "Sync failed for [name]"
4824
- 3. **Ask user**:
4825
- - Ignore this error?
4826
- - Retry sync?
4827
- - Let AI fix it?
4828
-
4829
- **AI Fix Option**:
4830
- - Analyze error
4831
- - Attempt to fix common issues:
4832
- - Malformed Mermaid syntax
4833
- - Invalid XML characters
4834
- - Encoding issues
4835
- - Missing nodes
4836
- - Retry sync after fix
4837
- - Report result
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-authentication
4979
+ User: /drawio-interact create user-auth
4843
4980
 
4844
- AI: Creating diagram: user-authentication
4981
+ AI: Creating diagram: user-auth
4845
4982
 
4846
- \u{1F4C4} Generated Mermaid Code:
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-authentication.mmd
4853
- - .aikit/assets/drawio/user-authentication.drawio
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
- \u2705 Updated: mermaid/user-authentication.mmd
4997
+ ### Edit & Sync (Draw.io \u2192 Mermaid)
4998
+ \`\`\`
4999
+ [User edits in Draw.io, adds "Password Reset" node, saves]
4870
5000
 
4871
- [Or user edits mermaid/user-authentication.mmd directly]
5001
+ User: /drawio-interact sync-to-mmd user-auth
4872
5002
 
4873
- \u{1F504} Background sync detected changes:
4874
- \u2022 Modified Mermaid syntax
5003
+ AI: Syncing Draw.io \u2192 Mermaid...
4875
5004
 
4876
- \u2705 Updated: .aikit/assets/drawio/user-authentication.drawio
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
- [User closes Draw.io app]
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
- \u{1F3A8} Draw.io closed - stopping sync service
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
- **Key Point**: Sync starts automatically when Draw.io opens, and stops automatically when Draw.io closes. No manual commands needed!
5024
+ User: /drawio-interact sync-to-drawio user-auth
4887
5025
 
4888
- ## Important Notes
5026
+ AI: Syncing Mermaid \u2192 Draw.io...
4889
5027
 
4890
- - **Auto-sync lifecycle** - Sync starts when Draw.io opens, stops when it closes
4891
- - **Zero manual intervention** - No need to run start/stop commands
4892
- - **Draw.io app** opens automatically on "create"
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
- ## Auto-Open Commands
5032
+ Changes:
5033
+ \u2022 4 nodes
5034
+ \u2022 3 edges
4899
5035
 
4900
- **IMPORTANT**: Always use absolute paths!
5036
+ Open in Draw.io? (y/n): y
5037
+ \u{1F3A8} Opening...
5038
+ \`\`\`
4901
5039
 
4902
- **Example code**:
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
- **Why absolute paths?**
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
- **Fallback**: If Draw.io app not found, open https://app.diagrams.net/
5046
+ 1. user-auth
5047
+ Mermaid: mermaid/user-auth.mmd \u2713
5048
+ Drawio: .aikit/assets/drawio/user-auth.drawio \u2713
4926
5049
 
4927
- ## Directory Setup
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
- Ensure directories exist:
4930
- \`\`\`bash
4931
- mkdir -p mermaid
4932
- mkdir -p .aikit/assets/drawio
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