Перейти к основному содержимому
J

dsh-devops

jackson-chen97/dsh-devops

GitLab and Kubernetes monitoring for DSH: merge request and pipeline management, deployment and pod status with logs and events, webhook-triggered alerts, and a dashboard UI.

Установка

dsh plugin --profile web add github:jackson-chen97/dsh-devops

README

@jacksonchen/dsh-devops

Release License: MIT Node DSH Topic: dsh-plugin

GitLab + Kubernetes DevOps monitoring plugin for DeepSeek Harness (DSH).

中文文档

GitLab tabK8s tab

Features

  • GitLab API: Create/review/close merge requests, manage tags, monitor CI/CD pipelines with per-job detail
  • Kubernetes API: Deployment status, pod lists, events, logs, image change and rollout restart
  • Dashboard UI: Dual-card switcher (GitLab server / project, kubeconfig / context / namespace) with persisted config
  • Multi-config: Multiple GitLab servers and multiple kubeconfigs, switchable from both the dashboard and settings
  • Webhook + Alert engine: GitLab webhook â†?followup() notification; background polling detects pipeline failures and pod crashes
  • i18n: Built-in Chinese / English UI with a one-click language toggle (persisted; follows browser language by default)
  • Self-signed clusters: Per-request CA pinning from kubeconfig via node:https

Installation

The dsh plugin command forwards to pnpm inside the profile directory, so any pnpm source works: npm, git, or a local path.

# From npm (once published)
dsh plugin --profile web add @jacksonchen/dsh-devops

# From GitHub
dsh plugin --profile web add https://github.com/Jackson-chen97/dsh-devops.git

# From a local checkout (development)
dsh plugin --profile web add "D:/path/to/dsh-devops"

Equivalent pnpm commands (if you prefer to work directly in the profile dir):

cd ~/.dsh/profiles/web
pnpm add @jacksonchen/dsh-devops       # npm (once published)
pnpm add https://github.com/Jackson-chen97/dsh-devops.git  # GitHub
pnpm add "D:/path/to/dsh-devops"       # local path

Then declare the plugin in the profile's patch layer ~/.dsh/profiles/web/cordis.patch.yml (required �the plugin is only loaded after this step):

- insert:
    - id: dsh-devops
      name: '@jacksonchen/dsh-devops'

Restart DSH, then open Settings �DevOps to configure.

Install from prebuilt artifacts (no build, no registry)

lib/ ships a complete, runnable bundle and is committed to the repo, so you can install with no build step and no package registry �ideal for locked-down or offline machines. A plain git clone is enough.

# 1) Clone anywhere you like
git clone https://github.com/Jackson-chen97/dsh-devops

# 2) Copy the prebuilt bundle into the profile's shared node_modules
#    (~/.dsh is %USERPROFILE%\.dsh on Windows)
DEST=~/.dsh/profiles/node_modules/@jacksonchen/dsh-devops
mkdir -p "$DEST"
cp -R dsh-devops/lib dsh-devops/package.json dsh-devops/cordis.patch.yml "$DEST"/

# 3) Register the bundle: add "@jacksonchen/dsh-devops" to
#    `dsh.profile.bundles` in ~/.dsh/profiles/web/package.json. This is the
#    same list that loads @deepseek-ai/dsh-base and dsh-web-app; the bundle then
#    self-registers through its own cordis.patch.yml. e.g.
#    "dsh": { "profile": { "bundles": [
#      "@deepseek-ai/dsh-base",
#      "@deepseek-ai/dsh-web-app",
#      "@jacksonchen/dsh-devops"
#    ] } }

# 4) Restart DSH, then open Settings �DevOps.

