dsh-reminder-notify 0.0.0-stage → 0.2.2
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/LICENSE +21 -0
- package/README.md +53 -2
- package/assets//346/217/220/347/244/272/351/237/263/345/257/274/345/205/245//345/256/214/346/210/220/346/217/220/351/206/222/350/257/255/351/237/263.wav +0 -0
- package/assets//346/217/220/347/244/272/351/237/263/345/257/274/345/205/245//351/234/200/350/246/201/344/275/240/346/235/245/345/206/263/345/256/232.wav +0 -0
- package/cordis.patch.yml +47 -0
- package/docs/DETAIL.md +86 -0
- package/docs/INSTALL-ZIP.md +30 -0
- package/docs/PUBLISH.md +114 -0
- package/docs/PUSH-CHECKLIST.md +172 -0
- package/host/ReminderHost.ps1 +271 -0
- package/icon.svg +13 -0
- package/index.js +314 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +55 -4
- package/publish/index.json +61 -0
- package/scripts/build-index.mjs +153 -0
- package/scripts/npm-login-and-publish.ps1 +82 -0
- package/scripts/npm-login-tee.ps1 +35 -0
- package/scripts/npm-publish-interactive.ps1 +20 -0
- package/scripts/publish-npm-window.cmd +3 -0
- package/scripts/publish-npm.cmd +5 -0
- package/scripts/publish-npm.ps1 +76 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": 1,
|
|
3
|
+
"title": {
|
|
4
|
+
"zh": "本地自建插件源",
|
|
5
|
+
"en": "Private plugin source"
|
|
6
|
+
},
|
|
7
|
+
"description": {
|
|
8
|
+
"zh": "个人维护的 DSH 插件,安装前请自行查看来源。",
|
|
9
|
+
"en": "Self-hosted DSH plugins. Check the source before installing."
|
|
10
|
+
},
|
|
11
|
+
"metadata": {
|
|
12
|
+
"categories": {
|
|
13
|
+
"productivity": {
|
|
14
|
+
"title": {
|
|
15
|
+
"zh": "效率工具",
|
|
16
|
+
"en": "Productivity"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"plugins": [
|
|
22
|
+
{
|
|
23
|
+
"name": "dsh-reminder-notify",
|
|
24
|
+
"title": {
|
|
25
|
+
"zh": "桌面提醒",
|
|
26
|
+
"en": "Desktop reminder"
|
|
27
|
+
},
|
|
28
|
+
"description": {
|
|
29
|
+
"zh": "把完成 / 决定提醒变成 notify_user 工具:浮动卡片 + 提示音,不抢焦点。卡片由插件自带的 PowerShell 脚本绘制,仓库零 exe。仅 Windows。",
|
|
30
|
+
"en": "Turns completion / decision reminders into a notify_user tool: floating card with sound, never steals focus. The card is drawn by the bundled PowerShell host, so the package ships no exe. Windows only."
|
|
31
|
+
},
|
|
32
|
+
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgdmlld0JveD0iMCAwIDY0IDY0IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9IkRlc2t0b3AgcmVtaW5kZXIiPgogIDxkZWZzPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJnIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzJmNmZlZCIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMxYjNmOWUiLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgPC9kZWZzPgogIDxyZWN0IHg9IjIiIHk9IjIiIHdpZHRoPSI2MCIgaGVpZ2h0PSI2MCIgcng9IjE0IiBmaWxsPSJ1cmwoI2cpIi8+CiAgPHBhdGggZD0iTTMyIDE0Yy02LjEgMC0xMC41IDQuNi0xMC41IDEwLjd2Ni4xYzAgMi40LS45IDQuMy0yLjQgNi4xLTEuMiAxLjUtLjMgMy42IDEuNyAzLjZoMjIuNGMyIDAgMi45LTIuMSAxLjctMy42LTEuNS0xLjgtMi40LTMuNy0yLjQtNi4xdi02LjFDNDIuNSAxOC42IDM4LjEgMTQgMzIgMTR6IiBmaWxsPSIjZmZmIi8+CiAgPHBhdGggZD0iTTI3IDQ1LjVhNSA1IDAgMCAwIDEwIDB6IiBmaWxsPSIjZmZkNDVlIi8+CiAgPGNpcmNsZSBjeD0iNDYiIGN5PSIxOCIgcj0iNyIgZmlsbD0iI2ZmZDQ1ZSIvPgogIDxwYXRoIGQ9Ik00Mi42IDE4LjFsMi40IDIuNCA0LjItNC40IiBmaWxsPSJub25lIiBzdHJva2U9IiMxYjNmOWUiIHN0cm9rZS13aWR0aD0iMi4yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==",
|
|
33
|
+
"author": "dsh-reminder-notify",
|
|
34
|
+
"repository": {
|
|
35
|
+
"url": "https://github.com/Jiangshuaiye1203/dsh-reminder-notify"
|
|
36
|
+
},
|
|
37
|
+
"metadata": {
|
|
38
|
+
"category": "productivity",
|
|
39
|
+
"keywords": [
|
|
40
|
+
"dsh",
|
|
41
|
+
"dsh-plugin",
|
|
42
|
+
"deepseek-harness",
|
|
43
|
+
"notify",
|
|
44
|
+
"reminder",
|
|
45
|
+
"toast"
|
|
46
|
+
],
|
|
47
|
+
"labels": []
|
|
48
|
+
},
|
|
49
|
+
"versions": [
|
|
50
|
+
{
|
|
51
|
+
"version": "0.2.2",
|
|
52
|
+
"publishTimestamp": 1795054082,
|
|
53
|
+
"source": {
|
|
54
|
+
"type": "npm"
|
|
55
|
+
},
|
|
56
|
+
"engines": {}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// 生成 / 更新插件市场索引(DSH 插件市场索引格式 1)。
|
|
3
|
+
//
|
|
4
|
+
// 用法:
|
|
5
|
+
// node scripts/build-index.mjs # 从 git remote.origin.url + HEAD 自动取
|
|
6
|
+
// node scripts/build-index.mjs --repo https://github.com/me/x # 指定仓库地址
|
|
7
|
+
// node scripts/build-index.mjs --commit <40位sha> # 指定提交
|
|
8
|
+
// node scripts/build-index.mjs --out publish/index.json
|
|
9
|
+
// node scripts/build-index.mjs --npm # 版本来源改成 npm 包(默认 registry)
|
|
10
|
+
// node scripts/build-index.mjs --npm --registry https://registry.npmmirror.com
|
|
11
|
+
// node scripts/build-index.mjs --publish # 写文件 + 只提交 publish/index.json
|
|
12
|
+
//
|
|
13
|
+
// 输出是一份自包含的 JSON:icon 内联成 data: URL(≤32 KiB)。
|
|
14
|
+
// 默认版本来源用 git + 固定提交(插件市场据此生成 git+https 安装串);
|
|
15
|
+
// 加 --npm 则用 npm 包名,装源变成 `pnpm add <name>@<version>`,不依赖 github.com。
|
|
16
|
+
import { execFileSync } from 'node:child_process'
|
|
17
|
+
import fs from 'node:fs'
|
|
18
|
+
import path from 'node:path'
|
|
19
|
+
import { fileURLToPath } from 'node:url'
|
|
20
|
+
|
|
21
|
+
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
22
|
+
const argv = process.argv.slice(2)
|
|
23
|
+
const flag = (name) => {
|
|
24
|
+
const at = argv.indexOf(`--${name}`)
|
|
25
|
+
return at < 0 ? undefined : argv[at + 1]
|
|
26
|
+
}
|
|
27
|
+
const git = (...args) => execFileSync('git', args, { cwd: ROOT, encoding: 'utf8' }).trim()
|
|
28
|
+
|
|
29
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'))
|
|
30
|
+
|
|
31
|
+
const rawRepo = flag('repo') ?? (() => {
|
|
32
|
+
try {
|
|
33
|
+
return git('config', '--get', 'remote.origin.url')
|
|
34
|
+
} catch {
|
|
35
|
+
return undefined
|
|
36
|
+
}
|
|
37
|
+
})()
|
|
38
|
+
if (!rawRepo) {
|
|
39
|
+
console.error('缺少仓库地址:先 `git remote add origin https://github.com/<你>/<仓库>`,或传 --repo <url>')
|
|
40
|
+
process.exit(1)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 规范化成 https://host/owner/repo(去掉 .git、凭据、查询串与末尾斜杠)
|
|
44
|
+
const repoUrl = (() => {
|
|
45
|
+
let text = String(rawRepo).trim()
|
|
46
|
+
const scp = /^git@([^:]+):(.+)$/u.exec(text)
|
|
47
|
+
if (scp) text = `https://${scp[1]}/${scp[2]}`
|
|
48
|
+
text = text.replace(/^ssh:\/\/git@/u, 'https://').replace(/\.git$/u, '').replace(/\/+$/u, '')
|
|
49
|
+
const url = new URL(text)
|
|
50
|
+
if (url.protocol !== 'https:') throw new Error(`仓库地址必须是 https:${text}`)
|
|
51
|
+
if (url.search || url.hash || url.username || url.password) throw new Error(`仓库地址不能带凭据/查询串:${text}`)
|
|
52
|
+
return `${url.origin}${url.pathname}`
|
|
53
|
+
})()
|
|
54
|
+
|
|
55
|
+
const commit = (flag('commit') ?? git('rev-parse', 'HEAD')).toLowerCase()
|
|
56
|
+
if (!/^[0-9a-f]{40}$/u.test(commit)) throw new Error(`提交必须是 40 位小写 sha:${commit}`)
|
|
57
|
+
|
|
58
|
+
// --npm:版本来源改成 npm 包(http(s) 注册表;不传 registry 就让安装方用自己配置的源)。
|
|
59
|
+
const useNpm = argv.includes('--npm')
|
|
60
|
+
const registry = flag('registry')
|
|
61
|
+
if (registry !== undefined && !/^https?:\/\//u.test(registry)) {
|
|
62
|
+
throw new Error(`registry 必须是 http(s) 地址:${registry}`)
|
|
63
|
+
}
|
|
64
|
+
const versionSource = useNpm
|
|
65
|
+
? { type: 'npm', ...(registry === undefined ? {} : { registry }) }
|
|
66
|
+
: { type: 'git', url: repoUrl, commit }
|
|
67
|
+
|
|
68
|
+
const publishTimestamp = Number(flag('time') ?? git('log', '-1', '--format=%ct', commit))
|
|
69
|
+
const iconPath = path.join(ROOT, 'icon.svg')
|
|
70
|
+
const icon = fs.existsSync(iconPath)
|
|
71
|
+
? `data:image/svg+xml;base64,${fs.readFileSync(iconPath).toString('base64')}`
|
|
72
|
+
: undefined
|
|
73
|
+
if (icon && Buffer.from(icon.split(',')[1], 'base64').length > 32 * 1024) {
|
|
74
|
+
throw new Error('内联图标超过 32 KiB,去掉 icon 字段或缩小图标')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const index = {
|
|
78
|
+
format: 1,
|
|
79
|
+
title: { zh: '本地自建插件源', en: 'Private plugin source' },
|
|
80
|
+
description: {
|
|
81
|
+
zh: '个人维护的 DSH 插件,安装前请自行查看来源。',
|
|
82
|
+
en: 'Self-hosted DSH plugins. Check the source before installing.',
|
|
83
|
+
},
|
|
84
|
+
metadata: {
|
|
85
|
+
categories: {
|
|
86
|
+
productivity: { title: { zh: '效率工具', en: 'Productivity' } },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
plugins: [
|
|
90
|
+
{
|
|
91
|
+
name: pkg.name,
|
|
92
|
+
title: { zh: '桌面提醒', en: 'Desktop reminder' },
|
|
93
|
+
description: {
|
|
94
|
+
zh: '把完成 / 决定提醒变成 notify_user 工具:浮动卡片 + 提示音,不抢焦点。卡片由插件自带的 PowerShell 脚本绘制,仓库零 exe。仅 Windows。',
|
|
95
|
+
en: 'Turns completion / decision reminders into a notify_user tool: floating card with sound, never steals focus. The card is drawn by the bundled PowerShell host, so the package ships no exe. Windows only.',
|
|
96
|
+
},
|
|
97
|
+
...icon === undefined ? {} : { icon },
|
|
98
|
+
author: flag('author') ?? pkg.name,
|
|
99
|
+
repository: { url: repoUrl },
|
|
100
|
+
metadata: {
|
|
101
|
+
category: 'productivity',
|
|
102
|
+
keywords: Array.isArray(pkg.keywords) ? pkg.keywords : [],
|
|
103
|
+
labels: [],
|
|
104
|
+
},
|
|
105
|
+
versions: [
|
|
106
|
+
{
|
|
107
|
+
version: pkg.version,
|
|
108
|
+
publishTimestamp,
|
|
109
|
+
source: versionSource,
|
|
110
|
+
engines: pkg.engines?.dsh === undefined ? {} : { dsh: pkg.engines.dsh },
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const outPath = path.resolve(ROOT, flag('out') ?? 'publish/index.json')
|
|
118
|
+
fs.mkdirSync(path.dirname(outPath), { recursive: true })
|
|
119
|
+
fs.writeFileSync(outPath, `${JSON.stringify(index, null, 2)}\n`, 'utf8')
|
|
120
|
+
console.log(`已写入 ${outPath}`)
|
|
121
|
+
console.log(` 插件 ${pkg.name}@${pkg.version}`)
|
|
122
|
+
console.log(` 仓库 ${repoUrl}`)
|
|
123
|
+
console.log(` 提交 ${commit}`)
|
|
124
|
+
console.log(` 来源 ${useNpm ? `npm(${registry ?? '使用安装方配置的 registry'})` : 'git'}`)
|
|
125
|
+
console.log(` 时间 ${new Date(publishTimestamp * 1000).toISOString()}`)
|
|
126
|
+
|
|
127
|
+
// --publish:只把这份索引提交进仓库(paths 限定,不会顺手带走别的改动)。
|
|
128
|
+
if (argv.includes('--publish')) {
|
|
129
|
+
const rel = path.relative(ROOT, outPath).split(path.sep).join('/')
|
|
130
|
+
execFileSync('git', ['add', '--', rel], { cwd: ROOT, stdio: 'inherit' })
|
|
131
|
+
let dirty = true
|
|
132
|
+
try {
|
|
133
|
+
execFileSync('git', ['diff', '--cached', '--quiet', '--', rel], { cwd: ROOT })
|
|
134
|
+
dirty = false
|
|
135
|
+
} catch {
|
|
136
|
+
dirty = true
|
|
137
|
+
}
|
|
138
|
+
if (!dirty) {
|
|
139
|
+
console.log(`已提交:${rel} 没有变化,跳过 commit`)
|
|
140
|
+
} else {
|
|
141
|
+
execFileSync('git', ['commit', '-m', `索引:${pkg.name}@${pkg.version}(${commit.slice(0, 7)})`, '--', rel], {
|
|
142
|
+
cwd: ROOT,
|
|
143
|
+
stdio: 'inherit',
|
|
144
|
+
})
|
|
145
|
+
console.log(`已提交:${rel}`)
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
execFileSync('git', ['config', '--get', 'remote.origin.url'], { cwd: ROOT, stdio: 'pipe' })
|
|
149
|
+
console.log('下一步:git push')
|
|
150
|
+
} catch {
|
|
151
|
+
console.log('还没有 remote:先 git remote add origin <仓库 https 地址> 再 push')
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# 在可见的控制台窗口里完成:npm 网页授权登录 → 发布 dsh-reminder-notify。
|
|
2
|
+
# 由 publish-npm-window.cmd 启动;也可以自己右键「使用 PowerShell 运行」。
|
|
3
|
+
|
|
4
|
+
$ErrorActionPreference = 'Continue'
|
|
5
|
+
$repo = Split-Path -Parent $PSScriptRoot
|
|
6
|
+
Set-Location $repo
|
|
7
|
+
$Host.UI.RawUI.WindowTitle = 'npm 发布:dsh-reminder-notify'
|
|
8
|
+
|
|
9
|
+
function Find-Tool {
|
|
10
|
+
param([string]$Name)
|
|
11
|
+
$candidates = @()
|
|
12
|
+
$runtimes = Get-ChildItem (Join-Path $env:USERPROFILE '.dsh\dsh-runtimes') -Directory -ErrorAction SilentlyContinue
|
|
13
|
+
foreach ($runtime in $runtimes) {
|
|
14
|
+
$deps = Join-Path $runtime.FullName 'dependencies'
|
|
15
|
+
if ($Name -eq 'node') { $candidates += Join-Path $deps 'node\bin\node.exe' }
|
|
16
|
+
if ($Name -eq 'pnpm') { $candidates += Join-Path $deps 'pnpm\bin\pnpm.cjs' }
|
|
17
|
+
}
|
|
18
|
+
foreach ($candidate in $candidates) {
|
|
19
|
+
if (Test-Path $candidate) { return $candidate }
|
|
20
|
+
}
|
|
21
|
+
if ($Name -eq 'node') {
|
|
22
|
+
$cmd = Get-Command node.exe -ErrorAction SilentlyContinue
|
|
23
|
+
if ($cmd) { return $cmd.Source }
|
|
24
|
+
}
|
|
25
|
+
return $null
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
$node = $env:DSH_NODE
|
|
29
|
+
if (-not $node) { $node = Find-Tool 'node' }
|
|
30
|
+
$pnpm = $env:DSH_PNPM
|
|
31
|
+
if (-not $pnpm) { $pnpm = Find-Tool 'pnpm' }
|
|
32
|
+
|
|
33
|
+
if (-not $node -or -not (Test-Path $node)) {
|
|
34
|
+
Write-Host '找不到 node.exe,退出。' -ForegroundColor Red
|
|
35
|
+
Read-Host '按回车关闭'
|
|
36
|
+
exit 1
|
|
37
|
+
}
|
|
38
|
+
if (-not $pnpm -or -not (Test-Path $pnpm)) {
|
|
39
|
+
Write-Host '找不到 pnpm.cjs,退出。' -ForegroundColor Red
|
|
40
|
+
Read-Host '按回车关闭'
|
|
41
|
+
exit 1
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# dlx 出来的 npm 需要一个叫 node 的命令,把 node 所在目录放到 PATH 最前面。
|
|
45
|
+
$env:PATH = (Split-Path $node) + ';' + $env:PATH
|
|
46
|
+
|
|
47
|
+
Write-Host '=============================================='
|
|
48
|
+
Write-Host ' 第 1 步:登录 npm(用浏览器点一下授权就行)'
|
|
49
|
+
Write-Host '=============================================='
|
|
50
|
+
Write-Host '接下来浏览器会打开 npm 的授权页;'
|
|
51
|
+
Write-Host '在页面上点「Authorize / Grant Access」这类确认按钮,'
|
|
52
|
+
Write-Host '然后等这个窗口出现登录成功的信息。'
|
|
53
|
+
Write-Host ''
|
|
54
|
+
|
|
55
|
+
& $node $pnpm dlx npm@latest login --auth-type=web --registry https://registry.npmjs.org/
|
|
56
|
+
if ($LASTEXITCODE -ne 0) {
|
|
57
|
+
Write-Host ''
|
|
58
|
+
Write-Host '网页授权没有完成。可以改用密码登录:' -ForegroundColor Yellow
|
|
59
|
+
Write-Host ' 在下面输入用户名 / 密码 / 邮箱(2FA 还会要一次验证码)。' -ForegroundColor Yellow
|
|
60
|
+
& $node $pnpm dlx npm@latest login --auth-type=legacy --registry https://registry.npmjs.org/
|
|
61
|
+
if ($LASTEXITCODE -ne 0) {
|
|
62
|
+
Write-Host '登录失败,退出。' -ForegroundColor Red
|
|
63
|
+
Read-Host '按回车关闭'
|
|
64
|
+
exit 1
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Write-Host ''
|
|
69
|
+
Write-Host '=============================================='
|
|
70
|
+
Write-Host ' 第 2 步:发布 dsh-reminder-notify@0.2.0'
|
|
71
|
+
Write-Host '=============================================='
|
|
72
|
+
& $node $pnpm publish --access public --no-git-checks --ignore-scripts
|
|
73
|
+
$code = $LASTEXITCODE
|
|
74
|
+
Write-Host ''
|
|
75
|
+
if ($code -eq 0) {
|
|
76
|
+
Write-Host '发布完成!https://www.npmjs.com/package/dsh-reminder-notify' -ForegroundColor Green
|
|
77
|
+
Write-Host '回 DSH 告诉 AI 一声,剩下的索引更新它会做。' -ForegroundColor Green
|
|
78
|
+
} else {
|
|
79
|
+
Write-Host '发布没有成功(退出码 ' + $code + ')。' -ForegroundColor Red
|
|
80
|
+
Write-Host '把上面的红字发回 DSH 即可;常见原因是版本号已存在或 2FA 需要验证码。' -ForegroundColor Red
|
|
81
|
+
}
|
|
82
|
+
Read-Host '按回车关闭这个窗口'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
$ErrorActionPreference = 'Continue'
|
|
2
|
+
$repo = 'C:\Users\Administrator\Documents\deepseek-harness\default-workspace\dsh-reminder-notify'
|
|
3
|
+
$nodeDir = 'C:\Users\Administrator\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\node'
|
|
4
|
+
$node = Join-Path $nodeDir 'bin\node.exe'
|
|
5
|
+
$pnpm = 'C:\Users\Administrator\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\pnpm\bin\pnpm.cjs'
|
|
6
|
+
$log = Join-Path $env:TEMP 'npm-login-output.txt'
|
|
7
|
+
$reg = 'https://registry.npmjs.org/'
|
|
8
|
+
|
|
9
|
+
Remove-Item $log -ErrorAction SilentlyContinue
|
|
10
|
+
$env:PATH = (Join-Path $nodeDir 'bin') + ';' + $env:PATH
|
|
11
|
+
Set-Location $repo
|
|
12
|
+
|
|
13
|
+
Write-Host ''
|
|
14
|
+
Write-Host '=== STEP 1: npm login (web authorize) ===' -ForegroundColor Cyan
|
|
15
|
+
& $node $pnpm dlx npm@latest login --auth-type=web --registry $reg 2>&1 | Tee-Object -FilePath $log -Append
|
|
16
|
+
|
|
17
|
+
if ($LASTEXITCODE -ne 0) {
|
|
18
|
+
Write-Host ''
|
|
19
|
+
Write-Host '=== STEP 1b: fallback password login ===' -ForegroundColor Yellow
|
|
20
|
+
& $node $pnpm dlx npm@latest login --auth-type=legacy --registry $reg 2>&1 | Tee-Object -FilePath $log -Append
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
Write-Host ''
|
|
24
|
+
Write-Host '=== STEP 2: npm publish ===' -ForegroundColor Cyan
|
|
25
|
+
& $node $pnpm dlx npm@latest publish --access public --no-git-checks --ignore-scripts --registry $reg 2>&1 | Tee-Object -FilePath $log -Append
|
|
26
|
+
$code = $LASTEXITCODE
|
|
27
|
+
|
|
28
|
+
Write-Host ''
|
|
29
|
+
if ($code -eq 0) {
|
|
30
|
+
Write-Host '=== PUBLISH DONE - OK ===' -ForegroundColor Green
|
|
31
|
+
} else {
|
|
32
|
+
Write-Host ('=== PUBLISH FAILED - exit ' + $code + ' ===') -ForegroundColor Red
|
|
33
|
+
}
|
|
34
|
+
Write-Host '(this window can stay open; the agent will read the log file)'
|
|
35
|
+
Write-Host ''
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
$ErrorActionPreference = 'Continue'
|
|
2
|
+
$repo = 'C:\Users\Administrator\Documents\deepseek-harness\default-workspace\dsh-reminder-notify'
|
|
3
|
+
$nodeDir = 'C:\Users\Administrator\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\node'
|
|
4
|
+
$node = Join-Path $nodeDir 'bin\node.exe'
|
|
5
|
+
$pnpm = 'C:\Users\Administrator\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\pnpm\bin\pnpm.cjs'
|
|
6
|
+
$env:PATH = (Join-Path $nodeDir 'bin') + ';' + $env:PATH
|
|
7
|
+
Set-Location $repo
|
|
8
|
+
|
|
9
|
+
Write-Host ''
|
|
10
|
+
Write-Host '=== npm publish (will ask for a one-time password) ===' -ForegroundColor Cyan
|
|
11
|
+
Write-Host ''
|
|
12
|
+
& $node $pnpm dlx npm@latest publish --access public --ignore-scripts --registry https://registry.npmjs.org/
|
|
13
|
+
$code = $LASTEXITCODE
|
|
14
|
+
Write-Host ''
|
|
15
|
+
if ($code -eq 0) {
|
|
16
|
+
Write-Host '=== PUBLISH DONE - OK ===' -ForegroundColor Green
|
|
17
|
+
} else {
|
|
18
|
+
Write-Host ('=== PUBLISH FAILED - exit ' + $code + ' ===') -ForegroundColor Red
|
|
19
|
+
}
|
|
20
|
+
Write-Host ''
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# 把 dsh-reminder-notify 发布到 npm 官方源(registry.npmjs.org)。
|
|
2
|
+
#
|
|
3
|
+
# 用法:双击 scripts/publish-npm.cmd,或在本目录执行
|
|
4
|
+
# powershell -NoProfile -ExecutionPolicy Bypass -File scripts/publish-npm.ps1
|
|
5
|
+
#
|
|
6
|
+
# 第一次会要求登录 npm(用户名 / 密码 / 邮箱,开了 2FA 的再输一次验证码),
|
|
7
|
+
# 登录信息保存在 %USERPROFILE%\.npmrc,之后发布不用再登。密码不会显示、也不会被本脚本记录。
|
|
8
|
+
|
|
9
|
+
$ErrorActionPreference = 'Stop'
|
|
10
|
+
|
|
11
|
+
$repo = Split-Path -Parent $PSScriptRoot
|
|
12
|
+
Set-Location $repo
|
|
13
|
+
|
|
14
|
+
# 找 node + pnpm:优先本机安装,其次 DSH 自带的运行时(桌面版用户通常只有后者)。
|
|
15
|
+
$node = $env:DSH_NODE
|
|
16
|
+
$pnpm = $env:DSH_PNPM
|
|
17
|
+
|
|
18
|
+
if (-not $node -or -not $pnpm) {
|
|
19
|
+
$runtimes = Get-ChildItem (Join-Path $env:USERPROFILE '.dsh\dsh-runtimes') -Directory -ErrorAction SilentlyContinue
|
|
20
|
+
foreach ($runtime in $runtimes) {
|
|
21
|
+
$deps = Join-Path $runtime.FullName 'dependencies'
|
|
22
|
+
$nodeCandidate = Join-Path $deps 'node\bin\node.exe'
|
|
23
|
+
$pnpmCandidate = Join-Path $deps 'pnpm\bin\pnpm.cjs'
|
|
24
|
+
if ((Test-Path $nodeCandidate) -and (Test-Path $pnpmCandidate)) {
|
|
25
|
+
$node = $nodeCandidate
|
|
26
|
+
$pnpm = $pnpmCandidate
|
|
27
|
+
break
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (-not $node -or -not (Test-Path $node)) {
|
|
32
|
+
$systemNode = Get-Command node.exe -ErrorAction SilentlyContinue
|
|
33
|
+
if ($systemNode) { $node = $systemNode.Source }
|
|
34
|
+
}
|
|
35
|
+
if (-not $node -or -not (Test-Path $node)) {
|
|
36
|
+
Write-Host '找不到 node.exe。请先在 DSH 里启动过一次(生成运行时),或设置 DSH_NODE 环境变量。' -ForegroundColor Red
|
|
37
|
+
exit 1
|
|
38
|
+
}
|
|
39
|
+
if (-not $pnpm -or -not (Test-Path $pnpm)) {
|
|
40
|
+
Write-Host '找不到 pnpm.cjs(DSH 自带运行时里应该有)。请设置 DSH_PNPM 环境变量指向 pnpm.cjs。' -ForegroundColor Red
|
|
41
|
+
exit 1
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Write-Host "node : $node"
|
|
45
|
+
Write-Host "pnpm : $pnpm"
|
|
46
|
+
Write-Host "包名 : dsh-reminder-notify"
|
|
47
|
+
Write-Host "仓库 : $repo"
|
|
48
|
+
|
|
49
|
+
# 未登录就先登录(交互输入,脚本不读取也不保存密码)。
|
|
50
|
+
& $node $pnpm whoami *> $null
|
|
51
|
+
if ($LASTEXITCODE -ne 0) {
|
|
52
|
+
Write-Host ''
|
|
53
|
+
Write-Host '还没有登录 npm,接下来按提示输入用户名 / 密码 / 邮箱(有 2FA 会再要一次验证码)。' -ForegroundColor Yellow
|
|
54
|
+
Write-Host '没有账号的话先到 https://www.npmjs.com/signup 注册,邮箱验证通过再回来。' -ForegroundColor Yellow
|
|
55
|
+
& $node $pnpm login
|
|
56
|
+
if ($LASTEXITCODE -ne 0) {
|
|
57
|
+
Write-Host '登录没有成功,退出。' -ForegroundColor Red
|
|
58
|
+
exit 1
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Write-Host ''
|
|
63
|
+
Write-Host '开始发布……'
|
|
64
|
+
& $node $pnpm publish --access public --no-git-checks --ignore-scripts
|
|
65
|
+
if ($LASTEXITCODE -ne 0) {
|
|
66
|
+
Write-Host ''
|
|
67
|
+
Write-Host '发布失败。常见原因:' -ForegroundColor Red
|
|
68
|
+
Write-Host ' - 这个版本号已经发布过(需要先在 package.json 里加一版,比如 0.2.1)'
|
|
69
|
+
Write-Host ' - 没有邮箱验证 / 没登录'
|
|
70
|
+
Write-Host ' - 网络连不上 registry.npmjs.org'
|
|
71
|
+
exit $LASTEXITCODE
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Write-Host ''
|
|
75
|
+
Write-Host '发布完成:https://www.npmjs.com/package/dsh-reminder-notify' -ForegroundColor Green
|
|
76
|
+
Write-Host '下一步:回到 DSH 告诉 AI「npm 发布好了」,它会更新插件索引并改成 npm 装源。' -ForegroundColor Green
|