myask 0.0.1 → 1.1.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.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/bin/myask +1 -1
  4. data/html/App.html +116 -0
  5. data/html/MyAsk/Api/Helper.html +207 -0
  6. data/html/MyAsk/Api/Invitation.html +212 -0
  7. data/html/MyAsk/Api/Project.html +355 -0
  8. data/html/MyAsk/Api/ProjectHelper.html +299 -0
  9. data/html/MyAsk/Api/Question.html +261 -0
  10. data/html/MyAsk/Api.html +120 -0
  11. data/html/MyAsk/Config.html +195 -0
  12. data/html/MyAsk/ConfigHelper.html +251 -0
  13. data/html/MyAsk/Prompt.html +221 -0
  14. data/html/MyAsk/PromptHelper.html +330 -0
  15. data/html/MyAsk.html +114 -0
  16. data/html/README_rdoc.html +394 -0
  17. data/html/created.rid +14 -0
  18. data/html/css/fonts.css +167 -0
  19. data/html/css/rdoc.css +681 -0
  20. data/html/fonts/Lato-Light.ttf +0 -0
  21. data/html/fonts/Lato-LightItalic.ttf +0 -0
  22. data/html/fonts/Lato-Regular.ttf +0 -0
  23. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  24. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  25. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  26. data/html/images/add.png +0 -0
  27. data/html/images/arrow_up.png +0 -0
  28. data/html/images/brick.png +0 -0
  29. data/html/images/brick_link.png +0 -0
  30. data/html/images/bug.png +0 -0
  31. data/html/images/bullet_black.png +0 -0
  32. data/html/images/bullet_toggle_minus.png +0 -0
  33. data/html/images/bullet_toggle_plus.png +0 -0
  34. data/html/images/date.png +0 -0
  35. data/html/images/delete.png +0 -0
  36. data/html/images/find.png +0 -0
  37. data/html/images/loadingAnimation.gif +0 -0
  38. data/html/images/macFFBgHack.png +0 -0
  39. data/html/images/package.png +0 -0
  40. data/html/images/page_green.png +0 -0
  41. data/html/images/page_white_text.png +0 -0
  42. data/html/images/page_white_width.png +0 -0
  43. data/html/images/plugin.png +0 -0
  44. data/html/images/ruby.png +0 -0
  45. data/html/images/tag_blue.png +0 -0
  46. data/html/images/tag_green.png +0 -0
  47. data/html/images/transparent.png +0 -0
  48. data/html/images/wrench.png +0 -0
  49. data/html/images/wrench_orange.png +0 -0
  50. data/html/images/zoom.png +0 -0
  51. data/html/index.html +403 -0
  52. data/html/js/darkfish.js +120 -0
  53. data/html/js/navigation.js +105 -0
  54. data/html/js/navigation.js.gz +0 -0
  55. data/html/js/search.js +110 -0
  56. data/html/js/search_index.js +1 -0
  57. data/html/js/search_index.js.gz +0 -0
  58. data/html/js/searcher.js +229 -0
  59. data/html/js/searcher.js.gz +0 -0
  60. data/html/table_of_contents.html +257 -0
  61. data/lib/myask/prompt_helper.rb +4 -1
  62. data/lib/myask/version.rb +1 -1
  63. data/pkg/myask-0.0.1/Gemfile +10 -0
  64. data/pkg/myask-0.0.1/Gemfile.lock +70 -0
  65. data/pkg/myask-0.0.1/README.rdoc +6 -0
  66. data/pkg/myask-0.0.1/Rakefile +21 -0
  67. data/pkg/myask-0.0.1/bin/myask +101 -0
  68. data/pkg/myask-0.0.1/lib/myask/api/api_helper.rb +45 -0
  69. data/pkg/myask-0.0.1/lib/myask/api/invitation.rb +49 -0
  70. data/pkg/myask-0.0.1/lib/myask/api/project.rb +193 -0
  71. data/pkg/myask-0.0.1/lib/myask/api/project_helper.rb +46 -0
  72. data/pkg/myask-0.0.1/lib/myask/api/question.rb +99 -0
  73. data/pkg/myask-0.0.1/lib/myask/config.rb +37 -0
  74. data/pkg/myask-0.0.1/lib/myask/config_helper.rb +28 -0
  75. data/pkg/myask-0.0.1/lib/myask/prompt.rb +63 -0
  76. data/pkg/myask-0.0.1/lib/myask/prompt_helper.rb +83 -0
  77. data/pkg/myask-0.0.1/lib/myask/version.rb +3 -0
  78. data/pkg/myask-0.0.1/lib/myask.rb +28 -0
  79. data/pkg/myask-0.0.1/myask.gemspec +22 -0
  80. data/pkg/myask-0.0.1/myask.rdoc +138 -0
  81. data/pkg/myask-0.0.1/test/default_test.rb +14 -0
  82. data/pkg/myask-0.0.1/test/test_helper.rb +4 -0
  83. data/pkg/myask-0.0.1.gem +0 -0
  84. data/pkg/myask-1.0.0/Gemfile +10 -0
  85. data/pkg/myask-1.0.0/Gemfile.lock +70 -0
  86. data/pkg/myask-1.0.0/README.rdoc +6 -0
  87. data/pkg/myask-1.0.0/Rakefile +21 -0
  88. data/pkg/myask-1.0.0/bin/myask +101 -0
  89. data/pkg/myask-1.0.0/html/App.html +116 -0
  90. data/pkg/myask-1.0.0/html/MyAsk/Api/Helper.html +207 -0
  91. data/pkg/myask-1.0.0/html/MyAsk/Api/Invitation.html +212 -0
  92. data/pkg/myask-1.0.0/html/MyAsk/Api/Project.html +355 -0
  93. data/pkg/myask-1.0.0/html/MyAsk/Api/ProjectHelper.html +299 -0
  94. data/pkg/myask-1.0.0/html/MyAsk/Api/Question.html +261 -0
  95. data/pkg/myask-1.0.0/html/MyAsk/Api.html +120 -0
  96. data/pkg/myask-1.0.0/html/MyAsk/Config.html +195 -0
  97. data/pkg/myask-1.0.0/html/MyAsk/ConfigHelper.html +251 -0
  98. data/pkg/myask-1.0.0/html/MyAsk/Prompt.html +221 -0
  99. data/pkg/myask-1.0.0/html/MyAsk/PromptHelper.html +330 -0
  100. data/pkg/myask-1.0.0/html/MyAsk.html +114 -0
  101. data/pkg/myask-1.0.0/html/README_rdoc.html +394 -0
  102. data/pkg/myask-1.0.0/html/created.rid +14 -0
  103. data/pkg/myask-1.0.0/html/css/fonts.css +167 -0
  104. data/pkg/myask-1.0.0/html/css/rdoc.css +681 -0
  105. data/pkg/myask-1.0.0/html/fonts/Lato-Light.ttf +0 -0
  106. data/pkg/myask-1.0.0/html/fonts/Lato-LightItalic.ttf +0 -0
  107. data/pkg/myask-1.0.0/html/fonts/Lato-Regular.ttf +0 -0
  108. data/pkg/myask-1.0.0/html/fonts/Lato-RegularItalic.ttf +0 -0
  109. data/pkg/myask-1.0.0/html/fonts/SourceCodePro-Bold.ttf +0 -0
  110. data/pkg/myask-1.0.0/html/fonts/SourceCodePro-Regular.ttf +0 -0
  111. data/pkg/myask-1.0.0/html/images/add.png +0 -0
  112. data/pkg/myask-1.0.0/html/images/arrow_up.png +0 -0
  113. data/pkg/myask-1.0.0/html/images/brick.png +0 -0
  114. data/pkg/myask-1.0.0/html/images/brick_link.png +0 -0
  115. data/pkg/myask-1.0.0/html/images/bug.png +0 -0
  116. data/pkg/myask-1.0.0/html/images/bullet_black.png +0 -0
  117. data/pkg/myask-1.0.0/html/images/bullet_toggle_minus.png +0 -0
  118. data/pkg/myask-1.0.0/html/images/bullet_toggle_plus.png +0 -0
  119. data/pkg/myask-1.0.0/html/images/date.png +0 -0
  120. data/pkg/myask-1.0.0/html/images/delete.png +0 -0
  121. data/pkg/myask-1.0.0/html/images/find.png +0 -0
  122. data/pkg/myask-1.0.0/html/images/loadingAnimation.gif +0 -0
  123. data/pkg/myask-1.0.0/html/images/macFFBgHack.png +0 -0
  124. data/pkg/myask-1.0.0/html/images/package.png +0 -0
  125. data/pkg/myask-1.0.0/html/images/page_green.png +0 -0
  126. data/pkg/myask-1.0.0/html/images/page_white_text.png +0 -0
  127. data/pkg/myask-1.0.0/html/images/page_white_width.png +0 -0
  128. data/pkg/myask-1.0.0/html/images/plugin.png +0 -0
  129. data/pkg/myask-1.0.0/html/images/ruby.png +0 -0
  130. data/pkg/myask-1.0.0/html/images/tag_blue.png +0 -0
  131. data/pkg/myask-1.0.0/html/images/tag_green.png +0 -0
  132. data/pkg/myask-1.0.0/html/images/transparent.png +0 -0
  133. data/pkg/myask-1.0.0/html/images/wrench.png +0 -0
  134. data/pkg/myask-1.0.0/html/images/wrench_orange.png +0 -0
  135. data/pkg/myask-1.0.0/html/images/zoom.png +0 -0
  136. data/pkg/myask-1.0.0/html/index.html +403 -0
  137. data/pkg/myask-1.0.0/html/js/darkfish.js +120 -0
  138. data/pkg/myask-1.0.0/html/js/navigation.js +105 -0
  139. data/pkg/myask-1.0.0/html/js/navigation.js.gz +0 -0
  140. data/pkg/myask-1.0.0/html/js/search.js +110 -0
  141. data/pkg/myask-1.0.0/html/js/search_index.js +1 -0
  142. data/pkg/myask-1.0.0/html/js/search_index.js.gz +0 -0
  143. data/pkg/myask-1.0.0/html/js/searcher.js +229 -0
  144. data/pkg/myask-1.0.0/html/js/searcher.js.gz +0 -0
  145. data/pkg/myask-1.0.0/html/table_of_contents.html +257 -0
  146. data/pkg/myask-1.0.0/lib/myask/api/api_helper.rb +45 -0
  147. data/pkg/myask-1.0.0/lib/myask/api/invitation.rb +49 -0
  148. data/pkg/myask-1.0.0/lib/myask/api/project.rb +193 -0
  149. data/pkg/myask-1.0.0/lib/myask/api/project_helper.rb +46 -0
  150. data/pkg/myask-1.0.0/lib/myask/api/question.rb +99 -0
  151. data/pkg/myask-1.0.0/lib/myask/config.rb +37 -0
  152. data/pkg/myask-1.0.0/lib/myask/config_helper.rb +28 -0
  153. data/pkg/myask-1.0.0/lib/myask/prompt.rb +63 -0
  154. data/pkg/myask-1.0.0/lib/myask/prompt_helper.rb +83 -0
  155. data/pkg/myask-1.0.0/lib/myask/version.rb +3 -0
  156. data/pkg/myask-1.0.0/lib/myask.rb +28 -0
  157. data/pkg/myask-1.0.0/myask.gemspec +22 -0
  158. data/pkg/myask-1.0.0/myask.rdoc +138 -0
  159. data/pkg/myask-1.0.0/pkg/myask-0.0.1/Gemfile +10 -0
  160. data/pkg/myask-1.0.0/pkg/myask-0.0.1/Gemfile.lock +70 -0
  161. data/pkg/myask-1.0.0/pkg/myask-0.0.1/README.rdoc +6 -0
  162. data/pkg/myask-1.0.0/pkg/myask-0.0.1/Rakefile +21 -0
  163. data/pkg/myask-1.0.0/pkg/myask-0.0.1/bin/myask +101 -0
  164. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/api_helper.rb +45 -0
  165. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/invitation.rb +49 -0
  166. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/project.rb +193 -0
  167. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/project_helper.rb +46 -0
  168. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/question.rb +99 -0
  169. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/config.rb +37 -0
  170. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/config_helper.rb +28 -0
  171. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/prompt.rb +63 -0
  172. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/prompt_helper.rb +83 -0
  173. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/version.rb +3 -0
  174. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask.rb +28 -0
  175. data/pkg/myask-1.0.0/pkg/myask-0.0.1/myask.gemspec +22 -0
  176. data/pkg/myask-1.0.0/pkg/myask-0.0.1/myask.rdoc +138 -0
  177. data/pkg/myask-1.0.0/pkg/myask-0.0.1/test/default_test.rb +14 -0
  178. data/pkg/myask-1.0.0/pkg/myask-0.0.1/test/test_helper.rb +4 -0
  179. data/pkg/myask-1.0.0/pkg/myask-0.0.1.gem +0 -0
  180. data/pkg/myask-1.0.0/test/default_test.rb +14 -0
  181. data/pkg/myask-1.0.0/test/test_helper.rb +4 -0
  182. data/pkg/myask-1.0.0.gem +0 -0
  183. metadata +179 -2
