@compozy/cli 0.0.1 → 0.0.10

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,52 @@
1
+ Business Source License 1.1 (Variante Personalizada para Compozy)
2
+
3
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
4
+ “Business Source License” is a trademark of MariaDB Corporation Ab.
5
+
6
+ Parameters
7
+
8
+ Licensor: NauckGroupt LTDA
9
+
10
+ Licensed Work: Compozy Version 1.0
11
+
12
+ The Licensed Work is © 2025 NauckGroupt LTDA
13
+
14
+ Additional Use Grant: You may use the Licensed Work in production for any purpose, including deploying workflows generated by Compozy to production environments using provided Dockerfiles for commercial use. However, you may not provide automated deployment platforms or cloud hosting services that enable third parties to automatically deploy, host, or manage instances of the Licensed Work (similar to services like Vercel for automated deployments). This restriction does not apply to internal use, personal projects, non-commercial hosting, or manual deployments of generated workflows.
15
+
16
+ Change Date: 2029-07-28 (4 anos após a data de lançamento inicial em 28 de julho de 2025)
17
+
18
+ Change License: Apache License, Version 2.0
19
+
20
+ Terms
21
+
22
+ The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
23
+
24
+ Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
25
+
26
+ If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
27
+
28
+ All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
29
+
30
+ You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
31
+
32
+ Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
33
+
34
+ This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License).
35
+
36
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
37
+
38
+ Covenants of Licensor
39
+
40
+ In consideration of the right to use this License’s text and the “Business Source License” name and trademark, Licensor covenants to the Compozy community, and to all other recipients of the licensed work to be provided by Licensor:
41
+
42
+ 1. To specify as the Change License the Apache License Version 2.0 or any later version.
43
+
44
+ 2. To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text “None”.
45
+
46
+ 3. To specify a Change Date.
47
+
48
+ 4. Not to modify this License in any other way.
49
+
50
+ Notice
51
+
52
+ The Business Source License (this document, or the “License”) is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
package/README.md CHANGED
@@ -1,15 +1,102 @@
1
- # cli-pkg
1
+ <div align="center">
2
+ <img src="./docs/public/banner.png" alt="Compozy Logo" width="100%">
3
+ <br>
4
+ <br>
5
+ <p>
6
+ <a href="https://github.com/compozy/compozy/actions/workflows/ci.yml">
7
+ <img src="https://github.com/compozy/compozy/actions/workflows/ci.yml/badge.svg" alt="Build Status">
8
+ </a>
9
+ <a href="https://pkg.go.dev/github.com/compozy/compozy">
10
+ <img src="https://pkg.go.dev/badge/github.com/compozy/compozy.svg" alt="Go Reference">
11
+ </a>
12
+ </p>
13
+ </div>
2
14
 
3
- To install dependencies:
15
+ > [!WARNING]
16
+ > ✨ Alpha Release is Here! This project is currently in alpha. Please use with caution, as it may contain bugs and undergo significant changes.
17
+
18
+ ## Next-level Agentic Orchestration Platform
19
+
20
+ **Compozy** orchestrates multi-agent AI systems with ease. Compozy's enterprise-grade platform uses declarative YAML to deliver scalable, reliable, and cost-efficient distributed workflows, simplifying complex fan-outs, debugging, and monitoring for production-ready automation.
21
+
22
+ ## ✨ Key Features
23
+
24
+ - **Declarative Workflows**: Define complex AI workflows with simple, human-readable YAML.
25
+ - **Developer-Focused**: A comprehensive CLI with hot-reloading for a seamless development experience.
26
+ - **Advanced Task Orchestration**: 8 powerful task types including parallel, sequential, and conditional execution.
27
+ - **Extensible Tools**: Write custom tools in TypeScript/JavaScript to extend agent capabilities.
28
+ - **Multi-Model Support**: Integrates with 7+ LLM providers like OpenAI, Anthropic, Google, and local models.
29
+ - **Enterprise-Ready**: With Temporal behind the scenes, Compozy is built for production with persistence, monitoring, and security features.
30
+ - **High Performance**: Built with Go at its core, Compozy delivers exceptional speed and efficiency.
31
+ - **Multi-Model Support**: Integrates with 7+ LLM providers like OpenAI, Anthropic, Google, and local models.
32
+
33
+ ## 🚀 Getting Started
34
+
35
+ Get up and running with Compozy in just a few minutes.
36
+
37
+ ### Install via Homebrew (macOS/Linux)
38
+
39
+ ```bash
40
+ brew tap compozy/homebrew-compozy
41
+ brew install compozy
42
+ ```
43
+
44
+ ### Install via NPM
4
45
 
