nhqydlsh 0.0.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/AGENTS.md +33 -0
- package/CLAUDE.md +260 -0
- package/README.md +15 -0
- package/biome.json +54 -0
- package/bun.lock +75 -0
- package/package.json +28 -0
- package/src/index.ts +69 -0
- package/tsconfig.json +29 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Package Manager
|
|
4
|
+
|
|
5
|
+
This project uses **bun** as the package manager. Do NOT use npm, yarn, or pnpm.
|
|
6
|
+
|
|
7
|
+
- Install dependencies: `bun install`
|
|
8
|
+
- Add package: `bun add <package>`
|
|
9
|
+
- Remove package: `bun remove <package>`
|
|
10
|
+
- Run scripts: `bun run <script>`
|
|
11
|
+
|
|
12
|
+
## Code Quality Requirements
|
|
13
|
+
|
|
14
|
+
After writing or modifying any code, you MUST run the following commands in order:
|
|
15
|
+
|
|
16
|
+
1. **Type checking**
|
|
17
|
+
```bash
|
|
18
|
+
bun run typecheck
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. **Lint and auto-fix**
|
|
22
|
+
```bash
|
|
23
|
+
bun run lint:fix
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Both commands must pass without errors before considering the task complete. If errors occur, fix them and re-run the checks.
|
|
27
|
+
|
|
28
|
+
## Sub-agent Instructions
|
|
29
|
+
|
|
30
|
+
When delegating coding tasks to sub-agent `senior-programmer`, ALWAYS include this requirement in your instruction:
|
|
31
|
+
|
|
32
|
+
> After completing code changes, you MUST run `bun run typecheck` and `bun run lint:fix` in order. Fix any errors and re-run until both commands pass without errors.
|
|
33
|
+
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
MMO Android CC Checker Automation - a TypeScript project using Bun runtime for automating credit card checking workflows on Android MMO platforms.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install dependencies
|
|
13
|
+
bun install
|
|
14
|
+
|
|
15
|
+
# Run development
|
|
16
|
+
bun run dev
|
|
17
|
+
|
|
18
|
+
# Build executable (compiles to auto-check-cc.exe)
|
|
19
|
+
bun run build
|
|
20
|
+
|
|
21
|
+
# Type checking
|
|
22
|
+
bun run typecheck
|
|
23
|
+
|
|
24
|
+
# Lint (check only)
|
|
25
|
+
bun run lint
|
|
26
|
+
|
|
27
|
+
# Lint with auto-fix
|
|
28
|
+
bun run lint:fix
|
|
29
|
+
|
|
30
|
+
# Format code
|
|
31
|
+
bun run format
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Code Quality Requirements
|
|
35
|
+
|
|
36
|
+
After writing or modifying any code, run these commands in order:
|
|
37
|
+
1. `bun run typecheck` - must pass without errors
|
|
38
|
+
2. `bun run lint:fix` - must pass without errors
|
|
39
|
+
|
|
40
|
+
## Tech Stack
|
|
41
|
+
|
|
42
|
+
- **Runtime**: Bun (not Node.js)
|
|
43
|
+
- **Language**: TypeScript (strict mode enabled)
|
|
44
|
+
- **Linter/Formatter**: Biome
|
|
45
|
+
- **CLI Prompts**: @clack/prompts
|
|
46
|
+
|
|
47
|
+
## TypeScript Configuration
|
|
48
|
+
|
|
49
|
+
Strict TypeScript settings are enforced:
|
|
50
|
+
- `noUncheckedIndexedAccess: true` - array/object index access returns `T | undefined`
|
|
51
|
+
- `noImplicitOverride: true` - requires explicit `override` keyword
|
|
52
|
+
- `noFallthroughCasesInSwitch: true` - prevents switch case fallthrough
|
|
53
|
+
- `verbatimModuleSyntax: true` - requires explicit `type` imports for type-only imports
|
|
54
|
+
|
|
55
|
+
## Code Style (Biome)
|
|
56
|
+
|
|
57
|
+
- Single quotes for strings
|
|
58
|
+
- 2-space indentation
|
|
59
|
+
- 100 character line width
|
|
60
|
+
- Auto-organize imports enabled
|
|
61
|
+
|
|
62
|
+
## UI Language
|
|
63
|
+
|
|
64
|
+
This project uses **Vietnamese** for all UI/user-facing text, including:
|
|
65
|
+
- CLI prompt messages
|
|
66
|
+
- Log messages
|
|
67
|
+
- Error messages
|
|
68
|
+
- Menu labels and options
|
|
69
|
+
|
|
70
|
+
## @clack/prompts Usage Guide
|
|
71
|
+
|
|
72
|
+
`@clack/prompts` is a library for building beautiful CLI interfaces. Documentation: https://bomb.sh/docs/clack/packages/prompts/
|
|
73
|
+
|
|
74
|
+
### Basic Structure
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { intro, outro, text, select, confirm, spinner, isCancel, cancel } from '@clack/prompts';
|
|
78
|
+
|
|
79
|
+
async function main() {
|
|
80
|
+
intro('Welcome to my CLI');
|
|
81
|
+
|
|
82
|
+
// ... prompts here
|
|
83
|
+
|
|
84
|
+
outro('Done!');
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Available Prompts
|
|
89
|
+
|
|
90
|
+
#### Text Input
|
|
91
|
+
```typescript
|
|
92
|
+
const name = await text({
|
|
93
|
+
message: 'What is your name?',
|
|
94
|
+
placeholder: 'John Doe',
|
|
95
|
+
validate: (value) => {
|
|
96
|
+
if (!value || value.length < 2) return 'Name must be at least 2 characters';
|
|
97
|
+
return undefined;
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Password Input
|
|
103
|
+
```typescript
|
|
104
|
+
const secret = await password({
|
|
105
|
+
message: 'Enter password',
|
|
106
|
+
mask: '*',
|
|
107
|
+
clearOnError: true,
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Select (Single Choice)
|
|
112
|
+
```typescript
|
|
113
|
+
const framework = await select({
|
|
114
|
+
message: 'Pick a framework',
|
|
115
|
+
options: [
|
|
116
|
+
{ value: 'next', label: 'Next.js', hint: 'React framework' },
|
|
117
|
+
{ value: 'astro', label: 'Astro', hint: 'Content-focused' },
|
|
118
|
+
{ value: 'svelte', label: 'SvelteKit', disabled: true, hint: 'Coming soon' },
|
|
119
|
+
],
|
|
120
|
+
maxItems: 5,
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Multiselect (Multiple Choices)
|
|
125
|
+
```typescript
|
|
126
|
+
const features = await multiselect({
|
|
127
|
+
message: 'Select features',
|
|
128
|
+
options: [
|
|
129
|
+
{ value: 'typescript', label: 'TypeScript' },
|
|
130
|
+
{ value: 'eslint', label: 'ESLint' },
|
|
131
|
+
{ value: 'prettier', label: 'Prettier' },
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Confirm
|
|
137
|
+
```typescript
|
|
138
|
+
const shouldContinue = await confirm({
|
|
139
|
+
message: 'Do you want to continue?',
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Handling Cancellation
|
|
144
|
+
|
|
145
|
+
Always check if user cancelled (Ctrl+C):
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import { isCancel, cancel } from '@clack/prompts';
|
|
149
|
+
|
|
150
|
+
const name = await text({ message: 'Your name?' });
|
|
151
|
+
|
|
152
|
+
if (isCancel(name)) {
|
|
153
|
+
cancel('Operation cancelled');
|
|
154
|
+
process.exit(0);
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Spinner
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
const s = spinner();
|
|
162
|
+
s.start('Installing dependencies');
|
|
163
|
+
// ... do work
|
|
164
|
+
s.message('Still working...'); // Update message
|
|
165
|
+
s.stop('Installation complete');
|
|
166
|
+
|
|
167
|
+
// Or on error:
|
|
168
|
+
s.stop('Installation failed', 1); // 1 = error code
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Progress Bar
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
const prog = progress({
|
|
175
|
+
style: 'heavy', // 'light', 'heavy', or 'block'
|
|
176
|
+
max: 100,
|
|
177
|
+
size: 40,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
prog.start('Processing files');
|
|
181
|
+
prog.advance(10);
|
|
182
|
+
prog.advance(25, 'Processing images...');
|
|
183
|
+
prog.stop('All files processed');
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Logging Utilities
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { log } from '@clack/prompts';
|
|
190
|
+
|
|
191
|
+
log.message('General message');
|
|
192
|
+
log.info('Information');
|
|
193
|
+
log.warn('Warning message');
|
|
194
|
+
log.error('Error message');
|
|
195
|
+
log.success('Success message');
|
|
196
|
+
log.step('Step completed');
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Note Box
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
import { note } from '@clack/prompts';
|
|
203
|
+
|
|
204
|
+
note('You can edit src/index.ts', 'Next steps');
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Group Prompts
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { group } from '@clack/prompts';
|
|
211
|
+
|
|
212
|
+
const result = await group({
|
|
213
|
+
name: () => text({ message: 'Your name?' }),
|
|
214
|
+
email: () => text({ message: 'Your email?' }),
|
|
215
|
+
confirm: () => confirm({ message: 'Continue?' }),
|
|
216
|
+
});
|
|
217
|
+
// result = { name: '...', email: '...', confirm: true/false }
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Tasks
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { tasks } from '@clack/prompts';
|
|
224
|
+
|
|
225
|
+
await tasks([
|
|
226
|
+
{
|
|
227
|
+
title: 'Installing dependencies',
|
|
228
|
+
task: async () => {
|
|
229
|
+
await installDeps();
|
|
230
|
+
return 'Installed 100 packages';
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
title: 'Building project',
|
|
235
|
+
task: async () => {
|
|
236
|
+
await build();
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
]);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Common Options (All Prompts)
|
|
243
|
+
|
|
244
|
+
- `signal?: AbortSignal` - For programmatic cancellation
|
|
245
|
+
- `input?: Readable` - Custom input stream
|
|
246
|
+
- `output?: Writable` - Custom output stream
|
|
247
|
+
|
|
248
|
+
### Global Settings
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import { updateSettings } from '@clack/prompts';
|
|
252
|
+
|
|
253
|
+
updateSettings({
|
|
254
|
+
messages: {
|
|
255
|
+
cancel: 'Đã hủy',
|
|
256
|
+
error: 'Có lỗi xảy ra',
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
```
|
|
260
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# mmo-android-cc-checker-automation
|
|
2
|
+
|
|
3
|
+
To install dependencies:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
To run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun run index.ts
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This project was created using `bun init` in bun v1.3.5. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
|
package/biome.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": false,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": false
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false,
|
|
10
|
+
"includes": ["**", "!**/dist", "!**/build"]
|
|
11
|
+
},
|
|
12
|
+
"formatter": {
|
|
13
|
+
"enabled": true,
|
|
14
|
+
"indentStyle": "space"
|
|
15
|
+
},
|
|
16
|
+
"linter": {
|
|
17
|
+
"enabled": true,
|
|
18
|
+
"rules": {
|
|
19
|
+
"recommended": true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"javascript": {
|
|
23
|
+
"formatter": {
|
|
24
|
+
"quoteStyle": "single",
|
|
25
|
+
"indentWidth": 2,
|
|
26
|
+
"lineWidth": 100
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"assist": {
|
|
30
|
+
"enabled": true,
|
|
31
|
+
"actions": {
|
|
32
|
+
"source": {
|
|
33
|
+
"organizeImports": "on"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"overrides": [
|
|
38
|
+
{
|
|
39
|
+
"includes": ["**/*.svelte", "**/*.astro", "**/*.vue"],
|
|
40
|
+
"linter": {
|
|
41
|
+
"rules": {
|
|
42
|
+
"style": {
|
|
43
|
+
"useConst": "off",
|
|
44
|
+
"useImportType": "off"
|
|
45
|
+
},
|
|
46
|
+
"correctness": {
|
|
47
|
+
"noUnusedVariables": "off",
|
|
48
|
+
"noUnusedImports": "off"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
package/bun.lock
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 1,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"": {
|
|
6
|
+
"name": "mmo-android-cc-checker-automation",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@clack/prompts": "^0.11.0",
|
|
9
|
+
"node-autoit-koffi": "^1.0.5",
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@biomejs/biome": "^2.3.11",
|
|
13
|
+
"@types/node": "^25.0.8",
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"typescript": "^5",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
"packages": {
|
|
21
|
+
"@biomejs/biome": ["@biomejs/biome@2.3.11", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.3.11", "@biomejs/cli-darwin-x64": "2.3.11", "@biomejs/cli-linux-arm64": "2.3.11", "@biomejs/cli-linux-arm64-musl": "2.3.11", "@biomejs/cli-linux-x64": "2.3.11", "@biomejs/cli-linux-x64-musl": "2.3.11", "@biomejs/cli-win32-arm64": "2.3.11", "@biomejs/cli-win32-x64": "2.3.11" }, "bin": { "biome": "bin/biome" } }, "sha512-/zt+6qazBWguPG6+eWmiELqO+9jRsMZ/DBU3lfuU2ngtIQYzymocHhKiZRyrbra4aCOoyTg/BmY+6WH5mv9xmQ=="],
|
|
22
|
+
|
|
23
|
+
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.3.11", "", { "os": "darwin", "cpu": "arm64" }, "sha512-/uXXkBcPKVQY7rc9Ys2CrlirBJYbpESEDme7RKiBD6MmqR2w3j0+ZZXRIL2xiaNPsIMMNhP1YnA+jRRxoOAFrA=="],
|
|
24
|
+
|
|
25
|
+
"@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.3.11", "", { "os": "darwin", "cpu": "x64" }, "sha512-fh7nnvbweDPm2xEmFjfmq7zSUiox88plgdHF9OIW4i99WnXrAC3o2P3ag9judoUMv8FCSUnlwJCM1B64nO5Fbg=="],
|
|
26
|
+
|
|
27
|
+
"@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.3.11", "", { "os": "linux", "cpu": "arm64" }, "sha512-l4xkGa9E7Uc0/05qU2lMYfN1H+fzzkHgaJoy98wO+b/7Gl78srbCRRgwYSW+BTLixTBrM6Ede5NSBwt7rd/i6g=="],
|
|
28
|
+
|
|
29
|
+
"@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.3.11", "", { "os": "linux", "cpu": "arm64" }, "sha512-XPSQ+XIPZMLaZ6zveQdwNjbX+QdROEd1zPgMwD47zvHV+tCGB88VH+aynyGxAHdzL+Tm/+DtKST5SECs4iwCLg=="],
|
|
30
|
+
|
|
31
|
+
"@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.3.11", "", { "os": "linux", "cpu": "x64" }, "sha512-/1s9V/H3cSe0r0Mv/Z8JryF5x9ywRxywomqZVLHAoa/uN0eY7F8gEngWKNS5vbbN/BsfpCG5yeBT5ENh50Frxg=="],
|
|
32
|
+
|
|
33
|
+
"@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.3.11", "", { "os": "linux", "cpu": "x64" }, "sha512-vU7a8wLs5C9yJ4CB8a44r12aXYb8yYgBn+WeyzbMjaCMklzCv1oXr8x+VEyWodgJt9bDmhiaW/I0RHbn7rsNmw=="],
|
|
34
|
+
|
|
35
|
+
"@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.3.11", "", { "os": "win32", "cpu": "arm64" }, "sha512-PZQ6ElCOnkYapSsysiTy0+fYX+agXPlWugh6+eQ6uPKI3vKAqNp6TnMhoM3oY2NltSB89hz59o8xIfOdyhi9Iw=="],
|
|
36
|
+
|
|
37
|
+
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.3.11", "", { "os": "win32", "cpu": "x64" }, "sha512-43VrG813EW+b5+YbDbz31uUsheX+qFKCpXeY9kfdAx+ww3naKxeVkTD9zLIWxUPfJquANMHrmW3wbe/037G0Qg=="],
|
|
38
|
+
|
|
39
|
+
"@clack/core": ["@clack/core@0.5.0", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-p3y0FIOwaYRUPRcMO7+dlmLh8PSRcrjuTndsiA0WAFbWES0mLZlrjVoBRZ9DzkPFJZG6KGkJmoEAY0ZcVWTkow=="],
|
|
40
|
+
|
|
41
|
+
"@clack/prompts": ["@clack/prompts@0.11.0", "", { "dependencies": { "@clack/core": "0.5.0", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-pMN5FcrEw9hUkZA4f+zLlzivQSeQf5dRGJjSUbvVYDLvpKCdQx5OaknvKzgbtXOizhP+SJJJjqEbOe55uKKfAw=="],
|
|
42
|
+
|
|
43
|
+
"@types/node": ["@types/node@25.0.8", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-powIePYMmC3ibL0UJ2i2s0WIbq6cg6UyVFQxSCpaPxxzAaziRfimGivjdF943sSGV6RADVbk0Nvlm5P/FB44Zg=="],
|
|
44
|
+
|
|
45
|
+
"debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
|
|
46
|
+
|
|
47
|
+
"get-symbol-from-current-process-h": ["get-symbol-from-current-process-h@1.0.2", "", {}, "sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw=="],
|
|
48
|
+
|
|
49
|
+
"iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],
|
|
50
|
+
|
|
51
|
+
"koffi": ["koffi@2.15.0", "", {}, "sha512-174BTuWK7L42Om7nDWy9YOTXj6Dkm14veuFf5yhVS5VU6GjtOI1Wjf+K16Z0JvSuZ3/NpkVzFBjE1oKbthTIEA=="],
|
|
52
|
+
|
|
53
|
+
"lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="],
|
|
54
|
+
|
|
55
|
+
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
|
56
|
+
|
|
57
|
+
"node-addon-api": ["node-addon-api@3.2.1", "", {}, "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A=="],
|
|
58
|
+
|
|
59
|
+
"node-autoit-koffi": ["node-autoit-koffi@1.0.5", "", { "dependencies": { "iconv-lite": "^0.6.3", "koffi": "^2.8.0", "lodash": "^4.17.21", "ref-napi": "^3.0.3" } }, "sha512-04oEUElh6TOxugwx5leLK8Z2g57mA65a3YeqINOT+zOL2IHGehM24oBmWE/ttEXVBOcGOViURCJNRO+tPnMV3Q=="],
|
|
60
|
+
|
|
61
|
+
"node-gyp-build": ["node-gyp-build@4.8.4", "", { "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", "node-gyp-build-test": "build-test.js" } }, "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ=="],
|
|
62
|
+
|
|
63
|
+
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
|
64
|
+
|
|
65
|
+
"ref-napi": ["ref-napi@3.0.3", "", { "dependencies": { "debug": "^4.1.1", "get-symbol-from-current-process-h": "^1.0.2", "node-addon-api": "^3.0.0", "node-gyp-build": "^4.2.1" } }, "sha512-LiMq/XDGcgodTYOMppikEtJelWsKQERbLQsYm0IOOnzhwE9xYZC7x8txNnFC9wJNOkPferQI4vD4ZkC0mDyrOA=="],
|
|
66
|
+
|
|
67
|
+
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
|
|
68
|
+
|
|
69
|
+
"sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
|
|
70
|
+
|
|
71
|
+
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
72
|
+
|
|
73
|
+
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
|
74
|
+
}
|
|
75
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nhqydlsh",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"module": "src/index.ts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@biomejs/biome": "^2.3.11",
|
|
9
|
+
"@types/node": "^25.0.8"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"typescript": "^5"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "bun run src/index.ts",
|
|
16
|
+
"build:compile": "bun build --compile --outfile=auto-check-cc src/index.ts --target node",
|
|
17
|
+
"build": "bun build --outdir=dist src/index.ts --target node",
|
|
18
|
+
"lint": "biome check .",
|
|
19
|
+
"lint:fix": "biome check --write .",
|
|
20
|
+
"format": "biome format --write .",
|
|
21
|
+
"typecheck": "bunx tsc --project tsconfig.json",
|
|
22
|
+
"prepublishOnly": "bun run build"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@clack/prompts": "^0.11.0",
|
|
26
|
+
"node-autoit-koffi": "^1.0.5"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { cancel, intro, isCancel, outro, select, text } from '@clack/prompts';
|
|
2
|
+
import autoit from 'node-autoit-koffi';
|
|
3
|
+
|
|
4
|
+
async function handleMoveMouse(): Promise<void> {
|
|
5
|
+
const xInput = await text({
|
|
6
|
+
message: 'Nhập X:',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
if (isCancel(xInput)) {
|
|
10
|
+
cancel('Đã hủy thao tác.');
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const yInput = await text({
|
|
15
|
+
message: 'Nhập Y:',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (isCancel(yInput)) {
|
|
19
|
+
cancel('Đã hủy thao tác.');
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const x = parseInt(xInput, 10);
|
|
24
|
+
const y = parseInt(yInput, 10);
|
|
25
|
+
|
|
26
|
+
if (Number.isNaN(x) || Number.isNaN(y)) {
|
|
27
|
+
console.log('Tọa độ không hợp lệ. Vui lòng nhập số hợp lệ.');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
await autoit.mouseMove(x, y);
|
|
32
|
+
console.log(`Đã di chuyển chuột đến (${x}, ${y})`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function mainMenu(): Promise<void> {
|
|
36
|
+
let running = true;
|
|
37
|
+
|
|
38
|
+
while (running) {
|
|
39
|
+
const option = await select({
|
|
40
|
+
message: 'Chọn tùy chọn:',
|
|
41
|
+
options: [
|
|
42
|
+
{ value: 'move', label: 'Di chuyển chuột' },
|
|
43
|
+
{ value: 'exit', label: 'Thoát' },
|
|
44
|
+
],
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (isCancel(option)) {
|
|
48
|
+
cancel('Đã hủy thao tác.');
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
switch (option) {
|
|
53
|
+
case 'move':
|
|
54
|
+
await handleMoveMouse();
|
|
55
|
+
break;
|
|
56
|
+
case 'exit':
|
|
57
|
+
running = false;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function main(): Promise<void> {
|
|
64
|
+
await autoit.init();
|
|
65
|
+
await mainMenu();
|
|
66
|
+
outro('Tạm biệt!');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main().catch(console.error);
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "Preserve",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
|
|
11
|
+
// Bundler mode
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
// Best practices
|
|
18
|
+
"strict": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
"noImplicitOverride": true,
|
|
23
|
+
|
|
24
|
+
// Some stricter flags (disabled by default)
|
|
25
|
+
"noUnusedLocals": false,
|
|
26
|
+
"noUnusedParameters": false,
|
|
27
|
+
"noPropertyAccessFromIndexSignature": false
|
|
28
|
+
}
|
|
29
|
+
}
|