meta_workflows 0.8.24 → 0.9.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.
- checksums.yaml +4 -4
- data/README.md +33 -2
- data/app/assets/stylesheets/meta_workflows/application.css +239 -153
- data/app/controllers/meta_workflows/base_debug_controller.rb +46 -0
- data/app/controllers/meta_workflows/debug_controller.rb +1 -42
- data/app/controllers/meta_workflows/workflow_imports_controller.rb +85 -0
- data/app/services/meta_workflows/application_service.rb +38 -0
- data/app/services/meta_workflows/workflow_import_service.rb +116 -0
- data/app/views/layouts/meta_workflows/application.html.erb +60 -6
- data/app/views/meta_workflows/_lexi_chat_alpha_tray.html.erb +2 -2
- data/app/views/meta_workflows/_lexi_chat_right_tray.html.erb +3 -3
- data/app/views/meta_workflows/_response_form_lexi.html.erb +2 -2
- data/app/views/meta_workflows/_response_lexi.html.erb +3 -3
- data/app/views/meta_workflows/debug/workflows.html.erb +23 -10
- data/app/views/meta_workflows/workflow_imports/new.html.erb +171 -0
- data/config/routes.rb +7 -0
- data/lib/meta_workflows/version.rb +2 -2
- data/lib/services/meta_workflows/asset_installer_service.rb +95 -0
- data/lib/tasks/asset_installer_tasks.rake +12 -0
- data/lib/tasks/meta_workflows_tasks.rake +23 -136
- metadata +9 -3
- data/app/views/layouts/meta_workflows/debug.html.erb +0 -50
@@ -2,152 +2,39 @@
|
|
2
2
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'fileutils'
|
5
|
-
require_relative '../meta_workflows/asset_installer'
|
6
5
|
|
7
6
|
namespace :meta_workflows do
|
8
7
|
desc 'Import workflows from YAML files in the workflows directory'
|
9
8
|
task import: :environment do
|
10
|
-
MetaWorkflows::
|
11
|
-
|
9
|
+
import_service = MetaWorkflows::WorkflowImportService.new
|
10
|
+
result = import_service.import_from_directory
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
if result.success?
|
13
|
+
puts result.data[:message]
|
14
|
+
display_import_results(import_service) if import_service.import_results.any?
|
15
|
+
else
|
16
|
+
puts "Import failed: #{result.error}"
|
17
|
+
exit 1
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@workflows_path = Rails.root.join('workflows')
|
26
|
-
end
|
27
|
-
|
28
|
-
def import_workflows
|
29
|
-
puts "Importing workflows from #{@workflows_path}..."
|
30
|
-
|
31
|
-
Dir.glob(File.join(@workflows_path, '*.yml')).each do |file_path|
|
32
|
-
import_single_workflow(file_path)
|
33
|
-
end
|
34
|
-
|
35
|
-
puts 'Workflow import completed!'
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def import_single_workflow(file_path)
|
41
|
-
file_name = File.basename(file_path, '.yml')
|
42
|
-
workflow_name = file_name.underscore
|
43
|
-
|
44
|
-
begin
|
45
|
-
yaml_content = YAML.load_file(file_path)
|
46
|
-
save_workflow(workflow_name, yaml_content)
|
47
|
-
rescue StandardError => e
|
48
|
-
puts "Error processing #{file_path}: #{e.message}"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def save_workflow(workflow_name, yaml_content)
|
53
|
-
workflow = MetaWorkflows::Workflow.find_or_initialize_by(name: workflow_name)
|
54
|
-
workflow.recipe = yaml_content
|
55
|
-
|
56
|
-
if workflow.save
|
57
|
-
puts "Successfully imported workflow: #{workflow.name}"
|
58
|
-
else
|
59
|
-
puts "Failed to import workflow #{workflow_name}: #{workflow.errors.full_messages.join(', ')}"
|
60
|
-
end
|
61
|
-
end
|
22
|
+
def display_import_results(import_service)
|
23
|
+
puts "\nDetailed results:"
|
24
|
+
import_service.import_results.each do |import_result|
|
25
|
+
display_single_import_result(import_result)
|
62
26
|
end
|
27
|
+
end
|
63
28
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
# Pre-installation validation
|
72
|
-
unless installer.valid_environment?
|
73
|
-
puts 'Installation aborted due to validation errors.'
|
74
|
-
return
|
75
|
-
end
|
76
|
-
|
77
|
-
begin
|
78
|
-
process_asset_installation(installer)
|
79
|
-
rescue MetaWorkflows::AssetInstaller::InstallationError => e
|
80
|
-
handle_installation_error(e)
|
81
|
-
rescue StandardError => e
|
82
|
-
handle_unexpected_error(e)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
private
|
87
|
-
|
88
|
-
def process_asset_installation(installer)
|
89
|
-
assets = discover_and_validate_assets(installer)
|
90
|
-
return if assets.empty?
|
91
|
-
|
92
|
-
result = installer.install_assets(assets)
|
93
|
-
display_installation_results(installer, assets, result)
|
94
|
-
end
|
95
|
-
|
96
|
-
def discover_and_validate_assets(installer)
|
97
|
-
assets = installer.discover_assets
|
98
|
-
|
99
|
-
if assets.empty?
|
100
|
-
puts 'No assets found to install.'
|
101
|
-
return []
|
102
|
-
end
|
103
|
-
|
104
|
-
puts "Found #{assets.count} asset(s) to install:"
|
105
|
-
assets.each { |asset| puts " - #{asset[:relative_path]}" }
|
106
|
-
puts
|
107
|
-
|
108
|
-
assets
|
109
|
-
end
|
110
|
-
|
111
|
-
def display_installation_results(installer, assets, result)
|
112
|
-
puts
|
113
|
-
if result[:success]
|
114
|
-
display_successful_installation(installer, assets, result)
|
115
|
-
else
|
116
|
-
display_partial_installation(installer, assets, result)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def display_successful_installation(installer, assets, result)
|
121
|
-
puts 'Installation completed successfully!'
|
122
|
-
puts "#{result[:copied]} file(s) copied, #{result[:skipped]} file(s) skipped."
|
123
|
-
|
124
|
-
return unless result[:copied].positive?
|
125
|
-
|
126
|
-
puts
|
127
|
-
installer.display_integration_instructions(assets, result)
|
128
|
-
end
|
129
|
-
|
130
|
-
def display_partial_installation(installer, assets, result)
|
131
|
-
puts 'Installation completed with errors.'
|
132
|
-
puts "#{result[:copied]} file(s) copied, #{result[:skipped]} file(s) skipped, " \
|
133
|
-
"#{result[:failed]} file(s) failed."
|
134
|
-
puts 'Some files may have been partially installed. Please review the output above.'
|
135
|
-
|
136
|
-
return unless result[:copied].positive?
|
137
|
-
|
138
|
-
puts
|
139
|
-
puts 'For successfully copied files, see integration instructions below:'
|
140
|
-
installer.display_integration_instructions(assets, result)
|
141
|
-
end
|
142
|
-
|
143
|
-
def handle_installation_error(error)
|
144
|
-
puts "Installation failed: #{error.message}"
|
145
|
-
puts 'Installation aborted.'
|
146
|
-
end
|
147
|
-
|
148
|
-
def handle_unexpected_error(error)
|
149
|
-
puts "Unexpected error during asset installation: #{error.message}"
|
150
|
-
puts 'Installation aborted.'
|
151
|
-
end
|
29
|
+
def display_single_import_result(import_result)
|
30
|
+
if import_result[:success]
|
31
|
+
action = determine_import_action(import_result[:action])
|
32
|
+
puts "✓ Successfully #{action} workflow: #{import_result[:workflow_name]}"
|
33
|
+
else
|
34
|
+
puts "✗ Failed to import workflow #{import_result[:workflow_name]}: #{import_result[:error]}"
|
152
35
|
end
|
153
36
|
end
|
37
|
+
|
38
|
+
def determine_import_action(action)
|
39
|
+
action == 'created' ? 'imported' : 'updated'
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta_workflows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Medovyy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -127,9 +127,11 @@ files:
|
|
127
127
|
- app/assets/stylesheets/meta_workflows/application.css
|
128
128
|
- app/controllers/concerns/tray_configurable.rb
|
129
129
|
- app/controllers/meta_workflows/application_controller.rb
|
130
|
+
- app/controllers/meta_workflows/base_debug_controller.rb
|
130
131
|
- app/controllers/meta_workflows/debug_controller.rb
|
131
132
|
- app/controllers/meta_workflows/humans_controller.rb
|
132
133
|
- app/controllers/meta_workflows/meta_controller.rb
|
134
|
+
- app/controllers/meta_workflows/workflow_imports_controller.rb
|
133
135
|
- app/helpers/meta_workflows/application_helper.rb
|
134
136
|
- app/helpers/meta_workflows/debug_helper.rb
|
135
137
|
- app/helpers/meta_workflows/execution_helper.rb
|
@@ -150,10 +152,11 @@ files:
|
|
150
152
|
- app/models/meta_workflows/workflow.rb
|
151
153
|
- app/models/meta_workflows/workflow_execution.rb
|
152
154
|
- app/models/meta_workflows/workflow_step.rb
|
155
|
+
- app/services/meta_workflows/application_service.rb
|
153
156
|
- app/services/meta_workflows/execution_filter_service.rb
|
157
|
+
- app/services/meta_workflows/workflow_import_service.rb
|
154
158
|
- app/sidekiq/meta_workflows/tools/meta_workflow_tool.rb
|
155
159
|
- app/views/layouts/meta_workflows/application.html.erb
|
156
|
-
- app/views/layouts/meta_workflows/debug.html.erb
|
157
160
|
- app/views/meta_workflows/_lexi_chat_alpha_tray.html.erb
|
158
161
|
- app/views/meta_workflows/_lexi_chat_right_tray.html.erb
|
159
162
|
- app/views/meta_workflows/_loader.html.erb
|
@@ -164,6 +167,7 @@ files:
|
|
164
167
|
- app/views/meta_workflows/debug/show_execution.html.erb
|
165
168
|
- app/views/meta_workflows/debug/show_workflow.html.erb
|
166
169
|
- app/views/meta_workflows/debug/workflows.html.erb
|
170
|
+
- app/views/meta_workflows/workflow_imports/new.html.erb
|
167
171
|
- config/routes.rb
|
168
172
|
- db/migrate/20250530220618_create_meta_workflows_workflows.rb
|
169
173
|
- db/migrate/20250530220634_create_meta_workflows_workflow_executions.rb
|
@@ -182,8 +186,10 @@ files:
|
|
182
186
|
- lib/meta_workflows/export_execution_service.rb
|
183
187
|
- lib/meta_workflows/version.rb
|
184
188
|
- lib/services/meta_workflows/application_service.rb
|
189
|
+
- lib/services/meta_workflows/asset_installer_service.rb
|
185
190
|
- lib/services/meta_workflows/meta_workflow_service.rb
|
186
191
|
- lib/services/meta_workflows/updaters/meta_service.rb
|
192
|
+
- lib/tasks/asset_installer_tasks.rake
|
187
193
|
- lib/tasks/git_hooks.rake
|
188
194
|
- lib/tasks/meta_workflows_tasks.rake
|
189
195
|
homepage: https://github.com/strongmind/meta-workflows
|
@@ -1,50 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>MetaWorkflows Debug Tool</title>
|
5
|
-
<%= csrf_meta_tags %>
|
6
|
-
<%= csp_meta_tag %>
|
7
|
-
|
8
|
-
<%= yield :head %>
|
9
|
-
|
10
|
-
<%= stylesheet_link_tag "meta_workflows/application", media: "all" %>
|
11
|
-
|
12
|
-
<!-- Tailwind CSS -->
|
13
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
14
|
-
<script src="https://cdn.tailwindcss.com"></script>
|
15
|
-
|
16
|
-
<!-- JSON Viewer Web Component -->
|
17
|
-
<script src="https://unpkg.com/@alenaksu/json-viewer@2.1.0/dist/json-viewer.bundle.js"></script>
|
18
|
-
</head>
|
19
|
-
<body class="bg-gray-50 min-h-screen">
|
20
|
-
<!-- Header Navigation -->
|
21
|
-
<nav class="bg-white shadow-sm border-b border-gray-200">
|
22
|
-
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
23
|
-
<div class="flex justify-between items-center h-16">
|
24
|
-
<!-- Logo/Title -->
|
25
|
-
<div class="flex items-center">
|
26
|
-
<h1 class="text-xl font-semibold text-gray-900">
|
27
|
-
MetaWorkflows Debug Tool
|
28
|
-
</h1>
|
29
|
-
</div>
|
30
|
-
|
31
|
-
<!-- Navigation Links -->
|
32
|
-
<div class="flex space-x-8">
|
33
|
-
<%= link_to "Workflows", workflows_path,
|
34
|
-
class: "#{current_page?(workflows_path) || params[:action] == 'workflows' || params[:action] == 'show_workflow' ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700'} px-3 py-2 text-sm font-medium" %>
|
35
|
-
<%= link_to "Executions", executions_path,
|
36
|
-
class: "#{current_page?(executions_path) || params[:action] == 'executions' || params[:action] == 'show_execution' ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700'} px-3 py-2 text-sm font-medium" %>
|
37
|
-
</div>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
</nav>
|
41
|
-
|
42
|
-
<!-- Main Content -->
|
43
|
-
<main class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
|
44
|
-
<%= yield %>
|
45
|
-
</main>
|
46
|
-
|
47
|
-
<!-- Optional JavaScript -->
|
48
|
-
<%= yield :javascripts %>
|
49
|
-
</body>
|
50
|
-
</html>
|