5
46
  ```bash
6
- bun install
47
+ npm install -g @compozy/cli
48
+ # Or with Yarn
49
+ yarn global add @compozy/cli
50
+ # Or with pnpm
51
+ pnpm add -g @compozy/cli
7
52
  ```
8
53
 
9
- To run:
54
+ ### Quick Start
10
55
 
11
56
  ```bash
12
- bun run index.ts
57
+ # Create a new project
58
+ compozy init my-ai-app
59
+ cd my-ai-app
60
+
61
+ # Start the development server
62
+ compozy dev
13
63
  ```
14
64
 
15
- This project was created using `bun init` in bun v1.2.19. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
65
+ For a complete walkthrough, check out our [**Quick Start Guide**](./docs/content/docs/core/getting-started/quick-start.mdx).
66
+
67
+ ## 📚 Documentation
68
+
69
+ Our documentation website is the best place to find comprehensive information, tutorials, and API references.
70
+
71
+ | Section | Description |
72
+ | ----------------------------------------------------------------------------------- | ------------------------------------------------ |
73
+ | 🚀 **[Getting Started](./docs/content/docs/core/getting-started/installation.mdx)** | Installation, setup, and your first workflow |
74
+ | 🛠️ **[Configuration](./docs/content/docs/core/configuration/project-setup.mdx)** | Project, runtime, and provider configuration |
75
+ | 🎨 **[Template Engine](./docs/content/docs/core/yaml-templates/overview.mdx)** | Dynamic YAML configuration with templating |
76
+ | 🤖 **[Agents](./docs/content/docs/core/agents/overview.mdx)** | Building and configuring AI agents |
77
+ | ⚙️ **[Tasks](./docs/content/docs/core/tasks/overview.mdx)** | Orchestrating operations with various task types |
78
+ | 🔧 **[Tools](./docs/content/docs/core/tools/overview.mdx)** | Extending agent capabilities with custom tools |
79
+ | 🧠 **[Memory & Context](./docs/content/docs/core/memory/overview.mdx)** | Managing agent memory and conversation context |
80
+ | 🔌 **[MCP Integration](./docs/content/docs/core/mcp/overview.mdx)** | Model Context Protocol for external tool servers |
81
+ | 📡 **[Signal System](./docs/content/docs/core/signals/overview.mdx)** | Event-driven communication between components |
82
+ | 🚀 **[Deployment](./docs/content/docs/core/deployment/docker.mdx)** | Deploy Compozy to production environments |
83
+ | 💻 **[CLI Reference](./docs/content/docs/cli/overview.mdx)** | Command-line interface reference |
84
+ | 📋 **[Schema Definition](./docs/content/docs/schema/project.mdx)** | YAML schema definitions for all components |
85
+ | 🔌 **[API Reference](./docs/content/docs/api/overview.mdx)** | REST API for programmatic access |
86
+
87
+ **[➡️ Explore the full documentation](./docs/content/docs/core/index.mdx)**
88
+
89
+ ## 🤝 Community & Contributing
90
+
91
+ We welcome contributions from the community! Whether it's reporting a bug, suggesting a feature, or submitting a pull request, your input is valuable.
92
+
93
+ - **[GitHub Issues](https://github.com/compozy/compozy/issues)**: Report bugs and request features.
94
+ - **[Contributing Guide](./CONTRIBUTING.md)**: Learn how to contribute to the project.
95
+
96
+ ---
97
+
98
+ ## 🔐 License
99
+
100
+ This project is licensed under the Business Source License 1.1 (BUSL-1.1). See the [LICENSE](LICENSE) file for details.
101
+
102
+ <p align="center">Made with ❤️ by the Compozy Team</p>
package/install.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+
3
+ // This file was generated by GoReleaser. DO NOT EDIT.
4
+
5
+ const { install } = require("./lib.js");
6
+ install();
package/lib.js ADDED
@@ -0,0 +1,215 @@
1
+ // This file was generated by GoReleaser. DO NOT EDIT.
2
+ const { archives } = require("./package.json");
3
+ const fs = require("fs");
4
+ const crypto = require("crypto");
5
+ const path = require("path");
6
+ const JSZip = require("jszip");
7
+ const tar = require("tar");
8
+ const axios = require("axios");
9
+ const { spawnSync } = require("child_process");
10
+
11
+ const getArchive = () => {
12
+ let target = `${process.platform}-${process.arch}`;
13
+ const archive = archives[target];
14
+ if (!archive) {
15
+ throw new Error(`No archive available for ${target}`);
16
+ }
17
+ return archive;
18
+ };
19
+
20
+ const binDir = path.join(__dirname, "bin");
21
+
22
+ async function extractTar(tarPath, binaries, dir, wrappedIn) {
23
+ try {
24
+ const filesToExtract = wrappedIn
25
+ ? binaries.map((bin) =>
26
+ path.join(wrappedIn, bin).replace(/\\/g, "/"),
27
+ )
28
+ : binaries;
29
+
30
+ await tar.x({
31
+ file: tarPath,
32
+ cwd: dir,
33
+ filter: (path) => filesToExtract.includes(path),
34
+ });
35
+
36
+ // If wrapped, move files from wrapped directory to bin directory
37
+ if (wrappedIn) {
38
+ const wrappedDir = path.join(dir, wrappedIn);
39
+ for (const binary of binaries) {
40
+ const srcPath = path.join(wrappedDir, binary);
41
+ const destPath = path.join(dir, binary);
42
+ if (fs.existsSync(srcPath)) {
43
+ fs.renameSync(srcPath, destPath);
44
+ }
45
+ }
46
+ // Clean up empty wrapped directory
47
+ try {
48
+ fs.rmSync(wrappedDir, { recursive: true, force: true });
49
+ } catch (err) {
50
+ // Ignore cleanup errors
51
+ }
52
+ }
53
+
54
+ console.log(`Successfully extracted ${binaries} to "${dir}"`);
55
+ } catch (err) {
56
+ throw new Error(`Extraction failed: ${err.message}`);
57
+ }
58
+ }
59
+
60
+ async function extractZip(zipPath, binaries, dir, wrappedIn) {
61
+ try {
62
+ const zipData = fs.readFileSync(zipPath);
63
+ const zip = await JSZip.loadAsync(zipData);
64
+
65
+ for (const binary of binaries) {
66
+ const binaryPath = wrappedIn
67
+ ? path.join(wrappedIn, binary).replace(/\\/g, "/")
68
+ : binary;
69
+
70
+ if (!zip.files[binaryPath]) {
71
+ throw new Error(
72
+ `Error: ${binaryPath} does not exist in ${zipPath}`,
73
+ );
74
+ }
75
+
76
+ const content = await zip.files[binaryPath].async("nodebuffer");
77
+ if (!fs.existsSync(dir)) {
78
+ fs.mkdirSync(dir, { recursive: true });
79
+ }
80
+ const file = path.join(dir, binary);
81
+ fs.writeFileSync(file, content);
82
+ fs.chmodSync(file, "755");
83
+ console.log(`Successfully extracted "${binary}" to "${dir}"`);
84
+ }
85
+ } catch (err) {
86
+ throw new Error(`Extraction failed: ${err.message}`);
87
+ }
88
+ }
89
+
90
+ const run = async (bin) => {
91
+ await install();
92
+ if (process.platform === "win32") {
93
+ bin += ".exe";
94
+ }
95
+ const [, , ...args] = process.argv;
96
+ let result = spawnSync(path.join(binDir, bin), args, {
97
+ cwd: process.cwd(),
98
+ stdio: "inherit",
99
+ });
100
+ if (result.error) {
101
+ console.error(result.error);
102
+ }
103
+ return result.status;
104
+ };
105
+
106
+ const install = async () => {
107
+ try {
108
+ let archive = getArchive();
109
+ if (await exists(archive)) {
110
+ return;
111
+ }
112
+ let tmp = fs.mkdtempSync("archive-");
113
+ let archivePath = path.join(tmp, archive.name);
114
+ await download(archive.url, archivePath);
115
+ verify(archivePath, archive.checksum);
116
+
117
+ if (!fs.existsSync(binDir)) {
118
+ fs.mkdirSync(binDir);
119
+ }
120
+ switch (archive.format) {
121
+ case "binary":
122
+ const bin = path.join(binDir, archive.bins[0]);
123
+ fs.copyFileSync(archivePath, bin);
124
+ fs.chmodSync(bin, 0o755);
125
+ return;
126
+ case "zip":
127
+ return extractZip(
128
+ archivePath,
129
+ archive.bins,
130
+ binDir,
131
+ archive.wrappedIn,
132
+ );
133
+ case "tar":
134
+ case "tar.gz":
135
+ case "tgz":
136
+ return extractTar(
137
+ archivePath,
138
+ archive.bins,
139
+ binDir,
140
+ archive.wrappedIn,
141
+ );
142
+ case "tar.zst":
143
+ case "tzst":
144
+ case "tar.xz":
145
+ case "txz":
146
+ default:
147
+ throw new Error(`unsupported format: ${archive.format}`);
148
+ }
149
+ } catch (err) {
150
+ throw new Error(`Installation failed: ${err.message}`);
151
+ }
152
+ };
153
+
154
+ const verify = (filename, checksum) => {
155
+ if (checksum.algorithm == "" || checksum.digest == "") {
156
+ console.warn("Warning: No checksum provided for verification");
157
+ return;
158
+ }
159
+ let digest = crypto
160
+ .createHash(checksum.algorithm)
161
+ .update(fs.readFileSync(filename))
162
+ .digest("hex");
163
+ if (digest != checksum.digest) {
164
+ throw new Error(
165
+ `${filename}: ${checksum.algorithm} does not match, expected ${checksum.digest}, got ${digest}`,
166
+ );
167
+ }
168
+ };
169
+
170
+ const download = async (url, filename) => {
171
+ try {
172
+ console.log(`Downloading ${url} to ${filename}...`);
173
+ const dir = path.dirname(filename);
174
+ if (!fs.existsSync(dir)) {
175
+ fs.mkdirSync(dir, { recursive: true });
176
+ }
177
+
178
+ const response = await axios({
179
+ method: "GET",
180
+ url: url,
181
+ responseType: "stream",
182
+ timeout: 300000, // 5min
183
+ });
184
+
185
+ const writer = fs.createWriteStream(filename);
186
+ response.data.pipe(writer);
187
+
188
+ return new Promise((resolve, reject) => {
189
+ writer.on("finish", () => {
190
+ console.log(`Download complete: ${filename}`);
191
+ resolve(dir);
192
+ });
193
+
194
+ writer.on("error", (err) => {
195
+ console.error(`Error writing file: ${err.message}`);
196
+ reject(err);
197
+ });
198
+ });
199
+ } catch (err) {
200
+ throw new Error(`Download failed: ${err.message}`);
201
+ }
202
+ };
203
+
204
+ function exists(archive) {
205
+ if (!fs.existsSync(binDir)) {
206
+ return false;
207
+ }
208
+ return archive.bins.every((bin) => fs.existsSync(path.join(binDir, bin)));
209
+ }
210
+
211
+ module.exports = {
212
+ install,
213
+ run,
214
+ getArchive,
215
+ };
package/package.json CHANGED
@@ -1,15 +1,94 @@
1
1
  {
2
2
  "name": "@compozy/cli",
3
- "version": "0.0.1",
4
- "module": "index.ts",
5
- "type": "module",
6
- "publishConfig": {
7
- "access": "public"
3
+ "version": "0.0.10",
4
+ "description": "Next-level Agentic Orchestration Platform",
5
+ "scripts": {
6
+ "postinstall": "node install.js",
7
+ "run": "node run-compozy.js"
8
8
  },
9
- "devDependencies": {
10
- "@types/bun": "latest"
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/compozy/compozy.git"
11
12
  },
12
- "peerDependencies": {
13
- "typescript": "^5"
13
+ "author": "Compozy Team \u003csupport@compozy.com\u003e",
14
+ "license": "BSL-1.1",
15
+ "bugs": {
16
+ "url": "https://github.com/compozy/compozy/issues"
17
+ },
18
+ "homepage": "https://github.com/compozy/compozy",
19
+ "bin": {
20
+ "compozy": "run-compozy.js"
21
+ },
22
+ "dependencies": {
23
+ "axios": "^1.8.2",
24
+ "jszip": "^3.10.1",
25
+ "tar": "^7.4.3"
26
+ },
27
+ "archives": {
28
+ "darwin-arm64": {
29
+ "name": "compozy_0.0.10_darwin_arm64.tar.gz",
30
+ "url": "https://github.com/compozy/compozy/releases/download/v0.0.10/compozy_0.0.10_darwin_arm64.tar.gz",
31
+ "bins": [
32
+ "compozy"
33
+ ],
34
+ "format": "tar.gz",
35
+ "checksum": {
36
+ "algorithm": "sha256",
37
+ "digest": "7a2046eacb39c08d93c2b9ae89ab9c62006b71f3586c3751838ae239fb176b7e"
38
+ },
39
+ "wrappedIn": "compozy_0.0.10_darwin_arm64"
40
+ },
41
+ "darwin-x64": {
42
+ "name": "compozy_0.0.10_darwin_x86_64.tar.gz",
43
+ "url": "https://github.com/compozy/compozy/releases/download/v0.0.10/compozy_0.0.10_darwin_x86_64.tar.gz",
44
+ "bins": [
45
+ "compozy"
46
+ ],
47
+ "format": "tar.gz",
48
+ "checksum": {
49
+ "algorithm": "sha256",
50
+ "digest": "07d2f4c452ef25e60b1404200170db1c58cf18aff2dc245b8d4f4634525c8e6d"
51
+ },
52
+ "wrappedIn": "compozy_0.0.10_darwin_x86_64"
53
+ },
54
+ "linux-arm64": {
55
+ "name": "compozy_0.0.10_linux_arm64.tar.gz",
56
+ "url": "https://github.com/compozy/compozy/releases/download/v0.0.10/compozy_0.0.10_linux_arm64.tar.gz",
57
+ "bins": [
58
+ "compozy"
59
+ ],
60
+ "format": "tar.gz",
61
+ "checksum": {
62
+ "algorithm": "sha256",
63
+ "digest": "e599b51e16d6a4eba9768a3ffebde4ef465aab63ad91cedff3bcb0181bd310f2"
64
+ },
65
+ "wrappedIn": "compozy_0.0.10_linux_arm64"
66
+ },
67
+ "linux-x64": {
68
+ "name": "compozy_0.0.10_linux_x86_64.tar.gz",
69
+ "url": "https://github.com/compozy/compozy/releases/download/v0.0.10/compozy_0.0.10_linux_x86_64.tar.gz",
70
+ "bins": [
71
+ "compozy"
72
+ ],
73
+ "format": "tar.gz",
74
+ "checksum": {
75
+ "algorithm": "sha256",
76
+ "digest": "085a758cd0973eac59dbcf7af699914b74c58094729d6659095505dba42d9fc6"
77
+ },
78
+ "wrappedIn": "compozy_0.0.10_linux_x86_64"
79
+ },
80
+ "win32-x64": {
81
+ "name": "compozy_0.0.10_windows_x86_64.zip",
82
+ "url": "https://github.com/compozy/compozy/releases/download/v0.0.10/compozy_0.0.10_windows_x86_64.zip",
83
+ "bins": [
84
+ "compozy.exe"
85
+ ],
86
+ "format": "zip",
87
+ "checksum": {
88
+ "algorithm": "sha256",
89
+ "digest": "c67da3c6aa039d4f514bb6873a655800878c5931b45d71d9c5ab0c161abb7a02"
90
+ },
91
+ "wrappedIn": "compozy_0.0.10_windows_x86_64"
92
+ }
14
93
  }
15
- }
94
+ }
package/run-compozy.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+
3
+ // This file was generated by GoReleaser. DO NOT EDIT.
4
+
5
+ const { run } = require("./lib.js");
6
+ run("compozy");
package/CLAUDE.md DELETED
@@ -1,111 +0,0 @@
1
- ---
2
- description: Use Bun instead of Node.js, npm, pnpm, or vite.
3
- globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
4
- alwaysApply: false
5
- ---
6
-
7
- Default to using Bun instead of Node.js.
8
-
9
- - Use `bun <file>` instead of `node <file>` or `ts-node <file>`
10
- - Use `bun test` instead of `jest` or `vitest`
11
- - Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
12
- - Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
13
- - Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
14
- - Bun automatically loads .env, so don't use dotenv.
15
-
16
- ## APIs
17
-
18
- - `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
19
- - `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
20
- - `Bun.redis` for Redis. Don't use `ioredis`.
21
- - `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
22
- - `WebSocket` is built-in. Don't use `ws`.
23
- - Prefer `Bun.file` over `node:fs`'s readFile/writeFile
24
- - Bun.$`ls` instead of execa.
25
-
26
- ## Testing
27
-
28
- Use `bun test` to run tests.
29
-
30
- ```ts#index.test.ts
31
- import { test, expect } from "bun:test";
32
-
33
- test("hello world", () => {
34
- expect(1).toBe(1);
35
- });
36
- ```
37
-
38
- ## Frontend
39
-
40
- Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
41
-
42
- Server:
43
-
44
- ```ts#index.ts
45
- import index from "./index.html"
46
-
47
- Bun.serve({
48
- routes: {
49
- "/": index,
50
- "/api/users/:id": {
51
- GET: (req) => {
52
- return new Response(JSON.stringify({ id: req.params.id }));
53
- },
54
- },
55
- },
56
- // optional websocket support
57
- websocket: {
58
- open: (ws) => {
59
- ws.send("Hello, world!");
60
- },
61
- message: (ws, message) => {
62
- ws.send(message);
63
- },
64
- close: (ws) => {
65
- // handle close
66
- }
67
- },
68
- development: {
69
- hmr: true,
70
- console: true,
71
- }
72
- })
73
- ```
74
-
75
- HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
76
-
77
- ```html#index.html
78
- <html>
79
- <body>
80
- <h1>Hello, world!</h1>
81
- <script type="module" src="./frontend.tsx"></script>
82
- </body>
83
- </html>
84
- ```
85
-
86
- With the following `frontend.tsx`:
87
-
88
- ```tsx#frontend.tsx
89
- import React from "react";
90
-
91
- // import .css files directly and it works
92
- import './index.css';
93
-
94
- import { createRoot } from "react-dom/client";
95
-
96
- const root = createRoot(document.body);
97
-
98
- export default function Frontend() {
99
- return <h1>Hello, world!</h1>;
100
- }
101
-
102
- root.render(<Frontend />);
103
- ```
104
-
105
- Then, run index.ts
106
-
107
- ```sh
108
- bun --hot ./index.ts
109
- ```
110
-
111
- For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`.
package/bun.lock DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "lockfileVersion": 1,
3
- "workspaces": {
4
- "": {
5
- "name": "cli-pkg",
6
- "devDependencies": {
7
- "@types/bun": "latest",
8
- },
9
- "peerDependencies": {
10
- "typescript": "^5",
11
- },
12
- },
13
- },
14
- "packages": {
15
- "@types/bun": ["@types/bun@1.2.19", "", { "dependencies": { "bun-types": "1.2.19" } }, "sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg=="],
16
-
17
- "@types/node": ["@types/node@24.2.0", "", { "dependencies": { "undici-types": "~7.10.0" } }, "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw=="],
18
-
19
- "@types/react": ["@types/react@19.1.9", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-WmdoynAX8Stew/36uTSVMcLJJ1KRh6L3IZRx1PZ7qJtBqT3dYTgyDTx8H1qoRghErydW7xw9mSJ3wS//tCRpFA=="],
20
-
21
- "bun-types": ["bun-types@1.2.19", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ=="],
22
-
23
- "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
24
-
25
- "typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="],
26
-
27
- "undici-types": ["undici-types@7.10.0", "", {}, "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag=="],
28
- }
29
- }
package/index.ts DELETED
@@ -1 +0,0 @@
1
- console.log("Hello via Bun!");
package/tsconfig.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // Environment setup & latest features
4
- "lib": ["ESNext"],
5
- "target": "ESNext",
6
- "module": "Preserve",
7
- "moduleDetection": "force",
8
- "jsx": "react-jsx",
9
- "allowJs": true,
10
-
11
- // Bundler mode
12
- "moduleResolution": "bundler",
13
- "allowImportingTsExtensions": true,
14
- "verbatimModuleSyntax": true,
15
- "noEmit": true,
16
-
17
- // Best practices
18
- "strict": true,
19
- "skipLibCheck": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "noUncheckedIndexedAccess": true,
22
- "noImplicitOverride": true,
23
-
24
- // Some stricter flags (disabled by default)
25
- "noUnusedLocals": false,
26
- "noUnusedParameters": false,
27
- "noPropertyAccessFromIndexSignature": false
28
- }
29
- }