@hit-sudomaker/ccw 0.4.0 → 0.5.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 +54 -52
- package/assets/ccline/config.toml +34 -34
- package/assets/skills/amirc-research/SKILL.md +39 -39
- package/dist/ccline.js +149 -616
- package/dist/ccw.js +167 -378
- package/dist/claude-program.js +191 -0
- package/dist/claude.js +177 -0
- package/dist/cleanup.js +150 -348
- package/dist/effect-machine.js +65 -0
- package/dist/frozen-json.js +99 -0
- package/dist/instance.js +71 -0
- package/dist/machine.js +613 -573
- package/dist/main.js +68 -58
- package/dist/management-catalog.js +60 -54
- package/dist/messages.js +182 -0
- package/dist/model.js +39 -144
- package/dist/npm-registry.js +110 -27
- package/dist/officecli.js +274 -404
- package/dist/planning.js +141 -0
- package/dist/plugins.js +134 -294
- package/dist/program-channels.js +94 -384
- package/dist/program-operations.js +155 -0
- package/dist/read-machine.js +94 -43
- package/dist/render.js +350 -347
- package/dist/settings.js +380 -0
- package/dist/skill-files.js +184 -77
- package/dist/skills.js +393 -237
- package/dist/terminal-view.js +303 -395
- package/dist/terminal.js +207 -467
- package/dist/work.js +135 -0
- package/package.json +1 -2
- package/dist/claude-config.js +0 -347
- package/dist/errors.js +0 -139
- package/dist/legacy-amirc.js +0 -60
- package/dist/mcp.js +0 -299
- package/dist/programs.js +0 -778
- package/dist/run-presentation.js +0 -155
- package/dist/titles.js +0 -43
- package/dist/warnings.js +0 -6
package/dist/run-presentation.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { CLEANUP_RESIDUE_CODES } from './cleanup.js';
|
|
2
|
-
import { contentName, describeDiagnostic, failureLabel, safeText } from './render.js';
|
|
3
|
-
const INDICATORS = {
|
|
4
|
-
waiting: { symbol: '·', status: '等待', tone: 'muted' },
|
|
5
|
-
running: { symbol: '▶', status: '执行中', tone: 'accent' },
|
|
6
|
-
done: { symbol: '✔', status: '完成', tone: 'success' },
|
|
7
|
-
partial: { symbol: '!', status: '部分完成', tone: 'danger' },
|
|
8
|
-
failed: { symbol: '✕', status: '失败', tone: 'danger' },
|
|
9
|
-
skipped: { symbol: '○', status: '已跳过', tone: 'warning' },
|
|
10
|
-
cancelled: { symbol: '○', status: '已停止', tone: 'muted' },
|
|
11
|
-
};
|
|
12
|
-
const EFFECTS = {
|
|
13
|
-
done: { symbol: '✔', tone: 'success' },
|
|
14
|
-
kept: { symbol: '—', tone: 'muted' },
|
|
15
|
-
failed: { symbol: '✕', tone: 'danger' },
|
|
16
|
-
skipped: { symbol: '○', tone: 'warning' },
|
|
17
|
-
};
|
|
18
|
-
function executionState(item) {
|
|
19
|
-
return item.state === 'failed' && item.effects.length > 0 && item.effects.every(effect => effect.state === 'skipped')
|
|
20
|
-
? 'skipped'
|
|
21
|
-
: item.state;
|
|
22
|
-
}
|
|
23
|
-
function executionSummary(items) {
|
|
24
|
-
const states = items.map(executionState);
|
|
25
|
-
const count = (state) => states.filter(value => value === state).length;
|
|
26
|
-
const processed = states.length - count('waiting') - count('running');
|
|
27
|
-
return `处理 ${processed}/${items.length} · 完成 ${count('done')} · 失败 ${count('failed') + count('partial')} · 跳过 ${count('skipped')}${count('cancelled') ? ` · 已停止 ${count('cancelled')}` : ''}`;
|
|
28
|
-
}
|
|
29
|
-
function detail(effect) {
|
|
30
|
-
const presentation = EFFECTS[effect.state];
|
|
31
|
-
return {
|
|
32
|
-
symbol: presentation.symbol,
|
|
33
|
-
text: `${{ done: '已完成', kept: '已保留', failed: '未完成', skipped: '未执行' }[effect.state]} · ${describeDiagnostic(effect)}`,
|
|
34
|
-
tone: presentation.tone,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function executionRows(items, shouldShowDetails = false) {
|
|
38
|
-
return items.map(item => {
|
|
39
|
-
const state = executionState(item);
|
|
40
|
-
const indicator = INDICATORS[state];
|
|
41
|
-
return {
|
|
42
|
-
id: item.id,
|
|
43
|
-
title: contentName(item),
|
|
44
|
-
...indicator,
|
|
45
|
-
...(state === 'failed' ? { status: failureLabel(item.action) } : {}),
|
|
46
|
-
details: shouldShowDetails
|
|
47
|
-
? [
|
|
48
|
-
{ text: `标识:${safeText(item.id)}`, tone: 'muted' },
|
|
49
|
-
...item.effects.map(detail),
|
|
50
|
-
{
|
|
51
|
-
text: item.isPending === true
|
|
52
|
-
? '本项仍有未完成步骤'
|
|
53
|
-
: item.isPending === false
|
|
54
|
-
? '本项无可续办步骤'
|
|
55
|
-
: '本项续办状态未提供',
|
|
56
|
-
tone: 'muted',
|
|
57
|
-
},
|
|
58
|
-
]
|
|
59
|
-
: [],
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function activeItem(items) {
|
|
64
|
-
return (items.find(item => item.state === 'running')?.id ?? [...items].reverse().find(item => item.state !== 'waiting')?.id);
|
|
65
|
-
}
|
|
66
|
-
function progressView(items) {
|
|
67
|
-
const activeId = activeItem(items);
|
|
68
|
-
return {
|
|
69
|
-
phase: 'progress',
|
|
70
|
-
title: '执行进度',
|
|
71
|
-
summary: executionSummary(items),
|
|
72
|
-
rows: executionRows(items),
|
|
73
|
-
...(activeId !== undefined ? { activeId } : {}),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function resultTitle(result, items, action) {
|
|
77
|
-
if (result.state === 'done' &&
|
|
78
|
-
result.items.some(item => item.effects.some(effect => CLEANUP_RESIDUE_CODES.includes(effect.code)))) {
|
|
79
|
-
return '清理完成(有保留)';
|
|
80
|
-
}
|
|
81
|
-
if (result.state === 'failed') {
|
|
82
|
-
const actions = new Set(items.map(item => item.action));
|
|
83
|
-
return failureLabel(action ?? (actions.size === 1 ? items[0]?.action : undefined));
|
|
84
|
-
}
|
|
85
|
-
return { done: '完成', partial: '部分完成', cancelled: '已停止' }[result.state];
|
|
86
|
-
}
|
|
87
|
-
function resultView(result, items, action, detailsId) {
|
|
88
|
-
return {
|
|
89
|
-
phase: 'result',
|
|
90
|
-
title: detailsId === undefined ? `运行结果 · ${resultTitle(result, items, action)}` : '结果详情',
|
|
91
|
-
summary: detailsId === undefined
|
|
92
|
-
? executionSummary(items)
|
|
93
|
-
: result.remaining
|
|
94
|
-
? '本次仍有可续办任务'
|
|
95
|
-
: '本次没有可续办任务',
|
|
96
|
-
rows: executionRows(detailsId === undefined ? items : items.filter(item => item.id === detailsId), detailsId !== undefined),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
/** 统一投影冻结计划的进度与结果;名称由计划条目携带 */
|
|
100
|
-
export function createRunPresentation(plan, action) {
|
|
101
|
-
const execution = new Map(plan.items.map(item => [
|
|
102
|
-
item.id,
|
|
103
|
-
{ id: item.id, title: item.title, action: item.action, state: 'waiting', effects: [] },
|
|
104
|
-
]));
|
|
105
|
-
const items = () => [...execution.values()];
|
|
106
|
-
const recordResult = (result) => {
|
|
107
|
-
for (const item of result.items) {
|
|
108
|
-
const previous = execution.get(item.id);
|
|
109
|
-
execution.set(item.id, {
|
|
110
|
-
...previous,
|
|
111
|
-
...item,
|
|
112
|
-
title: previous?.title ?? item.title,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
return {
|
|
117
|
-
progress(event) {
|
|
118
|
-
if (event) {
|
|
119
|
-
const previous = execution.get(event.id);
|
|
120
|
-
if (previous) {
|
|
121
|
-
execution.set(event.id, event.kind === 'finished'
|
|
122
|
-
? { ...previous, ...event.result, title: previous.title }
|
|
123
|
-
: event.kind === 'started'
|
|
124
|
-
? { ...previous, state: 'running' }
|
|
125
|
-
: { ...previous, effects: [...previous.effects, event.effect] });
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return progressView(items());
|
|
129
|
-
},
|
|
130
|
-
result(result) {
|
|
131
|
-
recordResult(result);
|
|
132
|
-
return resultView(result, items(), action);
|
|
133
|
-
},
|
|
134
|
-
details(result, id) {
|
|
135
|
-
recordResult(result);
|
|
136
|
-
return resultView(result, items(), action, id);
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
export function describeRun(view) {
|
|
141
|
-
return [
|
|
142
|
-
view.title,
|
|
143
|
-
view.summary,
|
|
144
|
-
...view.rows.flatMap(row => [
|
|
145
|
-
`${row.symbol} ${row.status} ${row.title}`,
|
|
146
|
-
...row.details.map(value => ` ${value.symbol ? `${value.symbol} ` : ''}${value.text}`),
|
|
147
|
-
]),
|
|
148
|
-
]
|
|
149
|
-
.filter(Boolean)
|
|
150
|
-
.join('\n');
|
|
151
|
-
}
|
|
152
|
-
export function describeResult(result) {
|
|
153
|
-
const items = result.items.map(item => ({ ...item }));
|
|
154
|
-
return describeRun(resultView(result, items));
|
|
155
|
-
}
|
package/dist/titles.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { bundledSkills, mcpSpecs, pluginSpecs, skillMembers, skillSuites } from './management-catalog.js';
|
|
2
|
-
/** 定义清理类别的键序与标题 */
|
|
3
|
-
const DATA_CATEGORY_TABLE = [
|
|
4
|
-
['cache', '缓存与诊断日志'],
|
|
5
|
-
['history', '会话与历史'],
|
|
6
|
-
['memory', '自动记忆'],
|
|
7
|
-
['backups', '恢复备份'],
|
|
8
|
-
['runtime', '后台任务与运行状态'],
|
|
9
|
-
];
|
|
10
|
-
export const DATA_CATEGORY_KEYS = DATA_CATEGORY_TABLE.map(([key]) => key);
|
|
11
|
-
/** 映射已知键到官方标题;显示标题不证明身份或授予操作资格 */
|
|
12
|
-
const KNOWN_TITLES = {
|
|
13
|
-
claude: 'Claude Code',
|
|
14
|
-
settings: '模型配置',
|
|
15
|
-
ccline: 'CCometixLine',
|
|
16
|
-
officecli: 'OfficeCLI',
|
|
17
|
-
'data:claude': 'Claude 用户数据',
|
|
18
|
-
...Object.fromEntries(DATA_CATEGORY_TABLE.map(([key, title]) => [`data:${key}`, title])),
|
|
19
|
-
plan: '操作计划',
|
|
20
|
-
...Object.fromEntries(Object.entries(pluginSpecs).map(([name, spec]) => [`plugin:${name}`, spec.title])),
|
|
21
|
-
...Object.fromEntries(Object.entries(mcpSpecs).map(([name, spec]) => [`mcp:${name}`, spec.title])),
|
|
22
|
-
...Object.fromEntries(Object.entries(skillSuites).map(([name, spec]) => [`skill-set:${name}`, spec.title])),
|
|
23
|
-
...Object.fromEntries(Object.entries({ ...skillMembers, ...bundledSkills }).map(([name, spec]) => [`skill:${name}`, spec.title])),
|
|
24
|
-
};
|
|
25
|
-
export function knownTitle(key, fallback = key) {
|
|
26
|
-
return KNOWN_TITLES[key] ?? fallback;
|
|
27
|
-
}
|
|
28
|
-
/** 计算程序副本标题后缀:同批出现同工具的其他副本时附渠道,渠道仍相同再附实际路径;
|
|
29
|
-
* 展示层不得反解 id 推断渠道,检查列表与计划标题共用此后缀 */
|
|
30
|
-
export function programCopySuffix(id, batch) {
|
|
31
|
-
const segments = id.split(':');
|
|
32
|
-
const [kind, channel] = segments;
|
|
33
|
-
if (segments.length < 3 || kind === undefined || channel === undefined)
|
|
34
|
-
return '';
|
|
35
|
-
const sameToolCopy = (other) => {
|
|
36
|
-
const parts = other.split(':');
|
|
37
|
-
return other !== id && parts[0] === kind && parts.length >= 3;
|
|
38
|
-
};
|
|
39
|
-
if (!batch.some(sameToolCopy))
|
|
40
|
-
return '';
|
|
41
|
-
const hasDuplicateChannel = batch.some(other => other !== id && other.startsWith(`${kind}:${channel}:`));
|
|
42
|
-
return ` (${channel}${hasDuplicateChannel ? ` · ${segments.slice(2).join(':')}` : ''})`;
|
|
43
|
-
}
|
package/dist/warnings.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export const WARNING_MESSAGES = {
|
|
2
|
-
'program-identity-unchecked': { brief: '身份待确认', detail: '程序文件已找到;操作前确认身份' },
|
|
3
|
-
'program-inspection-warning': { brief: '检查不完整', detail: '检查其他安装不完整' },
|
|
4
|
-
'inspection-incomplete': { brief: '检查不完整', detail: '检查不完整' },
|
|
5
|
-
'new-session-required': { brief: '稍后生效', detail: '新会话或重新加载后生效' },
|
|
6
|
-
};
|