@cloud411716/fancy-webnovel 1.0.32 → 1.0.34

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.
@@ -103,17 +103,22 @@ export function apply(ctx) {
103
103
  }
104
104
 
105
105
  // ---------- confirm ----------
106
- const confirm = await ctx.userQuestions.ask({
107
- questions: [{
108
- id: 'confirm',
109
- question: bootstrap.notify({ type: 'confirm', projectRoot }),
110
- detail: projectRoot,
111
- hideCustomInput: true,
112
- options: bootstrap.confirmOptions(),
113
- }],
114
- agent: invocation.agent,
115
- signal,
116
- });
106
+ let confirm;
107
+ try {
108
+ confirm = await ctx.userQuestions.ask({
109
+ questions: [{
110
+ id: 'confirm',
111
+ question: bootstrap.notify({ type: 'confirm', projectRoot }),
112
+ detail: projectRoot,
113
+ hideCustomInput: true,
114
+ options: bootstrap.confirmOptions(),
115
+ }],
116
+ agent: invocation.agent,
117
+ signal,
118
+ });
119
+ } catch {
120
+ return notify(session, 'error', bootstrap.notify({ type: 'cancelled' }));
121
+ }
117
122
  const ans = confirm.answers[0];
118
123
  const chosen = ans?.selected?.[0] ?? ans?.custom;
119
124
  if (chosen !== '确认创建') {
@@ -134,15 +134,20 @@ export function apply(ctx) {
134
134
  }
135
135
 
136
136
  // ---------- platform selection ----------
137
- const platformResult = await ctx.userQuestions.ask({
138
- questions: [{
139
- id: 'platform',
140
- ...scan.askPlatform(),
141
- question: `${scan.platformList()}\n\n请选择要扫的平台(输入编号 1-4):`,
142
- }],
143
- agent: invocation.agent,
144
- signal,
145
- });
137
+ let platformResult;
138
+ try {
139
+ platformResult = await ctx.userQuestions.ask({
140
+ questions: [{
141
+ id: 'platform',
142
+ ...scan.askPlatform(),
143
+ question: `${scan.platformList()}\n\n请选择要扫的平台(输入编号 1-4):`,
144
+ }],
145
+ agent: invocation.agent,
146
+ signal,
147
+ });
148
+ } catch {
149
+ return notify(session, 'error', scan.notify({ type: 'cancelled' }));
150
+ }
146
151
  const answer = platformResult.answers[0]?.custom?.trim();
147
152
  if (!answer) {
148
153
  return notify(session, 'error', scan.notify({ type: 'cancelled' }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {