@kirosnn/mosaic 0.0.7 → 0.0.9

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kirosnn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Mosaic CLI
6
6
 
7
- **Version 0.0.6.03**
7
+ **Version 0.0.8**
8
8
 
9
9
  Mosaic is an open-source, AI-powered coding agent for the terminal. It combines a React-based TUI (OpenTUI) with a tool-driven agent architecture to deliver a fast, context-aware development workflow. A web UI is also available for those who prefer a browser experience.
10
10
 
package/bin/mosaic.cjs ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn, spawnSync } = require('child_process');
4
+ const path = require('path');
5
+
6
+ function isBunInstalled() {
7
+ try {
8
+ const result = spawnSync('bun', ['--version'], {
9
+ stdio: 'pipe',
10
+ shell: process.platform === 'win32'
11
+ });
12
+ return result.status === 0;
13
+ } catch {
14
+ return false;
15
+ }
16
+ }
17
+
18
+ function main() {
19
+ if (!isBunInstalled()) {
20
+ console.error('\x1b[31mError: Bun runtime is required to run Mosaic.\x1b[0m');
21
+ console.error('');
22
+ console.error('Please install Bun first:');
23
+ console.error('');
24
+ if (process.platform === 'win32') {
25
+ console.error(' \x1b[36mpowershell -c "irm bun.sh/install.ps1 | iex"\x1b[0m');
26
+ } else {
27
+ console.error(' \x1b[36mcurl -fsSL https://bun.sh/install | bash\x1b[0m');
28
+ }
29
+ console.error('');
30
+ console.error('For more information, visit: https://bun.sh');
31
+ process.exit(1);
32
+ }
33
+
34
+ const entryPoint = path.join(__dirname, '..', 'src', 'index.tsx');
35
+ const args = process.argv.slice(2);
36
+
37
+ const child = spawn('bun', ['run', entryPoint, ...args], {
38
+ stdio: 'inherit',
39
+ shell: process.platform === 'win32'
40
+ });
41
+
42
+ child.on('error', (error) => {
43
+ console.error(`Failed to start Mosaic: ${error.message}`);
44
+ process.exit(1);
45
+ });
46
+
47
+ child.on('exit', (code) => {
48
+ process.exit(code || 0);
49
+ });
50
+ }
51
+
52
+ main();
package/package.json CHANGED
@@ -1,42 +1,48 @@
1
- {
2
- "name": "@kirosnn/mosaic",
3
- "module": "src/index.tsx",
4
- "version": "0.0.7",
5
- "description": "The open source coding agent.",
6
- "type": "module",
7
- "bin": {
8
- "mosaic": "src/index.tsx"
9
- },
10
- "scripts": {
11
- "dev": "bun run --watch src/index.tsx",
12
- "mosaic": "bun run src/index.tsx",
13
- "start": "bun run src/index.tsx"
14
- },
15
- "devDependencies": {
16
- "@types/bun": "latest",
17
- "@types/react": "^19.0.0",
18
- "@types/react-dom": "^19.2.3"
19
- },
20
- "peerDependencies": {
21
- "typescript": "^5"
22
- },
23
- "dependencies": {
24
- "@ai-sdk/anthropic": "^1.0.0",
25
- "@ai-sdk/google": "^1.0.0",
26
- "@ai-sdk/mistral": "^1.0.0",
27
- "@ai-sdk/openai": "^1.0.0",
28
- "@ai-sdk/xai": "^1.0.0",
29
- "@opentui/core": "^0.1.69",
30
- "@opentui/react": "^0.1.69",
31
- "@types/react-syntax-highlighter": "^15.5.13",
32
- "ai": "^4.0.0",
33
- "better-sqlite3": "^12.6.0",
34
- "ollama": "^0.5.0",
35
- "react": "^19.2.3",
36
- "react-dom": "^19.2.3",
37
- "react-markdown": "^10.1.0",
38
- "react-syntax-highlighter": "^16.1.0",
39
- "remark-gfm": "^4.0.1",
40
- "zod": "^3.23.8"
41
- }
1
+ {
2
+ "name": "@kirosnn/mosaic",
3
+ "version": "0.0.9",
4
+ "description": "The open source coding agent.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "mosaic": "bin/mosaic.cjs"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "src",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "dev": "bun run --watch src/index.tsx",
18
+ "mosaic": "bun run src/index.tsx",
19
+ "start": "bun run src/index.tsx"
20
+ },
21
+ "engines": {
22
+ "node": ">=18.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/bun": "latest",
26
+ "@types/react": "^19.0.0",
27
+ "@types/react-dom": "^19.2.3"
28
+ },
29
+ "dependencies": {
30
+ "@ai-sdk/anthropic": "^1.0.0",
31
+ "@ai-sdk/google": "^1.0.0",
32
+ "@ai-sdk/mistral": "^1.0.0",
33
+ "@ai-sdk/openai": "^1.0.0",
34
+ "@ai-sdk/xai": "^1.0.0",
35
+ "@opentui/core": "^0.1.69",
36
+ "@opentui/react": "^0.1.69",
37
+ "@types/react-syntax-highlighter": "^15.5.13",
38
+ "ai": "^4.0.0",
39
+ "better-sqlite3": "^12.6.0",
40
+ "ollama": "^0.5.0",
41
+ "react": "^19.2.3",
42
+ "react-dom": "^19.2.3",
43
+ "react-markdown": "^10.1.0",
44
+ "react-syntax-highlighter": "^16.1.0",
45
+ "remark-gfm": "^4.0.1",
46
+ "zod": "^3.23.8"
47
+ }
42
48
  }
