maiass 5.7.31
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 +26 -0
- package/README.md +347 -0
- package/build.js +127 -0
- package/lib/account-info.js +476 -0
- package/lib/colors.js +49 -0
- package/lib/commit.js +885 -0
- package/lib/config-command.js +310 -0
- package/lib/config-manager.js +344 -0
- package/lib/config.js +150 -0
- package/lib/devlog.js +182 -0
- package/lib/env-display.js +162 -0
- package/lib/git-info.js +509 -0
- package/lib/header.js +152 -0
- package/lib/input-utils.js +116 -0
- package/lib/logger.js +285 -0
- package/lib/machine-fingerprint.js +229 -0
- package/lib/maiass-command.js +79 -0
- package/lib/maiass-pipeline.js +1204 -0
- package/lib/maiass-variables.js +152 -0
- package/lib/secure-storage.js +256 -0
- package/lib/symbols.js +200 -0
- package/lib/token-validator.js +184 -0
- package/lib/version-command.js +256 -0
- package/lib/version-manager.js +902 -0
- package/maiass-standalone.cjs +148 -0
- package/maiass.cjs +34 -0
- package/maiass.mjs +167 -0
- package/package.json +45 -0
- package/setup-env.js +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2025 Velvary Pty Ltd
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
MAIASS (Modular AI-Augmented Semantic Scribe)
|
|
21
|
+
A Git workflow automation tool with AI-powered commit messages.
|
|
22
|
+
|
|
23
|
+
For the full GPL-3.0 license text, visit:
|
|
24
|
+
https://www.gnu.org/licenses/gpl-3.0.html
|
|
25
|
+
|
|
26
|
+
Contact: https://github.com/vsmash/nodemaiass
|
package/README.md
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
# š« MAIASS (Node.js Edition)
|
|
2
|
+
**Modular AI-Augmented Semantic Scribe** - Cross-platform Node.js implementation
|
|
3
|
+
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](package.json)---
|
|
7
|
+
|
|
8
|
+
**MAIASS** is an intelligent Git workflow automation tool that streamlines version management, changelog generation, and deployment processes with AI-powered commit message suggestions. This Node.js implementation provides cross-platform compatibility and self-contained binary distribution.
|
|
9
|
+
|
|
10
|
+
## š Quick Start
|
|
11
|
+
|
|
12
|
+
### Installation
|
|
13
|
+
|
|
14
|
+
**Cross-Platform Binaries** (Recommended):
|
|
15
|
+
```bash
|
|
16
|
+
# Download and install for your platform
|
|
17
|
+
curl -L https://github.com/vsmash/maiass/releases/latest/download/maiass-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m) -o maiass
|
|
18
|
+
chmod +x maiass
|
|
19
|
+
./maiass --version
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**From Source**:
|
|
23
|
+
```bash
|
|
24
|
+
git clone https://github.com/vsmash/nodemaiass.git
|
|
25
|
+
cd nodemaiass && npm install && npm link
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Basic Usage
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Complete workflow with patch version bump
|
|
32
|
+
maiass
|
|
33
|
+
|
|
34
|
+
# Specific version bumps
|
|
35
|
+
maiass minor # 1.2.3 ā 1.3.0
|
|
36
|
+
maiass major # 1.2.3 ā 2.0.0
|
|
37
|
+
maiass 2.1.0 # Set specific version
|
|
38
|
+
|
|
39
|
+
# Commit only (skip version management)
|
|
40
|
+
maiass --commits-only
|
|
41
|
+
|
|
42
|
+
# Preview changes without applying
|
|
43
|
+
maiass --dry-run
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### AI-Powered Commit Messages
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Enable AI features
|
|
50
|
+
maiass config set maiass_token "your_api_key"
|
|
51
|
+
maiass config set ai_mode "ask"
|
|
52
|
+
|
|
53
|
+
# MAIASS will now suggest intelligent commit messages
|
|
54
|
+
maiass
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## ⨠Key Features- **š¤ AI-Powered Commit Messages**: AI integration for intelligent commit suggestions- **š Dual Changelog System**: User-facing and developer-facing changelogs- **š Complete Git Workflow**: Branch validation, commits, merges, and versioning- **š·ļø Smart Version Management**: Multiple version file support with semantic versioning- **š Cross-Platform**: Self-contained binaries for macOS, Linux, and Windows- **āļø Zero Configuration**: Works out of the box with sensible defaults- **šÆ JIRA Integration**: Automatic ticket detection from branch names
|
|
58
|
+
|
|
59
|
+
## ļæ½ Documentation
|
|
60
|
+
|
|
61
|
+
| Topic | Description |
|
|
62
|
+
|-------|-------------|
|
|
63
|
+
| **[Installation Guide](docs/installation-guide.md)** | Detailed installation instructions and binaries |
|
|
64
|
+
| **[Configuration](docs/configuration.md)** | Environment variables and project setup |
|
|
65
|
+
| **[Workflow Guide](docs/workflow.md)** | Complete workflow documentation |
|
|
66
|
+
| **[Commands Reference](docs/commands.md)** | All available commands and options |
|
|
67
|
+
| **[Cross-Platform Guide](docs/cross-platform.md)** | Platform-specific notes and compatibility |
|
|
68
|
+
| **[Development](docs/development.md)** | Contributing and development setup |
|
|
69
|
+
|
|
70
|
+
## š§ Supported Technologies
|
|
71
|
+
|
|
72
|
+
### Version File Formats- **package.json** (Node.js/npm projects)- **composer.json** (PHP/Composer projects)- **VERSION** files (plain text)- **Git tags only** (for projects without version files)
|
|
73
|
+
|
|
74
|
+
### Git Platforms- **GitHub** (public and private repositories)- **Bitbucket** (Cloud and Server)- **Any Git host** (core features work universally)
|
|
75
|
+
|
|
76
|
+
### AI Models- **GPT-4o** (recommended for complex projects)- **GPT-4** (balanced performance and cost)- **GPT-3.5-turbo** (fast and economical)
|
|
77
|
+
|
|
78
|
+
## š Platform Support
|
|
79
|
+
|
|
80
|
+
| Platform | Binary Available | Self-Contained |
|
|
81
|
+
|----------|------------------|----------------|
|
|
82
|
+
| **macOS Intel** | ā
`maiass-macos-intel` | ā
Node.js included |
|
|
83
|
+
| **macOS Apple Silicon** | ā
`maiass-macos-arm64` | ā
Node.js included |
|
|
84
|
+
| **Linux x64** | ā
`maiass-linux-x64` | ā
Node.js included |
|
|
85
|
+
| **Linux ARM64** | ā
`maiass-linux-arm64` | ā
Node.js included |
|
|
86
|
+
| **Windows x64** | ā
`maiass-windows-x64.exe` | ā
Node.js included |
|
|
87
|
+
| **Windows ARM64** | ā
`maiass-windows-arm64.exe` | ā
Node.js included |
|
|
88
|
+
|
|
89
|
+
## š Workflow Overview
|
|
90
|
+
|
|
91
|
+
MAIASS orchestrates a 4-phase intelligent workflow:
|
|
92
|
+
|
|
93
|
+
1. **Branch Detection & Validation** - Validates current branch and workflow requirements
|
|
94
|
+
2. **Commit Workflow** - AI-powered commit messages with JIRA integration
|
|
95
|
+
3. **Merge Management** - Handles branch merging and conflict resolution
|
|
96
|
+
4. **Version & Changelog** - Semantic versioning with dual changelog generation
|
|
97
|
+
|
|
98
|
+
## āļø Quick Configuration
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Enable AI features (global)
|
|
102
|
+
maiass config set --global maiass_token "your_api_key"
|
|
103
|
+
maiass config set --global ai_mode "ask"
|
|
104
|
+
|
|
105
|
+
# Project-specific branch override
|
|
106
|
+
maiass config set mainbranch "main"
|
|
107
|
+
|
|
108
|
+
# View current configuration
|
|
109
|
+
maiass config list
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## šÆ What Makes This Special?
|
|
113
|
+
|
|
114
|
+
### Intelligent Automation- **Smart Version Detection**: Automatically finds and updates version files- **Context-Aware AI**: Analyzes code changes for meaningful commit messages- **Dual Changelog System**: Clean user-facing + detailed developer changelogs
|
|
115
|
+
|
|
116
|
+
### Developer Experience- **Self-Contained Binaries**: No Node.js installation required- **Cross-Platform Compatibility**: Consistent behavior across all platforms- **Zero Configuration**: Works immediately with sensible defaults
|
|
117
|
+
|
|
118
|
+
### Enterprise Ready- **Security First**: API keys never stored in repositories- **CI/CD Integration**: Perfect for automated deployment pipelines- **GPL-3.0 Licensed**: Free and open source software
|
|
119
|
+
|
|
120
|
+
## š Related Projects- **[MAIASS (Bash)](https://github.com/vsmash/maiass)** - Original bash implementation- **[Homebrew Formula](https://github.com/vsmash/homebrew-maiass)** - Homebrew installation
|
|
121
|
+
|
|
122
|
+
## š¤ Contributing
|
|
123
|
+
|
|
124
|
+
We welcome contributions! Whether it's:- š **Bug reports** and feature requests- š **Documentation** improvements- š§ **Code contributions** and enhancements- š” **Ideas** for new features
|
|
125
|
+
|
|
126
|
+
See our [Development Guide](docs/development.md) to get started.
|
|
127
|
+
|
|
128
|
+
## š License
|
|
129
|
+
|
|
130
|
+
MAIASS is released under the [GNU General Public License v3.0](LICENSE). Free and open source software.
|
|
131
|
+
|
|
132
|
+
## š Links- **[GitHub Repository](https://github.com/vsmash/nodemaiass)**- **[Issue Tracker](https://github.com/vsmash/nodemaiass/issues)**- **[Releases](https://github.com/vsmash/nodemaiass/releases)**- **[Original MAIASS](https://github.com/vsmash/maiass)**---
|
|
133
|
+
|
|
134
|
+
**Ready to streamline your Git workflow?** Download MAIASS today and experience intelligent version management with AI-powered automation.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Get the latest release
|
|
138
|
+
curl -L https://github.com/vsmash/maiass/releases/latest/download/maiass-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m) -o maiass && chmod +x maiass
|
|
139
|
+
```---
|
|
140
|
+
|
|
141
|
+
**Made with ā¤ļø for developers who want better Git workflows**
|
|
142
|
+
maiass version [major|minor|patch|version]
|
|
143
|
+
|
|
144
|
+
# Configuration
|
|
145
|
+
maiass config list
|
|
146
|
+
maiass config get <key>
|
|
147
|
+
maiass config set <key> <value>
|
|
148
|
+
|
|
149
|
+
# Environment info
|
|
150
|
+
maiass env
|
|
151
|
+
|
|
152
|
+
# Git information
|
|
153
|
+
maiass git-info
|
|
154
|
+
maiass git # Show git status and branch info
|
|
155
|
+
|
|
156
|
+
# Environment variables
|
|
157
|
+
maiass env # Show current environment
|
|
158
|
+
maiass env --json # Show environment as JSON
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## āļø Configuration
|
|
162
|
+
|
|
163
|
+
### Quick Setup
|
|
164
|
+
|
|
165
|
+
1. **Enable AI features** (optional):
|
|
166
|
+
```bash
|
|
167
|
+
# Set Maiass API key globally
|
|
168
|
+
maiass config --global maiass_token=your_api_key_here
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
2. **Project-specific settings** (if needed):
|
|
172
|
+
```bash
|
|
173
|
+
# Override branch names for projects using 'main'
|
|
174
|
+
maiass config --project mainbranch=main
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Configuration Files
|
|
178
|
+
|
|
179
|
+
MAIASS uses `.env.maiass` files for configuration:- **Global**: `~/.env.maiass` (user-wide settings)- **Project**: `./.env.maiass` (project-specific overrides)
|
|
180
|
+
|
|
181
|
+
### Common Configuration Variables
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# AI Integration
|
|
185
|
+
MAIASS_AI_TOKEN=your_api_key_here
|
|
186
|
+
MAIASS_AI_MODE=ask # ask, autosuggest, off
|
|
187
|
+
MAIASS_AI_MODEL=gpt-4 # AI model to use
|
|
188
|
+
|
|
189
|
+
# Branch Configuration (only set if different from defaults)
|
|
190
|
+
MAIASS_MAINBRANCH=main # Default: main
|
|
191
|
+
MAIASS_DEVELOPBRANCH=develop # Default: develop
|
|
192
|
+
MAIASS_STAGINGBRANCH=staging # Default: staging
|
|
193
|
+
|
|
194
|
+
# Workflow Settings
|
|
195
|
+
MAIASS_DEBUG=true # Enable debug output
|
|
196
|
+
MAIASS_VERBOSITY=normal # brief, normal, verbose
|
|
197
|
+
MAIASS_AUTO_TAG_RELEASES=true # Automatically tag releases (required for changelog)
|
|
198
|
+
|
|
199
|
+
# Changelog Configuration
|
|
200
|
+
MAIASS_CHANGELOG_PATH=CHANGELOG.md # Main changelog file path
|
|
201
|
+
MAIASS_CHANGELOG_NAME=CHANGELOG.md # Main changelog file name
|
|
202
|
+
MAIASS_CHANGELOG_INTERNAL_NAME.CHANGELOG_internal.md # Internal changelog file name
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## š Workflow Phases
|
|
206
|
+
|
|
207
|
+
MAIASS orchestrates a 4-phase workflow:
|
|
208
|
+
|
|
209
|
+
### 1. **Branch Detection & Validation**- Detects current branch and validates against workflow requirements- Auto-switches from main/staging to develop branch- Prompts for confirmation on release/main branches- Handles missing develop branch gracefully
|
|
210
|
+
|
|
211
|
+
### 2. **Commit Workflow**- Detects staged and unstaged changes- Offers AI-powered commit message suggestions- Supports multi-line commit messages- Prepends JIRA ticket numbers from branch names
|
|
212
|
+
|
|
213
|
+
### 3. **Merge to Develop**- Merges feature branches to develop for version management- Pulls latest changes from remote- Handles merge conflicts with clear error messages
|
|
214
|
+
|
|
215
|
+
### 4. **Version Management**- Detects version files (package.json, composer.json, etc.)- Bumps semantic versions (major.minor.patch)- Updates multiple version files simultaneously- Creates git tags for releases- **Generates dual changelogs**:
|
|
216
|
+
- `CHANGELOG.md`: Clean, user-facing format with JIRA tickets stripped
|
|
217
|
+
- `.CHANGELOG_internal.md`: Developer format with commit hashes, authors, and JIRA tickets- **Smart commit range detection**: Only includes commits since the last release tag- **Version replacement logic**: Replaces same-day patch versions instead of duplicating entries
|
|
218
|
+
|
|
219
|
+
## š Changelog System
|
|
220
|
+
|
|
221
|
+
MAIASS automatically generates two types of changelogs during version management:
|
|
222
|
+
|
|
223
|
+
### Main Changelog (`CHANGELOG.md`)
|
|
224
|
+
**User-facing format** with clean, readable entries:
|
|
225
|
+
```markdown
|
|
226
|
+
## 0.5.6
|
|
227
|
+
24 July 2025- Update Maiass Pipeline functionality
|
|
228
|
+
- feat: imported path package in maiass-pipeline
|
|
229
|
+
- docs: added comment about commit message formatting- Updated commit message filtering for maiass-pipeline
|
|
230
|
+
- feat: added code to clean up commit messages
|
|
231
|
+
- fix: removed empty lines and trailing newlines from each commit
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Internal Changelog (`CHANGELOG_internal.md`)
|
|
235
|
+
**Developer-facing format** with commit hashes, authors, and JIRA tickets:
|
|
236
|
+
```markdown
|
|
237
|
+
## 0.5.6
|
|
238
|
+
Thursday, 24 July 2025- d7ddba9 VEL-405 Update Maiass Pipeline functionality (Developer Name)- 5ea6d03 VEL-405 Updated commit message filtering for maiass-pipeline (Developer Name)
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Changelog Features- **Smart commit detection**: Only includes commits since the last release tag- **Automatic filtering**: Excludes merge commits, version bumps, and irrelevant entries- **JIRA integration**: Strips JIRA tickets from main changelog, preserves in internal- **Version replacement**: Same-day patch versions replace previous entries instead of duplicating- **Clean formatting**: No double bullets or unwanted blank lines
|
|
242
|
+
|
|
243
|
+
## šØ Examples
|
|
244
|
+
|
|
245
|
+
### Complete Feature Development Workflow
|
|
246
|
+
```bash
|
|
247
|
+
# On feature branch: feature/USER-123-new-login
|
|
248
|
+
|
|
249
|
+
# 1. Complete workflow with minor version bump
|
|
250
|
+
maiass minor --tag
|
|
251
|
+
|
|
252
|
+
# This will:
|
|
253
|
+
# - Detect you're on a feature branch
|
|
254
|
+
# - Run commit workflow with AI suggestions
|
|
255
|
+
# - Merge to develop branch
|
|
256
|
+
# - Bump minor version (1.0.0 ā 1.1.0)
|
|
257
|
+
# - Create git tag v1.1.0
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Quick Commit Without Version Management
|
|
261
|
+
```bash
|
|
262
|
+
# Just commit changes without version bumping
|
|
263
|
+
maiass --commits-only --auto-stage
|
|
264
|
+
|
|
265
|
+
# With AI commit message
|
|
266
|
+
maiass commit
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Safe Testing
|
|
270
|
+
```bash
|
|
271
|
+
# Preview what would happen without making changes
|
|
272
|
+
maiass --dry-run patch
|
|
273
|
+
|
|
274
|
+
# Check current version status
|
|
275
|
+
maiass version --current
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## š§ Advanced Usage
|
|
279
|
+
|
|
280
|
+
### Custom Version Files
|
|
281
|
+
```bash
|
|
282
|
+
# Configure custom version file
|
|
283
|
+
maiass config --project version_primary_file=VERSION.txt
|
|
284
|
+
maiass config --project version_primary_type=text
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Multiple Version Files
|
|
288
|
+
```bash
|
|
289
|
+
# Update multiple files with same version
|
|
290
|
+
maiass config --project version_secondary_files="src/version.js,docs/VERSION"
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### AI Customization
|
|
294
|
+
```bash
|
|
295
|
+
# Different AI modes
|
|
296
|
+
maiass config --global ai_mode=autosuggest # Auto-suggest without asking
|
|
297
|
+
maiass config --global ai_mode=off # Disable AI
|
|
298
|
+
|
|
299
|
+
# Custom commit message style
|
|
300
|
+
maiass config --global ai_commit_message_style=conventional
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## š Troubleshooting
|
|
304
|
+
|
|
305
|
+
### Common Issues
|
|
306
|
+
|
|
307
|
+
**"Not in a git repository"**
|
|
308
|
+
```bash
|
|
309
|
+
# Ensure you're in a git repository
|
|
310
|
+
git status
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**"No version files detected"**
|
|
314
|
+
```bash
|
|
315
|
+
# Check for supported version files
|
|
316
|
+
ls package.json composer.json VERSION
|
|
317
|
+
|
|
318
|
+
# Or configure custom version file
|
|
319
|
+
maiass config --project version_primary_file=your-version-file
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**"Failed to switch to develop branch"**
|
|
323
|
+
```bash
|
|
324
|
+
# Create develop branch if it doesn't exist
|
|
325
|
+
git checkout -b develop
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Debug Mode
|
|
329
|
+
```bash
|
|
330
|
+
# Enable verbose debugging
|
|
331
|
+
export MAIASS_DEBUG=true
|
|
332
|
+
maiass --dry-run
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## š Documentation- [Configuration Guide](docs/configuration.md)- [Workflow Guide](docs/workflow.md)- [API Reference](docs/api.md)- [Contributing](docs/contributing.md)
|
|
336
|
+
|
|
337
|
+
## š¤ Contributing
|
|
338
|
+
|
|
339
|
+
Contributions are welcome! Please read our [Contributing Guide](docs/contributing.md) for details.
|
|
340
|
+
|
|
341
|
+
## š License
|
|
342
|
+
|
|
343
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
344
|
+
|
|
345
|
+
## š Acknowledgments- Original MAIASS bash script by [vsmash](https://github.com/vsmash)- OpenAI for AI-powered commit messages- Node.js and npm ecosystem---
|
|
346
|
+
|
|
347
|
+
**Made with ā¤ļø by the MAIASS team**
|
package/build.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cross-platform build script for maiass
|
|
4
|
+
* Builds binaries for all supported platforms and architectures
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { execSync } from 'child_process';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import colors from './lib/colors.js';
|
|
11
|
+
|
|
12
|
+
const targets = [
|
|
13
|
+
'node18-macos-x64',
|
|
14
|
+
'node18-macos-arm64',
|
|
15
|
+
'node18-linux-x64',
|
|
16
|
+
'node18-linux-arm64',
|
|
17
|
+
'node18-win-x64',
|
|
18
|
+
'node18-win-arm64'
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const platformNames = {
|
|
22
|
+
'node18-macos-x64': 'macOS Intel',
|
|
23
|
+
'node18-macos-arm64': 'macOS Apple Silicon',
|
|
24
|
+
'node18-linux-x64': 'Linux x64',
|
|
25
|
+
'node18-linux-arm64': 'Linux ARM64',
|
|
26
|
+
'node18-win-x64': 'Windows x64',
|
|
27
|
+
'node18-win-arm64': 'Windows ARM64'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function buildForTarget(target) {
|
|
31
|
+
console.log(colors.BBlue(`Building for ${platformNames[target]}...`));
|
|
32
|
+
|
|
33
|
+
// Map target to output filename
|
|
34
|
+
const outputNames = {
|
|
35
|
+
'node18-macos-x64': 'maiass-macos-x64',
|
|
36
|
+
'node18-macos-arm64': 'maiass-macos-arm64',
|
|
37
|
+
'node18-linux-x64': 'maiass-linux-x64',
|
|
38
|
+
'node18-linux-arm64': 'maiass-linux-arm64',
|
|
39
|
+
'node18-win-x64': 'maiass-win-x64.exe',
|
|
40
|
+
'node18-win-arm64': 'maiass-win-arm64.exe'
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const outputName = outputNames[target];
|
|
44
|
+
const outputPath = `build/${outputName}`;
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
execSync(`npx pkg . --target ${target} --output ${outputPath}`, {
|
|
48
|
+
stdio: 'inherit',
|
|
49
|
+
encoding: 'utf8'
|
|
50
|
+
});
|
|
51
|
+
console.log(colors.Green(`ā Successfully built for ${platformNames[target]} -> ${outputName}`));
|
|
52
|
+
|
|
53
|
+
// Code sign macOS binaries
|
|
54
|
+
if (target.includes('macos') && process.platform === 'darwin') {
|
|
55
|
+
try {
|
|
56
|
+
console.log(colors.BBlue(` š Code signing ${outputName}...`));
|
|
57
|
+
execSync(`./scripts/codesign.sh "${outputPath}"`, { stdio: 'pipe' });
|
|
58
|
+
console.log(colors.Green(` ā Code signed ${outputName}`));
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.log(colors.Yellow(` ā ļø Code signing failed for ${outputName} (continuing without signing)`));
|
|
61
|
+
console.log(colors.Gray(` ${error.message.split('\n')[0]}`));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Code sign Windows binaries
|
|
66
|
+
if (target.includes('win')) {
|
|
67
|
+
try {
|
|
68
|
+
console.log(colors.BBlue(` š Code signing ${outputName}...`));
|
|
69
|
+
execSync(`./scripts/codesign-windows.sh "${outputPath}"`, { stdio: 'pipe' });
|
|
70
|
+
console.log(colors.Green(` ā Code signed ${outputName}`));
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.log(colors.Yellow(` ā ļø Windows code signing failed for ${outputName} (continuing without signing)`));
|
|
73
|
+
console.log(colors.Gray(` ${error.message.split('\n')[0]}`));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return true;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.log(colors.Red(`ā Failed to build for ${platformNames[target]}: ${error.message}`));
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function main() {
|
|
85
|
+
console.log(colors.Aqua('MAIASS Cross-Platform Build'));
|
|
86
|
+
console.log(colors.White('Building binaries for all supported platforms...\n'));
|
|
87
|
+
|
|
88
|
+
// Ensure build directory exists and is clean
|
|
89
|
+
if (fs.existsSync('build')) {
|
|
90
|
+
// Clean the build directory
|
|
91
|
+
const files = fs.readdirSync('build');
|
|
92
|
+
for (const file of files) {
|
|
93
|
+
if (file !== '.DS_Store') {
|
|
94
|
+
fs.unlinkSync(path.join('build', file));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
fs.mkdirSync('build');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
let successful = 0;
|
|
102
|
+
let failed = 0;
|
|
103
|
+
|
|
104
|
+
for (const target of targets) {
|
|
105
|
+
if (buildForTarget(target)) {
|
|
106
|
+
successful++;
|
|
107
|
+
} else {
|
|
108
|
+
failed++;
|
|
109
|
+
}
|
|
110
|
+
console.log(''); // Add spacing between builds
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
console.log(colors.White('\n=== Build Summary ==='));
|
|
114
|
+
console.log(colors.Green(`Successful builds: ${successful}`));
|
|
115
|
+
if (failed > 0) {
|
|
116
|
+
console.log(colors.Red(`Failed builds: ${failed}`));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (successful === targets.length) {
|
|
120
|
+
console.log(colors.Green('\nš All builds completed successfully!'));
|
|
121
|
+
console.log(colors.White('Binaries are available in the build/ directory'));
|
|
122
|
+
} else {
|
|
123
|
+
console.log(colors.Yellow('\nā ļø Some builds failed. Check the output above for details.'));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
main();
|