saibo-kanban 0.3.0 → 0.4.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/CHANGELOG.md +13 -0
- package/README.md +10 -1
- package/bin/import.mjs +199 -0
- package/client.js +5 -5
- package/lib/xlsx.js +153 -0
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
- 新增 xlsx 导入:`node bin/import.mjs --xlsx <文件> [--dry-run]`。
|
|
6
|
+
- 任务主表 → 归档历史条目(done)
|
|
7
|
+
- 长期滚动项 → 活跃条目(TODO→待办、PARTIAL/FIX→进行中、BLOCKED→受阻、暂缓→待规划)
|
|
8
|
+
- 节点说明 → 一条 design 资产
|
|
9
|
+
- 零依赖 XLSX 读取器(`lib/xlsx.js`,只读 ZIP + sharedStrings,不装任何包)。
|
|
10
|
+
- 看板 Tab 调到「对话」左边(order -10)。
|
|
11
|
+
|
|
12
|
+
## 0.3.1
|
|
13
|
+
|
|
14
|
+
- 入口改到顶部视图导航(`conversation.view`),像记忆插件的「记忆 / 技能 / 待办」那样以 Tab 出现,不再占左侧导航。
|
|
15
|
+
|
|
3
16
|
## 0.3.0
|
|
4
17
|
|
|
5
18
|
- 新增页面:左侧「看板」入口 + 中央面板(收件箱 / 看板 / 表格三视图)。
|
package/README.md
CHANGED
|
@@ -63,6 +63,15 @@ node bin/board.mjs show <id>
|
|
|
63
63
|
node bin/board.mjs brief
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
**导入 xlsx**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
node bin/import.mjs --xlsx "C:\path\开发任务管理看板.xlsx" --dry-run # 先看映射
|
|
70
|
+
node bin/import.mjs --xlsx "C:\path\开发任务管理看板.xlsx" # 真正写入
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
主表进归档(历史台账),长期滚动项进活跃列,节点说明合成一条 design 资产。
|
|
74
|
+
|
|
66
75
|
## 工具
|
|
67
76
|
|
|
68
77
|
| 工具 | 作用 |
|
|
@@ -80,7 +89,7 @@ node bin/board.mjs brief
|
|
|
80
89
|
- [x] 0.1.0 骨架
|
|
81
90
|
- [x] 0.2.0 核心 + 工具
|
|
82
91
|
- [x] 0.3.0 DSH 内页面(表格 / 看板 / 收件箱)+ 回滚
|
|
83
|
-
- [
|
|
92
|
+
- [x] 0.4.0 xlsx 导入(列映射 + 预览 + 冲突报告)
|
|
84
93
|
- [ ] 0.5.0 brief 注入与复用统计
|
|
85
94
|
|
|
86
95
|
## 开发
|
package/bin/import.mjs
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 导入 xlsx 到看板。
|
|
4
|
+
*
|
|
5
|
+
* node bin/import.mjs --xlsx "C:\path\开发任务管理看板.xlsx" --dry-run
|
|
6
|
+
* node bin/import.mjs --xlsx "..." --data-dir "C:\...\.dsh\saibo_kanban"
|
|
7
|
+
*
|
|
8
|
+
* 规则:
|
|
9
|
+
* - 任务主表:全部导入为已归档(历史台账),状态 done
|
|
10
|
+
* - 长期滚动项:导入为活跃条目,按状态映射
|
|
11
|
+
* - 节点说明:整页文本合成一条 design 资产
|
|
12
|
+
*/
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
import { readXlsx } from '../lib/xlsx.js';
|
|
15
|
+
import { Store, defaultDataDir } from '../store.js';
|
|
16
|
+
import { normalizeKinds, STATUSES } from '../core.js';
|
|
17
|
+
|
|
18
|
+
const argv = process.argv.slice(2);
|
|
19
|
+
const flags = {};
|
|
20
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
21
|
+
const a = argv[i];
|
|
22
|
+
if (a.startsWith('--')) {
|
|
23
|
+
const key = a.slice(2);
|
|
24
|
+
const next = argv[i + 1];
|
|
25
|
+
if (next !== undefined && !next.startsWith('--')) { flags[key] = next; i += 1; }
|
|
26
|
+
else flags[key] = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const file = flags.xlsx;
|
|
30
|
+
if (!file) {
|
|
31
|
+
console.error('用法: node bin/import.mjs --xlsx <文件> [--dry-run] [--data-dir <目录>]');
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const dryRun = flags['dry-run'] === true;
|
|
35
|
+
const dataDir = flags['data-dir'] || defaultDataDir();
|
|
36
|
+
|
|
37
|
+
const STATUS_MAP = {
|
|
38
|
+
DONE: 'done',
|
|
39
|
+
'DONE(描述修正)': 'done',
|
|
40
|
+
'DONE(已覆盖)': 'done',
|
|
41
|
+
TODO: 'todo',
|
|
42
|
+
PARTIAL: 'in_progress',
|
|
43
|
+
FIX: 'in_progress',
|
|
44
|
+
BLOCKED: 'blocked',
|
|
45
|
+
暂缓: 'backlog'
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const statusLabel = id => (STATUSES.find(s => s.id === id) || { label: id }).label;
|
|
49
|
+
|
|
50
|
+
function headerIndex(rows, name) {
|
|
51
|
+
for (let i = 0; i < Math.min(rows.length, 5); i += 1) {
|
|
52
|
+
if ((rows[i] || []).some(v => String(v).trim() === name)) return i;
|
|
53
|
+
}
|
|
54
|
+
return 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function col(rows, headerRow, name) {
|
|
58
|
+
const row = rows[headerRow] || [];
|
|
59
|
+
for (let i = 0; i < row.length; i += 1) if (String(row[i]).trim() === name) return i;
|
|
60
|
+
return -1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function cell(row, idx) {
|
|
64
|
+
if (idx < 0) return '';
|
|
65
|
+
const v = row[idx];
|
|
66
|
+
return v === undefined || v === null ? '' : String(v).trim();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function mapMain(rows) {
|
|
70
|
+
const h = headerIndex(rows, '编号');
|
|
71
|
+
const cId = col(rows, h, '编号');
|
|
72
|
+
const cGroup = col(rows, h, '分组');
|
|
73
|
+
const cTitle = col(rows, h, '名称');
|
|
74
|
+
const cBody = col(rows, h, '详细说明');
|
|
75
|
+
const cStatus = col(rows, h, '状态');
|
|
76
|
+
const cType = col(rows, h, '类型');
|
|
77
|
+
const out = [];
|
|
78
|
+
for (let i = h + 1; i < rows.length; i += 1) {
|
|
79
|
+
const title = cell(rows[i], cTitle);
|
|
80
|
+
if (!title) continue;
|
|
81
|
+
const status = STATUS_MAP[cell(rows[i], cStatus)] || 'done';
|
|
82
|
+
out.push({
|
|
83
|
+
title,
|
|
84
|
+
body: [
|
|
85
|
+
cell(rows[i], cId) ? `编号:${cell(rows[i], cId)}` : '',
|
|
86
|
+
cell(rows[i], cType) ? `类型:${cell(rows[i], cType)}` : '',
|
|
87
|
+
cell(rows[i], cBody)
|
|
88
|
+
].filter(Boolean).join('\n'),
|
|
89
|
+
kind: 'task',
|
|
90
|
+
scope: cell(rows[i], cGroup),
|
|
91
|
+
status,
|
|
92
|
+
archived: true,
|
|
93
|
+
ext: cell(rows[i], cId)
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function mapRolling(rows) {
|
|
100
|
+
const h = headerIndex(rows, '编号');
|
|
101
|
+
const cId = col(rows, h, '编号');
|
|
102
|
+
const cGroup = col(rows, h, '分组');
|
|
103
|
+
const cTitle = col(rows, h, '名称');
|
|
104
|
+
const cBody = col(rows, h, '详细说明');
|
|
105
|
+
const cStatus = col(rows, h, '状态');
|
|
106
|
+
const cPri = col(rows, h, '优先级');
|
|
107
|
+
const cRoll = col(rows, h, '滚动次数');
|
|
108
|
+
const cFirst = col(rows, h, '首次来源');
|
|
109
|
+
const cLast = col(rows, h, '最近来源');
|
|
110
|
+
const out = [];
|
|
111
|
+
for (let i = h + 1; i < rows.length; i += 1) {
|
|
112
|
+
const title = cell(rows[i], cTitle);
|
|
113
|
+
if (!title) continue;
|
|
114
|
+
const status = STATUS_MAP[cell(rows[i], cStatus)] || 'todo';
|
|
115
|
+
out.push({
|
|
116
|
+
title,
|
|
117
|
+
body: [
|
|
118
|
+
cell(rows[i], cId) ? `编号:${cell(rows[i], cId)}` : '',
|
|
119
|
+
cell(rows[i], cBody),
|
|
120
|
+
cell(rows[i], cPri) ? `优先级:${cell(rows[i], cPri)}` : '',
|
|
121
|
+
cell(rows[i], cRoll) ? `滚动次数:${cell(rows[i], cRoll)}` : '',
|
|
122
|
+
cell(rows[i], cFirst) ? `首次来源:${cell(rows[i], cFirst)}` : '',
|
|
123
|
+
cell(rows[i], cLast) ? `最近来源:${cell(rows[i], cLast)}` : ''
|
|
124
|
+
].filter(Boolean).join('\n'),
|
|
125
|
+
kind: 'task',
|
|
126
|
+
scope: cell(rows[i], cGroup),
|
|
127
|
+
status,
|
|
128
|
+
archived: false,
|
|
129
|
+
ext: cell(rows[i], cId)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function mapNotes(rows) {
|
|
136
|
+
const text = rows.map(r => cell(r, 0)).join('\n').trim();
|
|
137
|
+
if (!text) return null;
|
|
138
|
+
const firstLine = text.split('\n').find(l => l.trim()) || '节点说明';
|
|
139
|
+
return {
|
|
140
|
+
title: firstLine.replace(/^#+\s*/, '').slice(0, 120),
|
|
141
|
+
body: text,
|
|
142
|
+
kind: 'design',
|
|
143
|
+
scope: '设计',
|
|
144
|
+
status: 'done',
|
|
145
|
+
archived: false,
|
|
146
|
+
ext: 'nodes'
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const sheets = readXlsx(file);
|
|
151
|
+
const byName = new Map(sheets.map(s => [s.name, s.rows]));
|
|
152
|
+
const mainRows = byName.get('任务主表') || sheets[0]?.rows || [];
|
|
153
|
+
const rollingRows = byName.get('长期滚动项') || sheets[1]?.rows || [];
|
|
154
|
+
const notesRows = byName.get('节点说明') || sheets[2]?.rows || [];
|
|
155
|
+
|
|
156
|
+
const main = mapMain(mainRows);
|
|
157
|
+
const rolling = mapRolling(rollingRows);
|
|
158
|
+
const notes = mapNotes(notesRows);
|
|
159
|
+
|
|
160
|
+
console.log(`文件:${file}`);
|
|
161
|
+
console.log(`主表 ${main.length} 条(归档,done)`);
|
|
162
|
+
console.log(`滚动项 ${rolling.length} 条(活跃)`);
|
|
163
|
+
console.log(`节点说明:${notes ? '1 条' : '无'}`);
|
|
164
|
+
console.log('状态分布:', Object.fromEntries([...new Set(rolling.map(r => r.status))].map(s => [statusLabel(s), rolling.filter(r => r.status === s).length])));
|
|
165
|
+
|
|
166
|
+
const titles = new Map();
|
|
167
|
+
for (const r of rolling) titles.set(r.title, (titles.get(r.title) || 0) + 1);
|
|
168
|
+
const dup = [...titles.entries()].filter(([, n]) => n > 1);
|
|
169
|
+
console.log(`滚动项重名:${dup.length} 组`);
|
|
170
|
+
console.log('样例:');
|
|
171
|
+
for (const r of rolling.slice(0, 2)) console.log(' -', r.status, '|', r.scope, '|', r.title);
|
|
172
|
+
for (const r of main.slice(0, 1)) console.log(' -', r.status, '|', r.scope, '|', r.title, '(归档)');
|
|
173
|
+
|
|
174
|
+
if (dryRun) {
|
|
175
|
+
console.log('\n--dry-run:不写入。去掉 --dry-run 才导入。');
|
|
176
|
+
process.exit(0);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const store = new Store({ dataDir, kinds: normalizeKinds(null) }).load();
|
|
180
|
+
let written = 0;
|
|
181
|
+
for (const item of main) {
|
|
182
|
+
const created = store.record({
|
|
183
|
+
title: item.title, kind: item.kind, scope: item.scope, body: item.body, status: item.status
|
|
184
|
+
}, { by: 'human', note: '导入:任务主表' });
|
|
185
|
+
store.archive(created.id, { by: 'human', note: '导入历史台账' });
|
|
186
|
+
written += 1;
|
|
187
|
+
}
|
|
188
|
+
for (const item of rolling) {
|
|
189
|
+
store.record({
|
|
190
|
+
title: item.title, kind: item.kind, scope: item.scope, body: item.body, status: item.status
|
|
191
|
+
}, { by: 'human', note: '导入:长期滚动项' });
|
|
192
|
+
written += 1;
|
|
193
|
+
}
|
|
194
|
+
if (notes) {
|
|
195
|
+
store.record({ title: notes.title, kind: notes.kind, scope: notes.scope, body: notes.body, status: notes.status },
|
|
196
|
+
{ by: 'human', note: '导入:节点说明' });
|
|
197
|
+
written += 1;
|
|
198
|
+
}
|
|
199
|
+
console.log(`\n已导入 ${written} 条到 ${path.join(dataDir, 'records.jsonl')}`);
|
package/client.js
CHANGED
|
@@ -362,11 +362,11 @@ window.__ModuleLoader__.load({
|
|
|
362
362
|
return {
|
|
363
363
|
inject: ['slots'],
|
|
364
364
|
apply(ctx) {
|
|
365
|
-
ctx.slots.inject('
|
|
366
|
-
name: '
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
365
|
+
ctx.slots.inject('conversation.view', () => ctx.slots.register({
|
|
366
|
+
name: 'conversation.view',
|
|
367
|
+
id: 'saibo-kanban',
|
|
368
|
+
order: -10,
|
|
369
|
+
label: '看板'
|
|
370
370
|
}, Panel));
|
|
371
371
|
}
|
|
372
372
|
};
|
package/lib/xlsx.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* xlsx.js — 零依赖的最小 XLSX 读取器。
|
|
3
|
+
*
|
|
4
|
+
* 只做导入需要的事:读 ZIP 中央目录,拿 sharedStrings 和工作表 XML,
|
|
5
|
+
* 还原成二维数组。支持内联字符串、共享字符串、数字、布尔和公式缓存值。
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import zlib from 'node:zlib';
|
|
9
|
+
|
|
10
|
+
const EOCD = 0x06054b50;
|
|
11
|
+
const CEN = 0x02014b50;
|
|
12
|
+
const LOC = 0x04034b50;
|
|
13
|
+
|
|
14
|
+
function findEocd(buf) {
|
|
15
|
+
const start = Math.max(0, buf.length - 66000);
|
|
16
|
+
for (let i = buf.length - 22; i >= start; i -= 1) {
|
|
17
|
+
if (buf.readUInt32LE(i) === EOCD) return i;
|
|
18
|
+
}
|
|
19
|
+
throw new Error('不是有效的 xlsx(找不到 ZIP 目录)');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function readEntries(buf) {
|
|
23
|
+
const eocd = findEocd(buf);
|
|
24
|
+
const total = buf.readUInt16LE(eocd + 10);
|
|
25
|
+
const cdOffset = buf.readUInt32LE(eocd + 16);
|
|
26
|
+
const entries = new Map();
|
|
27
|
+
let p = cdOffset;
|
|
28
|
+
for (let i = 0; i < total; i += 1) {
|
|
29
|
+
if (buf.readUInt32LE(p) !== CEN) throw new Error('ZIP 中央目录损坏');
|
|
30
|
+
const method = buf.readUInt16LE(p + 10);
|
|
31
|
+
const compSize = buf.readUInt32LE(p + 20);
|
|
32
|
+
const nameLen = buf.readUInt16LE(p + 28);
|
|
33
|
+
const extraLen = buf.readUInt16LE(p + 30);
|
|
34
|
+
const commentLen = buf.readUInt16LE(p + 32);
|
|
35
|
+
const localOffset = buf.readUInt32LE(p + 42);
|
|
36
|
+
const name = buf.toString('utf8', p + 46, p + 46 + nameLen);
|
|
37
|
+
entries.set(name, { method, compSize, localOffset });
|
|
38
|
+
p += 46 + nameLen + extraLen + commentLen;
|
|
39
|
+
}
|
|
40
|
+
return entries;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function readFile(buf, entries, name) {
|
|
44
|
+
const entry = entries.get(name);
|
|
45
|
+
if (!entry) return null;
|
|
46
|
+
const p = entry.localOffset;
|
|
47
|
+
if (buf.readUInt32LE(p) !== LOC) throw new Error(`ZIP 本地头损坏: ${name}`);
|
|
48
|
+
const nameLen = buf.readUInt16LE(p + 26);
|
|
49
|
+
const extraLen = buf.readUInt16LE(p + 28);
|
|
50
|
+
const start = p + 30 + nameLen + extraLen;
|
|
51
|
+
const data = buf.subarray(start, start + entry.compSize);
|
|
52
|
+
if (entry.method === 0) return data.toString('utf8');
|
|
53
|
+
if (entry.method === 8) return zlib.inflateRawSync(data).toString('utf8');
|
|
54
|
+
throw new Error(`不支持的压缩方式 ${entry.method}: ${name}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const decode = s => s
|
|
58
|
+
.replace(/</g, '<')
|
|
59
|
+
.replace(/>/g, '>')
|
|
60
|
+
.replace(/"/g, '"')
|
|
61
|
+
.replace(/'/g, "'")
|
|
62
|
+
.replace(/&#(\d+);/g, (_, n) => String.fromCodePoint(Number(n)))
|
|
63
|
+
.replace(/&/g, '&');
|
|
64
|
+
|
|
65
|
+
function xmlText(xml) {
|
|
66
|
+
const parts = [];
|
|
67
|
+
const re = /<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g;
|
|
68
|
+
let m;
|
|
69
|
+
while ((m = re.exec(xml)) !== null) parts.push(decode(m[1]));
|
|
70
|
+
return parts.join('');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function readSharedStrings(xml) {
|
|
74
|
+
if (!xml) return [];
|
|
75
|
+
const out = [];
|
|
76
|
+
const re = /<si(?:\s[^>]*)?>([\s\S]*?)<\/si>/g;
|
|
77
|
+
let m;
|
|
78
|
+
while ((m = re.exec(xml)) !== null) out.push(xmlText(m[1]));
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function colIndex(ref) {
|
|
83
|
+
const letters = ref.replace(/\d+/g, '');
|
|
84
|
+
let n = 0;
|
|
85
|
+
for (const ch of letters) n = n * 26 + (ch.charCodeAt(0) - 64);
|
|
86
|
+
return n - 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function readSheet(xml, shared) {
|
|
90
|
+
const rows = [];
|
|
91
|
+
const rowRe = /<row[^>]*r="(\d+)"[^>]*>([\s\S]*?)<\/row>/g;
|
|
92
|
+
let rm;
|
|
93
|
+
while ((rm = rowRe.exec(xml)) !== null) {
|
|
94
|
+
const rowIndex = Number(rm[1]) - 1;
|
|
95
|
+
const cells = [];
|
|
96
|
+
const cellRe = /<c([^>]*)>([\s\S]*?)<\/c>/g;
|
|
97
|
+
let cm;
|
|
98
|
+
while ((cm = cellRe.exec(rm[2])) !== null) {
|
|
99
|
+
const attrs = cm[1];
|
|
100
|
+
const body = cm[2];
|
|
101
|
+
const refMatch = /r="([A-Z]+)\d+"/.exec(attrs);
|
|
102
|
+
const idx = refMatch ? colIndex(refMatch[1]) : cells.length;
|
|
103
|
+
const type = /t="([^"]+)"/.exec(attrs);
|
|
104
|
+
let value = '';
|
|
105
|
+
if (type && type[1] === 's') {
|
|
106
|
+
const v = /<v>([\s\S]*?)<\/v>/.exec(body);
|
|
107
|
+
value = v ? (shared[Number(v[1])] ?? '') : '';
|
|
108
|
+
} else if (type && type[1] === 'inlineStr') {
|
|
109
|
+
value = xmlText(body);
|
|
110
|
+
} else if (type && (type[1] === 'str' || type[1] === 'b')) {
|
|
111
|
+
const v = /<v>([\s\S]*?)<\/v>/.exec(body);
|
|
112
|
+
value = v ? decode(v[1]) : '';
|
|
113
|
+
} else {
|
|
114
|
+
const v = /<v>([\s\S]*?)<\/v>/.exec(body);
|
|
115
|
+
value = v ? decode(v[1]) : '';
|
|
116
|
+
}
|
|
117
|
+
cells[idx] = value;
|
|
118
|
+
}
|
|
119
|
+
rows[rowIndex] = cells;
|
|
120
|
+
}
|
|
121
|
+
for (let i = 0; i < rows.length; i += 1) if (!rows[i]) rows[i] = [];
|
|
122
|
+
return rows;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** 读取工作簿,返回 [{ name, rows }],rows 为二维字符串数组。 */
|
|
126
|
+
export function readXlsx(file) {
|
|
127
|
+
const buf = fs.readFileSync(file);
|
|
128
|
+
const entries = readEntries(buf);
|
|
129
|
+
const shared = readSharedStrings(readFile(buf, entries, 'xl/sharedStrings.xml'));
|
|
130
|
+
const workbook = readFile(buf, entries, 'xl/workbook.xml');
|
|
131
|
+
const rels = readFile(buf, entries, 'xl/_rels/workbook.xml.rels');
|
|
132
|
+
if (!workbook || !rels) throw new Error('缺少 workbook.xml 或 rels');
|
|
133
|
+
|
|
134
|
+
const relMap = new Map();
|
|
135
|
+
const relRe = /<Relationship[^>]*Id="([^"]+)"[^>]*Target="([^"]+)"[^>]*\/>/g;
|
|
136
|
+
let rm;
|
|
137
|
+
while ((rm = relRe.exec(rels)) !== null) {
|
|
138
|
+
relMap.set(rm[1], rm[2].replace(/^\/?xl\//, ''));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const sheets = [];
|
|
142
|
+
const sheetRe = /<sheet[^>]*name="([^"]*)"[^>]*r:id="([^"]+)"[^>]*\/>/g;
|
|
143
|
+
let sm;
|
|
144
|
+
while ((sm = sheetRe.exec(workbook)) !== null) {
|
|
145
|
+
const name = decode(sm[1]);
|
|
146
|
+
const target = relMap.get(sm[2]);
|
|
147
|
+
if (!target) continue;
|
|
148
|
+
const xml = readFile(buf, entries, 'xl/' + target);
|
|
149
|
+
if (!xml) continue;
|
|
150
|
+
sheets.push({ name, rows: readSheet(xml, shared) });
|
|
151
|
+
}
|
|
152
|
+
return sheets;
|
|
153
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saibo-kanban",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "AI 与人共用的活看板:草稿进收件箱、人做分拣、字段级修订可回滚,零 token 纠错。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"core.js",
|
|
31
31
|
"store.js",
|
|
32
32
|
"tools.js",
|
|
33
|
+
"lib",
|
|
33
34
|
"bin",
|
|
34
35
|
"cordis.patch.yml",
|
|
35
36
|
"locale/*.json",
|
|
@@ -53,7 +54,8 @@
|
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
55
56
|
"check": "node --check index.js && node --check core.js && node --check store.js && node --check tools.js",
|
|
56
|
-
"test": "node test/run.mjs"
|
|
57
|
+
"test": "node test/run.mjs",
|
|
58
|
+
"import": "node bin/import.mjs"
|
|
57
59
|
},
|
|
58
60
|
"repository": {
|
|
59
61
|
"type": "git",
|