The offline artifact is lib/*.js only. The .d.ts type files come from the normal pnpm run build (tsdown); the prebuilt bundle is runtime-only.

Quick Start

  1. Open DSH Settings �DevOps, add GitLab server(s) (Base URL + token) and kubeconfig file(s).
  2. On the dashboard, pick the GitLab project and K8s context/namespace �selections are saved to ~/.dsh-devops/config.json automatically.
  3. Create MRs, tags, inspect pipelines and operate deployments right from the dashboard �or just ask the AI, which calls the same tools with the same config.

Or configure via cordis.patch.yml:

- id: dsh-devops
  name: '@jacksonchen/dsh-devops'
  config:
    gitlab:
      servers:
        - id: main
          baseUrl: 'https://gitlab.example.com'
          projectPath: 'my-group/my-project'
    k8s:
      kubeconfigs:
        - id: prod
          path: '~/.kube/config'
          context: 'prod'

AI Tools

All tools are registered as soon as the plugin loads �no YAML config needed. They read the same configuration the Settings �DevOps UI saves (~/.dsh-devops/config.json), so switching project/cluster in the dashboard applies to AI calls immediately. Calling a tool before configuring returns a hint to finish setup first.

An explicit config: block in the cordis patch entry still works as an override layer for headless setups.

ToolDescription
gitlab_mr_createCreate MR (auto-triggers pipeline watch)
gitlab_mr_reviewReview MR (approve/request_changes/comment)
gitlab_mr_listList merge requests
gitlab_tag_createCreate git tag
gitlab_pipeline_statusGet pipeline status
gitlab_pipeline_jobsList pipeline jobs
gitlab_pipeline_watchStart/stop/check pipeline monitoring
k8s_deployment_statusGet deployment rolling status
k8s_podsList pods with restart counts
k8s_eventsGet recent K8s events
k8s_logsGet pod logs (tail N lines)

Configuration Reference

GitLab Config

FieldRequiredDescription
baseUrlYesGitLab instance URL
defaultProjectNoDefault project ID (falls back to first)
projects[].idYesUnique project identifier
projects[].pathYesGitLab project path (group/project)
projects[].tokenEnvYesEnv var name containing the token
projects[].defaultBranchNoDefault branch for this project

K8s Config

FieldRequiredDescription
kubeconfigs[].idYesUnique cluster identifier
kubeconfigs[].pathYesKubeconfig file path (~ supported)
kubeconfigs[].contextNoContext to use (defaults to current-context)
kubeconfigs[].namespaceNoDefault namespace override
defaultContextNoDefault cluster ID
defaultNamespaceNoFallback namespace

Webhook Config

FieldRequiredDescription
secretYesShared secret for webhook verification
projectPathsNoFilter by project path (whitelist)
quietEventsNoEvent types to suppress

Monitor Config

FieldDefaultDescription
pollIntervalSec60Polling interval
cooldownSec300Alert cooldown to prevent spam
pipeline[]�Pipeline alert rules
pod[]�Pod alert rules

Development

pnpm install
pnpm run typecheck   # TypeScript check
pnpm run build       # Build with tsdown (output in lib/)
node scripts/offline-build.mjs   # no-registry rebuild of lib/ (Node >= 22.13)
pnpm run test        # Run unit tests

Architecture

src/
├── index.ts          # Plugin entry: apply(ctx) orchestrator
├── config.ts         # Unified config parsing + validation
├── types.ts          # Shared public types
├── api.ts            # Local HTTP routes (settings wizard connectivity test)
├── runtime-config.ts # Runtime config loader (~/.dsh-devops/config.json)
├── gitlab/           # GitLab API client + multi-project router
├── k8s/              # K8s API client + kubeconfig parser + multi-cluster router
├── tools/            # Tool registration (gitlab_*, k8s_*)
├── webhook/          # GitLab webhook �followup handler
├── monitor/          # Background polling alert engine + throttle
└── runtime/          # Lazy service wrappers (lazy.ts)

Requirements

  • Node.js â‰?22.19 (native fetch, ESM)
  • GitLab â‰?16.0 (MR Approvals API)
  • Kubernetes API â‰?1.25 (apps/v1)
  • Network access to GitLab and K8s API endpoints

License

MIT

Похожие плагины