codebay 0.0.1 → 0.2.1
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/.mochi/import-css/index-0nwv3654.css +18 -0
- package/.mochi/import-css/index-xndx4980.css +54 -0
- package/.mochi/manifest.json +1612 -0
- package/.mochi/server-island.js +1 -0
- package/.mochi/svelte-client/HydratableIsland-wrq79y0w.js +1 -0
- package/.mochi/svelte-client/_hydrate-AppShell_2rtnxn6pgp2rh-7xgbmxxg.js +2 -0
- package/.mochi/svelte-client/_hydrate-AvatarsView_257s9yq1wwr4f-3cnbjpz2.js +13 -0
- package/.mochi/svelte-client/_hydrate-InstanceView_2ma45l9bybfhl-2ntmdm3e.js +1 -0
- package/.mochi/svelte-client/_hydrate-SettingsView_8hmarwmf8onq-t08spym1.js +23 -0
- package/.mochi/svelte-client/chunk-04qv4w6w.js +2 -0
- package/.mochi/svelte-client/chunk-5jnepvzx.js +2 -0
- package/.mochi/svelte-client/chunk-hcztrd75.js +1 -0
- package/.mochi/svelte-client/chunk-qxwt25hn.js +4 -0
- package/.mochi/svelte-client/chunk-sjmcgh7f.js +2 -0
- package/.mochi/svelte-client/chunk-tr67wtwn.js +2 -0
- package/.mochi/svelte-compile/App-f0q5n4rk.server.js +1168 -0
- package/.mochi/svelte-compile/Avatars-p8gfef7x.server.js +332 -0
- package/.mochi/svelte-compile/ClientStats-z3tn9ad6.server.js +99 -0
- package/.mochi/svelte-compile/DefaultError-wh77vebf.server.js +52 -0
- package/.mochi/svelte-compile/Instance-atjwsczx.server.js +356 -0
- package/.mochi/svelte-compile/Settings-q88xw6h8.server.js +1173 -0
- package/.mochi/svelte-compile/chunk-4kwy539a.js +14 -0
- package/.mochi/svelte-compile/chunk-9bjk7yx6.js +81 -0
- package/.mochi/svelte-compile/chunk-btmcxhqy.js +58 -0
- package/.mochi/svelte-compile/chunk-sxqys3nw.js +1668 -0
- package/.mochi/svelte-compile/chunk-v6796ga4.js +3295 -0
- package/.mochi/svelte-compile/chunk-we0ggtws.js +34 -0
- package/.mochi/svelte-css/AppBar-3bxinv4pabv8l.css +1 -0
- package/.mochi/svelte-css/AppShell-36mpg5smnbmuw.css +1 -0
- package/.mochi/svelte-css/Avatar-24th63awm9mna.css +1 -0
- package/.mochi/svelte-css/AvatarEditor-1ryrs1md5g36y.css +1 -0
- package/.mochi/svelte-css/AvatarsView-3hq37u4dgtljn.css +1 -0
- package/.mochi/svelte-css/BackLink-2wlu0eovz9j86.css +1 -0
- package/.mochi/svelte-css/BranchBox-1yqu1q2mgnjwz.css +1 -0
- package/.mochi/svelte-css/Brand-1la7zw5uhcbl4.css +1 -0
- package/.mochi/svelte-css/Button-2vtbrzb5kgu25.css +1 -0
- package/.mochi/svelte-css/CheckmarkIcon-3qlazj2oc50jc.css +1 -0
- package/.mochi/svelte-css/ClientStats-19qzckq40p2q9.css +1 -0
- package/.mochi/svelte-css/CoinButton-1rej3sh3tkjud.css +1 -0
- package/.mochi/svelte-css/CredMenu-9hwgeptp7crb.css +1 -0
- package/.mochi/svelte-css/DashboardView-1cy4xpqhja9sx.css +1 -0
- package/.mochi/svelte-css/DefaultError-2b0daamydxgb2.css +1 -0
- package/.mochi/svelte-css/ErrorIcon-2x0tzsqxskw28.css +1 -0
- package/.mochi/svelte-css/FolderBrowser-1x428zb3f2kti.css +1 -0
- package/.mochi/svelte-css/HealthBox-er2her0jukwl.css +1 -0
- package/.mochi/svelte-css/IdeBar-2qoqi2ya9zdn3.css +1 -0
- package/.mochi/svelte-css/IdeLoader-26rlko8e00j3g.css +1 -0
- package/.mochi/svelte-css/InstanceCard-16f77aysm7lgp.css +1 -0
- package/.mochi/svelte-css/InstanceView-wq85bxtusont.css +1 -0
- package/.mochi/svelte-css/LoaderIcon-soq5wt3p05ye.css +1 -0
- package/.mochi/svelte-css/PortsBox-1t25b5yg7jva3.css +1 -0
- package/.mochi/svelte-css/SettingsCog-jftyadvo64qo.css +1 -0
- package/.mochi/svelte-css/SettingsView-1nfdwnm16cpp2.css +1 -0
- package/.mochi/svelte-css/Skeleton-8k69usiju43h.css +1 -0
- package/.mochi/svelte-css/StatusBadge-3mq0j7z6aq4j.css +1 -0
- package/.mochi/svelte-css/ThemePicker-1ir8jyocm8mvi.css +1 -0
- package/.mochi/svelte-css/ToastBar-3havgkmtofntq.css +1 -0
- package/.mochi/svelte-css/ToastIcon-2z5wrkc95khg0.css +1 -0
- package/.mochi/svelte-css/ToastMessage-2jfwb2og2lfa8.css +1 -0
- package/.mochi/svelte-css/ToastWrapper-1fbnym10rm2nv.css +1 -0
- package/.mochi/svelte-css/Toaster-kk60j193854n.css +1 -0
- package/.mochi/svelte-css/TopBar-2q87li6yt8ids.css +1 -0
- package/LICENSE +21 -0
- package/README.md +34 -3
- package/bin/codebay.ts +22 -0
- package/migrations/0001_init.sql +20 -0
- package/migrations/0002_port_forwards.sql +9 -0
- package/migrations/0003_options.sql +4 -0
- package/migrations/0004_instance_image.sql +1 -0
- package/package.json +87 -9
- package/public/sounds/done.wav +0 -0
- package/public/sounds/waiting.wav +0 -0
- package/src/__fixtures__/HelloWorld.svelte +4 -0
- package/src/additional-svelte-typings.d.ts +1 -0
- package/src/api.ts +61 -0
- package/src/avatars/anchor.ts +17 -0
- package/src/avatars/bear.ts +17 -0
- package/src/avatars/bee.ts +17 -0
- package/src/avatars/bob-marley.ts +17 -0
- package/src/avatars/car.ts +17 -0
- package/src/avatars/carpathians.ts +17 -0
- package/src/avatars/cat-body.ts +17 -0
- package/src/avatars/cat-sits.ts +17 -0
- package/src/avatars/cat.ts +17 -0
- package/src/avatars/celtic-cross.ts +17 -0
- package/src/avatars/cherry.ts +17 -0
- package/src/avatars/cotton.ts +17 -0
- package/src/avatars/crab.ts +17 -0
- package/src/avatars/crown.ts +17 -0
- package/src/avatars/diamond.ts +17 -0
- package/src/avatars/dog.ts +17 -0
- package/src/avatars/elephant.ts +17 -0
- package/src/avatars/fish.ts +17 -0
- package/src/avatars/fleur-de-lis.ts +17 -0
- package/src/avatars/flower.ts +17 -0
- package/src/avatars/fox.ts +17 -0
- package/src/avatars/frog.ts +17 -0
- package/src/avatars/ghost.ts +17 -0
- package/src/avatars/giraffe.ts +17 -0
- package/src/avatars/glasses.ts +17 -0
- package/src/avatars/heart.ts +17 -0
- package/src/avatars/index.ts +128 -0
- package/src/avatars/invader.ts +17 -0
- package/src/avatars/kangaroo.ts +17 -0
- package/src/avatars/key.ts +17 -0
- package/src/avatars/lightning.ts +17 -0
- package/src/avatars/mushroom.ts +17 -0
- package/src/avatars/name-prompts.ts +30 -0
- package/src/avatars/octopus.ts +17 -0
- package/src/avatars/owl.ts +17 -0
- package/src/avatars/penguin.ts +17 -0
- package/src/avatars/planet.ts +17 -0
- package/src/avatars/rabbit.ts +17 -0
- package/src/avatars/rat.ts +17 -0
- package/src/avatars/robot.ts +17 -0
- package/src/avatars/rocket.ts +17 -0
- package/src/avatars/sea.ts +17 -0
- package/src/avatars/serialize.ts +65 -0
- package/src/avatars/skull.ts +17 -0
- package/src/avatars/snail.ts +17 -0
- package/src/avatars/snake.ts +17 -0
- package/src/avatars/snakegame.ts +17 -0
- package/src/avatars/star.ts +17 -0
- package/src/avatars/svelte.ts +17 -0
- package/src/avatars/target.ts +17 -0
- package/src/avatars/tree.ts +17 -0
- package/src/avatars/types.ts +24 -0
- package/src/avatars/ukraine.ts +17 -0
- package/src/avatars/whale.ts +17 -0
- package/src/avatars/wheat.ts +17 -0
- package/src/avatars/yinyan.ts +17 -0
- package/src/components/AppBar.svelte +35 -0
- package/src/components/AppShell.svelte +302 -0
- package/src/components/Avatar.svelte +235 -0
- package/src/components/AvatarEditor.svelte +297 -0
- package/src/components/AvatarsView.svelte +115 -0
- package/src/components/BranchBox.svelte +32 -0
- package/src/components/Brand.svelte +41 -0
- package/src/components/Button.svelte +161 -0
- package/src/components/CoinButton.svelte +121 -0
- package/src/components/CredMenu.svelte +171 -0
- package/src/components/DashboardView.svelte +198 -0
- package/src/components/FolderBrowser.svelte +635 -0
- package/src/components/HealthBox.svelte +161 -0
- package/src/components/IdeBar.svelte +186 -0
- package/src/components/IdeLoader.svelte +135 -0
- package/src/components/InstanceCard.svelte +220 -0
- package/src/components/InstanceView.svelte +567 -0
- package/src/components/PortsBox.svelte +74 -0
- package/src/components/SettingsCog.svelte +22 -0
- package/src/components/SettingsView.svelte +1494 -0
- package/src/components/Skeleton.svelte +43 -0
- package/src/components/StatusBadge.svelte +54 -0
- package/src/components/ThemePicker.svelte +77 -0
- package/src/components/TopBar.svelte +64 -0
- package/src/components/UiShowcase.svelte +578 -0
- package/src/components/ui-showcase/ComponentDemo.svelte +85 -0
- package/src/container-injections/attention-hooks.ts +117 -0
- package/src/container-injections/claude-aliases.ts +43 -0
- package/src/container-injections/claude-code-credentials.ts +145 -0
- package/src/container-injections/claude-code-custom.ts +125 -0
- package/src/container-injections/claude-no-coauthor.ts +35 -0
- package/src/container-injections/claude-skip-permissions.ts +38 -0
- package/src/container-injections/claude-statusline.ts +109 -0
- package/src/container-injections/git-identity.ts +63 -0
- package/src/container-injections/git-safe-directory.ts +18 -0
- package/src/container-injections/github-credentials.ts +162 -0
- package/src/container-injections/host-env-vars.ts +108 -0
- package/src/container-injections/tmux.ts +67 -0
- package/src/fontsource.d.ts +3 -0
- package/src/index.ts +81 -0
- package/src/lib/auth.server.ts +95 -0
- package/src/lib/bridge.server.ts +34 -0
- package/src/lib/config.server.ts +140 -0
- package/src/lib/crypto.server.ts +12 -0
- package/src/lib/db.server.ts +196 -0
- package/src/lib/devcontainer.server.ts +511 -0
- package/src/lib/docker-client.server.ts +61 -0
- package/src/lib/docker.server.ts +139 -0
- package/src/lib/exec.server.ts +92 -0
- package/src/lib/git.server.ts +68 -0
- package/src/lib/health.server.ts +105 -0
- package/src/lib/injections.server.ts +72 -0
- package/src/lib/instances.server.ts +552 -0
- package/src/lib/links.ts +9 -0
- package/src/lib/picker.server.ts +46 -0
- package/src/lib/ports.server.ts +9 -0
- package/src/lib/proxy.server.ts +170 -0
- package/src/lib/repo-url.ts +60 -0
- package/src/lib/spawn.server.ts +14 -0
- package/src/lib/theme.server.ts +22 -0
- package/src/live.ts +50 -0
- package/src/pages/App.svelte +14 -0
- package/src/pages/Avatars.svelte +9 -0
- package/src/pages/Instance.svelte +9 -0
- package/src/pages/Settings.svelte +76 -0
- package/src/pages/UI.svelte +10 -0
- package/src/routes.ts +444 -0
- package/src/settings.ts +14 -0
- package/src/shell.html +100 -0
- package/src/sound.ts +69 -0
- package/src/theme.ts +24 -0
- package/src/types.ts +79 -0
- package/svelte.config.js +5 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
Icon
|
|
4
|
+
} from "./chunk-v6796ga4.js";
|
|
5
|
+
|
|
6
|
+
// node_modules/@lucide/svelte/dist/icons/x.svelte
|
|
7
|
+
import"svelte/internal/flags/async";
|
|
8
|
+
import * as $ from "svelte/internal/server";
|
|
9
|
+
function X($$renderer, $$props) {
|
|
10
|
+
let { $$slots, $$events, ...props } = $$props;
|
|
11
|
+
const iconNode = [["path", { d: "M18 6 6 18" }], ["path", { d: "m6 6 12 12" }]];
|
|
12
|
+
Icon($$renderer, $.spread_props([{ name: "x" }, props, { iconNode }]));
|
|
13
|
+
}
|
|
14
|
+
export { X };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
Icon
|
|
4
|
+
} from "./chunk-v6796ga4.js";
|
|
5
|
+
|
|
6
|
+
// node_modules/@lucide/svelte/dist/icons/plus.svelte
|
|
7
|
+
import"svelte/internal/flags/async";
|
|
8
|
+
import * as $ from "svelte/internal/server";
|
|
9
|
+
function Plus($$renderer, $$props) {
|
|
10
|
+
let { $$slots, $$events, ...props } = $$props;
|
|
11
|
+
const iconNode = [["path", { d: "M5 12h14" }], ["path", { d: "M12 5v14" }]];
|
|
12
|
+
Icon($$renderer, $.spread_props([{ name: "plus" }, props, { iconNode }]));
|
|
13
|
+
}
|
|
14
|
+
// src/settings.ts
|
|
15
|
+
var SOUND_KEY = "codebay.sound";
|
|
16
|
+
function soundEnabled() {
|
|
17
|
+
if (typeof localStorage === "undefined")
|
|
18
|
+
return true;
|
|
19
|
+
return localStorage.getItem(SOUND_KEY) !== "off";
|
|
20
|
+
}
|
|
21
|
+
function setSoundEnabled(on) {
|
|
22
|
+
if (typeof localStorage === "undefined")
|
|
23
|
+
return;
|
|
24
|
+
localStorage.setItem(SOUND_KEY, on ? "on" : "off");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/sound.ts
|
|
28
|
+
var SOUNDS = {
|
|
29
|
+
done: "/sounds/done.wav",
|
|
30
|
+
waiting: "/sounds/waiting.wav"
|
|
31
|
+
};
|
|
32
|
+
var elements = {};
|
|
33
|
+
var unlocked = false;
|
|
34
|
+
function element(name) {
|
|
35
|
+
if (typeof window === "undefined")
|
|
36
|
+
return null;
|
|
37
|
+
let el = elements[name];
|
|
38
|
+
if (!el) {
|
|
39
|
+
el = new Audio(SOUNDS[name]);
|
|
40
|
+
el.preload = "auto";
|
|
41
|
+
elements[name] = el;
|
|
42
|
+
}
|
|
43
|
+
return el;
|
|
44
|
+
}
|
|
45
|
+
function unlockAudio() {
|
|
46
|
+
if (unlocked || typeof window === "undefined")
|
|
47
|
+
return;
|
|
48
|
+
unlocked = true;
|
|
49
|
+
for (const name of Object.keys(SOUNDS)) {
|
|
50
|
+
const el = element(name);
|
|
51
|
+
if (!el)
|
|
52
|
+
continue;
|
|
53
|
+
const { volume } = el;
|
|
54
|
+
el.volume = 0;
|
|
55
|
+
el.play().then(() => {
|
|
56
|
+
el.pause();
|
|
57
|
+
el.currentTime = 0;
|
|
58
|
+
el.volume = volume;
|
|
59
|
+
}).catch(() => {
|
|
60
|
+
el.volume = volume;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function playChime(state) {
|
|
65
|
+
if (!soundEnabled()) {
|
|
66
|
+
console.log(`[chime] playChime(${state}) \u2014 skipped (sound disabled in settings)`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const el = element(state);
|
|
70
|
+
if (!el) {
|
|
71
|
+
console.log(`[chime] playChime(${state}) \u2014 no audio element (SSR/no window?)`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!unlocked) {
|
|
75
|
+
console.warn(`[chime] playChime(${state}) \u2014 audio not yet unlocked; browser may block until the page is interacted with`);
|
|
76
|
+
}
|
|
77
|
+
el.currentTime = 0;
|
|
78
|
+
el.play().then(() => console.log(`[chime] playChime(${state}) \u2014 playing`)).catch((err) => console.warn(`[chime] playChime(${state}) \u2014 play rejected:`, err?.message ?? err));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { Plus, soundEnabled, setSoundEnabled, unlockAudio, playChime };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/types.ts
|
|
3
|
+
function ideUrl(instance) {
|
|
4
|
+
const base = `/p/${instance.id}/`;
|
|
5
|
+
return instance.remote_workspace_folder ? `${base}?folder=${encodeURIComponent(instance.remote_workspace_folder)}` : base;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// src/api.ts
|
|
9
|
+
var APP_REQUEST_HEADER = "X-Codebay-Request";
|
|
10
|
+
async function apiFetch(url, init, fallbackMessage = "Request failed") {
|
|
11
|
+
const res = await fetch(url, {
|
|
12
|
+
...init,
|
|
13
|
+
headers: {
|
|
14
|
+
...init?.headers,
|
|
15
|
+
[APP_REQUEST_HEADER]: "1"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
if (!res.ok) {
|
|
19
|
+
const data = await res.json().catch(() => null);
|
|
20
|
+
throw new Error(data?.error?.message ?? fallbackMessage);
|
|
21
|
+
}
|
|
22
|
+
return await res.json().catch(() => ({}));
|
|
23
|
+
}
|
|
24
|
+
function apiPost(url, body, fallbackMessage) {
|
|
25
|
+
return apiJson("POST", url, body, fallbackMessage);
|
|
26
|
+
}
|
|
27
|
+
function apiDelete(url, body, fallbackMessage) {
|
|
28
|
+
return apiJson("DELETE", url, body, fallbackMessage);
|
|
29
|
+
}
|
|
30
|
+
function apiJson(method, url, body, fallbackMessage) {
|
|
31
|
+
return apiFetch(url, body === undefined ? { method } : {
|
|
32
|
+
method,
|
|
33
|
+
headers: { "Content-Type": "application/json" },
|
|
34
|
+
body: JSON.stringify(body)
|
|
35
|
+
}, fallbackMessage);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/lib/links.ts
|
|
39
|
+
function forwardedPortUrl(hostPort) {
|
|
40
|
+
const host = typeof window === "undefined" ? "localhost" : window.location.hostname;
|
|
41
|
+
return `http://${host}:${hostPort}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/components/StatusBadge.svelte
|
|
45
|
+
import"svelte/internal/flags/async";
|
|
46
|
+
import * as $ from "svelte/internal/server";
|
|
47
|
+
function StatusBadge($$renderer, $$props) {
|
|
48
|
+
let { status } = $$props;
|
|
49
|
+
const label = {
|
|
50
|
+
creating: "Booting\u2026",
|
|
51
|
+
running: "Running",
|
|
52
|
+
stopped: "Stopped",
|
|
53
|
+
error: "Error"
|
|
54
|
+
};
|
|
55
|
+
$$renderer.push(`<span${$.attr_class(`status ${$.stringify(status)}`, "svelte-1hqr9xd")}>${$.escape(label[status])}</span>`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { ideUrl, apiFetch, apiPost, apiDelete, forwardedPortUrl, StatusBadge };
|