package/src/index.tsx CHANGED
File without changes
@@ -11,10 +11,10 @@ import '../assets/css/global.css'
11
11
  function BlendIcon() {
12
12
  return (
13
13
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" className="blend-icon">
14
- <circle cx="12" cy="6.5" r="1.4"/>
15
- <circle cx="17.5" cy="12" r="1.4"/>
16
- <circle cx="12" cy="17.5" r="1.4"/>
17
- <circle cx="6.5" cy="12" r="1.4"/>
14
+ <circle cx="12" cy="6.5" r="1.4" />
15
+ <circle cx="17.5" cy="12" r="1.4" />
16
+ <circle cx="12" cy="17.5" r="1.4" />
17
+ <circle cx="6.5" cy="12" r="1.4" />
18
18
  </svg>
19
19
  );
20
20
  }
@@ -132,12 +132,13 @@ export function MessageItem({ message }: MessageItemProps) {
132
132
  components={{
133
133
  code({ node, className, children, ...props }) {
134
134
  const match = /language-(\w+)/.exec(className || '');
135
+ const { ref, ...rest } = props as any;
135
136
  return match ? (
136
137
  <SyntaxHighlighter
137
- style={vscDarkPlus}
138
+ style={vscDarkPlus as any}
138
139
  language={match[1]}
139
140
  PreTag="div"
140
- {...props}
141
+ {...rest}
141
142
  >
142
143
  {String(children).replace(/\n$/, '')}
143
144
  </SyntaxHighlighter>
File without changes
package/MOSAIC.md DELETED
@@ -1,188 +0,0 @@
1
- # MOSAIC.md - Mosaic CLI Context File
2
-
3
- This file provides contextual information about the Mosaic CLI project to help AI agents understand the codebase structure, patterns, and conventions.
4
-
5
- ## Project Overview
6
-
7
- **Mosaic CLI** is an open-source AI-powered coding agent built with Bun and React. It provides a terminal-based interface using OpenTUI to render React components directly in the terminal, offering seamless interaction with AI coding assistants.
8
-
9
- **Key Features:**
10
- - Multi-provider AI support (OpenAI, Anthropic, Google, Mistral, XAI, Ollama)
11
- - Terminal-first UI with React components rendered via OpenTUI
12
- - Web interface option on http://127.0.0.1:8192
13
- - Built-in tools for file operations, code search, and terminal commands
14
- - Slash commands for quick operations
15
- - Workspace context via MOSAIC.md files
16
-
17
- ## Architecture
18
-
19
- ### Core Architecture Patterns
20
-
21
- 1. **Modular Design**: The codebase is organized into clear modules:
22
- - `src/agent/` - AI agent core logic and tools
23
- - `src/components/` - React UI components
24
- - `src/utils/` - Utility functions and helpers
25
- - `src/web/` - Web interface components
26
-
27
- 2. **Tool-Based System**: The AI agent uses a tool-based approach where each capability is implemented as a separate tool (read, write, edit, bash, grep, etc.)
28
-
29
- 3. **Provider Abstraction**: AI providers are abstracted behind a common interface, allowing easy switching between different AI models
30
-
31
- 4. **Event-Driven UI**: The terminal interface uses React with OpenTUI for rendering, creating a responsive terminal experience
32
-
33
- ### Key Design Decisions
34
-
35
- - **Bun Runtime**: Uses Bun for fast execution and modern JavaScript features
36
- - **TypeScript**: Entire codebase is written in TypeScript for type safety
37
- - **Functional Components**: React components use functional style with hooks
38
- - **Tool Registry**: Tools are registered and managed through a central registry system
39
- - **Context Management**: MOSAIC.md files provide project-specific context to AI agents
40
-
41
- ## Development Guidelines
42
-
43
- ### Coding Standards
44
-
45
- - **TypeScript**: All code must be TypeScript with strict type checking
46
- - **React Functional Components**: Use functional components with hooks
47
- - **File Organization**: Group related files in subdirectories (e.g., agent tools, web components)
48
- - **Error Handling**: Comprehensive error handling with user-friendly messages
49
- - **Async/Await**: Use async/await for asynchronous operations
50
-
51
- ### Naming Conventions
52
-
53
- - **Files**: PascalCase for components (App.tsx), camelCase for utilities (config.ts)
54
- - **Variables**: camelCase for variables and functions
55
- - **Constants**: UPPER_CASE for constants
56
- - **Types/Interfaces**: PascalCase for type names
57
- - **Components**: PascalCase component names (e.g., `<App />`)
58
-
59
- ### Best Practices
60
-
61
- - **Tool Development**: New tools should follow the existing pattern in `src/agent/tools/`
62
- - **Provider Integration**: New AI providers should implement the standard interface
63
- - **Error Filtering**: Filter out common React/terminal errors in stderr/stdout
64
- - **Configuration**: Use the config system for persistent settings
65
- - **Undo/Redo**: Implement undo/redo functionality for file operations
66
-
67
- ## Key Files & Directories
68
-
69
- ### Root Files
70
-
71
- - `package.json` - Project configuration and dependencies
72
- - `tsconfig.json` - TypeScript configuration
73
- - `README.md` - User documentation
74
- - `MOSAIC.md` - This context file for AI agents
75
-
76
- ### Source Structure
77
-
78
- #### `src/`
79
- - **index.tsx** - Main entry point and CLI parser
80
- - **components/` - React UI components for terminal interface
81
- - **agent/` - AI agent core functionality
82
- - **utils/` - Utility functions and helpers
83
- - **web/` - Web interface components and server
84
-
85
- #### `src/agent/`
86
- - **Agent.ts** - Main agent class
87
- - **context.ts** - Context management
88
- - **types.ts** - Type definitions
89
- - **prompts/` - Prompt templates
90
- - **provider/` - AI provider implementations
91
- - **tools/` - Tool implementations (file operations, bash, etc.)
92
-
93
- #### `src/components/`
94
- - **App.tsx** - Main application component
95
- - **Main.tsx** - Main UI container
96
- - **CustomInput.tsx** - Custom input component
97
- - **main/` - Main page components (ChatPage, HomePage, etc.)
98
-
99
- #### `src/utils/`
100
- - **config.ts** - Configuration management
101
- - **history.ts** - Chat history
102
- - **undoRedo.ts** - Undo/redo functionality
103
- - **commands/` - Slash command implementations
104
-
105
- #### `src/web/`
106
- - **app.tsx** - Web application entry point
107
- - **server.tsx** - Web server implementation
108
- - **components/` - Web UI components
109
- - **assets/` - Static assets (CSS, fonts, images)
110
-
111
- ## Common Tasks
112
-
113
- ### Adding a New Tool
114
-
115
- 1. Create a new file in `src/agent/tools/` following the existing pattern
116
- 2. Implement the tool function with proper TypeScript types
117
- 3. Register the tool in the tool registry
118
- 4. Add appropriate error handling and validation
119
-
120
- ### Adding a New AI Provider
121
-
122
- 1. Create a new provider file in `src/agent/provider/`
123
- 2. Implement the standard provider interface
124
- 3. Add provider-specific configuration options
125
- 4. Update the provider selection logic
126
-
127
- ### Creating a New Slash Command
128
-
129
- 1. Create a new command file in `src/utils/commands/`
130
- 2. Implement the command handler function
131
- 3. Register the command in the command registry
132
- 4. Add command documentation
133
-
134
- ### Building the Web Interface
135
-
136
- 1. Develop components in `src/web/components/`
137
- 2. Add styles in `src/web/assets/css/`
138
- 3. Update the web app entry point in `src/web/app.tsx`
139
- 4. Ensure the server handles new routes in `src/web/server.tsx`
140
-
141
- ### Running the Project
142
-
143
- ```bash
144
- # Development mode with auto-reload
145
- bun run dev
146
-
147
- # Production mode
148
- bun run start
149
-
150
- # Web interface
151
- mosaic web
152
- ```
153
-
154
- ### Testing Tools
155
-
156
- The project includes various tools that can be tested:
157
- - File operations (read, write, edit)
158
- - Directory listing and filtering
159
- - Code search with grep
160
- - Terminal command execution
161
- - User interaction via questions
162
-
163
- ## Technical Stack
164
-
165
- - **Runtime**: Bun
166
- - **Language**: TypeScript
167
- - **UI Framework**: React with OpenTUI
168
- - **AI Integration**: Vercel AI SDK
169
- - **Database**: Better SQLite 3
170
- - **Build System**: Bun
171
-
172
- ## AI Provider Support
173
-
174
- Mosaic supports multiple AI providers:
175
- - OpenAI (GPT models)
176
- - Anthropic (Claude models)
177
- - Google (Gemini models)
178
- - Mistral (Mistral/Mixtral models)
179
- - XAI (Grok models)
180
- - Ollama (local/cloud models)
181
-
182
- ## Important Notes
183
-
184
- - The project uses a custom error filtering system to suppress common React/terminal errors
185
- - Configuration is stored in `~/.mosaic/` directory
186
- - MOSAIC.md files are automatically created/updated in project directories
187
- - The system includes comprehensive undo/redo functionality for file operations
188
- - Web interface runs on port 8192 by default
package/docs/mosaic.png DELETED
Binary file
package/tsconfig.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": [
4
- "ESNext",
5
- "DOM",
6
- "DOM.Iterable"
7
- ],
8
- "target": "ESNext",
9
- "module": "Preserve",
10
- "moduleResolution": "bundler",
11
- "jsx": "react-jsx",
12
- "jsxImportSource": "@opentui/react",
13
- "allowImportingTsExtensions": true,
14
- "moduleDetection": "force",
15
- "noEmit": true,
16
- "strict": true,
17
- "skipLibCheck": true,
18
- "noUncheckedIndexedAccess": true,
19
- "noImplicitOverride": true,
20
- "allowSyntheticDefaultImports": true,
21
- "esModuleInterop": true,
22
- "resolveJsonModule": true,
23
- "types": [
24
- "bun"
25
- ]
26
- },
27
- "include": [
28
- "src/**/*"
29
- ],
30
- "exclude": [
31
- "node_modules"
32
- ]
33
- }