@nomad-e/bluma-cli 0.1.31 → 0.1.32
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/README.md +370 -54
- package/dist/config/native_tools.json +1 -1
- package/dist/main.js +49 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -418,36 +418,109 @@ Here's BluMa in action:
|
|
|
418
418
|
---
|
|
419
419
|
|
|
420
420
|
## <a name="project-structure"></a>Project Structure
|
|
421
|
+
|
|
421
422
|
```
|
|
422
423
|
bluma-cli/
|
|
423
|
-
├── package.json # npm
|
|
424
|
-
├── tsconfig.json # TypeScript
|
|
424
|
+
├── package.json # npm project config & dependencies
|
|
425
|
+
├── tsconfig.json # TypeScript configuration
|
|
426
|
+
├── babel.config.cjs # Babel presets for Jest/ESBuild
|
|
427
|
+
├── jest.config.cjs # Jest test configuration
|
|
425
428
|
├── scripts/
|
|
426
429
|
│ └── build.js # Build script using esbuild
|
|
427
430
|
├── src/
|
|
428
|
-
│ ├── main.
|
|
429
|
-
│
|
|
430
|
-
│
|
|
431
|
-
│
|
|
432
|
-
│
|
|
433
|
-
│
|
|
434
|
-
│
|
|
435
|
-
│
|
|
436
|
-
│
|
|
437
|
-
│
|
|
438
|
-
│
|
|
439
|
-
│
|
|
440
|
-
│ │
|
|
441
|
-
│ │ │
|
|
442
|
-
│ │
|
|
443
|
-
│
|
|
444
|
-
│
|
|
445
|
-
├──
|
|
431
|
+
│ ├── main.ts # Entry point (CLI bootstrap & agent mode)
|
|
432
|
+
│ └── app/
|
|
433
|
+
│ ├── agent/ # Agent core & orchestration
|
|
434
|
+
│ │ ├── agent.ts # Main orchestrator (RouteManager integration)
|
|
435
|
+
│ │ ├── routeManager.ts # Route registration & dispatch
|
|
436
|
+
│ │ ├── bluma/
|
|
437
|
+
│ │ │ └── core/
|
|
438
|
+
│ │ │ └── bluma.ts # Core agent loop & state management
|
|
439
|
+
│ │ ├── config/
|
|
440
|
+
│ │ │ ├── native_tools.json # Native tool definitions
|
|
441
|
+
│ │ │ └── skills/ # Built-in skills (git-commit, git-pr, pdf, xlsx, skill-creator)
|
|
442
|
+
│ │ ├── core/
|
|
443
|
+
│ │ │ ├── context-api/ # Context management & token counting
|
|
444
|
+
│ │ │ │ ├── context_manager.ts
|
|
445
|
+
│ │ │ │ ├── history_anchor.ts
|
|
446
|
+
│ │ │ │ └── token_counter.ts
|
|
447
|
+
│ │ │ ├── llm/ # LLM client (FactorRouter/OpenAI SDK)
|
|
448
|
+
│ │ │ │ ├── llm.ts
|
|
449
|
+
│ │ │ │ └── tool_call_normalizer.ts
|
|
450
|
+
│ │ │ └── prompt/ # System prompt builder
|
|
451
|
+
│ │ │ └── prompt_builder.ts
|
|
452
|
+
│ │ ├── feedback/
|
|
453
|
+
│ │ │ └── feedback_system.ts # Smart feedback & suggestions
|
|
454
|
+
│ │ ├── session_manager/
|
|
455
|
+
│ │ │ └── session_manager.ts # Session persistence & history
|
|
456
|
+
│ │ ├── skills/
|
|
457
|
+
│ │ │ └── skill_loader.ts # Pluggable skill system
|
|
458
|
+
│ │ ├── subagents/ # Sub-agent implementations
|
|
459
|
+
│ │ │ ├── registry.ts # Sub-agent registration & lookup
|
|
460
|
+
│ │ │ ├── types.ts
|
|
461
|
+
│ │ │ ├── base_llm_subagent.ts
|
|
462
|
+
│ │ │ └── init/ # Init subagent (environment setup)
|
|
463
|
+
│ │ │ ├── init_subagent.ts
|
|
464
|
+
│ │ │ ├── init_system_prompt.ts
|
|
465
|
+
│ │ │ └── contracts.ts
|
|
466
|
+
│ │ ├── tools/
|
|
467
|
+
│ │ │ ├── mcp/
|
|
468
|
+
│ │ │ │ └── mcp_client.ts # MCP SDK integration
|
|
469
|
+
│ │ │ └── natives/ # Native tools (20+ tools)
|
|
470
|
+
│ │ │ ├── shell_command.ts
|
|
471
|
+
│ │ │ ├── edit.ts
|
|
472
|
+
│ │ │ ├── readLines.ts
|
|
473
|
+
│ │ │ ├── ls.ts
|
|
474
|
+
│ │ │ ├── grep_search.ts
|
|
475
|
+
│ │ │ ├── find_by_name.ts
|
|
476
|
+
│ │ │ ├── coding_memory.ts
|
|
477
|
+
│ │ │ ├── load_skill.ts
|
|
478
|
+
│ │ │ ├── message.ts
|
|
479
|
+
│ │ │ ├── todo.ts
|
|
480
|
+
│ │ │ ├── task_boundary.ts
|
|
481
|
+
│ │ │ └── ... (10 more)
|
|
482
|
+
│ │ ├── types/
|
|
483
|
+
│ │ │ └── index.ts # TypeScript type definitions
|
|
484
|
+
│ │ └── utils/
|
|
485
|
+
│ │ └── update_check.ts # Version update notifications
|
|
486
|
+
│ └── ui/ # Ink/React CLI interface
|
|
487
|
+
│ ├── App.tsx # Main React component
|
|
488
|
+
│ ├── layout.tsx # UI layout components
|
|
489
|
+
│ ├── components/ # Reusable UI components (20+)
|
|
490
|
+
│ │ ├── MarkdownRenderer.tsx
|
|
491
|
+
│ │ ├── ToolCallDisplay.tsx
|
|
492
|
+
│ │ ├── ToolResultCard.tsx
|
|
493
|
+
│ │ ├── InputPrompt.tsx
|
|
494
|
+
│ │ ├── ConfirmationPrompt.tsx
|
|
495
|
+
│ │ ├── SessionStats.tsx
|
|
496
|
+
│ │ └── ... (15 more)
|
|
497
|
+
│ ├── hooks/
|
|
498
|
+
│ │ └── useAtCompletion.ts # Autocomplete hook
|
|
499
|
+
│ ├── theme/
|
|
500
|
+
│ │ ├── blumaTerminal.ts
|
|
501
|
+
│ │ └── m3Layout.tsx
|
|
502
|
+
│ ├── utils/
|
|
503
|
+
│ │ ├── slashRegistry.ts
|
|
504
|
+
│ │ ├── terminalTitle.ts
|
|
505
|
+
│ │ └── ... (4 more)
|
|
506
|
+
│ └── Asci/
|
|
507
|
+
│ └── AsciiArt.ts
|
|
508
|
+
├── tests/ # Test suite (Jest 30)
|
|
509
|
+
│ ├── *.spec.ts # Unit & integration tests
|
|
510
|
+
│ └── *.spec.tsx # UI component tests
|
|
446
511
|
├── artifacts/ # Generated deliverables (runtime)
|
|
447
|
-
└──
|
|
448
|
-
├──
|
|
449
|
-
|
|
512
|
+
└── docs/ # Documentation
|
|
513
|
+
├── SKILLS.md # Skills system documentation
|
|
514
|
+
├── FACTOR_ROUTER_TURNS.md # FactorRouter integration details
|
|
515
|
+
└── assets/
|
|
516
|
+
└── bluma.png # Project logo
|
|
450
517
|
```
|
|
518
|
+
|
|
519
|
+
**Runtime directories** (created on first run):
|
|
520
|
+
- `~/.bluma/sessions/` — Persistent session history
|
|
521
|
+
- `~/.bluma/coding_memory.json` — Long-term coding notes
|
|
522
|
+
- `~/.bluma/skills/` — User-installed skills
|
|
523
|
+
- `~/.bluma/.env` — Optional local environment overrides
|
|
451
524
|
---
|
|
452
525
|
|
|
453
526
|
## <a name="development-and-build"></a>Development and Build
|
|
@@ -467,24 +540,95 @@ npm run dev # (If configured, hot-reload/TS watch)
|
|
|
467
540
|
|
|
468
541
|
## <a name="extensibility-tools-and-plugins"></a>Extensibility: Tools, Skills and Plugins
|
|
469
542
|
|
|
470
|
-
### Native Tools
|
|
471
|
-
|
|
543
|
+
### Native Tools (20+ Built-in)
|
|
544
|
+
|
|
545
|
+
BluMa ships with a comprehensive set of native tools for software engineering tasks:
|
|
546
|
+
|
|
547
|
+
**File Operations:**
|
|
548
|
+
- `edit_tool` — Precise text replacement with context-aware editing
|
|
549
|
+
- `read_file_lines` — Read specific line ranges from files
|
|
550
|
+
- `ls_tool` — List directory contents with filtering & pagination
|
|
551
|
+
- `count_file_lines` — Count total lines in a file
|
|
552
|
+
- `view_file_outline` — Show code structure (classes, functions, methods)
|
|
553
|
+
- `find_by_name` — Search files by name using glob patterns
|
|
554
|
+
|
|
555
|
+
**Code Intelligence:**
|
|
556
|
+
- `grep_search` — Search text patterns with regex support
|
|
557
|
+
- `coding_memory` — Persistent notes about codebase & decisions
|
|
558
|
+
|
|
559
|
+
**Shell & Process:**
|
|
560
|
+
- `shell_command` — Execute shell commands (background async)
|
|
561
|
+
- `command_status` — Check command progress & retrieve output
|
|
562
|
+
- `send_command_input` — Send stdin to running commands
|
|
563
|
+
- `kill_command` — Terminate running processes
|
|
564
|
+
|
|
565
|
+
**Agent Workflow:**
|
|
566
|
+
- `message` — Send messages to user (info or result)
|
|
567
|
+
- `todo` — Manage task lists with completion tracking
|
|
568
|
+
- `task_boundary` — Mark task phases (PLANNING, EXECUTION, VERIFICATION)
|
|
569
|
+
- `load_skill` — Load specialized knowledge modules
|
|
570
|
+
|
|
571
|
+
**UI & Navigation:**
|
|
572
|
+
- All tools render rich Ink/React components in the terminal
|
|
573
|
+
|
|
574
|
+
To add custom native tools, create a new file in `src/app/agent/tools/natives/` following the existing pattern.
|
|
575
|
+
|
|
576
|
+
### Skills System (Pluggable Expertise)
|
|
472
577
|
|
|
473
|
-
### Skills System
|
|
474
578
|
BluMa features a **pluggable skills system** that loads domain-specific knowledge modules:
|
|
475
579
|
|
|
476
|
-
- Skills
|
|
477
|
-
-
|
|
478
|
-
-
|
|
479
|
-
-
|
|
580
|
+
**Built-in Skills:**
|
|
581
|
+
- `git-commit` — Professional Git commit workflows with Conventional Commits
|
|
582
|
+
- `git-pr` — Pull request creation, commit validation, and merge preparation
|
|
583
|
+
- `pdf` — PDF creation, manipulation, text extraction, merging, OCR
|
|
584
|
+
- `xlsx` — Excel spreadsheet manipulation, formulas, data cleaning
|
|
585
|
+
- `skill-creator` — Template and workflow for creating new skills
|
|
586
|
+
|
|
587
|
+
**Skill Structure:**
|
|
588
|
+
```
|
|
589
|
+
skills/
|
|
590
|
+
└── git-commit/
|
|
591
|
+
├── SKILL.md # Main workflow & instructions
|
|
592
|
+
├── LICENSE.txt # License terms
|
|
593
|
+
├── references/
|
|
594
|
+
│ └── REFERENCE.md # Additional documentation
|
|
595
|
+
└── scripts/
|
|
596
|
+
└── validate_commit_msg.py # Executable helper
|
|
597
|
+
```
|
|
480
598
|
|
|
481
|
-
|
|
599
|
+
**How Skills Work:**
|
|
600
|
+
1. Skills are stored in `src/app/agent/config/skills/` (built-in) or `~/.bluma/skills/` (user)
|
|
601
|
+
2. Each skill includes a `SKILL.md` with YAML frontmatter defining:
|
|
602
|
+
- `name`, `description`, `version`
|
|
603
|
+
- `depends_on` (other skills for delegation)
|
|
604
|
+
- `tools.required` and `tools.recommended`
|
|
605
|
+
3. Load a skill with: `load_skill({ skill_name: "git-commit" })`
|
|
606
|
+
4. Skill body provides workflows, examples, and decision trees
|
|
607
|
+
5. Skills can include `references/` (extra docs) and `scripts/` (Python helpers)
|
|
608
|
+
|
|
609
|
+
**Creating Custom Skills:**
|
|
610
|
+
Use the `skill-creator` skill to generate new skill templates. Skills are ideal for:
|
|
611
|
+
- Encoding domain-specific workflows (testing, deployment, frameworks)
|
|
612
|
+
- Packaging best practices and conventions
|
|
613
|
+
- Providing reusable scripts and reference documentation
|
|
482
614
|
|
|
483
615
|
### MCP Integration
|
|
484
|
-
|
|
616
|
+
|
|
617
|
+
BluMa integrates with the **Model Context Protocol (MCP)** SDK for:
|
|
618
|
+
- Connecting to external MCP servers
|
|
619
|
+
- Discovering and invoking remote tools
|
|
620
|
+
- Streaming tool results in real-time
|
|
621
|
+
|
|
622
|
+
MCP client is located at `src/app/agent/tools/mcp/mcp_client.ts`.
|
|
485
623
|
|
|
486
624
|
### Custom UI Components
|
|
487
|
-
|
|
625
|
+
|
|
626
|
+
Extend the interface by creating custom Ink components in `src/app/ui/components/`. The UI layer supports:
|
|
627
|
+
- React 18 with hooks
|
|
628
|
+
- Custom renderers for tool calls and results
|
|
629
|
+
- Streaming text and typewriter effects
|
|
630
|
+
- Progress bars, spinners, and notifications
|
|
631
|
+
- Markdown rendering with syntax highlighting
|
|
488
632
|
|
|
489
633
|
---
|
|
490
634
|
|
|
@@ -593,19 +737,74 @@ Enjoy, hack, and—if possible—contribute!
|
|
|
593
737
|
---
|
|
594
738
|
|
|
595
739
|
## 🏗 Architecture Diagram
|
|
596
|
-
|
|
740
|
+
|
|
741
|
+
BluMa's architecture is organized in **three layers**: UI, Agent Orchestration, and Core Services.
|
|
742
|
+
|
|
743
|
+
### High-Level Overview
|
|
597
744
|
```
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
745
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
746
|
+
│ UI Layer (Ink/React) │
|
|
747
|
+
│ main.ts → App.tsx → Components (20+) → Layout → Theme │
|
|
748
|
+
└─────────────────────────────────────────────────────────────┘
|
|
749
|
+
↓
|
|
750
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
751
|
+
│ Agent Orchestration Layer │
|
|
752
|
+
│ agent.ts → RouteManager → BluMaAgent (bluma.ts) │
|
|
753
|
+
│ ↓ │
|
|
754
|
+
│ SubAgents Registry | Feedback System | Session Manager │
|
|
755
|
+
└─────────────────────────────────────────────────────────────┘
|
|
756
|
+
↓
|
|
757
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
758
|
+
│ Core Services Layer │
|
|
759
|
+
│ ┌──────────────┬──────────────┬──────────────┐ │
|
|
760
|
+
│ │ Context API │ LLM Client │ Prompt Bld │ │
|
|
761
|
+
│ │ (context │ (Factor │ (system │ │
|
|
762
|
+
│ │ manager) │ Router) │ prompts) │ │
|
|
763
|
+
│ └──────────────┴──────────────┴──────────────┘ │
|
|
764
|
+
│ ┌──────────────┬──────────────┬──────────────┐ │
|
|
765
|
+
│ │ MCP Client │ Native Tools │ Skills │ │
|
|
766
|
+
│ │ (external │ (20+ tools) │ (pluggable) │ │
|
|
767
|
+
│ │ plugins) │ │ │ │
|
|
768
|
+
│ └──────────────┴──────────────┴──────────────┘ │
|
|
769
|
+
└─────────────────────────────────────────────────────────────┘
|
|
770
|
+
↓
|
|
771
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
772
|
+
│ External Integrations │
|
|
773
|
+
│ FactorRouter API | File System | Shell | MCP Servers │
|
|
774
|
+
└─────────────────────────────────────────────────────────────┘
|
|
607
775
|
```
|
|
608
|
-
|
|
776
|
+
|
|
777
|
+
### Key Architectural Concepts
|
|
778
|
+
|
|
779
|
+
**1. RouteManager Pattern**
|
|
780
|
+
- Central dispatch mechanism for command routing
|
|
781
|
+
- Registers custom route handlers (e.g., `/init`, `/status`)
|
|
782
|
+
- Falls back to core agent loop for unregistered commands
|
|
783
|
+
- Enables extensible command architecture
|
|
784
|
+
|
|
785
|
+
**2. SubAgents Registry**
|
|
786
|
+
- Pluggable sub-agent system for specialized tasks
|
|
787
|
+
- Each sub-agent declares capabilities via registry
|
|
788
|
+
- Init subagent handles environment setup
|
|
789
|
+
- Extensible via `registerSubAgent()` API
|
|
790
|
+
|
|
791
|
+
**3. Context Management**
|
|
792
|
+
- `ContextManager` handles conversation history
|
|
793
|
+
- `TokenCounter` tracks token usage (tiktoken)
|
|
794
|
+
- `HistoryAnchor` manages context window compression
|
|
795
|
+
- Automatic pruning to stay within LLM limits
|
|
796
|
+
|
|
797
|
+
**4. Session Persistence**
|
|
798
|
+
- `SessionManager` persists all interactions
|
|
799
|
+
- Stored in `~/.bluma/sessions/<session-id>.json`
|
|
800
|
+
- Survives across CLI restarts
|
|
801
|
+
- Includes full tool call history and results
|
|
802
|
+
|
|
803
|
+
**5. Skills System**
|
|
804
|
+
- Pluggable knowledge modules (`skill_loader.ts`)
|
|
805
|
+
- Built-in skills: `git-commit`, `git-pr`, `pdf`, `xlsx`, `skill-creator`
|
|
806
|
+
- Each skill includes `SKILL.md` with workflows
|
|
807
|
+
- Can include `references/` (docs) and `scripts/` (executables)
|
|
609
808
|
|
|
610
809
|
### Sequence Diagram
|
|
611
810
|
```mermaid
|
|
@@ -730,23 +929,140 @@ flowchart LR
|
|
|
730
929
|
---
|
|
731
930
|
|
|
732
931
|
## 💡 Usage Examples
|
|
733
|
-
|
|
932
|
+
|
|
933
|
+
### Interactive CLI Mode
|
|
934
|
+
|
|
935
|
+
**1. Start a Conversation**
|
|
936
|
+
```bash
|
|
937
|
+
bluma
|
|
938
|
+
```
|
|
939
|
+
Then ask naturally:
|
|
940
|
+
- "Help me refactor this authentication module"
|
|
941
|
+
- "Run tests and fix any failures"
|
|
942
|
+
- "Create a PDF report from this data"
|
|
943
|
+
|
|
944
|
+
**2. Use Slash Commands**
|
|
945
|
+
```bash
|
|
946
|
+
/init # Initialize environment with init subagent
|
|
947
|
+
/todo # View current task list
|
|
948
|
+
/memory list # List all coding memory entries
|
|
949
|
+
/skills # List available skills
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
**3. Load Skills for Specialized Tasks**
|
|
953
|
+
```
|
|
954
|
+
# The agent will automatically load skills when needed
|
|
955
|
+
"Commit these changes with a proper message" → loads git-commit skill
|
|
956
|
+
"Create a pull request" → loads git-pr skill
|
|
957
|
+
"Generate a PDF report" → loads pdf skill
|
|
958
|
+
"Analyze this Excel file" → loads xlsx skill
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
**4. Live Overlays During Processing**
|
|
962
|
+
While the agent is working, type guidance:
|
|
963
|
+
```
|
|
964
|
+
[hint] Focus on the authentication flow first
|
|
965
|
+
[constraint] Don't modify files in tests/ yet
|
|
966
|
+
[override] expected_replacements=2
|
|
967
|
+
[assume] target_database=postgresql
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
**5. Tool Confirmation Flow**
|
|
971
|
+
When the agent requests a sensitive operation:
|
|
972
|
+
```
|
|
973
|
+
┌─────────────────────────────────────────┐
|
|
974
|
+
│ EDIT PREVIEW │
|
|
975
|
+
│ File: src/auth/login.ts │
|
|
976
|
+
│ Lines 45-67 │
|
|
977
|
+
│ │
|
|
978
|
+
│ - old code │
|
|
979
|
+
│ + new code │
|
|
980
|
+
└─────────────────────────────────────────┘
|
|
981
|
+
|
|
982
|
+
[Accept] [Decline] [Accept Always] [Expand]
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
### Agent Mode (Sandbox / API Integration)
|
|
986
|
+
|
|
987
|
+
**6. Call BluMa from Another System**
|
|
988
|
+
```bash
|
|
989
|
+
BLUMA_SANDBOX=true BLUMA_SANDBOX_NAME="agiweb" \
|
|
990
|
+
node dist/main.js agent --input - << 'EOF'
|
|
991
|
+
{
|
|
992
|
+
"session_id": "conv-123",
|
|
993
|
+
"message_id": "job-456",
|
|
994
|
+
"from_agent": "agiweb",
|
|
995
|
+
"to_agent": "bluma",
|
|
996
|
+
"action": "generate_report",
|
|
997
|
+
"context": {
|
|
998
|
+
"user_request": "Create sales report PDF"
|
|
999
|
+
},
|
|
1000
|
+
"user_context": {
|
|
1001
|
+
"userId": "13",
|
|
1002
|
+
"userName": "Alex",
|
|
1003
|
+
"companyId": "4"
|
|
1004
|
+
},
|
|
1005
|
+
"metadata": { "sandbox": true }
|
|
1006
|
+
}
|
|
1007
|
+
EOF
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
**7. Parse JSONL Output**
|
|
1011
|
+
The agent outputs structured events:
|
|
1012
|
+
```json
|
|
1013
|
+
{"event_type":"log","level":"info","message":"Starting..."}
|
|
1014
|
+
{"event_type":"action_status","payload":{"action":"Thinking"}}
|
|
1015
|
+
{"event_type":"backend_message","backend_type":"tool_call",...}
|
|
1016
|
+
{"event_type":"result","status":"success","data":{"attachments":["/app/artifacts/report.pdf"]}}
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
**8. Retrieve Generated Artifacts**
|
|
1020
|
+
Check the `attachments` array in the final `result` event:
|
|
1021
|
+
```json
|
|
1022
|
+
{
|
|
1023
|
+
"event_type": "result",
|
|
1024
|
+
"status": "success",
|
|
1025
|
+
"data": {
|
|
1026
|
+
"message_id": "job-456",
|
|
1027
|
+
"last_assistant_message": "Report generated successfully",
|
|
1028
|
+
"attachments": [
|
|
1029
|
+
"/app/artifacts/sales_report.pdf",
|
|
1030
|
+
"/app/artifacts/sales_data.csv"
|
|
1031
|
+
]
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
### Common Workflows
|
|
1037
|
+
|
|
1038
|
+
**9. Code Refactoring**
|
|
734
1039
|
```
|
|
735
|
-
/
|
|
1040
|
+
User: "Refactor this function to use async/await"
|
|
1041
|
+
→ Agent reads file with read_file_lines
|
|
1042
|
+
→ Plans changes with todo
|
|
1043
|
+
→ Applies edits with edit_tool (shows preview)
|
|
1044
|
+
→ Runs tests with shell_command
|
|
1045
|
+
→ Reports results
|
|
736
1046
|
```
|
|
737
|
-
Executes the `init` subagent to prepare the working environment.
|
|
738
1047
|
|
|
739
|
-
|
|
740
|
-
When the system prompts an `edit_tool` operation, review the preview and choose:
|
|
1048
|
+
**10. Git Workflow**
|
|
741
1049
|
```
|
|
742
|
-
|
|
1050
|
+
User: "Commit my changes"
|
|
1051
|
+
→ Agent loads git-commit skill
|
|
1052
|
+
→ Runs git status --short
|
|
1053
|
+
→ Stages files with git add
|
|
1054
|
+
→ Writes conventional commit message
|
|
1055
|
+
→ Executes git commit
|
|
743
1056
|
```
|
|
744
1057
|
|
|
745
|
-
|
|
746
|
-
During a long-running task, you can send hints:
|
|
1058
|
+
**11. Data Analysis & Reporting**
|
|
747
1059
|
```
|
|
748
|
-
|
|
749
|
-
|
|
1060
|
+
User: "Analyze sales.xlsx and create a summary"
|
|
1061
|
+
→ Agent loads xlsx skill
|
|
1062
|
+
→ Runs Python script to read Excel
|
|
1063
|
+
→ Processes data with pandas
|
|
1064
|
+
→ Generates PDF with charts
|
|
1065
|
+
→ Returns attachments array
|
|
750
1066
|
```
|
|
751
1067
|
|
|
752
1068
|
---
|
|
@@ -560,7 +560,7 @@
|
|
|
560
560
|
"properties": {
|
|
561
561
|
"skill_name": {
|
|
562
562
|
"type": "string",
|
|
563
|
-
"description": "
|
|
563
|
+
"description": "Exact skill name from the <available_skills> list in the system prompt (e.g. git-commit, git-pr, pdf). Do not invent names — use only names listed there."
|
|
564
564
|
}
|
|
565
565
|
},
|
|
566
566
|
"required": [
|
package/dist/main.js
CHANGED
|
@@ -4305,10 +4305,19 @@ var SkillLoader = class _SkillLoader {
|
|
|
4305
4305
|
if (process.env.JEST_WORKER_ID !== void 0 || process.env.NODE_ENV === "test") {
|
|
4306
4306
|
return path14.join(process.cwd(), "dist", "config", "skills");
|
|
4307
4307
|
}
|
|
4308
|
-
const candidates = [
|
|
4308
|
+
const candidates = [];
|
|
4309
|
+
const argv1 = process.argv[1];
|
|
4310
|
+
if (argv1 && !argv1.startsWith("-")) {
|
|
4311
|
+
try {
|
|
4312
|
+
const scriptDir = path14.dirname(path14.resolve(argv1));
|
|
4313
|
+
candidates.push(path14.join(scriptDir, "config", "skills"));
|
|
4314
|
+
} catch {
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
candidates.push(
|
|
4309
4318
|
path14.join(process.cwd(), "dist", "config", "skills"),
|
|
4310
4319
|
path14.join(process.cwd(), "node_modules", "@nomad-e", "bluma-cli", "dist", "config", "skills")
|
|
4311
|
-
|
|
4320
|
+
);
|
|
4312
4321
|
if (typeof __dirname !== "undefined") {
|
|
4313
4322
|
candidates.push(
|
|
4314
4323
|
path14.join(__dirname, "config", "skills"),
|
|
@@ -4695,6 +4704,10 @@ var SYSTEM_PROMPT = `
|
|
|
4695
4704
|
- NEVER try to \`load_skill\` with a name that isn't in \`<available_skills>\`
|
|
4696
4705
|
- Your base knowledge (testing, git, docker...) is NOT a skill - it's just knowledge you have
|
|
4697
4706
|
|
|
4707
|
+
**Git / commits (when \`git-commit\` is listed in \`<available_skills>\`):**
|
|
4708
|
+
- For "commit", "push", "commit message", or "conventional commit": call \`load_skill({ skill_name: "git-commit" })\` **before** \`git commit\`, then follow the skill body (scopes, types, optional validator script).
|
|
4709
|
+
- The bundled skill name is exactly \`git-commit\`. Do **not** use \`git-conventional\` or other invented names.
|
|
4710
|
+
|
|
4698
4711
|
**Progressive Disclosure (Skills with references and scripts):**
|
|
4699
4712
|
|
|
4700
4713
|
Skills may include additional assets beyond the SKILL.md body:
|
|
@@ -5218,7 +5231,7 @@ tools:
|
|
|
5218
5231
|
|
|
5219
5232
|
2. READ FRONTMATTER FIRST
|
|
5220
5233
|
- name: npm-publish
|
|
5221
|
-
- depends_on: [git-
|
|
5234
|
+
- depends_on: [git-commit]
|
|
5222
5235
|
- tools.required: [shell_command, command_status]
|
|
5223
5236
|
- tools.recommended: [read_file_lines, message]
|
|
5224
5237
|
|
|
@@ -5255,17 +5268,17 @@ User: "Publish the package"
|
|
|
5255
5268
|
2. load_skill({ skill_name: "npm-publish" })
|
|
5256
5269
|
|
|
5257
5270
|
3. Read frontmatter:
|
|
5258
|
-
- depends_on: [git-
|
|
5271
|
+
- depends_on: [git-commit]
|
|
5259
5272
|
- tools.required: [shell_command, command_status]
|
|
5260
5273
|
|
|
5261
5274
|
4. Read body -> Workflow says:
|
|
5262
|
-
"Step 1: If uncommitted changes, delegate to git-
|
|
5275
|
+
"Step 1: If uncommitted changes, delegate to git-commit"
|
|
5263
5276
|
|
|
5264
5277
|
5. Check git status with shell_command (required tool)
|
|
5265
5278
|
Found changes
|
|
5266
5279
|
|
|
5267
|
-
6. Delegate: load_skill({ skill_name: "git-
|
|
5268
|
-
- Read git-
|
|
5280
|
+
6. Delegate: load_skill({ skill_name: "git-commit" })
|
|
5281
|
+
- Read git-commit frontmatter
|
|
5269
5282
|
- Follow its workflow for commit
|
|
5270
5283
|
- Commit done
|
|
5271
5284
|
|
|
@@ -6020,29 +6033,38 @@ var BluMaAgent = class {
|
|
|
6020
6033
|
history: this.history,
|
|
6021
6034
|
skillLoader: this.skillLoader
|
|
6022
6035
|
});
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
});
|
|
6040
|
-
}
|
|
6036
|
+
const dirs = this.skillLoader.getSkillsDirs();
|
|
6037
|
+
this.eventBus.emit("backend_message", {
|
|
6038
|
+
type: "info",
|
|
6039
|
+
message: `Skills dirs \u2014 bundled: ${dirs.bundled} | project: ${dirs.project} | global: ${dirs.global}`
|
|
6040
|
+
});
|
|
6041
|
+
const availableSkills = this.skillLoader.listAvailable();
|
|
6042
|
+
this.eventBus.emit("backend_message", {
|
|
6043
|
+
type: "info",
|
|
6044
|
+
message: `Skills loaded: ${availableSkills.length} \u2014 ${availableSkills.map((s) => `${s.name} (${s.source})`).join(", ") || "none"}`
|
|
6045
|
+
});
|
|
6046
|
+
if (this.skillLoader.hasConflicts()) {
|
|
6047
|
+
for (const warning of this.skillLoader.formatConflictWarnings()) {
|
|
6048
|
+
this.eventBus.emit("backend_message", {
|
|
6049
|
+
type: "warning",
|
|
6050
|
+
message: warning
|
|
6051
|
+
});
|
|
6041
6052
|
}
|
|
6042
|
-
|
|
6053
|
+
}
|
|
6054
|
+
const systemPrompt = getUnifiedSystemPrompt(availableSkills);
|
|
6055
|
+
if (this.history.length === 0) {
|
|
6043
6056
|
this.history.push({ role: "system", content: systemPrompt });
|
|
6044
|
-
|
|
6057
|
+
} else {
|
|
6058
|
+
const sysIdx = this.history.findIndex(
|
|
6059
|
+
(m) => m.role === "system" && typeof m.content === "string" && String(m.content).includes("<identity>")
|
|
6060
|
+
);
|
|
6061
|
+
if (sysIdx >= 0) {
|
|
6062
|
+
this.history[sysIdx] = { ...this.history[sysIdx], content: systemPrompt };
|
|
6063
|
+
} else {
|
|
6064
|
+
this.history.unshift({ role: "system", content: systemPrompt });
|
|
6065
|
+
}
|
|
6045
6066
|
}
|
|
6067
|
+
this.persistSession();
|
|
6046
6068
|
}
|
|
6047
6069
|
getAvailableTools() {
|
|
6048
6070
|
return this.mcpClient.getAvailableTools();
|