@webship.co/workspace-docksal 0.0.0-stage → 1.0.0-alpha1

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 CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # @webship.co/workspace-docksal
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Docksal for the [Webship Workspace](https://github.com/webship/workspace) dashboard: the **DOCKSAL**
4
+ menu on every project folder that carries a .docksal/ folder, with the runtime's verbs as terminal sessions in
5
+ the project, the up/down caption and the site link, and "Scaffold .docksal/ here (fin config generate)" when a new folder is made.
6
+ A runtime of [`@webship.co/workspace-container`](https://github.com/webship/workspace-container).
7
+
8
+ A project is a Docksal project when it carries `.docksal/` (`docksal.env` or `docksal.yml`); the site link is `VIRTUAL_HOST` from `docksal.env`, or `<folder>.docksal.site`.
9
+
10
+ ## Use it
11
+
12
+ ```bash
13
+ cd ~/workspace
14
+ bash core/scripts/plugins.sh --require github:webship/workspace-docksal
15
+ bash core/scripts/plugins.sh --activate docksal
16
+ bash core/scripts/plugins.sh --install docksal
17
+ ```
18
+
19
+ ## The verbs
20
+
21
+ | Verb | Command |
22
+ | --- | --- |
23
+ | Start | `fin project start` |
24
+ | Stop | `fin project stop` |
25
+ | Restart | `fin project restart` |
26
+ | Status | `fin project status` |
27
+ | Logs | `fin logs -f` |
28
+ | Shell | `fin bash` |
29
+ | Init | `fin init` (the project's own init command) |
30
+ | Remove | `fin project remove -f` (containers and data: marked in red) |
31
+
32
+ Every verb opens a terminal session in the project folder, so what the CLI prints is what you see,
33
+ and a verb that asks a question can be answered.
34
+
35
+ The `workspacePlugin` block in `package.json` is the manifest the installer reads.
@@ -0,0 +1,7 @@
1
+ # Docksal's config, shared FROM THE HOST into the dashboard container, so the verbs that run from
2
+ # the dashboard see the same contexts and sessions the host does.
3
+ services:
4
+ web:
5
+ volumes:
6
+ - "${HOME}/.local/bin:/host-local-bin:ro"
7
+ - "${HOME}/.docksal:/home/${USER}/.docksal:rw"
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Docksal for Webship Workspace.
3
+ *
4
+ * The DOCKSAL menu on every project folder that carries a .docksal/ folder: the runtime's verbs as terminal
5
+ * sessions in the project, the up/down caption, the site link, and "Scaffold .docksal/ here (fin config generate)" when a new folder
6
+ * is made. All of it is the container family's surface (@webship.co/workspace-container); this
7
+ * package is the Docksal runtime plus its host install.
8
+ */
9
+ import type { PluginApi } from '@webship.co/workspace-plugin-api';
10
+ import { docksalRuntime } from './lib/runtime';
11
+ export { docksalRuntime };
12
+ export declare function register(api: PluginApi): void;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * Docksal for Webship Workspace.
4
+ *
5
+ * The DOCKSAL menu on every project folder that carries a .docksal/ folder: the runtime's verbs as terminal
6
+ * sessions in the project, the up/down caption, the site link, and "Scaffold .docksal/ here (fin config generate)" when a new folder
7
+ * is made. All of it is the container family's surface (@webship.co/workspace-container); this
8
+ * package is the Docksal runtime plus its host install.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.docksalRuntime = void 0;
12
+ exports.register = register;
13
+ const workspace_container_1 = require("@webship.co/workspace-container");
14
+ const runtime_1 = require("./lib/runtime");
15
+ Object.defineProperty(exports, "docksalRuntime", { enumerable: true, get: function () { return runtime_1.docksalRuntime; } });
16
+ function register(api) {
17
+ (0, workspace_container_1.registerContainer)(api, runtime_1.docksalRuntime);
18
+ }
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AASH,4BAEC;AARD,yEAAoE;AAEpE,2CAA+C;AAEtC,+FAFA,wBAAc,OAEA;AAEvB,SAAgB,QAAQ,CAAC,GAAc;IACrC,IAAA,uCAAiB,EAAC,GAAG,EAAE,wBAAc,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Docksal, as a container runtime: a project with a .docksal/ folder.
3
+ */
4
+ import type { ContainerRuntime } from '@webship.co/workspace-container';
5
+ export declare const docksalRuntime: ContainerRuntime;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /**
3
+ * Docksal, as a container runtime: a project with a .docksal/ folder.
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.docksalRuntime = void 0;
10
+ const fs_1 = __importDefault(require("fs"));
11
+ const path_1 = __importDefault(require("path"));
12
+ exports.docksalRuntime = {
13
+ id: 'docksal',
14
+ label: 'DOCKSAL',
15
+ title: 'Docksal',
16
+ cli: 'fin',
17
+ cliHint: 'https://docs.docksal.io/getting-started/setup/',
18
+ detect: (dir) => {
19
+ const file = ['.docksal/docksal.env', '.docksal/docksal.yml'].find((f) => fs_1.default.existsSync(path_1.default.join(dir, f)));
20
+ if (!file)
21
+ return null;
22
+ let host = '';
23
+ try {
24
+ host = (fs_1.default.readFileSync(path_1.default.join(dir, '.docksal', 'docksal.env'), 'utf8').match(/^VIRTUAL_HOST=["']?([\w.-]+)/m) || [])[1] || '';
25
+ }
26
+ catch (_) { /* no env file */ }
27
+ const name = path_1.default.basename(dir);
28
+ return { file, name, url: `http://${host || `${name}.docksal.site`}` };
29
+ },
30
+ state: async (_p, dir, lib) => {
31
+ const out = await lib.run('fin', ['project', 'status'], dir, { timeoutMs: 20 * 1000 });
32
+ if (!out.ok)
33
+ return 'unknown';
34
+ return /\bUp\b/.test(String(out.stdout)) ? 'up' : 'down';
35
+ },
36
+ verbs: {
37
+ start: { label: 'Start', icon: 'play', kind: 'start', cmd: () => 'fin project start' },
38
+ stop: { label: 'Stop', icon: 'ban', kind: 'stop', cmd: () => 'fin project stop' },
39
+ restart: { label: 'Restart', icon: 'refresh', kind: 'restart', cmd: () => 'fin project restart' },
40
+ status: { label: 'Status', icon: 'info', kind: 'status', cmd: () => 'fin project status' },
41
+ logs: { label: 'Logs (follow)', icon: 'file-text', kind: 'logs', cmd: () => 'fin logs -f' },
42
+ shell: { label: 'Shell (fin bash)', icon: 'terminal', kind: 'shell', cmd: () => 'fin bash' },
43
+ init: { label: 'Run the project init (fin init)', icon: 'bolt', kind: 'other', cmd: () => 'fin init' },
44
+ remove: { label: 'Remove (containers and data)', icon: 'trash', kind: 'other', danger: true, cmd: () => 'fin project remove -f' },
45
+ },
46
+ init: { label: 'Scaffold .docksal/ here (fin config generate)', cmd: () => 'fin config generate', help: 'Docksal writes .docksal/docksal.env with the default stack.' },
47
+ menuNote: 'Every verb opens a terminal in the project',
48
+ };
49
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/lib/runtime.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,4CAAoB;AACpB,gDAAwB;AAGX,QAAA,cAAc,GAAqB;IAC9C,EAAE,EAAE,SAAS;IACb,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,gDAAgD;IACzD,MAAM,EAAE,CAAC,GAAG,EAA2B,EAAE;QACvC,MAAM,IAAI,GAAG,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5G,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,CAAC;YAAC,IAAI,GAAG,CAAC,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,aAAa,CA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,CAAC,qBAAqB,EAAE;QACjG,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,oBAAoB,EAAE;QAC1F,IAAI,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE;QAC3F,KAAK,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;QAC5F,IAAI,EAAE,EAAE,KAAK,EAAE,iCAAiC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;QACtG,MAAM,EAAE,EAAE,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,uBAAuB,EAAE;KAClI;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,+CAA+C,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAqB,EAAE,IAAI,EAAE,6DAA6D,EAAE;IACvK,QAAQ,EAAE,4CAA4C;CACvD,CAAC"}
@@ -0,0 +1,8 @@
1
+ Feature: The Docksal plugin on a project row
2
+ Once the plugin is activated and installed, every project folder that carries a .docksal/ folder carries
3
+ the DOCKSAL menu, and the Plugins page lists the plugin with its four steps.
4
+
5
+ Scenario: The plugin is listed on the Plugins page
6
+ Given I am on "/settings/plugins"
7
+ Then I should see "Docksal"
8
+ And I should see "@webship.co/workspace-docksal"
@@ -0,0 +1,2 @@
1
+ # Directories the dashboard container bind-mounts for this plugin; host-mounts.sh creates them as you first.
2
+ ~/.docksal
package/package.json CHANGED
@@ -1,6 +1,61 @@
1
1
  {
2
2
  "name": "@webship.co/workspace-docksal",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0-alpha1",
4
+ "description": "Docksal for Webship Workspace: the DOCKSAL menu on every project with a .docksal/ folder (start, stop, restart, status, logs, bash, init, remove), the up/down caption, the virtual host as the site link. A runtime of @webship.co/workspace-container.",
5
+ "main": "dist/src/index.js",
6
+ "types": "dist/src/index.d.ts",
7
+ "license": "ISC",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/webship/workspace-docksal.git"
11
+ },
12
+ "files": [
13
+ "dist/src",
14
+ "features",
15
+ "scripts",
16
+ "README.md",
17
+ "ddev",
18
+ "host-mounts.txt"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "prepare": "npm run build",
23
+ "test": "npm run build && node --test dist/tests/*.test.js",
24
+ "lint": "tsc -p tsconfig.json --noEmit"
25
+ },
26
+ "workspacePlugin": {
27
+ "name": "docksal",
28
+ "label": "Docksal",
29
+ "typeActions": {
30
+ "docksal": [
31
+ "sites",
32
+ "code"
33
+ ]
34
+ },
35
+ "scripts": {
36
+ "hostInstall": "scripts/host-install.sh"
37
+ },
38
+ "features": [
39
+ "features/docksal.feature"
40
+ ],
41
+ "ddev": {
42
+ "compose": [
43
+ "ddev/docker-compose.docksal.yaml"
44
+ ],
45
+ "hostMounts": [
46
+ "~/.docksal"
47
+ ]
48
+ }
49
+ },
50
+ "dependencies": {
51
+ "@webship.co/workspace-container": "^1.0.0-alpha1"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^24.0.0",
55
+ "@webship.co/workspace-plugin-api": "^1.0.0-alpha1",
56
+ "typescript": "^5.9.0"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public"
60
+ }
61
+ }
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bash
2
+ ## The host side of the Docksal plugin: the CLI on this machine. Run by core/scripts/plugins.sh
3
+ ## --install docksal, and by core/scripts/install.sh for every installed plugin that ships one.
4
+ ## Idempotent: whatever is already there is reported, not redone; nothing is installed unasked.
5
+ set -u
6
+ BIN='';
7
+ for candidate in "$(command -v fin 2>/dev/null)" "${HOME}/.local/bin/fin" ; do
8
+ [ -n "${candidate}" ] && [ -x "${candidate}" ] && { BIN="${candidate}"; break; }
9
+ done
10
+ if [ -n "${BIN}" ] ; then
11
+ printf ' ✓ %-16s %s\n' "fin" "${BIN}" ;
12
+ else
13
+ printf ' ✗ %-16s %s\n' "fin" "missing — the DOCKSAL menu's verbs need it (docs.docksal.io/getting-started/setup)" ;
14
+ fi