augent 0.6.4

Lean package manager for various AI coding platforms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
//! Install platform-specific tests

mod common;

use predicates::prelude::*;

#[test]
fn test_install_auto_detect_platforms() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("workspace-multiple-agents");
    // Create platform directories so platforms can be auto-detected
    workspace.create_agent_dir("cursor");
    workspace.create_agent_dir("opencode");
    workspace.copy_fixture_bundle("simple-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();
}

#[test]
fn test_install_for_single_agent() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("cursor");
    workspace.copy_fixture_bundle("simple-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle", "--to", "cursor"])
        .assert()
        .success();
}

#[test]
fn test_install_for_multiple_agents() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("cursor");
    workspace.create_agent_dir("opencode");
    workspace.copy_fixture_bundle("simple-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args([
            "install",
            "./bundles/test-bundle",
            "--to",
            "cursor",
            "opencode",
        ])
        .assert()
        .success();
}

#[test]
fn test_install_invalid_agent_name() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.copy_fixture_bundle("simple-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle", "--to", "invalid-agent"])
        .assert()
        .failure()
        .stderr(predicate::str::contains("invalid").or(predicate::str::contains("not supported")));
}

#[test]
fn test_install_empty_workspace_platforms() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("opencode");
    workspace.copy_fixture_bundle("simple-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();
}

#[test]
fn test_install_with_root_files() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("opencode");
    workspace.copy_fixture_bundle("bundle-with-root-files", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();
}

#[test]
fn test_root_directory_handling_empty_vs_non_empty() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("cursor");

    let bundle = workspace.create_bundle("test-bundle");

    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    let bundle_root = bundle.join("root");
    std::fs::create_dir_all(&bundle_root).unwrap();
    std::fs::write(bundle_root.join("EMPTY_DIR"), "").expect("Failed to write empty file");

    std::fs::create_dir_all(bundle_root.join("NON_EMPTY_DIR")).unwrap();
    std::fs::write(
        bundle_root.join("NON_EMPTY_DIR").join("file.txt"),
        "content",
    )
    .expect("Failed to write file");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists("EMPTY_DIR"),
        "Empty directory should be copied to workspace root"
    );
    assert!(
        workspace.file_exists("NON_EMPTY_DIR"),
        "Non-empty directory should be copied to workspace root"
    );
    assert!(
        workspace.file_exists("NON_EMPTY_DIR/file.txt"),
        "Files in directory should be copied"
    );
}

#[test]
fn test_all_resource_types_commands_rules_skills_agents_mcp_servers() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("claude");

    let bundle = workspace.create_bundle("test-bundle");

    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("commands")).unwrap();
    std::fs::write(
        bundle.join("commands").join("deploy.md"),
        "# Deployment command",
    )
    .expect("Failed to write command");

    std::fs::create_dir_all(bundle.join("rules")).unwrap();
    std::fs::write(bundle.join("rules").join("lint.md"), "# Linting rule")
        .expect("Failed to write rule");

    std::fs::create_dir_all(bundle.join("skills/analyze")).unwrap();
    std::fs::write(
        bundle.join("skills/analyze/SKILL.md"),
        "---\nname: analyze\ndescription: Analysis skill for testing.\n---\n\n# Analysis skill",
    )
    .expect("Failed to write skill");

    std::fs::create_dir_all(bundle.join("agents")).unwrap();
    std::fs::write(bundle.join("agents").join("custom.md"), "# Custom agent")
        .expect("Failed to write agent");

    std::fs::write(
        bundle.join("mcp.jsonc"),
        r#"{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"]
    }
  }
}"#,
    )
    .expect("Failed to write mcp.jsonc");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".claude/commands/deploy.md"),
        "Commands resource should be installed"
    );
    assert!(
        workspace.file_exists(".claude/rules/lint.md"),
        "Rules resource should be installed"
    );
    assert!(
        workspace.file_exists(".claude/skills/analyze/SKILL.md"),
        "Skills resource should be installed"
    );
    assert!(
        workspace.file_exists(".claude/agents/custom.md"),
        "Agents resource should be installed"
    );
    assert!(
        workspace.file_exists(".mcp.json"),
        "MCP server configuration should be installed (Claude Code reads project-root .mcp.json)"
    );

    let mcp_content = workspace.read_file(".mcp.json");
    assert!(
        mcp_content.contains("filesystem"),
        "MCP server should be in config"
    );
}

