easyai 1.0.2 → 1.0.4

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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easyai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wade
@@ -37,6 +37,20 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '3.1'
40
+ - !ruby/object:Gem::Dependency
41
+ name: webrick
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.7'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.7'
40
54
  - !ruby/object:Gem::Dependency
41
55
  name: bundler
42
56
  requirement: !ruby/object:Gem::Requirement
@@ -93,9 +107,22 @@ files:
93
107
  - bin/easyai
94
108
  - easyai.gemspec
95
109
  - lib/easyai.rb
96
- - lib/easyai/claude.rb
97
- - lib/easyai/gemini.rb
98
- - lib/easyai/gpt.rb
110
+ - lib/easyai/auth/authclaude.rb
111
+ - lib/easyai/auth/jpslogin.rb
112
+ - lib/easyai/base/file_crypto.rb
113
+ - lib/easyai/base/system_keychain.rb
114
+ - lib/easyai/base/update_notifier.rb
115
+ - lib/easyai/base/version_checker.rb
116
+ - lib/easyai/command.rb
117
+ - lib/easyai/command/claude.rb
118
+ - lib/easyai/command/clean.rb
119
+ - lib/easyai/command/gemini.rb
120
+ - lib/easyai/command/gpt.rb
121
+ - lib/easyai/command/update.rb
122
+ - lib/easyai/command/utils.rb
123
+ - lib/easyai/command/utils/decry.rb
124
+ - lib/easyai/command/utils/encry.rb
125
+ - lib/easyai/config/config.rb
99
126
  - lib/easyai/version.rb
100
127
  homepage: https://github.com/wade/easyai
101
128
  licenses:
data/lib/easyai/claude.rb DELETED
@@ -1,61 +0,0 @@
1
- module EasyAI
2
- class Claude < Command
3
- self.command = 'claude'
4
- self.summary = '使用配置的环境运行 Claude CLI'
5
- self.description = <<-DESC
6
- 使用预配置的 API 令牌和代理设置运行 Claude CLI 工具。
7
- 所有参数都会传递给 claude 命令。
8
- DESC
9
-
10
- def initialize(argv)
11
- @claude_args = argv.remainder!
12
- super
13
- end
14
-
15
- def validate!
16
- super
17
- help! '未找到 Claude CLI。请安装:npm install -g @anthropic-ai/claude-code' unless claude_available?
18
- end
19
-
20
- def run
21
- config = load_config
22
-
23
- env = ENV.to_h.merge({
24
- 'ANTHROPIC_API_KEY' => config['claude_token'] || config['anthropic_api_key'],
25
- 'CLAUDE_CODE_OAUTH_TOKEN' => config['claude_token'] || config['anthropic_api_key']
26
- })
27
-
28
- # Add proxy settings if configured
29
- if config['http_proxy']
30
- env['HTTP_PROXY'] = config['http_proxy']
31
- env['HTTPS_PROXY'] = config['http_proxy']
32
- env['http_proxy'] = config['http_proxy']
33
- env['https_proxy'] = config['http_proxy']
34
- end
35
-
36
- puts "正在运行: claude #{@claude_args.join(' ')}".blue if verbose?
37
- exec(env, 'claude', *@claude_args)
38
- end
39
-
40
- private
41
-
42
- def claude_available?
43
- # 跨平台命令检测
44
- if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
45
- system('where claude >nul 2>&1')
46
- else
47
- system('which claude > /dev/null 2>&1')
48
- end
49
- end
50
-
51
- def load_config
52
- config_path = File.expand_path('~/.easyai/config.yml')
53
- return {} unless File.exist?(config_path)
54
-
55
- YAML.load_file(config_path) || {}
56
- rescue => e
57
- puts "加载配置出错: #{e.message}".red
58
- {}
59
- end
60
- end
61
- end
data/lib/easyai/gemini.rb DELETED
@@ -1,61 +0,0 @@
1
- module EasyAI
2
- class Gemini < Command
3
- self.command = 'gemini'
4
- self.summary = '使用配置的环境运行 Gemini CLI'
5
- self.description = <<-DESC
6
- 使用预配置的 API 令牌和代理设置运行 Gemini CLI 工具。
7
- 所有参数都会传递给 gemini 命令。
8
- DESC
9
-
10
- def initialize(argv)
11
- @gemini_args = argv.remainder!
12
- super
13
- end
14
-
15
- def validate!
16
- super
17
- help! '未找到 Gemini CLI。请安装:npm install -g @google/gemini-cli' unless gemini_available?
18
- end
19
-
20
- def run
21
- config = load_config
22
-
23
- env = ENV.to_h.merge({
24
- 'GOOGLE_API_KEY' => config['gemini_token'] || config['google_api_key'],
25
- 'GEMINI_API_KEY' => config['gemini_token'] || config['google_api_key']
26
- })
27
-
28
- # Add proxy settings if configured
29
- if config['http_proxy']
30
- env['HTTP_PROXY'] = config['http_proxy']
31
- env['HTTPS_PROXY'] = config['http_proxy']
32
- env['http_proxy'] = config['http_proxy']
33
- env['https_proxy'] = config['http_proxy']
34
- end
35
-
36
- puts "正在运行: gemini #{@gemini_args.join(' ')}".blue if verbose?
37
- exec(env, 'gemini', *@gemini_args)
38
- end
39
-
40
- private
41
-
42
- def gemini_available?
43
- # 跨平台命令检测
44
- if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
45
- system('where gemini >nul 2>&1')
46
- else
47
- system('which gemini > /dev/null 2>&1')
48
- end
49
- end
50
-
51
- def load_config
52
- config_path = File.expand_path('~/.easyai/config.yml')
53
- return {} unless File.exist?(config_path)
54
-
55
- YAML.load_file(config_path) || {}
56
- rescue => e
57
- puts "加载配置出错: #{e.message}".red
58
- {}
59
- end
60
- end
61
- end
data/lib/easyai/gpt.rb DELETED
@@ -1,60 +0,0 @@
1
- module EasyAI
2
- class GPT < Command
3
- self.command = 'gpt'
4
- self.summary = '使用配置的环境运行 OpenAI CLI'
5
- self.description = <<-DESC
6
- 使用预配置的 API 令牌和代理设置运行 OpenAI CLI 工具。
7
- 所有参数都会传递给 openai 命令。
8
- DESC
9
-
10
- def initialize(argv)
11
- @gpt_args = argv.remainder!
12
- super
13
- end
14
-
15
- def validate!
16
- super
17
- help! '未找到 OpenAI CLI。请安装:pip install openai' unless gpt_available?
18
- end
19
-
20
- def run
21
- config = load_config
22
-
23
- env = ENV.to_h.merge({
24
- 'OPENAI_API_KEY' => config['openai_token'] || config['openai_api_key']
25
- })
26
-
27
- # Add proxy settings if configured
28
- if config['http_proxy']
29
- env['HTTP_PROXY'] = config['http_proxy']
30
- env['HTTPS_PROXY'] = config['http_proxy']
31
- env['http_proxy'] = config['http_proxy']
32
- env['https_proxy'] = config['http_proxy']
33
- end
34
-
35
- puts "正在运行: openai #{@gpt_args.join(' ')}".blue if verbose?
36
- exec(env, 'openai', *@gpt_args)
37
- end
38
-
39
- private
40
-
41
- def gpt_available?
42
- # 跨平台命令检测
43
- if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
44
- system('where openai >nul 2>&1')
45
- else
46
- system('which openai > /dev/null 2>&1')
47
- end
48
- end
49
-
50
- def load_config
51
- config_path = File.expand_path('~/.easyai/config.yml')
52
- return {} unless File.exist?(config_path)
53
-
54
- YAML.load_file(config_path) || {}
55
- rescue => e
56
- puts "加载配置出错: #{e.message}".red
57
- {}
58
- end
59
- end
60
- end