withvibe 0.1.4
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 +93 -0
- package/README.md +67 -0
- package/dist/api.js +29 -0
- package/dist/api.js.map +1 -0
- package/dist/assets/docker-compose.yml +130 -0
- package/dist/config.js +48 -0
- package/dist/config.js.map +1 -0
- package/dist/env-command.js +331 -0
- package/dist/env-command.js.map +1 -0
- package/dist/exec.js +35 -0
- package/dist/exec.js.map +1 -0
- package/dist/git-auth.js +64 -0
- package/dist/git-auth.js.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/install/anthropic-validate.js +73 -0
- package/dist/install/anthropic-validate.js.map +1 -0
- package/dist/install/build-images.js +99 -0
- package/dist/install/build-images.js.map +1 -0
- package/dist/install/commands/build-images-cmd.js +68 -0
- package/dist/install/commands/build-images-cmd.js.map +1 -0
- package/dist/install/commands/configure.js +276 -0
- package/dist/install/commands/configure.js.map +1 -0
- package/dist/install/commands/lifecycle.js +129 -0
- package/dist/install/commands/lifecycle.js.map +1 -0
- package/dist/install/commands/uninstall.js +88 -0
- package/dist/install/commands/uninstall.js.map +1 -0
- package/dist/install/commands/upgrade.js +164 -0
- package/dist/install/commands/upgrade.js.map +1 -0
- package/dist/install/compose-rewriter.js +298 -0
- package/dist/install/compose-rewriter.js.map +1 -0
- package/dist/install/compose.js +118 -0
- package/dist/install/compose.js.map +1 -0
- package/dist/install/doctor.js +176 -0
- package/dist/install/doctor.js.map +1 -0
- package/dist/install/env-file.js +63 -0
- package/dist/install/env-file.js.map +1 -0
- package/dist/install/exec.js +32 -0
- package/dist/install/exec.js.map +1 -0
- package/dist/install/images.js +78 -0
- package/dist/install/images.js.map +1 -0
- package/dist/install/init.js +584 -0
- package/dist/install/init.js.map +1 -0
- package/dist/install/log.js +15 -0
- package/dist/install/log.js.map +1 -0
- package/dist/install/paths.js +26 -0
- package/dist/install/paths.js.map +1 -0
- package/dist/install/ports.js +23 -0
- package/dist/install/ports.js.map +1 -0
- package/dist/install/register.js +155 -0
- package/dist/install/register.js.map +1 -0
- package/dist/install/secrets.js +9 -0
- package/dist/install/secrets.js.map +1 -0
- package/dist/install/state.js +29 -0
- package/dist/install/state.js.map +1 -0
- package/dist/login.js +56 -0
- package/dist/login.js.map +1 -0
- package/dist/ports.js +33 -0
- package/dist/ports.js.map +1 -0
- package/dist/preflight.js +150 -0
- package/dist/preflight.js.map +1 -0
- package/package.json +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WithVibe
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject
|
|
14
|
+
to the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
27
|
+
of the licensor in the software. Any use of the licensor's trademarks is subject
|
|
28
|
+
to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
+
also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that organization.
|
|
84
|
+
**control** means ownership of substantially all the assets of an entity, or
|
|
85
|
+
the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# withvibe
|
|
2
|
+
|
|
3
|
+
CLI to run a withvibe environment locally — clones the repos defined by the
|
|
4
|
+
env, boots its `docker-compose` stack, and opens it in VSCode.
|
|
5
|
+
|
|
6
|
+
Binary name: `withvibe`.
|
|
7
|
+
|
|
8
|
+
## Install (from source)
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm --filter withvibe build
|
|
12
|
+
node packages/cli/dist/index.js --help
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
To use the `withvibe` name globally, link the package:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cd packages/cli && pnpm link --global
|
|
19
|
+
withvibe --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Commands
|
|
23
|
+
|
|
24
|
+
### `withvibe login`
|
|
25
|
+
|
|
26
|
+
Authorize this machine against a withvibe server. Stores a CLI token in your
|
|
27
|
+
OS keyring (or falls back to a config file).
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
withvibe login
|
|
31
|
+
withvibe login --force # re-auth even if a token exists
|
|
32
|
+
withvibe --server <url> login # point at a non-default server
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### `withvibe env <envId>`
|
|
36
|
+
|
|
37
|
+
Set up the given env on this machine: pre-flight checks, GitHub-account
|
|
38
|
+
confirmation, repo cloning, port allocation, then `docker compose up -d`, and
|
|
39
|
+
finally launches VSCode.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
withvibe env env_abc123
|
|
43
|
+
withvibe env env_abc123 --no-open # skip VSCode launch
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Configuration
|
|
47
|
+
|
|
48
|
+
| Flag / env var | Purpose | Default |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `--server <url>` / `WITHVIBE_SERVER` | Withvibe web server URL | `http://localhost:3000` |
|
|
51
|
+
|
|
52
|
+
## How it works
|
|
53
|
+
|
|
54
|
+
1. **Preflight** — checks `git`, `docker`, `gh`, and `code` are on `PATH`.
|
|
55
|
+
2. **GitHub auth** — uses `gh auth status` to show which account git will use, with a prompt to switch.
|
|
56
|
+
3. **Repo clone** — clones each repo declared by the env into a per-env workspace folder.
|
|
57
|
+
4. **Ports** — allocates host ports and wires them into the compose project.
|
|
58
|
+
5. **`docker compose up -d`** — starts the env's services.
|
|
59
|
+
6. **VSCode** — opens the workspace folder.
|
|
60
|
+
|
|
61
|
+
## Links
|
|
62
|
+
|
|
63
|
+
- Website / docs: <https://withvibe.dev>
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
Elastic License 2.0 — see the [root LICENSE](../../LICENSE).
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Thin wrapper around the web app's HTTP endpoints used by the CLI.
|
|
2
|
+
// The server URL always points at the Next.js web app (not the Nest API) —
|
|
3
|
+
// web is the auth edge and mints the internal JWT to call Nest.
|
|
4
|
+
async function request(server, path, init = {}) {
|
|
5
|
+
const url = `${server.replace(/\/$/, "")}${path}`;
|
|
6
|
+
const res = await fetch(url, init);
|
|
7
|
+
if (!res.ok) {
|
|
8
|
+
const body = await res.text().catch(() => "");
|
|
9
|
+
throw new Error(`${init.method || "GET"} ${path} → ${res.status} ${res.statusText}${body ? `\n${body}` : ""}`);
|
|
10
|
+
}
|
|
11
|
+
return (await res.json());
|
|
12
|
+
}
|
|
13
|
+
export async function initiateLogin(server, label) {
|
|
14
|
+
return request(server, "/api/cli-auth/initiate", {
|
|
15
|
+
method: "POST",
|
|
16
|
+
headers: { "content-type": "application/json" },
|
|
17
|
+
body: JSON.stringify({ label }),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export async function pollLogin(server, code) {
|
|
21
|
+
return request(server, `/api/cli-auth/poll?code=${encodeURIComponent(code)}`);
|
|
22
|
+
}
|
|
23
|
+
export async function fetchLocalBundle(server, token, envId) {
|
|
24
|
+
return request(server, `/api/envs/${encodeURIComponent(envId)}/local-bundle`, { headers: { authorization: `Bearer ${token}` } });
|
|
25
|
+
}
|
|
26
|
+
export async function fetchExportReadiness(server, token, envId) {
|
|
27
|
+
return request(server, `/api/envs/${encodeURIComponent(envId)}/export-readiness`, { headers: { authorization: `Bearer ${token}` } });
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,2EAA2E;AAC3E,gEAAgE;AAiChE,KAAK,UAAU,OAAO,CACpB,MAAc,EACd,IAAY,EACZ,OAAoB,EAAE;IAEtB,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;IAClD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,IAAI,IAAI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|
|
3
|
+
# - api: NestJS, drives Docker via DooD (host socket mounted in)
|
|
4
|
+
# - web: Next.js standalone server, proxies auth routes to api over the
|
|
5
|
+
# compose network
|
|
6
|
+
#
|
|
7
|
+
# Two ways to run this:
|
|
8
|
+
#
|
|
9
|
+
# A) From source (this repo):
|
|
10
|
+
# cp .env.example .env && edit secrets
|
|
11
|
+
# docker compose up -d --build
|
|
12
|
+
#
|
|
13
|
+
# B) From a prebuilt bundle (no source on the target host):
|
|
14
|
+
# ./scripts/build-bundle.sh # locally, produces dist/withvibe-deploy.tar.gz
|
|
15
|
+
# scp dist/withvibe-deploy.tar.gz user@host:~ && ssh user@host
|
|
16
|
+
# tar -xzf withvibe-deploy.tar.gz && cd withvibe-deploy-*
|
|
17
|
+
# docker load -i images.tar
|
|
18
|
+
# cp .env.example .env && edit secrets
|
|
19
|
+
# docker compose up -d
|
|
20
|
+
#
|
|
21
|
+
# Production posture: bring-your-own reverse proxy / TLS in front of :3000.
|
|
22
|
+
|
|
23
|
+
name: withvibe
|
|
24
|
+
|
|
25
|
+
services:
|
|
26
|
+
postgres:
|
|
27
|
+
image: postgres:17-alpine
|
|
28
|
+
restart: unless-stopped
|
|
29
|
+
environment:
|
|
30
|
+
POSTGRES_USER: ${POSTGRES_USER:-withvibe}
|
|
31
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-withvibe}
|
|
32
|
+
POSTGRES_DB: ${POSTGRES_DB:-withvibe}
|
|
33
|
+
volumes:
|
|
34
|
+
- postgres-data:/var/lib/postgresql/data
|
|
35
|
+
healthcheck:
|
|
36
|
+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-withvibe} -d ${POSTGRES_DB:-withvibe}"]
|
|
37
|
+
interval: 5s
|
|
38
|
+
timeout: 3s
|
|
39
|
+
retries: 20
|
|
40
|
+
networks: [withvibe]
|
|
41
|
+
|
|
42
|
+
api:
|
|
43
|
+
image: withvibe/api:${WITHVIBE_VERSION:-latest}
|
|
44
|
+
build:
|
|
45
|
+
context: .
|
|
46
|
+
dockerfile: apps/api/Dockerfile
|
|
47
|
+
restart: unless-stopped
|
|
48
|
+
depends_on:
|
|
49
|
+
postgres:
|
|
50
|
+
condition: service_healthy
|
|
51
|
+
environment:
|
|
52
|
+
DATABASE_URL: postgresql://${POSTGRES_USER:-withvibe}:${POSTGRES_PASSWORD:-withvibe}@postgres:5432/${POSTGRES_DB:-withvibe}
|
|
53
|
+
INTERNAL_JWT_SECRET: ${INTERNAL_JWT_SECRET}
|
|
54
|
+
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
|
|
55
|
+
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
|
|
56
|
+
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
|
|
57
|
+
GITHUB_TOKEN: ${GITHUB_TOKEN}
|
|
58
|
+
WEB_PUBLIC_URL: ${WEB_PUBLIC_URL:-http://localhost:3000}
|
|
59
|
+
API_PUBLIC_URL: ${API_PUBLIC_URL:-http://localhost:4000}
|
|
60
|
+
PUBLIC_HOST: ${PUBLIC_HOST:-localhost}
|
|
61
|
+
# Name of the external Docker network Traefik is attached to. The
|
|
62
|
+
# subdomain rewriter joins each exposed env service to this network
|
|
63
|
+
# and points Traefik labels at it. Must match the network's `name:`
|
|
64
|
+
# on the host. Defaults to the platform's own `withvibe` network when
|
|
65
|
+
# operators colocate Traefik there; set explicitly otherwise.
|
|
66
|
+
PROXY_NETWORK: ${PROXY_NETWORK:-withvibe}
|
|
67
|
+
# Traefik entrypoint name the env's router binds to (must match
|
|
68
|
+
# Traefik's static config — `websecure` is the platform default :443
|
|
69
|
+
# entrypoint).
|
|
70
|
+
TRAEFIK_ENTRYPOINT: ${TRAEFIK_ENTRYPOINT:-websecure}
|
|
71
|
+
# Traefik certresolver name for issuing TLS certs. Empty string
|
|
72
|
+
# disables TLS labels (useful when an upstream LB terminates TLS or
|
|
73
|
+
# for local plain-HTTP dev).
|
|
74
|
+
TRAEFIK_CERT_RESOLVER: ${TRAEFIK_CERT_RESOLVER:-letsencrypt}
|
|
75
|
+
REPO_BASE_DIR: ${REPO_BASE_DIR:-/root/.withvibe/repos}
|
|
76
|
+
# Persisted per-user `code tunnel` auth dirs. Mounted volume below.
|
|
77
|
+
CODE_TUNNEL_DATA_DIR: /var/lib/withvibe/code-tunnel
|
|
78
|
+
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
79
|
+
WITHVIBE_VERSION: ${WITHVIBE_VERSION:-latest}
|
|
80
|
+
NODE_ENV: production
|
|
81
|
+
PORT: "4000"
|
|
82
|
+
ports:
|
|
83
|
+
# Exposed for DooD-spawned runner sidecars that call back via
|
|
84
|
+
# host.docker.internal:4000 (CLAUDE_RUNNER_MCP_BASE_URL default). The
|
|
85
|
+
# host-side port is configurable via API_HOST_PORT so installs on
|
|
86
|
+
# boxes with :4000 already taken can map to e.g. 4001 transparently.
|
|
87
|
+
- "${API_HOST_PORT:-4000}:4000"
|
|
88
|
+
volumes:
|
|
89
|
+
# DooD: api drives the host docker daemon to spawn env sidecars.
|
|
90
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
|
91
|
+
# Path-parity bind mount: host and container see clones under the
|
|
92
|
+
# SAME absolute path, so when api emits `docker run -v <path>:...`
|
|
93
|
+
# the host daemon finds <path>.
|
|
94
|
+
- ${REPO_BASE_DIR:-/root/.withvibe/repos}:${REPO_BASE_DIR:-/root/.withvibe/repos}
|
|
95
|
+
# Persist `code tunnel` per-user auth dirs across redeploys so users
|
|
96
|
+
# don't have to re-run the device-code login every time.
|
|
97
|
+
- code-tunnel-data:/var/lib/withvibe/code-tunnel
|
|
98
|
+
extra_hosts:
|
|
99
|
+
# So spawned sidecars resolving host.docker.internal hit the host
|
|
100
|
+
# gateway on Linux too (Docker Desktop wires this automatically on
|
|
101
|
+
# Mac/Windows; this line is harmless there).
|
|
102
|
+
- "host.docker.internal:host-gateway"
|
|
103
|
+
networks: [withvibe]
|
|
104
|
+
|
|
105
|
+
web:
|
|
106
|
+
image: withvibe/web:${WITHVIBE_VERSION:-latest}
|
|
107
|
+
build:
|
|
108
|
+
context: .
|
|
109
|
+
dockerfile: apps/web/Dockerfile
|
|
110
|
+
restart: unless-stopped
|
|
111
|
+
depends_on:
|
|
112
|
+
- api
|
|
113
|
+
environment:
|
|
114
|
+
# Server-side rewrites (next.config.ts) point /api/auth/* and
|
|
115
|
+
# /api/cli-auth/* at this URL. Inside the compose network the api
|
|
116
|
+
# service is reachable as `api:4000`.
|
|
117
|
+
API_BASE_URL: http://api:4000
|
|
118
|
+
NODE_ENV: production
|
|
119
|
+
PORT: "3000"
|
|
120
|
+
ports:
|
|
121
|
+
- "${WEB_HOST_PORT:-3000}:3000"
|
|
122
|
+
networks: [withvibe]
|
|
123
|
+
|
|
124
|
+
volumes:
|
|
125
|
+
postgres-data:
|
|
126
|
+
code-tunnel-data:
|
|
127
|
+
|
|
128
|
+
networks:
|
|
129
|
+
withvibe:
|
|
130
|
+
name: withvibe
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
function configDir() {
|
|
5
|
+
return path.join(os.homedir(), ".withvibe");
|
|
6
|
+
}
|
|
7
|
+
function configPath() {
|
|
8
|
+
return path.join(configDir(), "config.json");
|
|
9
|
+
}
|
|
10
|
+
export async function loadConfig() {
|
|
11
|
+
try {
|
|
12
|
+
const raw = await fs.readFile(configPath(), "utf-8");
|
|
13
|
+
const parsed = JSON.parse(raw);
|
|
14
|
+
if (!parsed.server || !parsed.token)
|
|
15
|
+
return null;
|
|
16
|
+
return {
|
|
17
|
+
server: parsed.server,
|
|
18
|
+
token: parsed.token,
|
|
19
|
+
savedAt: parsed.savedAt || "",
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
const code = err.code;
|
|
24
|
+
if (code === "ENOENT")
|
|
25
|
+
return null;
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export async function saveConfig(cfg) {
|
|
30
|
+
await fs.mkdir(configDir(), { recursive: true, mode: 0o700 });
|
|
31
|
+
await fs.writeFile(configPath(), JSON.stringify(cfg, null, 2), {
|
|
32
|
+
mode: 0o600,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export async function clearConfig() {
|
|
36
|
+
try {
|
|
37
|
+
await fs.unlink(configPath());
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
if (err.code !== "ENOENT")
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Root the CLI uses for everything it creates on the user's machine.
|
|
45
|
+
export function withvibeHome() {
|
|
46
|
+
return path.join(os.homedir(), "withvibe");
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AAUzB,SAAS,SAAS;IAChB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,aAAa,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAuB,CAAC;QACrD,IAA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