sdd-skills 1.1.8 → 1.1.10
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/install.js +28 -8
- package/package.json +1 -1
- package/uninstall.js +24 -6
package/install.js
CHANGED
|
@@ -72,15 +72,26 @@ async function promptInstallation() {
|
|
|
72
72
|
// Removed default to force user selection
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
|
-
type: '
|
|
75
|
+
type: 'input',
|
|
76
76
|
name: 'configureDingTalk',
|
|
77
|
-
message: 'Would you like to configure DingTalk notifications?',
|
|
78
|
-
default:
|
|
77
|
+
message: 'Would you like to configure DingTalk notifications? (y/n)',
|
|
78
|
+
default: 'n',
|
|
79
|
+
validate: (input) => {
|
|
80
|
+
const normalized = String(input).toLowerCase().trim();
|
|
81
|
+
if (['y', 'n', 'yes', 'no', ''].includes(normalized)) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return 'Please enter y or n';
|
|
85
|
+
},
|
|
79
86
|
},
|
|
80
87
|
]);
|
|
81
88
|
|
|
89
|
+
// Convert to boolean
|
|
90
|
+
const wantsDingTalk = ['y', 'yes'].includes(String(answers.configureDingTalk).toLowerCase().trim());
|
|
91
|
+
answers.configureDingTalk = wantsDingTalk;
|
|
92
|
+
|
|
82
93
|
// Prompt for DingTalk webhook if user wants to configure
|
|
83
|
-
if (
|
|
94
|
+
if (wantsDingTalk) {
|
|
84
95
|
const dingTalkAnswers = await inquirer.prompt([
|
|
85
96
|
{
|
|
86
97
|
type: 'input',
|
|
@@ -243,14 +254,23 @@ async function install() {
|
|
|
243
254
|
|
|
244
255
|
const { confirmInstall } = await inquirer.prompt([
|
|
245
256
|
{
|
|
246
|
-
type: '
|
|
257
|
+
type: 'input',
|
|
247
258
|
name: 'confirmInstall',
|
|
248
|
-
message: 'Proceed with installation?',
|
|
249
|
-
default:
|
|
259
|
+
message: 'Proceed with installation? (y/n)',
|
|
260
|
+
default: 'y',
|
|
261
|
+
validate: (input) => {
|
|
262
|
+
const normalized = String(input).toLowerCase().trim();
|
|
263
|
+
if (['y', 'n', 'yes', 'no', ''].includes(normalized)) {
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
return 'Please enter y or n';
|
|
267
|
+
},
|
|
250
268
|
},
|
|
251
269
|
]);
|
|
252
270
|
|
|
253
|
-
|
|
271
|
+
const shouldInstall = ['', 'y', 'yes'].includes(String(confirmInstall).toLowerCase().trim());
|
|
272
|
+
|
|
273
|
+
if (!shouldInstall) {
|
|
254
274
|
console.log(chalk.yellow('\n⚠️ Installation cancelled by user\n'));
|
|
255
275
|
process.exit(0);
|
|
256
276
|
}
|
package/package.json
CHANGED
package/uninstall.js
CHANGED
|
@@ -90,29 +90,47 @@ async function promptUninstallation() {
|
|
|
90
90
|
choices: locationChoices,
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
type: '
|
|
93
|
+
type: 'input',
|
|
94
94
|
name: 'removeConfig',
|
|
95
|
-
message: 'Also remove DingTalk configuration?',
|
|
96
|
-
default:
|
|
95
|
+
message: 'Also remove DingTalk configuration? (y/n)',
|
|
96
|
+
default: 'y',
|
|
97
97
|
when: (answers) => {
|
|
98
98
|
const configPath = answers.location === 'global' ? GLOBAL_CONFIG : LOCAL_CONFIG;
|
|
99
99
|
return existsSync(configPath);
|
|
100
100
|
},
|
|
101
|
+
validate: (input) => {
|
|
102
|
+
const normalized = String(input).toLowerCase().trim();
|
|
103
|
+
if (['y', 'n', 'yes', 'no', ''].includes(normalized)) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
return 'Please enter y or n';
|
|
107
|
+
},
|
|
101
108
|
},
|
|
102
109
|
{
|
|
103
|
-
type: '
|
|
110
|
+
type: 'input',
|
|
104
111
|
name: 'confirm',
|
|
105
112
|
message: (answers) => {
|
|
106
113
|
const location = answers.location;
|
|
107
114
|
const skillsCount = location === 'global'
|
|
108
115
|
? globalInstallation.skills.length
|
|
109
116
|
: localInstallation.skills.length;
|
|
110
|
-
return `${chalk.red('Are you sure you want to remove')} ${chalk.bold.red(skillsCount)} ${chalk.red('Skills?')}`;
|
|
117
|
+
return `${chalk.red('Are you sure you want to remove')} ${chalk.bold.red(skillsCount)} ${chalk.red('Skills?')} (y/n)`;
|
|
118
|
+
},
|
|
119
|
+
default: 'n',
|
|
120
|
+
validate: (input) => {
|
|
121
|
+
const normalized = String(input).toLowerCase().trim();
|
|
122
|
+
if (['y', 'n', 'yes', 'no', ''].includes(normalized)) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return 'Please enter y or n';
|
|
111
126
|
},
|
|
112
|
-
default: false,
|
|
113
127
|
},
|
|
114
128
|
]);
|
|
115
129
|
|
|
130
|
+
// Convert to boolean
|
|
131
|
+
answers.removeConfig = ['', 'y', 'yes'].includes(String(answers.removeConfig || 'n').toLowerCase().trim());
|
|
132
|
+
answers.confirm = ['y', 'yes'].includes(String(answers.confirm).toLowerCase().trim());
|
|
133
|
+
|
|
116
134
|
return answers;
|
|
117
135
|
}
|
|
118
136
|
|