Skip to main content

dsh-plugin-dev-skills/examples/hello-plugin

38Stars1Forks0Issues0Watchers

A minimal lifecycle example from the DSH plugin development skill pack, demonstrating plugin loading and the standard approach for ctx.effect automatic cleanup.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki

ⓘ This plugin is a sub-package of the zimodzh/dsh-plugin-dev-skills monorepo — stars and activity count the whole repository.

License
MIT
Branch
master
agentagent-skillagent-skillsaiai-agentawesome-dsh-pluginclaude-codecodex

Install

cmdweb profile
$ dsh plugin --profile web add dsh-hello-plugin

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin zimodzh/dsh-plugin-dev-skills/examples/hello-plugin for me: review the repository at https://github.com/zimodzh/dsh-plugin-dev-skills first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Description

This is a minimal runnable example that comes with the dsh-plugin-dev-skills repository. It registers a placeholder plugin named hello-plugin with DSH to demonstrate the standard pattern for plugin loading and automatic ctx.effect cleanup. It provides no business functionality—it's merely a reference template for developers learning DSH plugin development.

Core Capabilities

  • Upon loading, outputs [hello-plugin] plugin loaded! in the host log as a visual indicator that the plugin layer was loaded correctly
  • Registers a 5-second heartbeat timer via ctx.effect that continuously outputs [hello-plugin] heartbeat
  • Demonstrates the standard Cordis plugin model entry point: export name and apply(ctx), with no build steps required
  • Demonstrates the composite package declaration in package.json via dsh.bundle.patch pointing to cordis.patch.yml
  • Demonstrates the insert写法 in cordis.patch.yml: declares id and name so Node module resolution can locate the installed plugin code
  • Serves as a copy-paste runnable example accompanying the dsh-plugin-dev skill references/plugin-anatomy.md documentation

Technical Implementation

  • Language: JavaScript (ESM, "type": "module")
  • Key Dependencies: No runtime dependencies; relies solely on ctx.effect provided by the host Cordis container (from @deepseek-ai/dsh or its runtime packages)
  • Architecture Pattern: Cordis plugin model—registers cleanable side effects via ctx.effect in apply(ctx); the returned cleanup function is automatically called by the host when the plugin is unloaded
  • Entry File: examples/hello-plugin/index.js

Use Cases

Suitable for developers learning DSH plugin development who want to complete the full chain of "plugin loading and lifecycle cleanup." After reading the references/plugin-anatomy.md documentation and wanting a minimal example you can directly run with dsh plugin add, install this example and observe the [hello-plugin] plugin loaded! message in the terminal logs along with the heartbeat every 5 seconds. This lets you visually confirm whether the plugin layer is loaded correctly and whether ctx.effect cleanup is working. For production scenarios, extend this example as needed.

Prerequisites & Compatibility

DependencyMin VersionDescription
DSHNot declaredOnly depends on the host's Cordis container and ctx.effect interface; no engines declared in package.json
NodeNot declaredUses only ESM syntax; no engines declared in package.json
PlatformCross-platformPure JavaScript implementation, no native modules
Native ModulesNoneNo native dependencies in package.json

Installation

dsh plugin --profile web add github:zimodzh/dsh-plugin-dev-skills/examples/hello-plugin

Configuration

This plugin requires no additional configuration. All behaviors (startup logs, heartbeat interval, cleanup timing) are directly written in the index.js source code, with no configuration options exposed.

FAQ

Q: What practical functionality does this plugin provide after installation?

A: None. It only prints a log line upon loading, then prints a heartbeat every 5 seconds. Its entire value lies in demonstrating the minimal skeleton of a DSH plugin and the lifecycle cleanup mechanism, allowing you to visually observe whether the plugin layer is loaded correctly.

Q: Does this plugin require a build step?

A: No. index.js is pure ESM JavaScript that the host loads directly as a Node module; the package.json files field also only publishes index.js and cordis.patch.yml—no TypeScript compilation or bundling steps.

Q: After installation, once I see [hello-plugin] plugin loaded!, how long until I see the heartbeat?

A: 5 seconds. The setInterval interval is hardcoded to 5000ms in index.js:11, printing [hello-plugin] heartbeat every 5 seconds from the moment the plugin finishes loading.

Q: Does the heartbeat stop immediately after uninstalling the plugin?

A: Yes. The cleanup function returned by ctx.effect is automatically called by the host when the plugin is unloaded; the clearInterval inside it clears the timer and stops the heartbeat output. This is the standard paradigm this example emphasizes: all side effects requiring cleanup must be placed in ctx.effect, otherwise they will leak upon unload.

Q: What's the difference between this example and the greet-tool example in the same repository?

A: hello-plugin is a minimal lifecycle example that only demonstrates plugin loading and automatic ctx.effect cleanup; greet-tool is a model-callable tool example that demonstrates the three-part defineTool pattern: parameters, execute, and output. The two focus on different aspects—reading both is recommended.

Q: Why is id written as hello instead of hello-plugin in cordis.patch.yml?

A: This is a naming choice for the Cordis layer id; there's no mandatory correspondence with the name field exported in index.js. The id is the layer identifier in the configuration graph, while name is the logical name of the plugin at runtime—they can differ.

Q: What are the core knowledge points one can learn from reading the hello-plugin source code?

A: Three things: package.json dsh.bundle.patch must point to cordis.patch.yml; index.js only needs to export name and apply(ctx); any side effects registered through ctx (here, setInterval) must be placed in ctx.effect to avoid leaking upon unload.

Difficulty Level

Beginner — the example itself is only 15 lines of code: one setInterval call plus a cordis.patch.yml. Getting it to run means you've already mastered the standard skeleton of DSH plugin loading and lifecycle cleanup.

Known Issues & Limitations

  • The heartbeat interval 5000 ms and the heartbeat message '[hello-plugin] heartbeat' are both hardcoded inside the setInterval callback in index.js—the source code has no configuration reads or environment variable branches; to modify the interval or message, you must edit the source (evidence: examples/hello-plugin/index.js:11-13)
  • Both id: hello and name: dsh-hello-plugin in cordis.patch.yml are hardcoded strings; if a plugin id with the same name already exists in the user's environment, a naming conflict will occur (evidence: examples/hello-plugin/cordis.patch.yml:2-3)
  • No engines, peerDependencies, os, or cpu fields are declared in the source code—DSH version compatibility must be validated by the host side (evidence: examples/hello-plugin/package.json:1-8)

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/zimodzh/dsh-plugin-dev-skills/examples/hello-plugin)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory