dsh-progress-union 0.6.3 → 0.7.0-rc.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/CHANGELOG.md +387 -373
- package/LICENSE +21 -21
- package/README.md +286 -286
- package/anchor.js +39 -39
- package/client.js +2993 -2993
- package/cordis.patch.yml +4 -4
- package/docs/slot-models-comparison.md +23 -23
- package/docs/slot-trail-fanout.md +31 -31
- package/docs/spirit-reference.md +38 -38
- package/dsh.plugin.json +1 -1
- package/icon.svg +7 -7
- package/index.js +4993 -4568
- package/package.json +93 -79
- package/test/anchor.test.mjs +139 -139
- package/test/assistant.test.mjs +214 -214
- package/test/client.test.mjs +190 -190
- package/test/download-classify.test.mjs +199 -0
- package/test/e2e.test.mjs +77 -77
- package/test/goal-drive.test.mjs +17 -17
- package/test/harness.mjs +249 -249
- package/test/host.test.mjs +251 -251
- package/test/observer.test.mjs +170 -170
- package/test/parse-progress.test.mjs +78 -0
- package/test/settings.test.mjs +81 -81
- package/test/star-panel.test.mjs +181 -181
- package/test/time.test.mjs +147 -147
- package/test/todo-sync.test.mjs +155 -155
package/anchor.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dsh-progress-union/anchor — 零依赖锚点契约,供其他插件 import。
|
|
3
|
-
* 版本握手:consumer 读 ANCHOR_VERSION,与 service.version 相等才解析字段。
|
|
4
|
-
*/
|
|
5
|
-
export const ANCHOR_VERSION = 1
|
|
6
|
-
|
|
7
|
-
export const ANCHOR_ROUTES = {
|
|
8
|
-
anchor: '/progress-union/anchor',
|
|
9
|
-
snapshot: '/progress-union/snapshot',
|
|
10
|
-
status: '/dsh-progress/status',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const BOARD_STATUSES = ['todo', 'doing', 'done', 'blocked']
|
|
14
|
-
|
|
15
|
-
function isObject(value) {
|
|
16
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** 形状校验:新旧快照都能过(version/board/time 必备,不挑新增字段)。 */
|
|
20
|
-
export function isAnchor(v) {
|
|
21
|
-
if (!isObject(v)) return false
|
|
22
|
-
if (typeof v.version !== 'number' || typeof v.sessionId !== 'string') return false
|
|
23
|
-
if (!isObject(v.board) || typeof v.board.enabled !== 'boolean' || !isObject(v.board.summary)) return false
|
|
24
|
-
if (!isObject(v.time)) return false
|
|
25
|
-
const s = v.board.summary
|
|
26
|
-
return ['total', 'done', 'percent'].every((k) => typeof s[k] === 'number')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** 单行摘要:45% 3/7 · ETA 6m · stale 12m(缺值段省略)。 */
|
|
30
|
-
export function anchorLine(anchor) {
|
|
31
|
-
if (!isAnchor(anchor)) return ''
|
|
32
|
-
const s = anchor.board.summary
|
|
33
|
-
const bits = [`${s.percent}% ${s.done}/${s.total}`]
|
|
34
|
-
const eta = Number(anchor.time && anchor.time.etaMin)
|
|
35
|
-
if (Number.isFinite(eta) && eta > 0) bits.push(`ETA ${Math.round(eta)}m`)
|
|
36
|
-
const stale = Number(anchor.time && anchor.time.staleMin)
|
|
37
|
-
if (Number.isFinite(stale) && stale > 0) bits.push(`stale ${Math.round(stale)}m`)
|
|
38
|
-
return bits.join(' · ')
|
|
39
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* dsh-progress-union/anchor — 零依赖锚点契约,供其他插件 import。
|
|
3
|
+
* 版本握手:consumer 读 ANCHOR_VERSION,与 service.version 相等才解析字段。
|
|
4
|
+
*/
|
|
5
|
+
export const ANCHOR_VERSION = 1
|
|
6
|
+
|
|
7
|
+
export const ANCHOR_ROUTES = {
|
|
8
|
+
anchor: '/progress-union/anchor',
|
|
9
|
+
snapshot: '/progress-union/snapshot',
|
|
10
|
+
status: '/dsh-progress/status',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const BOARD_STATUSES = ['todo', 'doing', 'done', 'blocked']
|
|
14
|
+
|
|
15
|
+
function isObject(value) {
|
|
16
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 形状校验:新旧快照都能过(version/board/time 必备,不挑新增字段)。 */
|
|
20
|
+
export function isAnchor(v) {
|
|
21
|
+
if (!isObject(v)) return false
|
|
22
|
+
if (typeof v.version !== 'number' || typeof v.sessionId !== 'string') return false
|
|
23
|
+
if (!isObject(v.board) || typeof v.board.enabled !== 'boolean' || !isObject(v.board.summary)) return false
|
|
24
|
+
if (!isObject(v.time)) return false
|
|
25
|
+
const s = v.board.summary
|
|
26
|
+
return ['total', 'done', 'percent'].every((k) => typeof s[k] === 'number')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** 单行摘要:45% 3/7 · ETA 6m · stale 12m(缺值段省略)。 */
|
|
30
|
+
export function anchorLine(anchor) {
|
|
31
|
+
if (!isAnchor(anchor)) return ''
|
|
32
|
+
const s = anchor.board.summary
|
|
33
|
+
const bits = [`${s.percent}% ${s.done}/${s.total}`]
|
|
34
|
+
const eta = Number(anchor.time && anchor.time.etaMin)
|
|
35
|
+
if (Number.isFinite(eta) && eta > 0) bits.push(`ETA ${Math.round(eta)}m`)
|
|
36
|
+
const stale = Number(anchor.time && anchor.time.staleMin)
|
|
37
|
+
if (Number.isFinite(stale) && stale > 0) bits.push(`stale ${Math.round(stale)}m`)
|
|
38
|
+
return bits.join(' · ')
|
|
39
|
+
}
|