Skip to content

Commit 398842d

Browse files
committed
feat: add CLI bundling scripts and CI release workflow
1 parent b4a6f33 commit 398842d

86 files changed

Lines changed: 1181 additions & 342 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/release.yml‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Automated Release Pipeline
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Build & Release Standalone Binaries
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup pnpm
23+
uses: pnpm/action-setup@v4
24+
with:
25+
version: 9.15.4
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 22.x
31+
cache: 'pnpm'
32+
33+
- name: Install Monorepo Dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Build Workspace Packages
37+
run: pnpm run build
38+
39+
- name: Package Standalone CLI Executables
40+
run: pnpm --filter @collagility/cli package
41+
42+
- name: Create GitHub Release & Upload Assets
43+
uses: softprops/action-gh-release@v2
44+
with:
45+
name: Collagility ${{ github.ref_name }}
46+
draft: false
47+
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
48+
files: |
49+
apps/cli/dist/releases/collagility-linux-x64.tar.gz
50+
apps/cli/dist/releases/collagility-linux-arm64.tar.gz
51+
apps/cli/dist/releases/collagility-macos-x64.tar.gz
52+
apps/cli/dist/releases/collagility-macos-arm64.tar.gz
53+
apps/cli/dist/releases/collagility-windows-x64.zip
54+
body: |
55+
# Collagility ${{ github.ref_name }}
56+
57+
🚀 **Single-Command Installation**
58+
59+
```bash
60+
curl -fsSL https://raw.githubusercontent.com/JhaSourav07/Collagility/main/install.sh | bash
61+
```
62+
63+
## Release Assets
64+
- **Linux (x64)**: `collagility-linux-x64.tar.gz`
65+
- **Linux (arm64)**: `collagility-linux-arm64.tar.gz`
66+
- **macOS (Intel x64)**: `collagility-macos-x64.tar.gz`
67+
- **macOS (Apple Silicon arm64)**: `collagility-macos-arm64.tar.gz`
68+
- **Windows (x64)**: `collagility-windows-x64.zip`
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ node_modules/
66
dist/
77
build/
88
out/
9+
.next/
910
*.tsbuildinfo
1011
.turbo/
1112

‎README.md‎

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,47 @@ Prompt: "create index.ts" ─────────
3838

3939
## 📦 Installation
4040

41-
Prerequisites: Node.js `>= 22.0.0`, `pnpm` >= 9.0.0, and Antigravity CLI (`agy`) or Gemini CLI.
41+
### Single-Command Quick Install (Zero Dependencies Required)
42+
43+
No Node.js, pnpm, or repository cloning is required. Run the automated installer in your terminal:
4244

4345
```bash
44-
# 1. Clone repository
45-
git clone https://github.com/JhaSourav07/Collagility.git
46-
cd Collagility
46+
curl -fsSL https://raw.githubusercontent.com/JhaSourav07/Collagility/main/install.sh | bash
47+
```
48+
49+
The installer detects your OS and architecture, downloads the latest standalone release binary, and installs it into `~/.local/bin/collagility`.
50+
51+
---
52+
53+
### 💻 Supported Platforms
54+
55+
| Platform | Architecture | Binary Archive |
56+
| -------- | ------------ | -------------- |
57+
| Linux | x64 (AMD64) | `collagility-linux-x64.tar.gz` |
58+
| Linux | arm64 (AArch64) | `collagility-linux-arm64.tar.gz` |
59+
| macOS | Intel (x64) | `collagility-macos-x64.tar.gz` |
60+
| macOS | Apple Silicon (M1/M2/M3) | `collagility-macos-arm64.tar.gz` |
61+
| Windows | x64 | `collagility-windows-x64.zip` |
62+
63+
---
4764

48-
# 2. Install dependencies & build monorepo packages (single command at root)
49-
pnpm install
50-
pnpm run build
65+
### 🔄 Updating Collagility
5166

52-
# 3. Link CLI globally (runs right from root)
67+
To update Collagility to the latest version at any time, re-run the installation command:
68+
69+
```bash
70+
curl -fsSL https://raw.githubusercontent.com/JhaSourav07/Collagility/main/install.sh | bash
71+
```
72+
73+
---
74+
75+
### 🛠️ Installing from Source (Contributors)
76+
77+
```bash
78+
# Clone repository & build monorepo packages
79+
git clone https://github.com/JhaSourav07/Collagility.git
80+
cd Collagility
81+
pnpm install && pnpm run build
5382
sudo npm link
5483
```
5584