@@ -0,0 +1,99 @@
1
+ module MyAsk
2
+ module Api
3
+ class Question
4
+
5
+ def initialize(c)
6
+ c.desc "Show details for MyAsk question"
7
+ c.arg_name "question_id"
8
+
9
+ c.command :show do |c|
10
+ c.desc "List questions and select to view"
11
+ c.switch [:l, :list]
12
+
13
+ c.flag [:q, :question_id], desc: "ID of question to display"
14
+ c.switch [:skip_response], desc: "Do not include question response in output"
15
+
16
+ c.action do |global_options, options, args|
17
+ api_host = global_options[:api_host]
18
+ api_key = global_options[:api_key]
19
+
20
+ if options[:list]
21
+ response = MyAsk::Api::Helper.make_request("Get", URI("#{api_host}/api/questions"), api_key)
22
+ questions = JSON.parse(response.body).reverse
23
+
24
+ if questions.empty?
25
+ puts "No questions found."
26
+ exit
27
+ end
28
+
29
+ selected_question_id = TTY::Prompt.new.select("Select a question:", per_page: 10) do |menu|
30
+ questions.each do |q|
31
+ menu.choice "[#{q["id"]}] #{q["content"][0, 80]}", q["id"]
32
+ end
33
+ end
34
+
35
+ selected_question = selected_question_id
36
+ end
37
+
38
+ response = MyAsk::Api::Helper.make_request("Get", URI("#{api_host}/api/questions/#{selected_question || options[:question_id]}"), api_key)
39
+ response = JSON.parse(response.body)
40
+ response = response.except("response") if options[:skip_response]
41
+
42
+ puts "\n#{"\\" * 30} BEGIN Question (#{response["question"]["id"]}) #{"/" * 30}\n\n" unless global_options[:json]
43
+ puts global_options[:json] ? response.to_json : response["question"]["content"]
44
+ puts "\n#{"\\" * 35} END Question #{"/" * 35}\n" unless global_options[:json]
45
+
46
+ unless options[:skip_response] || global_options[:json] || response["response"].nil?
47
+ puts "\n\n#{"\\" * 30} BEGIN Response (#{response["response"]["id"]}) #{"/" * 30}\n\n" unless global_options[:json]
48
+ puts response["response"]["content"]
49
+ puts "\n#{"\\" * 35} END Response #{"/" * 35}\n" unless global_options[:json]
50
+ end
51
+ end
52
+ end
53
+
54
+ c.desc "Delete MyAsk question"
55
+ c.arg_name "question_id"
56
+
57
+ c.command :delete do |c|
58
+ c.desc "List questions and select to delete"
59
+ c.switch [:l, :list]
60
+
61
+ c.flag [:question_id], desc: "ID of question to delete"
62
+
63
+ c.action do |global_options, options, args|
64
+ api_host = global_options[:api_host]
65
+ api_key = global_options[:api_key]
66
+
67
+ if options[:list]
68
+ response = MyAsk::Api::Helper.make_request("Get", URI("#{api_host}/api/questions"), api_key)
69
+ questions = JSON.parse(response.body).reverse
70
+
71
+ if questions.empty?
72
+ puts "No questions found."
73
+ exit
74
+ end
75
+
76
+ selected_question_id = TTY::Prompt.new.select("Select a question:", per_page: 10) do |menu|
77
+ questions.each do |q|
78
+ menu.choice "[#{q["id"]}] #{q["content"][0, 80]}", q["id"]
79
+ end
80
+ end
81
+
82
+ selected_question = selected_question_id
83
+ end
84
+
85
+ response = MyAsk::Api::Helper.make_request("Delete", URI("#{api_host}/api/questions/#{selected_question || options[:question_id]}"), api_key)
86
+ response = JSON.parse(response.body)
87
+
88
+ puts JSON.pretty_generate(response["question"])
89
+
90
+ end
91
+ end
92
+
93
+ c.default_command :show
94
+ c
95
+ end
96
+
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,37 @@
1
+ module MyAsk
2
+ class Config
3
+
4
+ def initialize(c)
5
+ c.command :save do |c|
6
+ c.desc "Set MyAsk API URL"
7
+ c.flag [:api_host], type: String
8
+
9
+ c.desc "Set MyAsk API Key"
10
+ c.flag [:api_key], type: String
11
+
12
+ c.desc "Set MyAsk Project"
13
+ c.flag [:project], type: String
14
+
15
+ c.action do |global_options, options, args|
16
+ helper = MyAsk::ConfigHelper.new(global_options, options, args)
17
+ response = helper.save_config
18
+ puts response
19
+ response
20
+ end
21
+ end
22
+
23
+ c.command :show do |c|
24
+ c.action do |global_options, options, args|
25
+ helper = MyAsk::ConfigHelper.new(global_options, options, args)
26
+ response = helper.get_config
27
+ puts response
28
+ response
29
+ end
30
+ end
31
+
32
+ c.default_command :show
33
+ c
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,28 @@
1
+ module MyAsk
2
+ class ConfigHelper
3
+
4
+ def initialize(global_options, options, args)
5
+ @global_options = global_options
6
+ @options = options
7
+ @args = args
8
+ @rc_file_path = File.expand_path("~/.myask.rc")
9
+ @config_data = YAML.load_file(@rc_file_path)
10
+ end
11
+
12
+ def get_config
13
+ @config_data.reject { |key, _| ["commands", "version", "s", "help"].include?(key.to_s) }.to_json
14
+ end
15
+
16
+ def save_config
17
+ @config_data[:api_key] = @options[:api_key] if @options[:api_key]
18
+ @config_data[:api_host] = @options[:api_host] if @options[:api_host]
19
+ @config_data[:project] = @options[:project] if @options[:project]
20
+
21
+ File.open(@rc_file_path, "w") do |file|
22
+ file.write(@config_data.to_yaml)
23
+ end
24
+ @config_data.reject { |key, _| ["commands", "version", "s", "help"].include?(key.to_s) }.to_json
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,63 @@
1
+ module MyAsk
2
+ class Prompt
3
+
4
+ def initialize(c)
5
+ c.desc "Skip Follow-Up Question"
6
+ c.switch [:no_followup]
7
+
8
+ c.desc "Project ID"
9
+ c.flag [:project]
10
+
11
+ c.desc "Prompt to send"
12
+ c.flag [:p, :prompt]
13
+
14
+ c.desc "Question IDs to include in prompt context"
15
+ c.flag [:c, :context_ids], multiple: true
16
+
17
+ c.desc "Path to source file(s)"
18
+ c.flag [:F, :input_file], multiple: true
19
+
20
+ c.action do |global_options, options, args|
21
+ helper = MyAsk::PromptHelper.new(global_options, options, args)
22
+
23
+ config = global_options
24
+ auth_token = config[:api_key]
25
+ project = options[:project] || config[:project]
26
+
27
+ content = helper.get_initial_question
28
+ context_ids = options[:"context_ids"]
29
+
30
+ loop do
31
+ begin
32
+ question_id = helper.submit_question(config[:api_host], auth_token, project, content, context_ids)
33
+ abort if question_id.nil?
34
+
35
+ context_ids << question_id
36
+
37
+ response = helper.poll_for_response(config[:api_host], auth_token, question_id)
38
+
39
+ if global_options[:json]
40
+ puts "\n\n#{JSON.dump({response: response})}\n\n"
41
+ else
42
+ puts "\n\n#{response}\n\n"
43
+ end
44
+
45
+ break if options[:no_followup]
46
+
47
+ prompt = TTY::Prompt.new
48
+ is_follow_up = prompt.yes?("Would you like to ask a follow-up question?", default: false)
49
+
50
+ break unless is_follow_up
51
+
52
+ follow_up_question = prompt.ask("Enter your follow-up question:").strip
53
+ content = follow_up_question
54
+ rescue => e
55
+ abort "Error: #{e}"
56
+ end
57
+ end
58
+ end
59
+ c
60
+ end
61
+
62
+ end
63
+ end
@@ -0,0 +1,83 @@
1
+ module MyAsk
2
+ class PromptHelper
3
+ def initialize(global_options, options, args)
4
+ @global_options = global_options
5
+ @options = options
6
+ @args = args
7
+ end
8
+
9
+ def submit_question(api_host, auth_token, project_id, content, context_ids)
10
+ uri = URI("#{api_host}/api/questions")
11
+ http = Net::HTTP.new(uri.host, uri.port)
12
+ http.use_ssl = (uri.scheme == "https")
13
+
14
+ request = Net::HTTP::Post.new(uri.path)
15
+ request["Authorization"] = "Bearer #{auth_token}"
16
+ request["Content-Type"] = "application/json"
17
+
18
+ request.body = {
19
+ question: {
20
+ project_id: project_id,
21
+ content: content,
22
+ context_ids: context_ids
23
+ }
24
+ }.to_json
25
+
26
+ response = http.request(request)
27
+ parsed_response = JSON.parse(response.body)
28
+
29
+ parsed_response['id'] || nil
30
+ end
31
+
32
+ def poll_for_response(api_host, auth_token, question_id)
33
+ unless @global_options[:silent]
34
+ spinner = TTY::Spinner.new('🔄 Waiting for response from MyAsk API... [:spinner]', format: :dots)
35
+ spinner.auto_spin
36
+ end
37
+
38
+ max_retries = 50
39
+ attempt = 0
40
+
41
+ while attempt < max_retries
42
+ sleep 3
43
+ uri = URI("#{api_host}/api/responses/#{question_id}")
44
+ response = Net::HTTP.get(uri, { 'Authorization' => "Bearer #{auth_token}" })
45
+ parsed_response = JSON.parse(response)
46
+
47
+ if parsed_response.key?('content')
48
+ spinner.success('✅ Response received!') unless @global_options[:silent]
49
+ return parsed_response['content']
50
+ end
51
+
52
+ attempt += 1
53
+ end
54
+
55
+ spinner.error('❌ Timed out waiting for MyAsk API response.') unless @global_options[:silent]
56
+ raise 'No response received from MyAsk API after multiple attempts.'
57
+ end
58
+
59
+ def get_initial_question
60
+ file_contents = []
61
+
62
+ current_directory = Dir.pwd
63
+
64
+ if @options[:input_file]&.any?
65
+ @options[:input_file].each do |file_path|
66
+ begin
67
+ file_path = file_path[0] == "/" ? file_path : "#{current_directory}/#{file_path}"
68
+ content = File.read("#{current_directory}/#{file_path}").strip
69
+ file_contents << "**File**: #{file_path}**\n#{content}"
70
+ rescue => e
71
+ raise "❌ Failed to read input file: #{file_path}"
72
+ end
73
+ end
74
+ end
75
+
76
+ combined_question = "#{@options[:prompt]}\n\n---\n#{file_contents.join("\n\n---\n")}" unless file_contents.empty?
77
+ combined_question ||= @options[:prompt] || TTY::Prompt.new.ask('Please enter a prompt:').strip
78
+
79
+ combined_question.empty? ? nil : combined_question
80
+ end
81
+
82
+ end
83
+ end
@@ -0,0 +1,3 @@
1
+ module Myask
2
+ VERSION = '1.1.0'
3
+ end
@@ -0,0 +1,28 @@
1
+ require 'myask/version.rb'
2
+
3
+ require 'myask/config.rb'
4
+ require 'myask/config_helper.rb'
5
+
6
+ require 'myask/api/api_helper.rb'
7
+
8
+ require 'myask/api/question.rb'
9
+ require 'myask/api/invitation.rb'
10
+
11
+ require 'myask/api/project.rb'
12
+ require 'myask/api/project_helper.rb'
13
+
14
+ require 'myask/prompt.rb'
15
+ require 'myask/prompt_helper.rb'
16
+
17
+ # Add requires for other files you add to your project here, so
18
+ # you just need to require this one file in your bin file
19
+
20
+ require 'net/http'
21
+ require 'json'
22
+
23
+ require 'io/console'
24
+ require 'tty-spinner'
25
+ require 'tty-prompt'
26
+ require 'yaml'
27
+
28
+ require 'pry-byebug'
@@ -0,0 +1,22 @@
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__),'lib','myask','version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'myask'
5
+ s.version = Myask::VERSION
6
+ s.author = 'Andrew Chaney (netuoso)'
7
+ s.email = 'netuoso@myask.io'
8
+ s.homepage = 'https://myask.io'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = 'MyAsk Command Line Tool Integrates with MyAsk AI API (https://myask.io).'
11
+ s.files = `git ls-files`.split("
12
+ ")
13
+ s.require_paths << 'lib'
14
+ s.extra_rdoc_files = ['README.rdoc','myask.rdoc']
15
+ s.rdoc_options << '--title' << 'myask' << '--main' << 'README.rdoc' << '-ri'
16
+ s.bindir = 'bin'
17
+ s.executables << 'myask'
18
+ s.add_development_dependency('rake')
19
+ s.add_development_dependency('rdoc')
20
+ s.add_development_dependency('minitest')
21
+ s.add_runtime_dependency('gli','~> 2.22.2')
22
+ end
@@ -0,0 +1,138 @@
1
+ == myask - Describe your application here
2
+
3
+ v0.0.1
4
+
5
+ === Global Options
6
+ === --api_host arg
7
+
8
+ Host for MyAsk API
9
+
10
+ [Default Value] http://localhost:3000
11
+
12
+
13
+ === --api_key arg
14
+
15
+ API Key for MyAsk API
16
+
17
+ [Default Value] A9qVFSgXFH8Ubclq4jVYn0PBsEGMSfQf
18
+
19
+
20
+ === --project arg
21
+
22
+ Current MyAsk Project
23
+
24
+ [Default Value] 156891416
25
+
26
+
27
+ === --help
28
+ Show this message
29
+
30
+
31
+
32
+ === --[no-]json
33
+ Format Output as JSON
34
+
35
+
36
+
37
+ === --[no-]silent
38
+ Silent Progress Spinner
39
+
40
+
41
+
42
+ === --version
43
+ Display the program version
44
+
45
+
46
+
47
+ === Commands
48
+ ==== Command: <tt>config </tt>
49
+ View current or set new MyAsk configuration values
50
+
51
+
52
+ ===== Commands
53
+ ====== Command: <tt>save </tt>
54
+
55
+
56
+
57
+ ====== Command: <tt>show </tt>
58
+
59
+
60
+
61
+ [Default Command] show
62
+ ==== Command: <tt>help command</tt>
63
+ Shows a list of commands or help for one command
64
+
65
+ Gets help for the application or its commands. Can also list the commands in a way helpful to creating a bash-style completion function
66
+ ===== Options
67
+ ===== -c
68
+ List commands one per line, to assist with shell completion
69
+
70
+
71
+
72
+ ==== Command: <tt>initconfig </tt>
73
+ Initialize the config file using current global options
74
+
75
+ Initializes a configuration file where you can set default options for command line flags, both globally and on a per-command basis. These defaults override the built-in defaults and allow you to omit commonly-used command line flags when invoking this program
76
+ ===== Options
77
+ ===== --[no-]force
78
+ force overwrite of existing config file
79
+
80
+
81
+
82
+ ==== Command: <tt>invitation </tt>
83
+ Create/list MyAsk Invitations
84
+
85
+
86
+ ===== Commands
87
+ ====== Command: <tt>list </tt>
88
+ List MyAsk invitations.
89
+
90
+
91
+ ====== Command: <tt>send </tt>
92
+ Send MyAsk invitation to a new user
93
+
94
+
95
+ [Default Command] list
96
+ ==== Command: <tt>project </tt>
97
+ Create/show/list/delete MyAsk Project
98
+
99
+
100
+ ===== Commands
101
+ ====== Command: <tt>create </tt>
102
+ Create MyAsk Project
103
+
104
+
105
+ ====== Command: <tt>delete </tt>
106
+ Delete MyAsk Project
107
+
108
+
109
+ ====== Command: <tt>edit project</tt>
110
+ Edit MyAsk Project
111
+
112
+
113
+ ====== Command: <tt>set project</tt>
114
+ Set MyAsk Project
115
+
116
+
117
+ ====== Command: <tt>show project</tt>
118
+ Show MyAsk Project Details
119
+
120
+
121
+ ==== Command: <tt>prompt </tt>
122
+ Send a prompt to MyAsk API
123
+
124
+
125
+ ==== Command: <tt>question </tt>
126
+ Show/delete MyAsk Question
127
+
128
+
129
+ ===== Commands
130
+ ====== Command: <tt>delete question_id</tt>
131
+ Delete MyAsk question
132
+
133
+
134
+ ====== Command: <tt>show question_id</tt>
135
+ Show details for MyAsk question
136
+
137
+
138
+ [Default Command] show
@@ -0,0 +1,14 @@
1
+ require_relative "test_helper"
2
+
3
+ class DefaultTest < Minitest::Test
4
+
5
+ def setup
6
+ end
7
+
8
+ def teardown
9
+ end
10
+
11
+ def test_the_truth
12
+ assert true
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ require "minitest/autorun"
2
+
3
+ # Add test libraries you want to use here, e.g. mocha
4
+ # Add helper classes or methods here, too
Binary file
@@ -0,0 +1,14 @@
1
+ require_relative "test_helper"
2
+
3
+ class DefaultTest < Minitest::Test
4
+
5
+ def setup
6
+ end
7
+
8
+ def teardown
9
+ end
10
+
11
+ def test_the_truth
12
+ assert true
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ require "minitest/autorun"
2
+
3
+ # Add test libraries you want to use here, e.g. mocha
4
+ # Add helper classes or methods here, too
Binary file