@karoy/dsh-gitlab-workbench 0.0.0-stage → 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/README.md +106 -2
- package/cordis.patch.yml +4 -0
- package/dist/client.js +2288 -0
- package/dist/host/gitlab.js +268 -0
- package/dist/host/index.js +54 -0
- package/dist/host/routes.js +567 -0
- package/dist/host/store.js +236 -0
- package/dist/host/types.js +1 -0
- package/docs/DETAIL.md +37 -0
- package/icon.svg +18 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +79 -4
package/README.md
CHANGED
|
@@ -1,3 +1,107 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-gitlab-workbench
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A DeepSeek Harness plugin: one **GitLab** entry in the left sidebar opens a global workbench for several self-managed GitLab instances (built for GitLab 17.x, REST API v4).
|
|
4
|
+
|
|
5
|
+
The panel's design mockups live in the repository's `designs/` directory.
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
- **Several instances** — each keeps its own URL, TLS settings and personal access token; switch in the top bar.
|
|
10
|
+
- **Project rail** — search and switch projects without losing the pipeline view.
|
|
11
|
+
- **Overview** — counters, recent pipelines, branches and commits.
|
|
12
|
+
- **Pipelines** — list, stage timeline, jobs, the tail of a failed job's log, retry and cancel for pipelines and jobs.
|
|
13
|
+
- **Merge requests and issues** — list and read-only details, with a link into GitLab.
|
|
14
|
+
- **Files** — browse the repository tree and read text files.
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/
|
|
20
|
+
host/ the Node half: it owns tokens and talks to GitLab
|
|
21
|
+
index.ts exports apply(); registers the /gitlab-workbench/api route
|
|
22
|
+
routes.ts the route table and the admission check
|
|
23
|
+
gitlab.ts REST v4 client over node http/https (TLS, redirects, errors)
|
|
24
|
+
store.ts instance document (~/.dsh/gitlab-workbench) + credential records
|
|
25
|
+
types.ts structural types for the runtime services it resolves
|
|
26
|
+
client/ the browser half: bundled by esbuild, React external
|
|
27
|
+
index.ts esbuild entry
|
|
28
|
+
plugin.ts locale detection, sidebar entry, main panel registration
|
|
29
|
+
api.ts same-origin calls to the host routes
|
|
30
|
+
i18n.ts zh/en dictionaries
|
|
31
|
+
util.ts formatting, status vocabulary, useAsync, persisted selection
|
|
32
|
+
icons.ts the line-icon set
|
|
33
|
+
ui.ts primitives: status, buttons, empty state, error note, meta grid
|
|
34
|
+
types.ts payload shapes returned by the host
|
|
35
|
+
views/ one module per screen: panel, project, overview, pipelines,
|
|
36
|
+
mergeRequests, issues, files, settings
|
|
37
|
+
styles/app.css the panel stylesheet, imported as text and injected
|
|
38
|
+
designs/gitlab-workbench/ the design mockups the panel follows
|
|
39
|
+
test/ mock GitLab, host route checks, client smoke + e2e, preview shell
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The host half never ships a token to the browser: the client only receives normalized instance metadata, and every GitLab call is made by `gitlab.ts`.
|
|
43
|
+
|
|
44
|
+
## Build
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
npm install
|
|
48
|
+
npm run build # tsc -> dist/host, esbuild -> dist/client.js
|
|
49
|
+
npm run typecheck
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`build.mjs` wraps the esbuild CJS bundle in the DSH module-loader format
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
window.__ModuleLoader__.load({ id, factory(require) { ... } })
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
with `react` left external, so the page's React instance is used.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
Install this directory as a bundle (Plugins → Add plugin, or the plugin manager with this path). A new bundle needs a DSH restart before the host half is live; refreshing the page after that loads the panel.
|
|
63
|
+
|
|
64
|
+
## Tokens
|
|
65
|
+
|
|
66
|
+
Each instance uses a personal access token:
|
|
67
|
+
|
|
68
|
+
- `read_api` for the read-only views;
|
|
69
|
+
- `api` for pipeline and job retry/cancel.
|
|
70
|
+
|
|
71
|
+
Tokens are stored by the host credential service under `gitlab-workbench/<instance id>`. The instance list lives in `~/.dsh/gitlab-workbench/instances.json`.
|
|
72
|
+
|
|
73
|
+
## Tests
|
|
74
|
+
|
|
75
|
+
The suite runs against the bundled mock GitLab, which must be listening on
|
|
76
|
+
port 18080 first:
|
|
77
|
+
|
|
78
|
+
```powershell
|
|
79
|
+
npm run mock # node test/mock-gitlab.js 18080 (keep it running)
|
|
80
|
+
npm test # build, host routes, client smoke, jsdom end-to-end
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`npm test` runs the three suites in order: `npm run test:host`,
|
|
84
|
+
`npm run test:client`, `npm run test:e2e`. They also run on their own once the
|
|
85
|
+
mock is up. `test/preview-server.mjs` serves the built panel with a fake shell
|
|
86
|
+
for a quick browser look.
|
|
87
|
+
|
|
88
|
+
## CI
|
|
89
|
+
|
|
90
|
+
`.github/workflows/ci.yml` runs on every push and pull request to `main`: it
|
|
91
|
+
installs with `npm ci`, builds, type-checks, starts the mock GitLab, runs the
|
|
92
|
+
three suites on Node 22 and 24, and checks that the tarball `npm pack` would
|
|
93
|
+
publish contains `dist/`, the patch, both locales, the detail document, the
|
|
94
|
+
icon and the README (`dist/` is not committed, so a missing build must fail
|
|
95
|
+
here instead of publishing an empty plugin).
|
|
96
|
+
|
|
97
|
+
## Release
|
|
98
|
+
|
|
99
|
+
`.github/workflows/npm-publish.yml` publishes on a published GitHub Release:
|
|
100
|
+
|
|
101
|
+
1. Bump `version` in `package.json` (and refresh the lockfile root with
|
|
102
|
+
`npm install --package-lock-only`), commit and push.
|
|
103
|
+
2. Create a GitHub Release whose tag is `v<version>` — the workflow fails when
|
|
104
|
+
the tag and `package.json` disagree, or when that version is already on npm.
|
|
105
|
+
3. The `test` job runs first; then `npm publish --access public` runs with the
|
|
106
|
+
repository's `NPM_TOKEN` secret. `prepack` rebuilds `dist/` for the tarball.
|
|
107
|
+
4. Verify with `npm view @karoy/dsh-gitlab-workbench version`.
|
package/cordis.patch.yml
ADDED