‎apps/cli/package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"main": "./dist/index.js",
1111
"scripts": {
1212
"build": "tsc --build",
13+
"bundle": "node ./scripts/bundle.js",
14+
"package": "node ./scripts/bundle.js && node ./scripts/package.js",
1315
"dev": "tsc --build --watch",
1416
"start": "node ./dist/index.js",
1517
"lint": "eslint src/**/*.ts",
@@ -31,6 +33,8 @@
3133
"devDependencies": {
3234
"@types/node": "^22.10.2",
3335
"@types/ws": "^8.5.13",
36+
"@yao-pkg/pkg": "^5.15.1",
37+
"esbuild": "^0.24.2",
3438
"typescript": "^5.7.2",
3539
"vitest": "^2.1.8"
3640
}

‎apps/cli/scripts/bundle.js‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import * as esbuild from 'esbuild';
2+
import path from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = path.dirname(__filename);
7+
const projectRoot = path.resolve(__dirname, '..');
8+
9+
console.log('📦 Bundling @collagility/cli with esbuild...');
10+
11+
try {
12+
await esbuild.build({
13+
entryPoints: [path.join(projectRoot, 'src', 'index.ts')],
14+
bundle: true,
15+
platform: 'node',
16+
target: 'node20',
17+
format: 'cjs',
18+
outfile: path.join(projectRoot, 'dist', 'bundle.cjs'),
19+
sourcemap: false,
20+
minify: false,
21+
loader: {
22+
'.ts': 'ts',
23+
},
24+
define: {
25+
'process.env.NODE_ENV': '"production"',
26+
},
27+
});
28+
29+
console.log('✓ ESBuild bundle generated: apps/cli/dist/bundle.cjs');
30+
} catch (err) {
31+
console.error('✖ Bundle failed:', err);
32+
process.exit(1);
33+
}

‎apps/cli/scripts/package.js‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { execSync } from 'node:child_process';
2+
import fs from 'node:fs';
3+
import path from 'node:path';
4+
import { fileURLToPath } from 'node:url';
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = path.dirname(__filename);
8+
const projectRoot = path.resolve(__dirname, '..');
9+
const bundlePath = path.join(projectRoot, 'dist', 'bundle.cjs');
10+
const binariesDir = path.join(projectRoot, 'dist', 'binaries');
11+
const releasesDir = path.join(projectRoot, 'dist', 'releases');
12+
13+
if (!fs.existsSync(bundlePath)) {
14+
console.error('✖ Bundle dist/bundle.cjs missing. Please run `pnpm run bundle` first.');
15+
process.exit(1);
16+
}
17+
18+
fs.mkdirSync(binariesDir, { recursive: true });
19+
fs.mkdirSync(releasesDir, { recursive: true });
20+
21+
const targets = [
22+
{ target: 'node20-linux-x64', name: 'collagility-linux-x64', archive: 'collagility-linux-x64.tar.gz' },
23+
{ target: 'node20-linux-arm64', name: 'collagility-linux-arm64', archive: 'collagility-linux-arm64.tar.gz' },
24+
{ target: 'node20-macos-x64', name: 'collagility-macos-x64', archive: 'collagility-macos-x64.tar.gz' },
25+
{ target: 'node20-macos-arm64', name: 'collagility-macos-arm64', archive: 'collagility-macos-arm64.tar.gz' },
26+
{ target: 'node20-win-x64', name: 'collagility-windows-x64.exe', archive: 'collagility-windows-x64.zip' },
27+
];
28+
29+
console.log('⚡ Packaging standalone binaries with pkg...');
30+
31+
for (const t of targets) {
32+
const outputPath = path.join(binariesDir, t.name);
33+
console.log(`Building binary for target: ${t.target} -> ${t.name}`);
34+
35+
try {
36+
execSync(`npx @yao-pkg/pkg --target ${t.target} --output "${outputPath}" "${bundlePath}"`, {
37+
stdio: 'inherit',
38+
cwd: projectRoot,
39+
});
40+
console.log(`✓ Generated ${t.name}`);
41+
} catch (err) {
42+
console.error(`✖ Failed to build binary for ${t.target}:`, err);
43+
}
44+
}
45+
46+
console.log('📦 Creating release archives (.tar.gz / .zip)...');
47+
48+
for (const t of targets) {
49+
const binaryPath = path.join(binariesDir, t.name);
50+
const archivePath = path.join(releasesDir, t.archive);
51+
52+
if (!fs.existsSync(binaryPath)) {
53+
console.warn(`⚠️ Warning: Binary ${binaryPath} not found. Skipping archive creation.`);
54+
continue;
55+
}
56+
57+
try {
58+
if (t.archive.endsWith('.tar.gz')) {
59+
const binaryFileName = t.name;
60+
// Package binary named "collagility" inside tarball so extraction produces "collagility" executable
61+
const tempDir = path.join(binariesDir, `temp-${t.name}`);
62+
fs.mkdirSync(tempDir, { recursive: true });
63+
fs.copyFileSync(binaryPath, path.join(tempDir, 'collagility'));
64+
execSync(`chmod +x "${path.join(tempDir, 'collagility')}"`);
65+
66+
execSync(`tar -czf "${archivePath}" -C "${tempDir}" collagility`, { stdio: 'inherit' });
67+
fs.rmSync(tempDir, { recursive: true, force: true });
68+
console.log(`✓ Created release archive: dist/releases/${t.archive}`);
69+
} else if (t.archive.endsWith('.zip')) {
70+
const tempDir = path.join(binariesDir, `temp-${t.name}`);
71+
fs.mkdirSync(tempDir, { recursive: true });
72+
fs.copyFileSync(binaryPath, path.join(tempDir, 'collagility.exe'));
73+
74+
execSync(`zip -j "${archivePath}" "${path.join(tempDir, 'collagility.exe')}"`, { stdio: 'inherit' });
75+
fs.rmSync(tempDir, { recursive: true, force: true });
76+
console.log(`✓ Created release archive: dist/releases/${t.archive}`);
77+
}
78+
} catch (err) {
79+
console.error(`✖ Failed to create archive ${t.archive}:`, err);
80+
}
81+
}
82+
83+
console.log('🎉 Packaging complete! All binaries and release archives ready in apps/cli/dist/releases/');

‎apps/web/.next/BUILD_ID‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎apps/web/.next/app-build-manifest.json‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎apps/web/.next/app-path-routes-manifest.json‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎apps/web/.next/build-manifest.json‎

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)