#[test]
fn test_bundle_with_resources_not_supported_by_some_platforms() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("cursor");

    let bundle = workspace.create_bundle("test-bundle");

    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("commands")).unwrap();
    std::fs::write(bundle.join("commands").join("test.md"), "# Test command")
        .expect("Failed to write command");

    std::fs::create_dir_all(bundle.join("unsupported_resource")).unwrap();
    std::fs::write(
        bundle.join("unsupported_resource").join("file.md"),
        "# Unsupported resource",
    )
    .expect("Failed to write unsupported resource");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".cursor/commands/test.md"),
        "Supported resource (commands) should be installed"
    );

    assert!(
        !workspace.file_exists(".cursor/unsupported_resource"),
        "Unsupported resource should not be installed to platform"
    );
}

#[test]
fn test_platform_detection_order_with_multiple_platforms() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("claude");
    workspace.create_agent_dir("cursor");
    workspace.create_agent_dir("opencode");

    workspace.copy_fixture_bundle("simple-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".claude/commands/debug.md"),
        "Claude platform should have commands installed"
    );
    assert!(
        workspace.file_exists(".claude/rules/lint.md"),
        "Claude platform should have rules installed"
    );
    assert!(
        workspace.file_exists(".cursor/commands/debug.md"),
        "Cursor platform should have commands installed"
    );
    assert!(
        workspace.file_exists(".cursor/rules/lint.mdc"),
        "Cursor platform should have rules installed"
    );
    assert!(
        workspace.file_exists(".opencode/commands/debug.md"),
        "OpenCode platform should have commands installed"
    );
    assert!(
        workspace.file_exists(".opencode/rules/lint.md"),
        "OpenCode platform should have rules installed"
    );
}

#[test]
fn test_platform_detection_order_with_root_files() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    // Only platform directories are used for detection; root agent files do not add platforms
    workspace.create_agent_dir("claude");
    workspace.create_agent_dir("cursor");
    workspace.write_file("CLAUDE.md", "# Claude Config");
    workspace.write_file("AGENTS.md", "# Agents Config");

    workspace.copy_fixture_bundle("simple-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".claude/commands/debug.md"),
        "Claude platform (directory present) should get commands"
    );
    assert!(
        workspace.file_exists(".cursor/commands/debug.md"),
        "Cursor platform (directory present) should get commands"
    );
}

#[test]
fn test_install_universal_frontmatter_merged_for_opencode() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("opencode");
    workspace.copy_fixture_bundle("universal-frontmatter-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    let cmd_content = workspace.read_file(".opencode/commands/review.md");
    assert!(
        cmd_content.contains("OpenCode review command"),
        "OpenCode command should use merged description from platform block"
    );
    assert!(
        cmd_content.contains("Run the review checklist"),
        "Command body should be preserved"
    );

    assert!(
        workspace.file_exists(".opencode/skills/analyze/SKILL.md"),
        "OpenCode skill should be installed under skills/analyze/SKILL.md"
    );
    let skill_content = workspace.read_file(".opencode/skills/analyze/SKILL.md");
    assert!(
        skill_content.contains("OpenCode skill for analysis"),
        "OpenCode skill should use merged description from platform block"
    );
    assert!(
        skill_content.contains("name: analyze"),
        "Skill name should be present"
    );

    let agent_content = workspace.read_file(".opencode/agents/planner.md");
    assert!(
        agent_content.contains("OpenCode planner agent"),
        "OpenCode agent should use merged description from platform block"
    );
    assert!(
        agent_content.contains("You are the planner"),
        "Agent body should be preserved"
    );
}

