mino-connector-backup 0.1.0 → 0.1.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 +11 -11
- package/cordis.patch.yml +5 -5
- package/hostdeps.mjs +30 -65
- package/package.json +45 -45
- package/skills/backup-annual-report/SKILL.md +28 -28
- package/skills/backup-audit/SKILL.md +13 -13
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# mino-connector-backup
|
|
2
|
-
|
|
3
|
-
手机备份盘点连接器。
|
|
4
|
-
|
|
5
|
-
backup_dirs 枚举 iTunes/HiSuite/小米备份目录;backup_itunes 读 Manifest.db 看备份内容按域统计。
|
|
6
|
-
|
|
7
|
-
## 原则
|
|
8
|
-
|
|
9
|
-
- 只读/本地:数据不出本机
|
|
10
|
-
- 用户主动:导入动作都由用户发起
|
|
11
|
-
- 只读 Manifest.db 不解密内容。
|
|
1
|
+
# mino-connector-backup
|
|
2
|
+
|
|
3
|
+
手机备份盘点连接器。
|
|
4
|
+
|
|
5
|
+
backup_dirs 枚举 iTunes/HiSuite/小米备份目录;backup_itunes 读 Manifest.db 看备份内容按域统计。
|
|
6
|
+
|
|
7
|
+
## 原则
|
|
8
|
+
|
|
9
|
+
- 只读/本地:数据不出本机
|
|
10
|
+
- 用户主动:导入动作都由用户发起
|
|
11
|
+
- 只读 Manifest.db 不解密内容。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# mino-connector-backup — bundle patch
|
|
2
|
-
- insert:
|
|
3
|
-
- id: connector-backup
|
|
4
|
-
name: 'mino-connector-backup'
|
|
5
|
-
config: {}
|
|
1
|
+
# mino-connector-backup — bundle patch
|
|
2
|
+
- insert:
|
|
3
|
+
- id: connector-backup
|
|
4
|
+
name: 'mino-connector-backup'
|
|
5
|
+
config: {}
|
package/hostdeps.mjs
CHANGED
|
@@ -1,74 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* 本包只需要 defineTool 一个件。
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
|
8
|
-
import { join, dirname } from 'node:path'
|
|
9
|
-
import { homedir } from 'node:os'
|
|
10
|
-
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
1
|
+
// Canonical host API loader. Generate packaged copies with scripts/sync-hostdeps.mjs.
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
3
|
+
import { join, resolve } from 'node:path'
|
|
4
|
+
import { pathToFileURL } from 'node:url'
|
|
11
5
|
|
|
12
|
-
|
|
6
|
+
function resolverOrigins(name) {
|
|
7
|
+
const origins = []
|
|
8
|
+
// An explicit development host and the current Electron installation own these APIs.
|
|
9
|
+
if (process.env.DSH_HOST_MODULES) origins.push(join(process.env.DSH_HOST_MODULES, name, 'package.json'))
|
|
10
|
+
if (process.resourcesPath) origins.push(join(process.resourcesPath, 'app.asar', 'dsh', 'node_modules', '@deepseek-ai', name, 'package.json'))
|
|
11
|
+
if (process.argv[1]) origins.push(resolve(process.argv[1]))
|
|
12
|
+
origins.push(import.meta.url)
|
|
13
|
+
return [...new Set(origins)]
|
|
14
|
+
}
|
|
13
15
|
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
push(process.env.DSH_HOST_MODULES)
|
|
18
|
-
const appdata = process.env.APPDATA
|
|
19
|
-
if (appdata) {
|
|
20
|
-
const npm = join(appdata, 'npm', 'node_modules')
|
|
21
|
-
push(join(npm, '@deepseek-ai'))
|
|
16
|
+
async function loadLibrary(name, notes) {
|
|
17
|
+
const failures = []
|
|
18
|
+
for (const origin of resolverOrigins(name)) {
|
|
22
19
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
20
|
+
const entry = createRequire(origin).resolve(`@deepseek-ai/${name}`)
|
|
21
|
+
const module = await import(pathToFileURL(entry).href)
|
|
22
|
+
notes.push(`${name}: ${entry}`)
|
|
23
|
+
return module
|
|
24
|
+
} catch (error) { failures.push(error) }
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
const dshHome = process.env.DSH_HOME || join(homedir(), '.dsh')
|
|
30
|
-
for (const p of readdirSync(join(dshHome, 'profiles'))) {
|
|
31
|
-
push(join(dshHome, 'profiles', p, 'node_modules', '@deepseek-ai'))
|
|
32
|
-
}
|
|
33
|
-
} catch { /* 没有就算了 */ }
|
|
34
|
-
push(SELF_MODULES)
|
|
35
|
-
return out
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function entryUrlFor(root, name) {
|
|
39
|
-
try {
|
|
40
|
-
const dir = join(root, name)
|
|
41
|
-
const pkgFile = join(dir, 'package.json')
|
|
42
|
-
if (!existsSync(pkgFile)) return null
|
|
43
|
-
const pkg = JSON.parse(readFileSync(pkgFile, 'utf8'))
|
|
44
|
-
const dot = pkg.exports?.['.']
|
|
45
|
-
const rel = typeof dot === 'string' ? dot : (dot?.import || dot?.default || pkg.module || pkg.main)
|
|
46
|
-
if (!rel) return null
|
|
47
|
-
const file = join(dir, String(rel).replace(/^\.\//, ''))
|
|
48
|
-
return existsSync(file) ? pathToFileURL(file).href : null
|
|
49
|
-
} catch { return null }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function localDefineTool(options) {
|
|
53
|
-
return options
|
|
26
|
+
throw new AggregateError(failures, `Host API @deepseek-ai/${name} is unavailable`)
|
|
54
27
|
}
|
|
55
28
|
|
|
56
29
|
export async function loadHostDeps() {
|
|
57
30
|
const notes = []
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
catch { /* try next root */ }
|
|
67
|
-
}
|
|
68
|
-
if (!dtMod) {
|
|
69
|
-
try { dtMod = await import('@deepseek-ai/dsh-tools'); log('dsh-tools:用自己依赖里那份') }
|
|
70
|
-
catch (e) { log(`dsh-tools 拿不到(${e?.code || ''})—— 用本地等价实现顶上`); dtMod = null }
|
|
71
|
-
}
|
|
72
|
-
defineTool = dtMod?.defineTool || ((options) => localDefineTool(options))
|
|
73
|
-
return { defineTool, notes }
|
|
31
|
+
const tools = await loadLibrary('dsh-tools', notes)
|
|
32
|
+
if (typeof tools.defineTool !== 'function') throw new Error('Required host API @deepseek-ai/dsh-tools.defineTool is unavailable')
|
|
33
|
+
let z = null
|
|
34
|
+
try {
|
|
35
|
+
const schema = await loadLibrary('schemastery', notes)
|
|
36
|
+
z = schema.default ?? schema
|
|
37
|
+
} catch (error) { notes.push(error.message) }
|
|
38
|
+
return { z, defineTool: tools.defineTool, notes }
|
|
74
39
|
}
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mino-connector-backup",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "手机备份连接器:读 iTunes 备份 Manifest.db 列内容清单 + 华为备份目录枚举。只读。",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"dsh",
|
|
7
|
-
"dsh-plugin",
|
|
8
|
-
"mino-connector",
|
|
9
|
-
"backup"
|
|
10
|
-
],
|
|
11
|
-
"type": "module",
|
|
12
|
-
"main": "index.js",
|
|
13
|
-
"exports": {
|
|
14
|
-
".": "./index.js",
|
|
15
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
16
|
-
"./package.json": "./package.json"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"index.js",
|
|
20
|
-
"hostdeps.mjs",
|
|
21
|
-
"skill-provider.mjs",
|
|
22
|
-
"skills",
|
|
23
|
-
"cordis.patch.yml",
|
|
24
|
-
"README.md",
|
|
25
|
-
"LICENSE"
|
|
26
|
-
],
|
|
27
|
-
"dsh": {
|
|
28
|
-
"bundle": {
|
|
29
|
-
"patch": "./cordis.patch.yml"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"engines": {
|
|
33
|
-
"dsh": ">=0.2.2-alpha.1 <0.3.0",
|
|
34
|
-
"node": ">=20.18"
|
|
35
|
-
},
|
|
36
|
-
"license": "MIT",
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/694410194/mino-plugins.git",
|
|
40
|
-
"directory": "packages/backup"
|
|
41
|
-
},
|
|
42
|
-
"bugs": {
|
|
43
|
-
"url": "https://github.com/694410194/mino-plugins/issues"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mino-connector-backup",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "手机备份连接器:读 iTunes 备份 Manifest.db 列内容清单 + 华为备份目录枚举。只读。",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"dsh-plugin",
|
|
8
|
+
"mino-connector",
|
|
9
|
+
"backup"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./index.js",
|
|
15
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"hostdeps.mjs",
|
|
21
|
+
"skill-provider.mjs",
|
|
22
|
+
"skills",
|
|
23
|
+
"cordis.patch.yml",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"dsh": {
|
|
28
|
+
"bundle": {
|
|
29
|
+
"patch": "./cordis.patch.yml"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"dsh": ">=0.2.2-alpha.1 <0.3.0",
|
|
34
|
+
"node": ">=20.18"
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/694410194/mino-plugins.git",
|
|
40
|
+
"directory": "packages/backup"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/694410194/mino-plugins/issues"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: backup-annual-report
|
|
3
|
-
description: 备份年度体检。备份够不够,产出可晒的年度总结 markdown。涉及"年度报告/年终总结/年度盘点"请求时适用。
|
|
4
|
-
metadata:
|
|
5
|
-
author: mino
|
|
6
|
-
version: "0.1.0"
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# 备份年度体检
|
|
10
|
-
|
|
11
|
-
用本域连接器把备份够不够整理成一份年度总结。数据全程本地,产物写用户目录。
|
|
12
|
-
|
|
13
|
-
## 流程
|
|
14
|
-
|
|
15
|
-
0. **可选出图**:把报告要点按 `poster-design` 技能写成自包含 HTML,调 `poster_render` 出 PNG 晒图。
|
|
16
|
-
|
|
17
|
-
1. **确认数据**:相关工具(backup_dirs/backup_itunes)有数据才做;没有先引导导入。
|
|
18
|
-
2. **取数**:调对应工具拉统计和明细。
|
|
19
|
-
3. **写报告**:在数据同目录写 `<年份>-backup报告.md`,结构:
|
|
20
|
-
- 总览(区间/总量/来源)
|
|
21
|
-
- 各设备最近备份时间、内容域分布、风险提示
|
|
22
|
-
- 值得记住的几条(选有故事感的明细)
|
|
23
|
-
- 结语一句
|
|
24
|
-
|
|
25
|
-
## 纪律
|
|
26
|
-
|
|
27
|
-
- 数字必须来自工具返回,不估不编
|
|
28
|
-
- 数据缺口直说,不补假数
|
|
1
|
+
---
|
|
2
|
+
name: backup-annual-report
|
|
3
|
+
description: 备份年度体检。备份够不够,产出可晒的年度总结 markdown。涉及"年度报告/年终总结/年度盘点"请求时适用。
|
|
4
|
+
metadata:
|
|
5
|
+
author: mino
|
|
6
|
+
version: "0.1.0"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 备份年度体检
|
|
10
|
+
|
|
11
|
+
用本域连接器把备份够不够整理成一份年度总结。数据全程本地,产物写用户目录。
|
|
12
|
+
|
|
13
|
+
## 流程
|
|
14
|
+
|
|
15
|
+
0. **可选出图**:把报告要点按 `poster-design` 技能写成自包含 HTML,调 `poster_render` 出 PNG 晒图。
|
|
16
|
+
|
|
17
|
+
1. **确认数据**:相关工具(backup_dirs/backup_itunes)有数据才做;没有先引导导入。
|
|
18
|
+
2. **取数**:调对应工具拉统计和明细。
|
|
19
|
+
3. **写报告**:在数据同目录写 `<年份>-backup报告.md`,结构:
|
|
20
|
+
- 总览(区间/总量/来源)
|
|
21
|
+
- 各设备最近备份时间、内容域分布、风险提示
|
|
22
|
+
- 值得记住的几条(选有故事感的明细)
|
|
23
|
+
- 结语一句
|
|
24
|
+
|
|
25
|
+
## 纪律
|
|
26
|
+
|
|
27
|
+
- 数字必须来自工具返回,不估不编
|
|
28
|
+
- 数据缺口直说,不补假数
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: backup-audit
|
|
3
|
-
description: 手机备份盘点。backup_dirs 枚举 iTunes/HiSuite/小米备份目录;backup_itunes 读 Manifest.db 看备份内容按域统计。
|
|
4
|
-
---
|
|
5
|
-
# 手机备份盘点
|
|
6
|
-
|
|
7
|
-
## 用法
|
|
8
|
-
|
|
9
|
-
iTunes 加密备份只报域分布不解密。
|
|
10
|
-
|
|
11
|
-
## 边界
|
|
12
|
-
|
|
13
|
-
只读 Manifest.db 不解密内容。
|
|
1
|
+
---
|
|
2
|
+
name: backup-audit
|
|
3
|
+
description: 手机备份盘点。backup_dirs 枚举 iTunes/HiSuite/小米备份目录;backup_itunes 读 Manifest.db 看备份内容按域统计。
|
|
4
|
+
---
|
|
5
|
+
# 手机备份盘点
|
|
6
|
+
|
|
7
|
+
## 用法
|
|
8
|
+
|
|
9
|
+
iTunes 加密备份只报域分布不解密。
|
|
10
|
+
|
|
11
|
+
## 边界
|
|
12
|
+
|
|
13
|
+
只读 Manifest.db 不解密内容。
|