@radkode/neo 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/README.md +163 -37
- package/dist/commands/git/index.d.ts.map +1 -1
- package/dist/commands/git/index.js +5 -1
- package/dist/commands/git/index.js.map +1 -1
- package/dist/commands/git/pull/index.d.ts +3 -0
- package/dist/commands/git/pull/index.d.ts.map +1 -0
- package/dist/commands/git/pull/index.js +114 -0
- package/dist/commands/git/pull/index.js.map +1 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/update/index.d.ts +3 -0
- package/dist/commands/update/index.d.ts.map +1 -0
- package/dist/commands/update/index.js +188 -0
- package/dist/commands/update/index.js.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,72 +1,198 @@
|
|
|
1
|
-
|
|
1
|
+
```
|
|
2
|
+
███╗ ██╗███████╗ ██████╗ ██████╗██╗ ██╗
|
|
3
|
+
████╗ ██║██╔════╝██╔═══██╗ ██╔════╝██║ ██║
|
|
4
|
+
██╔██╗ ██║█████╗ ██║ ██║ ██║ ██║ ██║
|
|
5
|
+
██║╚██╗██║██╔══╝ ██║ ██║ ██║ ██║ ██║
|
|
6
|
+
██║ ╚████║███████╗╚██████╔╝ ╚██████╗███████╗██║
|
|
7
|
+
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═════╝╚══════╝╚═╝
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
<div align="center">
|
|
11
|
+
|
|
12
|
+
### ⚡ Lightning-fast TypeScript CLI framework
|
|
2
13
|
|
|
3
|
-
|
|
14
|
+
[](https://www.npmjs.com/package/@radkode/neo)
|
|
15
|
+
[](https://opensource.org/licenses/MIT)
|
|
16
|
+
[](https://www.typescriptlang.org/)
|
|
17
|
+
[](https://github.com/radkode/neo/actions)
|
|
18
|
+
|
|
19
|
+
Intelligent git operations • Configuration management • Self-updating
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
✨ **Smart Git Operations** - Enhanced git commands with safety confirmations
|
|
28
|
+
⚙️ **Configuration Management** - Simple key-value configuration storage
|
|
29
|
+
🛡️ **Branch Protection** - Interactive confirmation for main branch pushes
|
|
30
|
+
🔄 **Self-Updating** - Built-in update command with smart package manager detection
|
|
31
|
+
🎨 **Beautiful UI** - Colorful output with progress indicators and banners
|
|
32
|
+
📦 **Semantic Versioning** - Automated releases with changesets
|
|
33
|
+
🚀 **TypeScript First** - Built with full TypeScript support and type safety
|
|
4
34
|
|
|
5
35
|
## Installation
|
|
6
36
|
|
|
7
37
|
```bash
|
|
38
|
+
# Install globally
|
|
39
|
+
npm install -g @radkode/neo
|
|
40
|
+
# or with pnpm
|
|
8
41
|
pnpm add -g @radkode/neo
|
|
9
42
|
```
|
|
10
43
|
|
|
11
|
-
|
|
44
|
+
## Quick Start
|
|
12
45
|
|
|
13
46
|
```bash
|
|
14
|
-
|
|
47
|
+
# Display help and available commands
|
|
48
|
+
neo --help
|
|
49
|
+
|
|
50
|
+
# Initialize Neo CLI configuration
|
|
51
|
+
neo init
|
|
52
|
+
|
|
53
|
+
# Check for updates
|
|
54
|
+
neo update --check-only
|
|
55
|
+
|
|
56
|
+
# Configure a setting
|
|
57
|
+
neo config set editor.default "code"
|
|
58
|
+
|
|
59
|
+
# Smart git push with main branch protection
|
|
60
|
+
neo git push
|
|
61
|
+
|
|
62
|
+
# View current configuration
|
|
63
|
+
neo config list
|
|
15
64
|
```
|
|
16
65
|
|
|
17
|
-
##
|
|
66
|
+
## Demo
|
|
67
|
+
|
|
68
|
+
### Smart Git Push Protection
|
|
69
|
+
|
|
70
|
+
When attempting to push to the main branch, Neo intelligently prompts for confirmation:
|
|
18
71
|
|
|
19
72
|
```bash
|
|
20
|
-
|
|
21
|
-
neo init my-project
|
|
73
|
+
$ neo git push
|
|
22
74
|
|
|
23
|
-
|
|
24
|
-
|
|
75
|
+
⚡ NEO CLI
|
|
76
|
+
Radkode's Lightning-Fast CLI Framework
|
|
77
|
+
|
|
78
|
+
⚠️ You are about to push directly to the main branch.
|
|
79
|
+
This is generally not recommended as it bypasses code review processes.
|
|
80
|
+
✔ Are you sure you want to continue? » No
|
|
25
81
|
|
|
26
|
-
|
|
27
|
-
|
|
82
|
+
✅ Push cancelled. Here's how to push your changes safely:
|
|
83
|
+
1. Create a feature branch: git checkout -b feature/your-feature-name
|
|
84
|
+
2. Push to your branch: git push -u origin feature/your-feature-name
|
|
85
|
+
3. Create a pull request to merge into main
|
|
28
86
|
|
|
29
|
-
|
|
30
|
-
neo config set api.key YOUR_KEY
|
|
31
|
-
neo config get api.key
|
|
32
|
-
neo config list
|
|
87
|
+
This protects the main branch from accidental changes.
|
|
33
88
|
```
|
|
34
89
|
|
|
35
|
-
|
|
90
|
+
### Beautiful Configuration Management
|
|
36
91
|
|
|
37
|
-
|
|
38
|
-
|
|
92
|
+
```bash
|
|
93
|
+
$ neo config set theme.primary "#00ff88"
|
|
94
|
+
✨ Configuration saved: theme.primary = "#00ff88"
|
|
39
95
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- `--skip-install` - Skip dependency installation
|
|
43
|
-
- `--force` - Overwrite existing files
|
|
96
|
+
$ neo config list
|
|
97
|
+
📝 Your Configuration:
|
|
44
98
|
|
|
45
|
-
|
|
46
|
-
|
|
99
|
+
🎨 theme.primary "#00ff88"
|
|
100
|
+
💻 editor.default "code"
|
|
101
|
+
🚀 workflow.auto true
|
|
102
|
+
```
|
|
47
103
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- `-o, --output <dir>` - Output directory (default: "dist")
|
|
104
|
+
## Commands
|
|
105
|
+
|
|
106
|
+
### `init`
|
|
107
|
+
Install and configure Neo CLI globally.
|
|
53
108
|
|
|
54
|
-
|
|
55
|
-
|
|
109
|
+
```bash
|
|
110
|
+
neo init
|
|
111
|
+
```
|
|
56
112
|
|
|
57
113
|
Options:
|
|
58
|
-
- `--
|
|
59
|
-
- `--skip-
|
|
60
|
-
- `--force` - Force deployment without confirmation
|
|
114
|
+
- `--force` - Force reconfiguration if already initialized
|
|
115
|
+
- `--skip-install` - Skip global installation (configuration only)
|
|
61
116
|
|
|
62
117
|
### `config`
|
|
63
|
-
Manage configuration values.
|
|
118
|
+
Manage configuration values with simple key-value storage.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Set a configuration value
|
|
122
|
+
neo config set api.key "your-api-key"
|
|
123
|
+
|
|
124
|
+
# Get a configuration value
|
|
125
|
+
neo config get api.key
|
|
126
|
+
|
|
127
|
+
# List all configuration values
|
|
128
|
+
neo config list
|
|
129
|
+
```
|
|
64
130
|
|
|
65
131
|
Subcommands:
|
|
66
132
|
- `config get <key>` - Get a configuration value
|
|
67
133
|
- `config set <key> <value>` - Set a configuration value
|
|
68
134
|
- `config list` - List all configuration values
|
|
69
135
|
|
|
136
|
+
### `git`
|
|
137
|
+
Enhanced git operations with safety features.
|
|
138
|
+
|
|
139
|
+
#### `git push`
|
|
140
|
+
Smart git push with main branch protection.
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Regular push (prompts for confirmation on main branch)
|
|
144
|
+
neo git push
|
|
145
|
+
|
|
146
|
+
# Force push (use with caution)
|
|
147
|
+
neo git push --force
|
|
148
|
+
|
|
149
|
+
# Dry run to see what would be pushed
|
|
150
|
+
neo git push --dry-run
|
|
151
|
+
|
|
152
|
+
# Push and set upstream branch
|
|
153
|
+
neo git push --set-upstream origin feature-branch
|
|
154
|
+
|
|
155
|
+
# Push with tags
|
|
156
|
+
neo git push --tags
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Options:
|
|
160
|
+
- `-f, --force` - Force push (overwrites remote)
|
|
161
|
+
- `-u, --set-upstream <branch>` - Set upstream branch
|
|
162
|
+
- `--dry-run` - Show what would be pushed without actually pushing
|
|
163
|
+
- `--tags` - Push tags along with commits
|
|
164
|
+
|
|
165
|
+
**Safety Features:**
|
|
166
|
+
- ⚠️ Interactive confirmation when pushing to main branch
|
|
167
|
+
- 📝 Helpful guidance for safer alternatives
|
|
168
|
+
- ✅ Graceful cancellation (exits with success code)
|
|
169
|
+
- 🎯 Encourages best practices while allowing flexibility
|
|
170
|
+
|
|
171
|
+
### `update`
|
|
172
|
+
Update Neo CLI to the latest version from npm.
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Update to the latest version (with confirmation)
|
|
176
|
+
neo update
|
|
177
|
+
|
|
178
|
+
# Check for updates without installing
|
|
179
|
+
neo update --check-only
|
|
180
|
+
|
|
181
|
+
# Force update/reinstall even if on latest version
|
|
182
|
+
neo update --force
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Options:
|
|
186
|
+
- `--check-only` - Only check for updates without installing
|
|
187
|
+
- `--force` - Force update even if already on latest version
|
|
188
|
+
|
|
189
|
+
**Features:**
|
|
190
|
+
- 🔍 Automatic version checking against npm registry
|
|
191
|
+
- 📦 Smart package manager detection (npm, pnpm, yarn)
|
|
192
|
+
- ✨ Interactive confirmation before updating
|
|
193
|
+
- 🎯 Helpful error messages for permission issues
|
|
194
|
+
- ⚡ Progress indicators with real-time status
|
|
195
|
+
|
|
70
196
|
## Global Options
|
|
71
197
|
|
|
72
198
|
- `-v, --verbose` - Enable verbose logging
|
|
@@ -81,8 +207,8 @@ Subcommands:
|
|
|
81
207
|
### Setup
|
|
82
208
|
|
|
83
209
|
```bash
|
|
84
|
-
git clone https://github.com/
|
|
85
|
-
cd
|
|
210
|
+
git clone https://github.com/radkode/neo.git
|
|
211
|
+
cd neo
|
|
86
212
|
pnpm install
|
|
87
213
|
```
|
|
88
214
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,wBAAgB,gBAAgB,IAAI,OAAO,CAS1C"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Command } from '@commander-js/extra-typings';
|
|
2
2
|
import { createPushCommand } from '../git/push/index.js';
|
|
3
|
+
import { createPullCommand } from '../git/pull/index.js';
|
|
3
4
|
export function createGitCommand() {
|
|
4
5
|
const command = new Command('git');
|
|
5
|
-
command
|
|
6
|
+
command
|
|
7
|
+
.description('Git operations and utilities')
|
|
8
|
+
.addCommand(createPushCommand())
|
|
9
|
+
.addCommand(createPullCommand());
|
|
6
10
|
return command;
|
|
7
11
|
}
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,UAAU,gBAAgB;IAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAEnC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,UAAU,gBAAgB;IAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAEnC,OAAO;SACJ,WAAW,CAAC,8BAA8B,CAAC;SAC3C,UAAU,CAAC,iBAAiB,EAAE,CAAC;SAC/B,UAAU,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/git/pull/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAetD,wBAAgB,iBAAiB,IAAI,OAAO,CAyI3C"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Command } from '@commander-js/extra-typings';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { execa } from 'execa';
|
|
5
|
+
import { logger } from '../../../utils/logger.js';
|
|
6
|
+
export function createPullCommand() {
|
|
7
|
+
const command = new Command('pull');
|
|
8
|
+
command
|
|
9
|
+
.description('Pull changes from remote repository with automatic rebase fallback')
|
|
10
|
+
.option('--rebase', 'force rebase strategy')
|
|
11
|
+
.option('--no-rebase', 'prevent automatic rebase fallback')
|
|
12
|
+
.action(async (options) => {
|
|
13
|
+
const spinner = ora('Pulling from remote...');
|
|
14
|
+
try {
|
|
15
|
+
const { stdout: currentBranch } = await execa('git', ['branch', '--show-current']);
|
|
16
|
+
const branchName = currentBranch.trim();
|
|
17
|
+
logger.debug(`Current branch: ${branchName}`);
|
|
18
|
+
try {
|
|
19
|
+
await execa('git', ['rev-parse', '--abbrev-ref', '@{u}']);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
logger.error(chalk.red('❌ No upstream branch configured!'));
|
|
23
|
+
logger.log(chalk.yellow('Set an upstream branch first:'));
|
|
24
|
+
logger.log(chalk.cyan(` git branch --set-upstream-to=origin/${branchName} ${branchName}`));
|
|
25
|
+
logger.log(chalk.gray('Or push with upstream:'));
|
|
26
|
+
logger.log(chalk.cyan(` neo git push -u ${branchName}`));
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
spinner.start();
|
|
30
|
+
if (options.rebase) {
|
|
31
|
+
logger.debug('Using rebase strategy (user specified)');
|
|
32
|
+
spinner.text = 'Pulling with rebase...';
|
|
33
|
+
const { stdout } = await execa('git', ['pull', '--rebase'], {
|
|
34
|
+
stdio: 'pipe',
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
});
|
|
37
|
+
spinner.succeed(chalk.green('✅ Successfully pulled with rebase!'));
|
|
38
|
+
if (stdout.trim()) {
|
|
39
|
+
logger.log(chalk.gray(stdout));
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
logger.debug('Attempting normal pull...');
|
|
44
|
+
try {
|
|
45
|
+
const { stdout } = await execa('git', ['pull'], {
|
|
46
|
+
stdio: 'pipe',
|
|
47
|
+
encoding: 'utf8',
|
|
48
|
+
});
|
|
49
|
+
spinner.succeed(chalk.green('✅ Successfully pulled from remote!'));
|
|
50
|
+
if (stdout.trim()) {
|
|
51
|
+
logger.log(chalk.gray(stdout));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
56
|
+
if ((errorMessage.includes('non-fast-forward') ||
|
|
57
|
+
errorMessage.includes('divergent branches') ||
|
|
58
|
+
errorMessage.includes('cannot fast-forward')) &&
|
|
59
|
+
!options.noRebase) {
|
|
60
|
+
logger.debug('Normal pull failed, attempting rebase...');
|
|
61
|
+
spinner.text = 'Cannot fast-forward, retrying with rebase...';
|
|
62
|
+
const { stdout } = await execa('git', ['pull', '--rebase'], {
|
|
63
|
+
stdio: 'pipe',
|
|
64
|
+
encoding: 'utf8',
|
|
65
|
+
});
|
|
66
|
+
spinner.succeed(chalk.green('✅ Successfully pulled with rebase!'));
|
|
67
|
+
logger.log(chalk.yellow('ℹ️ Used rebase strategy due to divergent branches'));
|
|
68
|
+
if (stdout.trim()) {
|
|
69
|
+
logger.log(chalk.gray(stdout));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
spinner.stop();
|
|
79
|
+
if (error instanceof Error) {
|
|
80
|
+
const errorMessage = error.message;
|
|
81
|
+
if (errorMessage.includes('not a git repository')) {
|
|
82
|
+
logger.error(chalk.red('❌ Not a git repository!'));
|
|
83
|
+
logger.log(chalk.yellow('Make sure you are in a git repository directory.'));
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
if (errorMessage.includes('conflict')) {
|
|
87
|
+
logger.error(chalk.red('❌ Merge conflicts detected!'));
|
|
88
|
+
logger.log(chalk.yellow('Resolve conflicts manually, then:'));
|
|
89
|
+
logger.log(chalk.cyan(' 1. Fix conflicts in your editor'));
|
|
90
|
+
logger.log(chalk.cyan(' 2. Stage resolved files: git add <files>'));
|
|
91
|
+
logger.log(chalk.cyan(' 3. Continue rebase: git rebase --continue'));
|
|
92
|
+
logger.log(chalk.gray('Or abort the rebase:'));
|
|
93
|
+
logger.log(chalk.cyan(' git rebase --abort'));
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
if (errorMessage.includes('authentication') || errorMessage.includes('permission')) {
|
|
97
|
+
logger.error(chalk.red('❌ Authentication failed!'));
|
|
98
|
+
logger.log(chalk.yellow('Check your git credentials or SSH keys.'));
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
if (errorMessage.includes('Could not resolve host')) {
|
|
102
|
+
logger.error(chalk.red('❌ Network error!'));
|
|
103
|
+
logger.log(chalk.yellow('Check your internet connection.'));
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
logger.error(chalk.red('❌ Failed to pull from remote'));
|
|
108
|
+
logger.error(chalk.gray(error instanceof Error ? error.message : String(error)));
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return command;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/git/pull/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAW3C,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO;SACJ,WAAW,CAAC,oEAAoE,CAAC;SACjF,MAAM,CAAC,UAAU,EAAE,uBAAuB,CAAC;SAC3C,MAAM,CAAC,aAAa,EAAE,mCAAmC,CAAC;SAC1D,MAAM,CAAC,KAAK,EAAE,OAAuB,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAE9C,IAAI,CAAC;YAEH,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;YACnF,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;YAExC,MAAM,CAAC,KAAK,CAAC,mBAAmB,UAAU,EAAE,CAAC,CAAC;YAG9C,IAAI,CAAC;gBACH,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;YAC5D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AC,CAAC,CAAC;oBAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;gBAED,IAAI,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;oBACnF,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAC;oBACpD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC,CAAC;oBACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;gBAED,IAAI,YAAY,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC;oBACpD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;oBAC5C,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC,CAAC;oBAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;YACH,CAAC;YAED,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC,CAAC;YACxD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export declare function registerCommands(program: Command): void;
|
|
|
3
3
|
export { createInitCommand } from './init/index.js';
|
|
4
4
|
export { createConfigCommand } from './config/index.js';
|
|
5
5
|
export { createGitCommand } from './git/index.js';
|
|
6
|
+
export { createUpdateCommand } from './update/index.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAMtD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAKvD;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/commands/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { createInitCommand } from './init/index.js';
|
|
2
2
|
import { createConfigCommand } from './config/index.js';
|
|
3
3
|
import { createGitCommand } from './git/index.js';
|
|
4
|
+
import { createUpdateCommand } from './update/index.js';
|
|
4
5
|
export function registerCommands(program) {
|
|
5
6
|
program.addCommand(createInitCommand());
|
|
6
7
|
program.addCommand(createConfigCommand());
|
|
7
8
|
program.addCommand(createGitCommand());
|
|
9
|
+
program.addCommand(createUpdateCommand());
|
|
8
10
|
}
|
|
9
11
|
export { createInitCommand } from './init/index.js';
|
|
10
12
|
export { createConfigCommand } from './config/index.js';
|
|
11
13
|
export { createGitCommand } from './git/index.js';
|
|
14
|
+
export { createUpdateCommand } from './update/index.js';
|
|
12
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAO,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACxC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACvC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/update/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AA8GtD,wBAAgB,mBAAmB,IAAI,OAAO,CA2I7C"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Command } from '@commander-js/extra-typings';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { execa } from 'execa';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { dirname, join } from 'path';
|
|
9
|
+
import { logger } from '../../utils/logger.js';
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = dirname(__filename);
|
|
12
|
+
function getCurrentVersion() {
|
|
13
|
+
try {
|
|
14
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, '../../../package.json'), 'utf-8'));
|
|
15
|
+
return packageJson.version;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
logger.error('Failed to read current version');
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function getLatestVersion() {
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetch('https://registry.npmjs.org/@radkode/neo');
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
27
|
+
}
|
|
28
|
+
const data = (await response.json());
|
|
29
|
+
return data['dist-tags'].latest;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
logger.error('Failed to fetch latest version from npm registry');
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function compareVersions(v1, v2) {
|
|
37
|
+
const parts1 = v1.split('.').map(Number);
|
|
38
|
+
const parts2 = v2.split('.').map(Number);
|
|
39
|
+
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
40
|
+
const part1 = parts1[i] || 0;
|
|
41
|
+
const part2 = parts2[i] || 0;
|
|
42
|
+
if (part1 > part2)
|
|
43
|
+
return 1;
|
|
44
|
+
if (part1 < part2)
|
|
45
|
+
return -1;
|
|
46
|
+
}
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
async function detectPackageManager() {
|
|
50
|
+
try {
|
|
51
|
+
await execa('ls', ['pnpm-lock.yaml']);
|
|
52
|
+
return 'pnpm';
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
await execa('ls', ['yarn.lock']);
|
|
58
|
+
return 'yarn';
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
}
|
|
62
|
+
return 'npm';
|
|
63
|
+
}
|
|
64
|
+
async function executeUpdate(packageManager, force) {
|
|
65
|
+
const commands = {
|
|
66
|
+
npm: ['install', '-g', '@radkode/neo@latest'],
|
|
67
|
+
pnpm: ['add', '-g', '@radkode/neo@latest'],
|
|
68
|
+
yarn: ['global', 'add', '@radkode/neo@latest'],
|
|
69
|
+
};
|
|
70
|
+
if (force) {
|
|
71
|
+
if (packageManager === 'npm') {
|
|
72
|
+
commands.npm.push('--force');
|
|
73
|
+
}
|
|
74
|
+
else if (packageManager === 'pnpm') {
|
|
75
|
+
commands.pnpm.push('--force');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
await execa(packageManager, commands[packageManager], {
|
|
79
|
+
stdio: 'inherit',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export function createUpdateCommand() {
|
|
83
|
+
const command = new Command('update');
|
|
84
|
+
command
|
|
85
|
+
.description('Update Neo CLI to the latest version')
|
|
86
|
+
.option('--check-only', 'only check for updates without installing')
|
|
87
|
+
.option('--force', 'force update even if already on latest version')
|
|
88
|
+
.action(async (options) => {
|
|
89
|
+
try {
|
|
90
|
+
const currentVersion = getCurrentVersion();
|
|
91
|
+
logger.debug(`Current version: ${currentVersion}`);
|
|
92
|
+
const spinner = ora('Checking for updates...').start();
|
|
93
|
+
let latestVersion;
|
|
94
|
+
try {
|
|
95
|
+
latestVersion = await getLatestVersion();
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
spinner.fail(chalk.red('Failed to check for updates'));
|
|
99
|
+
logger.error('Could not connect to npm registry. Please check your internet connection.');
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
logger.debug(`Latest version: ${latestVersion}`);
|
|
103
|
+
const comparison = compareVersions(latestVersion, currentVersion);
|
|
104
|
+
if (comparison === 0) {
|
|
105
|
+
spinner.succeed(chalk.green('You are already on the latest version!'));
|
|
106
|
+
logger.log(`\n${chalk.cyan('Current version:')} ${chalk.bold(currentVersion)}`);
|
|
107
|
+
if (!options.force) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
logger.log(chalk.yellow('\n--force flag detected, proceeding with reinstall...'));
|
|
111
|
+
}
|
|
112
|
+
else if (comparison < 0) {
|
|
113
|
+
spinner.warn(chalk.yellow(`You are on a newer version (${currentVersion}) than the latest stable (${latestVersion})`));
|
|
114
|
+
if (!options.force && !options.checkOnly) {
|
|
115
|
+
const { shouldDowngrade } = await inquirer.prompt([
|
|
116
|
+
{
|
|
117
|
+
type: 'confirm',
|
|
118
|
+
name: 'shouldDowngrade',
|
|
119
|
+
message: 'Do you want to downgrade to the latest stable version?',
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
122
|
+
]);
|
|
123
|
+
if (!shouldDowngrade) {
|
|
124
|
+
logger.log(chalk.gray('\nUpdate cancelled'));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else if (!options.force) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
spinner.succeed(chalk.green('Update available!'));
|
|
134
|
+
logger.log(`\n${chalk.cyan('Current version:')} ${chalk.bold(currentVersion)}`);
|
|
135
|
+
logger.log(`${chalk.cyan('Latest version:')} ${chalk.bold.green(latestVersion)}`);
|
|
136
|
+
}
|
|
137
|
+
if (options.checkOnly) {
|
|
138
|
+
if (comparison > 0) {
|
|
139
|
+
logger.log(chalk.gray(`\nRun ${chalk.cyan('neo update')} to install the latest version.`));
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (!options.force && comparison !== 0) {
|
|
144
|
+
const { confirm } = await inquirer.prompt([
|
|
145
|
+
{
|
|
146
|
+
type: 'confirm',
|
|
147
|
+
name: 'confirm',
|
|
148
|
+
message: `Update to version ${latestVersion}?`,
|
|
149
|
+
default: true,
|
|
150
|
+
},
|
|
151
|
+
]);
|
|
152
|
+
if (!confirm) {
|
|
153
|
+
logger.log(chalk.gray('\nUpdate cancelled'));
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const updateSpinner = ora('Detecting package manager...').start();
|
|
158
|
+
const packageManager = await detectPackageManager();
|
|
159
|
+
updateSpinner.text = `Updating via ${chalk.cyan(packageManager)}...`;
|
|
160
|
+
logger.debug(`Using package manager: ${packageManager}`);
|
|
161
|
+
try {
|
|
162
|
+
await executeUpdate(packageManager, options.force || false);
|
|
163
|
+
updateSpinner.succeed(chalk.green(`Successfully updated to version ${latestVersion}!`));
|
|
164
|
+
logger.log(chalk.gray(`\n✨ Run ${chalk.cyan('neo --version')} to verify the installation.`));
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
updateSpinner.fail(chalk.red('Update failed'));
|
|
168
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
169
|
+
if (errorMessage.includes('EACCES') || errorMessage.includes('permission denied')) {
|
|
170
|
+
logger.error('Permission denied. Try running with sudo:');
|
|
171
|
+
logger.log(chalk.cyan(` sudo ${packageManager} ${packageManager === 'npm' ? 'install' : 'add'} -g @radkode/neo@latest`));
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
logger.error(`Update failed: ${errorMessage}`);
|
|
175
|
+
logger.log(chalk.gray(`\nTry updating manually: ${chalk.cyan(`${packageManager} ${packageManager === 'npm' ? 'install' : 'add'} -g @radkode/neo@latest`)}`));
|
|
176
|
+
}
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
182
|
+
logger.error(`Unexpected error: ${errorMessage}`);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
return command;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/update/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAKtC,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QAChG,OAAO,WAAW,CAAC,OAAO,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC/C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;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K,CAAC,CAAC;gBAE5E,IAAI,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;oBAClF,MAAM,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;oBAC1D,MAAM,CAAC,GAAG,CACR,KAAK,CAAC,IAAI,CACR,UAAU,cAAc,IAAI,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,yBAAyB,CAClG,CACF,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,KAAK,CAAC,kBAAkB,YAAY,EAAE,CAAC,CAAC;oBAC/C,MAAM,CAAC,GAAG,CACR,KAAK,CAAC,IAAI,CACR,4BAA4B,KAAK,CAAC,IAAI,CAAC,GAAG,cAAc,IAAI,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,yBAAyB,CAAC,EAAE,CACrI,CACF,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5E,MAAM,CAAC,KAAK,CAAC,qBAAqB,YAAY,EAAE,CAAC,CAAC;YAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,4 +14,21 @@ export interface GitPushOptions extends BaseOptions {
|
|
|
14
14
|
setUpstream?: string;
|
|
15
15
|
tags?: boolean;
|
|
16
16
|
}
|
|
17
|
+
export interface GitPullOptions extends BaseOptions {
|
|
18
|
+
rebase?: boolean;
|
|
19
|
+
noRebase?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface UpdateOptions extends BaseOptions {
|
|
22
|
+
checkOnly?: boolean;
|
|
23
|
+
force?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface NpmPackageInfo {
|
|
26
|
+
name: string;
|
|
27
|
+
version: string;
|
|
28
|
+
'dist-tags': {
|
|
29
|
+
latest: string;
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export type PackageManager = 'npm' | 'pnpm' | 'yarn';
|
|
17
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;C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