#[test]
fn test_install_universal_frontmatter_full_yaml_for_all_platforms() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("cursor");
    workspace.create_agent_dir("opencode");
    workspace.copy_fixture_bundle("universal-frontmatter-bundle", "test-bundle");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    // Cursor gets full merged frontmatter (cursor block merged)
    let cursor_cmd = workspace.read_file(".cursor/commands/review.md");
    assert!(
        cursor_cmd.contains("Cursor review command"),
        "Cursor command should use merged description from cursor: block"
    );
    assert!(
        cursor_cmd.contains("Run the review checklist"),
        "Command body should be preserved"
    );
    assert!(
        cursor_cmd.starts_with("---"),
        "Cursor command should have YAML frontmatter"
    );

    // OpenCode still gets merged frontmatter
    let opencode_cmd = workspace.read_file(".opencode/commands/review.md");
    assert!(
        opencode_cmd.contains("OpenCode review command"),
        "OpenCode command should use merged description from opencode: block"
    );
}

#[test]
fn test_claude_commands_transformation() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("claude");

    let bundle = workspace.create_bundle("test-bundle");
    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("commands")).unwrap();
    std::fs::write(
        bundle.join("commands").join("deploy.md"),
        "# Deploy command",
    )
    .expect("Failed to write command");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".claude/commands/deploy.md"),
        "Commands should transform to .claude/commands/"
    );

    let content = workspace.read_file(".claude/commands/deploy.md");
    assert_eq!(
        content, "# Deploy command",
        "Command content should be preserved"
    );
}

#[test]
fn test_claude_rules_transformation() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("claude");

    let bundle = workspace.create_bundle("test-bundle");
    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("rules")).unwrap();
    std::fs::write(bundle.join("rules").join("lint.md"), "# Linting rule")
        .expect("Failed to write rule");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".claude/rules/lint.md"),
        "Rules should transform to .claude/rules/"
    );

    let content = workspace.read_file(".claude/rules/lint.md");
    assert_eq!(
        content, "# Linting rule",
        "Rule content should be preserved"
    );
}

#[test]
fn test_claude_skills_transformation() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("claude");

    let bundle = workspace.create_bundle("test-bundle");
    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("skills/analyze")).unwrap();
    std::fs::write(
        bundle.join("skills/analyze/SKILL.md"),
        "---\nname: analyze\ndescription: Analysis skill.\n---\n\n# Analysis skill",
    )
    .expect("Failed to write skill");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".claude/skills/analyze/SKILL.md"),
        "Skills should transform to .claude/skills/"
    );

    let content = workspace.read_file(".claude/skills/analyze/SKILL.md");
    assert!(
        content.contains("# Analysis skill"),
        "Skill content should be preserved"
    );
}

#[test]
fn test_cursor_rules_transformation() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("cursor");

    let bundle = workspace.create_bundle("test-bundle");
    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("rules")).unwrap();
    std::fs::write(bundle.join("rules").join("format.md"), "# Formatting rule")
        .expect("Failed to write rule");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle", "--to", "cursor"])
        .assert()
        .success();

    // Cursor rules should transform to .mdc extension
    assert!(
        workspace.file_exists(".cursor/rules/format.mdc"),
        "Rules should transform to .cursor/rules/ with .mdc extension"
    );
    assert!(
        !workspace.file_exists(".cursor/rules/format.md"),
        "Original .md extension should not exist"
    );

    let content = workspace.read_file(".cursor/rules/format.mdc");
    assert_eq!(
        content, "# Formatting rule",
        "Rule content should be preserved"
    );
}

