decocms 0.16.0 → 2.138.0
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 +52 -77
- package/bin/deco.js +33 -0
- package/package.json +29 -60
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -373
- package/dist/cli.js.map +0 -1
- package/dist/commands/add/add.d.ts +0 -7
- package/dist/commands/add/add.d.ts.map +0 -1
- package/dist/commands/add/add.js +0 -90
- package/dist/commands/add/add.js.map +0 -1
- package/dist/commands/auth/login.d.ts +0 -2
- package/dist/commands/auth/login.d.ts.map +0 -1
- package/dist/commands/auth/login.js +0 -125
- package/dist/commands/auth/login.js.map +0 -1
- package/dist/commands/auth/whoami.d.ts +0 -2
- package/dist/commands/auth/whoami.d.ts.map +0 -1
- package/dist/commands/auth/whoami.js +0 -51
- package/dist/commands/auth/whoami.js.map +0 -1
- package/dist/commands/config/configure.d.ts +0 -2
- package/dist/commands/config/configure.d.ts.map +0 -1
- package/dist/commands/config/configure.js +0 -51
- package/dist/commands/config/configure.js.map +0 -1
- package/dist/commands/create/create.d.ts +0 -3
- package/dist/commands/create/create.d.ts.map +0 -1
- package/dist/commands/create/create.js +0 -238
- package/dist/commands/create/create.js.map +0 -1
- package/dist/commands/dev/dev.d.ts +0 -8
- package/dist/commands/dev/dev.d.ts.map +0 -1
- package/dist/commands/dev/dev.js +0 -64
- package/dist/commands/dev/dev.js.map +0 -1
- package/dist/commands/dev/link.d.ts +0 -8
- package/dist/commands/dev/link.d.ts.map +0 -1
- package/dist/commands/dev/link.js +0 -124
- package/dist/commands/dev/link.js.map +0 -1
- package/dist/commands/gen/gen.d.ts +0 -11
- package/dist/commands/gen/gen.d.ts.map +0 -1
- package/dist/commands/gen/gen.js +0 -341
- package/dist/commands/gen/gen.js.map +0 -1
- package/dist/commands/hosting/deploy.d.ts +0 -19
- package/dist/commands/hosting/deploy.d.ts.map +0 -1
- package/dist/commands/hosting/deploy.js +0 -194
- package/dist/commands/hosting/deploy.js.map +0 -1
- package/dist/commands/hosting/list.d.ts +0 -6
- package/dist/commands/hosting/list.d.ts.map +0 -1
- package/dist/commands/hosting/list.js +0 -26
- package/dist/commands/hosting/list.js.map +0 -1
- package/dist/commands/hosting/promote.d.ts +0 -11
- package/dist/commands/hosting/promote.d.ts.map +0 -1
- package/dist/commands/hosting/promote.js +0 -153
- package/dist/commands/hosting/promote.js.map +0 -1
- package/dist/commands/update/update.d.ts +0 -4
- package/dist/commands/update/update.d.ts.map +0 -1
- package/dist/commands/update/update.js +0 -242
- package/dist/commands/update/update.js.map +0 -1
- package/dist/commands/update/upgrade.d.ts +0 -4
- package/dist/commands/update/upgrade.d.ts.map +0 -1
- package/dist/commands/update/upgrade.js +0 -157
- package/dist/commands/update/upgrade.js.map +0 -1
- package/dist/lib/config.d.ts +0 -309
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -262
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -10
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/constants.js +0 -16
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/fs.d.ts +0 -40
- package/dist/lib/fs.d.ts.map +0 -1
- package/dist/lib/fs.js +0 -162
- package/dist/lib/fs.js.map +0 -1
- package/dist/lib/mcp.d.ts +0 -34
- package/dist/lib/mcp.d.ts.map +0 -1
- package/dist/lib/mcp.js +0 -19
- package/dist/lib/mcp.js.map +0 -1
- package/dist/lib/parse-binding-tool.d.ts +0 -12
- package/dist/lib/parse-binding-tool.d.ts.map +0 -1
- package/dist/lib/parse-binding-tool.js +0 -15
- package/dist/lib/parse-binding-tool.js.map +0 -1
- package/dist/lib/prompt-ide-setup.d.ts +0 -27
- package/dist/lib/prompt-ide-setup.d.ts.map +0 -1
- package/dist/lib/prompt-ide-setup.js +0 -158
- package/dist/lib/prompt-ide-setup.js.map +0 -1
- package/dist/lib/prompt-integrations.d.ts +0 -7
- package/dist/lib/prompt-integrations.d.ts.map +0 -1
- package/dist/lib/prompt-integrations.js +0 -84
- package/dist/lib/prompt-integrations.js.map +0 -1
- package/dist/lib/prompt-workspace.d.ts +0 -2
- package/dist/lib/prompt-workspace.d.ts.map +0 -1
- package/dist/lib/prompt-workspace.js +0 -93
- package/dist/lib/prompt-workspace.js.map +0 -1
- package/dist/lib/runtime.d.ts +0 -5
- package/dist/lib/runtime.d.ts.map +0 -1
- package/dist/lib/runtime.js +0 -15
- package/dist/lib/runtime.js.map +0 -1
- package/dist/lib/session.d.ts +0 -39
- package/dist/lib/session.d.ts.map +0 -1
- package/dist/lib/session.js +0 -124
- package/dist/lib/session.js.map +0 -1
- package/dist/lib/slugify.d.ts +0 -13
- package/dist/lib/slugify.d.ts.map +0 -1
- package/dist/lib/slugify.js +0 -27
- package/dist/lib/slugify.js.map +0 -1
- package/dist/lib/supabase.d.ts +0 -5
- package/dist/lib/supabase.d.ts.map +0 -1
- package/dist/lib/supabase.js +0 -19
- package/dist/lib/supabase.js.map +0 -1
- package/dist/lib/wrangler.d.ts +0 -9
- package/dist/lib/wrangler.d.ts.map +0 -1
- package/dist/lib/wrangler.js +0 -118
- package/dist/lib/wrangler.js.map +0 -1
- package/dist/rules/deco-chat.mdc +0 -902
package/README.md
CHANGED
|
@@ -1,95 +1,70 @@
|
|
|
1
|
-
# Deco
|
|
1
|
+
# Deco Studio
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[deco.chat](https://deco.chat).
|
|
3
|
+
Open-source control plane for your AI agents. Install in 30 seconds.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
```bash
|
|
6
|
+
bunx decocms
|
|
7
|
+
```
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
> Requires [Bun](https://bun.sh). Install with: `curl -fsSL https://bun.sh/install | bash`
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## What is Deco Studio?
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
| `deco logout` | Remove local credentials and end the session. |
|
|
16
|
-
| `deco whoami` | Show the currently authenticated user and workspace. |
|
|
13
|
+
Deco Studio is where you hire AI agents, connect tools, and manage projects —
|
|
14
|
+
all from a single dashboard. Browse specialized agents, wire up 50+ integrations
|
|
15
|
+
via MCP, and track every token, cost, and action in real time.
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
- **Hire agents** — browse specialized AI agents or create your own from custom prompts. Agents can compose and call each other.
|
|
18
|
+
- **Connect tools** — 50+ integrations (GitHub, Slack, Postgres, OpenAI, and more) with one-click OAuth and granular RBAC.
|
|
19
|
+
- **Track everything** — real-time cost attribution, latency monitoring, and error tracking per agent and connection.
|
|
20
|
+
- **Run locally** — private, SQLite-based setup on your machine. No cloud required.
|
|
21
|
+
- **Scale to teams** — optional cloud sync via [studio.decocms.com](https://studio.decocms.com), or self-host for your org.
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
```
|
|
24
|
+
Your AI Agents & MCP Clients
|
|
25
|
+
│
|
|
26
|
+
▼
|
|
27
|
+
Deco Studio
|
|
28
|
+
Agents · Tools · Observability
|
|
29
|
+
│
|
|
30
|
+
▼
|
|
31
|
+
Integrations (Slack, GitHub, APIs, DBs...)
|
|
32
|
+
```
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
| ---------------- | --------------------------------------------------------------------------- |
|
|
24
|
-
| `deco create` | Scaffold a new deco project from an official template. |
|
|
25
|
-
| `deco configure` | Re-run setup for the current directory to change workspace or app settings. |
|
|
34
|
+
## Quick start
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
```bash
|
|
37
|
+
# Start Deco Studio locally
|
|
38
|
+
bunx decocms
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
# Opens at http://localhost:3000
|
|
41
|
+
```
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
| --------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
33
|
-
| `npm run dev` | Preferred way to run local Worker and React frontend in watch mode. |
|
|
34
|
-
| `deco dev` | (Experimental) Future unified development command. |
|
|
35
|
-
| `deco link [build-command]` | Link your local dev server to a public domain. Supports `-p <port>`. Example: deco link npm run dev. |
|
|
43
|
+
Connect any MCP client to `http://localhost:3000/mcp`:
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"deco": {
|
|
49
|
+
"url": "http://localhost:3000/mcp"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
38
54
|
|
|
39
|
-
##
|
|
55
|
+
## Deploy
|
|
40
56
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| `deco gen` | Generate types for external integrations (`deco.gen.ts`). |
|
|
44
|
-
| `deco gen:self` | Generate types for your own tools and workflows via local `/mcp` endpoint. |
|
|
57
|
+
Run locally with SQLite, or deploy for your team with Docker, Bun/Node,
|
|
58
|
+
Kubernetes, and PostgreSQL. See the [docs](https://docs.deco.page/).
|
|
45
59
|
|
|
46
|
-
|
|
60
|
+
## Links
|
|
47
61
|
|
|
48
|
-
|
|
62
|
+
- [Website](https://decocms.com/studio)
|
|
63
|
+
- [Documentation](https://docs.deco.page/)
|
|
64
|
+
- [GitHub](https://github.com/decocms/mesh)
|
|
65
|
+
- [Discord](https://decocms.com/discord)
|
|
49
66
|
|
|
50
|
-
|
|
51
|
-
| ----------------------------- | -------------------------------------------------------------------------- |
|
|
52
|
-
| `npm run deploy` | Builds frontend and invokes `deco deploy`. Recommended for most use cases. |
|
|
53
|
-
| `deco deploy` | Bundle and deploy to Cloudflare Workers. Supports `-w`, `-a`, and `-l`. |
|
|
54
|
-
| `deco hosting list -w <name>` | List deployed apps in a specific workspace. |
|
|
67
|
+
## License
|
|
55
68
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## Integrations
|
|
59
|
-
|
|
60
|
-
| Command | Description |
|
|
61
|
-
| ---------- | ----------------------------------------- |
|
|
62
|
-
| `deco add` | Add and configure workspace integrations. |
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Maintenance
|
|
67
|
-
|
|
68
|
-
| Command | Description |
|
|
69
|
-
| ------------- | ------------------------------------------------ |
|
|
70
|
-
| `deco update` | Upgrade the CLI to the latest published version. |
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Getting Help
|
|
75
|
-
|
|
76
|
-
| Command | Description |
|
|
77
|
-
| ------------- | ------------------------------------------------ |
|
|
78
|
-
| `deco --help` | Display the full list of CLI commands and usage. |
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## Configuration File
|
|
83
|
-
|
|
84
|
-
The CLI uses a local config file to store your workspace and app context. Set or
|
|
85
|
-
update this configuration anytime using: `deco configure`
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Environment Variables
|
|
90
|
-
|
|
91
|
-
| Variable | Purpose |
|
|
92
|
-
| --------------------- | --------------------------------------------------------------------- |
|
|
93
|
-
| `DECO_CHAT_API_TOKEN` | API token for authentication (set by `deco login`). |
|
|
94
|
-
| `DECO_CHAT_API_LOCAL` | Overrides API base URL for local development. |
|
|
95
|
-
| `DECO_SELF_URL` | Local MCP endpoint for `deco gen:self` to introspect workflows/tools. |
|
|
69
|
+
Sustainable Use License — free to self-host for internal use and client
|
|
70
|
+
projects. See [LICENSE.md](https://github.com/decocms/mesh/blob/main/LICENSE.md).
|
package/bin/deco.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Re-export the @decocms/mesh CLI entry point.
|
|
4
|
+
// This wrapper package exists so that `npx decocms` / `deco` works
|
|
5
|
+
// while the canonical package remains @decocms/mesh.
|
|
6
|
+
|
|
7
|
+
const { execFileSync } = require("child_process");
|
|
8
|
+
const { createRequire } = require("module");
|
|
9
|
+
const { dirname, join } = require("path");
|
|
10
|
+
|
|
11
|
+
const require_ = createRequire(__filename);
|
|
12
|
+
const meshPkgJson = require_.resolve("@decocms/mesh/package.json");
|
|
13
|
+
const meshDir = dirname(meshPkgJson);
|
|
14
|
+
const meshBin = join(meshDir, "dist", "server", "cli.js");
|
|
15
|
+
|
|
16
|
+
// The built CLI uses Bun APIs (Bun.file, Bun.serve), so bun is required.
|
|
17
|
+
try {
|
|
18
|
+
execFileSync("bun", ["--version"], { stdio: "ignore" });
|
|
19
|
+
} catch {
|
|
20
|
+
console.error("Deco Studio requires Bun to run.");
|
|
21
|
+
console.error("Install it with: curl -fsSL https://bun.sh/install | bash");
|
|
22
|
+
console.error("");
|
|
23
|
+
console.error("Then run: bunx decocms");
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
execFileSync("bun", [meshBin, ...process.argv.slice(2)], {
|
|
29
|
+
stdio: "inherit",
|
|
30
|
+
});
|
|
31
|
+
} catch (e) {
|
|
32
|
+
process.exit(e.status || 1);
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,79 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decocms",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "2.138.0",
|
|
4
|
+
"description": "Open-source control plane for your AI agents. Hire agents, connect tools, track costs.",
|
|
6
5
|
"author": "Deco team",
|
|
7
|
-
"
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/decocms/mesh",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
11
|
-
"directory": "packages/
|
|
10
|
+
"url": "git+https://github.com/decocms/mesh.git",
|
|
11
|
+
"directory": "packages/studio"
|
|
12
12
|
},
|
|
13
13
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/
|
|
14
|
+
"url": "https://github.com/decocms/mesh/issues"
|
|
15
15
|
},
|
|
16
|
-
"type": "module",
|
|
17
|
-
"main": "./dist/cli.js",
|
|
18
16
|
"bin": {
|
|
19
|
-
"deco": "./
|
|
17
|
+
"deco": "./bin/deco.js"
|
|
20
18
|
},
|
|
21
19
|
"files": [
|
|
22
|
-
"
|
|
23
|
-
"template/**/*"
|
|
20
|
+
"bin/**/*"
|
|
24
21
|
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsc && cp -r src/rules dist/",
|
|
27
|
-
"dev": "tsx src/cli.ts",
|
|
28
|
-
"start": "node dist/cli.js",
|
|
29
|
-
"type-check": "tsc --noEmit",
|
|
30
|
-
"prepublishOnly": "npm run build",
|
|
31
|
-
"postpublish": "echo 'Published deco-cli to npm registry!'"
|
|
32
|
-
},
|
|
33
22
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@modelcontextprotocol/sdk": "1.17.1",
|
|
36
|
-
"@supabase/ssr": "^0.6.1",
|
|
37
|
-
"@supabase/supabase-js": "^2.50.0",
|
|
38
|
-
"chalk": "^5.3.0",
|
|
39
|
-
"commander": "^12.0.0",
|
|
40
|
-
"glob": "^10.3.10",
|
|
41
|
-
"inquirer": "^9.2.15",
|
|
42
|
-
"inquirer-search-checkbox": "^1.0.0",
|
|
43
|
-
"inquirer-search-list": "^1.2.6",
|
|
44
|
-
"jose": "^6.0.11",
|
|
45
|
-
"json-schema-to-typescript": "^15.0.4",
|
|
46
|
-
"object-hash": "^3.0.0",
|
|
47
|
-
"prettier": "^3.6.2",
|
|
48
|
-
"semver": "^7.6.0",
|
|
49
|
-
"smol-toml": "^1.3.4",
|
|
50
|
-
"ws": "^8.16.0",
|
|
51
|
-
"zod": "^3.25.64"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@types/inquirer": "^9.0.7",
|
|
55
|
-
"@types/node": "^20.11.17",
|
|
56
|
-
"@types/object-hash": "^3.0.6",
|
|
57
|
-
"@types/semver": "^7.5.6",
|
|
58
|
-
"@types/ws": "^8.5.10",
|
|
59
|
-
"tsx": "^4.7.1",
|
|
60
|
-
"typescript": "^5.3.3"
|
|
23
|
+
"@decocms/mesh": "2.138.0"
|
|
61
24
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
64
27
|
},
|
|
65
28
|
"keywords": [
|
|
66
|
-
"
|
|
67
|
-
"deco",
|
|
68
|
-
"chat",
|
|
69
|
-
"deployment",
|
|
70
|
-
"development",
|
|
29
|
+
"ai-agents",
|
|
71
30
|
"mcp",
|
|
72
31
|
"model-context-protocol",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
|
|
32
|
+
"ai",
|
|
33
|
+
"gateway",
|
|
34
|
+
"self-hosted",
|
|
35
|
+
"mesh",
|
|
36
|
+
"studio",
|
|
37
|
+
"deco",
|
|
38
|
+
"decocms",
|
|
39
|
+
"cli",
|
|
40
|
+
"cursor",
|
|
41
|
+
"claude",
|
|
42
|
+
"observability",
|
|
43
|
+
"cost-tracking",
|
|
44
|
+
"integrations",
|
|
45
|
+
"oauth",
|
|
46
|
+
"rbac"
|
|
47
|
+
]
|
|
79
48
|
}
|
package/dist/cli.d.ts
DELETED
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
DELETED
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Check Node.js version requirement
|
|
3
|
-
import process from "node:process";
|
|
4
|
-
const MIN_NODE_VERSION = "18.0.0";
|
|
5
|
-
const currentNodeVersion = process.version.slice(1); // Remove 'v' prefix
|
|
6
|
-
function compareVersions(version1, version2) {
|
|
7
|
-
const v1parts = version1.split(".").map(Number);
|
|
8
|
-
const v2parts = version2.split(".").map(Number);
|
|
9
|
-
for (let i = 0; i < Math.max(v1parts.length, v2parts.length); i++) {
|
|
10
|
-
const v1part = v1parts[i] || 0;
|
|
11
|
-
const v2part = v2parts[i] || 0;
|
|
12
|
-
if (v1part < v2part)
|
|
13
|
-
return -1;
|
|
14
|
-
if (v1part > v2part)
|
|
15
|
-
return 1;
|
|
16
|
-
}
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
19
|
-
if (compareVersions(currentNodeVersion, MIN_NODE_VERSION) < 0) {
|
|
20
|
-
console.error(`❌ Error: Node.js ${MIN_NODE_VERSION} or higher is required.`);
|
|
21
|
-
console.error(` Current version: ${process.version}`);
|
|
22
|
-
console.error(` Please upgrade Node.js: https://nodejs.org/`);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
// Suppress punycode deprecation warning from dependencies
|
|
26
|
-
process.removeAllListeners("warning");
|
|
27
|
-
process.on("warning", (warning) => {
|
|
28
|
-
if (warning.name === "DeprecationWarning" &&
|
|
29
|
-
warning.message.includes("punycode")) {
|
|
30
|
-
return; // Ignore punycode deprecation warnings
|
|
31
|
-
}
|
|
32
|
-
console.warn(warning.message);
|
|
33
|
-
});
|
|
34
|
-
import { Command } from "commander";
|
|
35
|
-
import { readFile, writeFile } from "fs/promises";
|
|
36
|
-
import { dirname, join } from "path";
|
|
37
|
-
import { fileURLToPath } from "url";
|
|
38
|
-
import { spawn } from "child_process";
|
|
39
|
-
import { deleteSession, readSession, setToken } from "./lib/session.js";
|
|
40
|
-
import { DECO_CHAT_API_LOCAL } from "./lib/constants.js";
|
|
41
|
-
import { getAppDomain, getConfig, readWranglerConfig, getLocal, setLocal, } from "./lib/config.js";
|
|
42
|
-
import { loginCommand } from "./commands/auth/login.js";
|
|
43
|
-
import { whoamiCommand } from "./commands/auth/whoami.js";
|
|
44
|
-
import { configureCommand } from "./commands/config/configure.js";
|
|
45
|
-
import { deploy } from "./commands/hosting/deploy.js";
|
|
46
|
-
import { listApps } from "./commands/hosting/list.js";
|
|
47
|
-
import { promoteApp } from "./commands/hosting/promote.js";
|
|
48
|
-
import { createCommand } from "./commands/create/create.js";
|
|
49
|
-
import { devCommand } from "./commands/dev/dev.js";
|
|
50
|
-
import { link } from "./commands/dev/link.js";
|
|
51
|
-
import { genEnv } from "./commands/gen/gen.js";
|
|
52
|
-
import { upgradeCommand } from "./commands/update/upgrade.js";
|
|
53
|
-
import { updateCommand } from "./commands/update/update.js";
|
|
54
|
-
import { addCommand } from "./commands/add/add.js";
|
|
55
|
-
import { detectRuntime } from "./lib/runtime.js";
|
|
56
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
57
|
-
const __dirname = dirname(__filename);
|
|
58
|
-
// Read package.json for version
|
|
59
|
-
const packageJsonPath = join(__dirname, "../package.json");
|
|
60
|
-
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf-8"));
|
|
61
|
-
// Login command implementation
|
|
62
|
-
const login = new Command("login")
|
|
63
|
-
.description("Log in to deco.chat and retrieve tokens for CLI usage.")
|
|
64
|
-
.action(async () => {
|
|
65
|
-
try {
|
|
66
|
-
await loginCommand();
|
|
67
|
-
console.log("✅ Successfully logged in to deco.chat");
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
console.error("❌ Login failed:", error instanceof Error ? error.message : String(error));
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
// Placeholder for logout command implementation
|
|
75
|
-
const logout = new Command("logout")
|
|
76
|
-
.description("Log out of deco.chat and remove local session data.")
|
|
77
|
-
.action(async () => {
|
|
78
|
-
try {
|
|
79
|
-
await deleteSession();
|
|
80
|
-
console.log("Logged out successfully. Session data removed.");
|
|
81
|
-
}
|
|
82
|
-
catch (e) {
|
|
83
|
-
if (e instanceof Error) {
|
|
84
|
-
console.error("Failed to log out:", e.message);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
console.error("Failed to log out:", String(e));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
// Whoami command implementation
|
|
92
|
-
const whoami = new Command("whoami")
|
|
93
|
-
.description("Print info about the current session.")
|
|
94
|
-
.action(whoamiCommand);
|
|
95
|
-
// Configure command implementation
|
|
96
|
-
const configure = new Command("configure")
|
|
97
|
-
.alias("config")
|
|
98
|
-
.description("Save configuration options for the current directory.")
|
|
99
|
-
.action(async () => {
|
|
100
|
-
try {
|
|
101
|
-
await configureCommand(getLocal());
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
console.error("❌ Configuration failed:", error instanceof Error ? error.message : String(error));
|
|
105
|
-
process.exit(1);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
const hostingList = new Command("list")
|
|
109
|
-
.description("List all apps in the current workspace.")
|
|
110
|
-
.option("-w, --workspace <workspace>", "Workspace name")
|
|
111
|
-
.action(async (options) => {
|
|
112
|
-
try {
|
|
113
|
-
const session = await readSession();
|
|
114
|
-
const workspace = options.workspace || session?.workspace;
|
|
115
|
-
if (!workspace) {
|
|
116
|
-
console.error("❌ No workspace specified. Use -w flag or run 'deco configure' first.");
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
119
|
-
await listApps({ workspace });
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
console.error("❌ Failed to list apps:", error instanceof Error ? error.message : String(error));
|
|
123
|
-
process.exit(1);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
// Hosting deploy command implementation
|
|
127
|
-
const hostingDeploy = new Command("deploy")
|
|
128
|
-
.description("Deploy the current directory into the current workspace.")
|
|
129
|
-
.option("-w, --workspace <workspace>", "Workspace name")
|
|
130
|
-
.option("-a, --app <app>", "App name")
|
|
131
|
-
.option("-y, --yes", "Skip confirmation")
|
|
132
|
-
.option("-p, --public", "Make the app public in the registry")
|
|
133
|
-
.option("-f, --force", "Force the deployment even if there are breaking changes")
|
|
134
|
-
.option("--dry-run", "Write deploy manifest to local filesystem instead of deploying")
|
|
135
|
-
.argument("[cwd]", "Working directory")
|
|
136
|
-
.action(async (cwd, options) => {
|
|
137
|
-
try {
|
|
138
|
-
const config = await getConfig({
|
|
139
|
-
inlineOptions: options,
|
|
140
|
-
});
|
|
141
|
-
const wranglerConfig = await readWranglerConfig();
|
|
142
|
-
const assetsDirectory = wranglerConfig.assets?.directory;
|
|
143
|
-
const app = options.app ??
|
|
144
|
-
(typeof wranglerConfig.name === "string"
|
|
145
|
-
? wranglerConfig.name
|
|
146
|
-
: "my-app");
|
|
147
|
-
await deploy({
|
|
148
|
-
...config,
|
|
149
|
-
app,
|
|
150
|
-
skipConfirmation: options.yes,
|
|
151
|
-
cwd: cwd ?? process.cwd(),
|
|
152
|
-
unlisted: !options.public,
|
|
153
|
-
assetsDirectory,
|
|
154
|
-
force: options.force,
|
|
155
|
-
dryRun: options.dryRun,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
console.error("❌ Deployment failed:", error instanceof Error ? error.message : JSON.stringify(error));
|
|
160
|
-
process.exit(1);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
// Hosting promote command implementation
|
|
164
|
-
const hostingPromote = new Command("promote")
|
|
165
|
-
.description("Promote a deployment to an existing route pattern.")
|
|
166
|
-
.option("-w, --workspace <workspace>", "Workspace name")
|
|
167
|
-
.option("-a, --app <app>", "App name")
|
|
168
|
-
.option("-d, --deployment <deployment>", "Deployment ID")
|
|
169
|
-
.option("-r, --route <route>", "Route pattern (defaults to appName.deco.page)")
|
|
170
|
-
.option("-y, --yes", "Skip confirmation")
|
|
171
|
-
.action(async (options) => {
|
|
172
|
-
try {
|
|
173
|
-
const config = await getConfig({
|
|
174
|
-
inlineOptions: options,
|
|
175
|
-
});
|
|
176
|
-
let app = options.app;
|
|
177
|
-
if (!app) {
|
|
178
|
-
try {
|
|
179
|
-
const wranglerConfig = await readWranglerConfig();
|
|
180
|
-
app =
|
|
181
|
-
typeof wranglerConfig.name === "string"
|
|
182
|
-
? wranglerConfig.name
|
|
183
|
-
: undefined;
|
|
184
|
-
}
|
|
185
|
-
catch {
|
|
186
|
-
// No wrangler config found, app will remain undefined
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
await promoteApp({
|
|
190
|
-
workspace: config.workspace,
|
|
191
|
-
local: config.local,
|
|
192
|
-
appSlug: app,
|
|
193
|
-
deploymentId: options.deployment,
|
|
194
|
-
routePattern: options.route,
|
|
195
|
-
skipConfirmation: options.yes,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
console.error("❌ Promotion failed:", error instanceof Error ? error.message : String(error));
|
|
200
|
-
process.exit(1);
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
// Link command implementation
|
|
204
|
-
const linkCmd = new Command("link")
|
|
205
|
-
.description("Link the project to be accessed through a remote domain.")
|
|
206
|
-
.option("-p, --port <port>", "Port to link", parseInt)
|
|
207
|
-
.allowUnknownOption()
|
|
208
|
-
.action(async (options, cmd) => {
|
|
209
|
-
try {
|
|
210
|
-
const runCommand = cmd.args;
|
|
211
|
-
await link({
|
|
212
|
-
port: options.port,
|
|
213
|
-
onBeforeRegister: () => {
|
|
214
|
-
if (runCommand.length === 0) {
|
|
215
|
-
console.log("⚠️ No command provided. Tunnel will connect to existing service on port.");
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const [command, ...args] = runCommand;
|
|
219
|
-
console.log(`🔗 Starting command: ${command} ${args.join(" ")}`);
|
|
220
|
-
const childProcess = spawn(command, args, {
|
|
221
|
-
stdio: "inherit",
|
|
222
|
-
shell: true,
|
|
223
|
-
});
|
|
224
|
-
childProcess.on("error", (error) => {
|
|
225
|
-
console.error("❌ Failed to start command:", error.message);
|
|
226
|
-
process.exit(1);
|
|
227
|
-
});
|
|
228
|
-
return childProcess;
|
|
229
|
-
},
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
catch (error) {
|
|
233
|
-
console.error("❌ Link failed:", error instanceof Error ? error.message : String(error));
|
|
234
|
-
process.exit(1);
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
const upgrade = new Command("upgrade")
|
|
238
|
-
.description("Upgrade the deco CLI to the latest version.")
|
|
239
|
-
.action(upgradeCommand);
|
|
240
|
-
const update = new Command("update")
|
|
241
|
-
.description("Update Deco dependencies to their latest versions.")
|
|
242
|
-
.option("-y, --yes", "Skip confirmation prompts")
|
|
243
|
-
.action(async (options) => {
|
|
244
|
-
try {
|
|
245
|
-
await updateCommand({ yes: options.yes });
|
|
246
|
-
}
|
|
247
|
-
catch (error) {
|
|
248
|
-
console.error("❌ Update failed:", error instanceof Error ? error.message : String(error));
|
|
249
|
-
process.exit(1);
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
// Dev command implementation
|
|
253
|
-
const dev = new Command("dev")
|
|
254
|
-
.description("Start a development server.")
|
|
255
|
-
.option("--clean-build-dir <directory>", "Clean the build directory before starting the development server", (directory) => {
|
|
256
|
-
return {
|
|
257
|
-
enabled: true,
|
|
258
|
-
directory,
|
|
259
|
-
};
|
|
260
|
-
})
|
|
261
|
-
.action((options) => {
|
|
262
|
-
devCommand({
|
|
263
|
-
cleanBuildDirectory: options.cleanBuildDir,
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
// Create command implementation
|
|
267
|
-
const create = new Command("create")
|
|
268
|
-
.description("Create a new project from a template.")
|
|
269
|
-
.argument("[project-name]", "Name of the project")
|
|
270
|
-
.action(async (projectName) => {
|
|
271
|
-
try {
|
|
272
|
-
const config = await getConfig().catch(() => ({}));
|
|
273
|
-
await createCommand(projectName, config);
|
|
274
|
-
}
|
|
275
|
-
catch (error) {
|
|
276
|
-
console.error("❌ Project creation failed:", error instanceof Error ? error.message : String(error));
|
|
277
|
-
process.exit(1);
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
// Add command implementation
|
|
281
|
-
const add = new Command("add")
|
|
282
|
-
.description("Add integrations to the current project.")
|
|
283
|
-
.option("-w, --workspace <workspace>", "Workspace name")
|
|
284
|
-
.action(async (options) => {
|
|
285
|
-
try {
|
|
286
|
-
await addCommand({
|
|
287
|
-
workspace: options.workspace,
|
|
288
|
-
local: getLocal(),
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
catch (error) {
|
|
292
|
-
console.error("❌ Failed to add integrations:", error instanceof Error ? error.message : String(error));
|
|
293
|
-
process.exit(1);
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
// Hosting parent command
|
|
297
|
-
const hosting = new Command("hosting")
|
|
298
|
-
.description("Manage hosting apps in a workspace.")
|
|
299
|
-
.addCommand(hostingList)
|
|
300
|
-
.addCommand(hostingDeploy)
|
|
301
|
-
.addCommand(hostingPromote);
|
|
302
|
-
const gen = new Command("gen")
|
|
303
|
-
.description("Generate the environment that will be used to run the app.")
|
|
304
|
-
.option("-s, --self <url>", "Useful to generate a SELF binding for own types based on local mcp server.")
|
|
305
|
-
.option("-o, --output <path>", "Output path for the generated environment file.")
|
|
306
|
-
.action(async (options) => {
|
|
307
|
-
try {
|
|
308
|
-
const wranglerConfig = await readWranglerConfig();
|
|
309
|
-
const config = await getConfig({});
|
|
310
|
-
const env = await genEnv({
|
|
311
|
-
workspace: config.workspace,
|
|
312
|
-
local: config.local,
|
|
313
|
-
bindings: config.bindings,
|
|
314
|
-
selfUrl: options.self ??
|
|
315
|
-
`https://${getAppDomain(config.workspace, wranglerConfig.name ?? "my-app")}/mcp`,
|
|
316
|
-
});
|
|
317
|
-
if (options.output) {
|
|
318
|
-
await writeFile(options.output, env);
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
console.log(env);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
catch (error) {
|
|
325
|
-
console.error("❌ Failed to generate environment:", error instanceof Error ? error.message : String(error));
|
|
326
|
-
process.exit(1);
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
// Main CLI program
|
|
330
|
-
const program = new Command()
|
|
331
|
-
.name(packageJson.name)
|
|
332
|
-
.version(packageJson.version)
|
|
333
|
-
.description(packageJson.description)
|
|
334
|
-
.configureOutput({
|
|
335
|
-
writeOut: (str) => {
|
|
336
|
-
// Customize version output to include runtime info
|
|
337
|
-
if (str.includes(packageJson.version) &&
|
|
338
|
-
str.trim() === packageJson.version) {
|
|
339
|
-
const runtime = detectRuntime();
|
|
340
|
-
process.stdout.write(`${packageJson.version} (${runtime})\n`);
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
process.stdout.write(str);
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
|
-
writeErr: (str) => process.stderr.write(str),
|
|
347
|
-
})
|
|
348
|
-
.option("-t, --token <token>", "Authentication token to use for API requests", (token) => {
|
|
349
|
-
setToken(token);
|
|
350
|
-
})
|
|
351
|
-
.option("-l, --local", `Deploy the app locally (Needs deco.chat running at ${DECO_CHAT_API_LOCAL})`, () => {
|
|
352
|
-
setLocal(true);
|
|
353
|
-
})
|
|
354
|
-
.addHelpText("after", () => {
|
|
355
|
-
const runtime = detectRuntime();
|
|
356
|
-
return `\nRuntime: ${runtime}`;
|
|
357
|
-
})
|
|
358
|
-
.addCommand(login)
|
|
359
|
-
.addCommand(logout)
|
|
360
|
-
.addCommand(whoami)
|
|
361
|
-
.addCommand(hosting)
|
|
362
|
-
.addCommand(hostingDeploy)
|
|
363
|
-
.addCommand(hostingPromote)
|
|
364
|
-
.addCommand(dev)
|
|
365
|
-
.addCommand(configure)
|
|
366
|
-
.addCommand(add)
|
|
367
|
-
.addCommand(upgrade)
|
|
368
|
-
.addCommand(update)
|
|
369
|
-
.addCommand(linkCmd)
|
|
370
|
-
.addCommand(gen)
|
|
371
|
-
.addCommand(create);
|
|
372
|
-
program.parse();
|
|
373
|
-
//# sourceMappingURL=cli.js.map
|