dsh-publish-helper 0.21.7 → 0.22.0

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
@@ -2,6 +2,10 @@
2
2
 
3
3
  DSH 插件上架 / 发布 / 撤回助手:发现、检查、生成 entry、开 PR、一键发布 npm、按版本撤回。
4
4
 
5
+ ## 自带技能
6
+
7
+ 插件在运行时注册 **`publish-release`** 技能(按需加载,不占常驻 token):preflight → 收录检查 → 建仓库 → npm 发布(staging 审核)→ entry/PR → 撤回。含 BOM、占名、stale fork、2FA 限制等坑。
8
+
5
9
  ## 安装
6
10
 
7
11
  ```bash
package/index.js CHANGED
@@ -8,6 +8,7 @@ import { readLocalConfig, writeLocalConfig } from './lib/config.mjs';
8
8
  import { readNpmrcToken } from './lib/credentials.mjs';
9
9
  import { checkPlugin, repoFromUrl, resolveRepo, searchTopic } from './lib/discover.mjs';
10
10
  import { AGENT_GUIDE, SECTION_NAME, SUBMISSION_SPEC } from './lib/guide.mjs';
11
+ import { SKILL_REGISTRATION } from './lib/skill.mjs';
11
12
  import { appendPublishLog } from './lib/log.mjs';
12
13
  import { inboxDir, intakeZip, listInbox } from './lib/intake.mjs';
13
14
  import { npmrcLine, publishArgs, recallArgs } from './lib/npm.mjs';
@@ -243,6 +244,10 @@ export function apply(ctx, rawConfig) {
243
244
  });
244
245
  }
245
246
 
247
+ // The release SOP is loaded on demand as a skill instead of living in the prompt.
248
+ const skills = ctx.get('skills');
249
+ if (skills) ctx.effect(() => skills.register(SKILL_REGISTRATION));
250
+
246
251
  ctx.tools.register({
247
252
  name: 'publish_discover',
248
253
  description: 'Search GitHub repositories carrying the dsh-plugin topic, ranked by stars. Use it to find plugins or to confirm a plugin is discoverable by topic.',
package/lib/skill.mjs ADDED
@@ -0,0 +1,41 @@
1
+ export const SKILL_NAME = 'publish-release';
2
+
3
+ export const SKILL_DESCRIPTION = 'Publish a DSH plugin end to end: preflight, listing check, GitHub repo upload, npm publish with staging approval, registry entry and PR, plus rollback of a broken version.';
4
+
5
+ export const SKILL_CONTENT = `# DSH plugin release workflow
6
+
7
+ Use this skill when the user asks to publish, release, or list a DSH plugin on npm / GitHub / awesome-dsh-plugin.
8
+
9
+ ## Preconditions
10
+
11
+ - The package directory is final: \`package.json\` has name, version, description, license, repository, homepage, keywords and \`dsh.bundle.patch\`; README and LICENSE exist.
12
+ - A GitHub token and an npm token are already stored locally. Never print them.
13
+ - npm publishing may land in the Staged queue (bypass-2FA granular tokens): the user has to approve the version on npmjs.com before it becomes \`latest\`.
14
+
15
+ ## Steps
16
+
17
+ 1. \`publish_preflight\` on the directory. Fix every FAIL before continuing.
18
+ 2. \`publish_check\` with the repo and package name. Topics, bundle, npm backlink and registry entry are the usual failures.
19
+ 3. If the GitHub repository does not exist, create/upload it with \`publish_repo\`.
20
+ 4. Publish with \`publish_npm\`. If npm asks for a 2FA code, pass \`otp\`.
21
+ 5. Ask the user to approve the staged version, then confirm with the registry that \`dist-tags.latest\` points at it.
22
+ 6. Generate the registry entry with \`publish_entry\` and open the PR with \`publish_pr\`. The awesome repo's submission gate requires the repository to be at least one day old, so a fresh repo fails the first run and passes after the gate re-runs.
23
+ 7. Add or update a format-1 index when the user maintains one (a \`index.json\` with a \`plugins\` list).
24
+ 8. For a broken release: \`publish_recall\` with \`deprecate\` (always available) or \`unpublish\` (only within 72 hours and only with a token that satisfies npm's 2FA policy).
25
+
26
+ ## Pitfalls
27
+
28
+ - A package name can already belong to someone else; check the registry before choosing, and rename both package and repository when needed.
29
+ - Writing files with PowerShell \`Set-Content -Encoding UTF8\` adds a BOM and breaks JSON parsing; write with the file-write tool or strip the BOM before publishing.
30
+ - A stale fork makes \`publish_pr\` include unrelated files; rebuild a clean branch from upstream HEAD and open a fresh PR with only the new entry.
31
+ - Granular tokens that bypass 2FA cannot unpublish and are restricted for account changes and direct publishing; prefer OTP or GitHub Actions trusted publishing for the long term.
32
+ - Publishing is irreversible enough to require a user confirmation before the npm publish step.
33
+ `;
34
+
35
+ export const SKILL_REGISTRATION = {
36
+ name: SKILL_NAME,
37
+ description: SKILL_DESCRIPTION,
38
+ whenToUse: 'when the user asks to publish, release, or list a DSH plugin',
39
+ source: 'custom',
40
+ content: SKILL_CONTENT,
41
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-publish-helper",
3
- "version": "0.21.7",
3
+ "version": "0.22.0",
4
4
  "description": "DSH plugin publishing assistant: discover by topic, check listing readiness, generate the registry entry, open the pull request and show a settings page.",
5
5
  "type": "module",
6
6
  "main": "index.js",