#[test]
fn test_opencode_all_transformations() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("opencode");

    let bundle = workspace.create_bundle("test-bundle");
    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("commands")).unwrap();
    std::fs::write(bundle.join("commands").join("build.md"), "# Build command")
        .expect("Failed to write command");

    std::fs::create_dir_all(bundle.join("rules")).unwrap();
    std::fs::write(bundle.join("rules").join("security.md"), "# Security rule")
        .expect("Failed to write rule");

    std::fs::create_dir_all(bundle.join("skills/debug")).unwrap();
    std::fs::write(
        bundle.join("skills/debug/SKILL.md"),
        "---\nname: debug\ndescription: Debugging skill.\n---\n\n# Debugging skill",
    )
    .expect("Failed to write skill");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".opencode/commands/build.md"),
        "Commands should transform to .opencode/commands/"
    );
    assert!(
        workspace.file_exists(".opencode/rules/security.md"),
        "Rules should transform to .opencode/rules/"
    );
    assert!(
        workspace.file_exists(".opencode/skills/debug/SKILL.md"),
        "Skills should transform to .opencode/skills/<name>/SKILL.md"
    );

    assert_eq!(
        workspace.read_file(".opencode/commands/build.md"),
        "# Build command",
        "Command content should be preserved"
    );
    assert_eq!(
        workspace.read_file(".opencode/rules/security.md"),
        "# Security rule",
        "Rule content should be preserved"
    );
    assert!(
        workspace
            .read_file(".opencode/skills/debug/SKILL.md")
            .contains("# Debugging skill"),
        "Skill content should be preserved"
    );
}

#[test]
fn test_multi_platform_simultaneous_install() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("claude");
    workspace.create_agent_dir("cursor");
    workspace.create_agent_dir("opencode");

    let bundle = workspace.create_bundle("test-bundle");
    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("commands")).unwrap();
    std::fs::write(bundle.join("commands").join("test.md"), "# Test command")
        .expect("Failed to write command");

    std::fs::create_dir_all(bundle.join("rules")).unwrap();
    std::fs::write(bundle.join("rules").join("test.md"), "# Test rule")
        .expect("Failed to write rule");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".claude/commands/test.md"),
        "Claude: commands should be installed"
    );
    assert!(
        workspace.file_exists(".claude/rules/test.md"),
        "Claude: rules should be installed"
    );

    assert!(
        workspace.file_exists(".cursor/commands/test.md"),
        "Cursor: commands should be installed"
    );
    assert!(
        workspace.file_exists(".cursor/rules/test.mdc"),
        "Cursor: rules should be installed"
    );

    assert!(
        workspace.file_exists(".opencode/commands/test.md"),
        "OpenCode: commands should be installed"
    );
    assert!(
        workspace.file_exists(".opencode/rules/test.md"),
        "OpenCode: rules should be installed"
    );
}

#[test]
fn test_directory_structure_creation_for_all_platforms() {
    let workspace = common::TestWorkspace::new();
    workspace.init_from_fixture("empty");
    workspace.create_agent_dir("claude");

    let bundle = workspace.create_bundle("test-bundle");
    workspace.write_file(
        "bundles/test-bundle/augent.yaml",
        r#"
name: "@test/bundle"
bundles: []
"#,
    );

    std::fs::create_dir_all(bundle.join("commands")).unwrap();
    std::fs::create_dir_all(bundle.join("rules")).unwrap();
    std::fs::create_dir_all(bundle.join("skills")).unwrap();

    std::fs::write(bundle.join("commands").join("cmd.md"), "# Command").expect("Failed to write");
    std::fs::write(bundle.join("rules").join("rule.md"), "# Rule").expect("Failed to write");
    std::fs::create_dir_all(bundle.join("skills/skill")).unwrap();
    std::fs::write(
        bundle.join("skills/skill/SKILL.md"),
        "---\nname: skill\ndescription: A test skill.\n---\n\n# Skill",
    )
    .expect("Failed to write");

    common::augent_cmd_for_workspace(&workspace.path)
        .args(["install", "./bundles/test-bundle"])
        .assert()
        .success();

    assert!(
        workspace.file_exists(".claude/commands/cmd.md"),
        ".claude/commands/ directory should exist"
    );
    assert!(
        workspace.file_exists(".claude/rules/rule.md"),
        ".claude/rules/ directory should exist"
    );
    assert!(
        workspace.file_exists(".claude/skills/skill/SKILL.md"),
        ".claude/skills/ directory should exist"
    );
}