sxn 0.2.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.
- checksums.yaml +7 -0
- data/.gem_rbs_collection/addressable/2.8/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/addressable/2.8/addressable.rbs +62 -0
- data/.gem_rbs_collection/async/2.12/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/async/2.12/async.rbs +119 -0
- data/.gem_rbs_collection/async/2.12/kernel.rbs +5 -0
- data/.gem_rbs_collection/async/2.12/manifest.yaml +7 -0
- data/.gem_rbs_collection/bcrypt/3.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/bcrypt/3.1/bcrypt.rbs +47 -0
- data/.gem_rbs_collection/bcrypt/3.1/manifest.yaml +2 -0
- data/.gem_rbs_collection/bigdecimal/3.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/bigdecimal/3.1/bigdecimal-math.rbs +119 -0
- data/.gem_rbs_collection/bigdecimal/3.1/bigdecimal.rbs +1630 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/array.rbs +4 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/executor.rbs +26 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/hash.rbs +4 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/map.rbs +65 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/promises.rbs +249 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs +5 -0
- data/.gem_rbs_collection/diff-lcs/1.5/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/diff-lcs/1.5/diff-lcs.rbs +11 -0
- data/.gem_rbs_collection/listen/3.9/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/listen/3.9/listen.rbs +25 -0
- data/.gem_rbs_collection/listen/3.9/listener.rbs +24 -0
- data/.gem_rbs_collection/mini_mime/0.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/mini_mime/0.1/mini_mime.rbs +14 -0
- data/.gem_rbs_collection/parallel/1.20/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/parallel/1.20/parallel.rbs +86 -0
- data/.gem_rbs_collection/rake/13.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rake/13.0/manifest.yaml +2 -0
- data/.gem_rbs_collection/rake/13.0/rake.rbs +39 -0
- data/.gem_rbs_collection/rubocop-ast/1.46/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rubocop-ast/1.46/rubocop-ast.rbs +822 -0
- data/.gem_rbs_collection/sqlite3/2.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/sqlite3/2.0/database.rbs +20 -0
- data/.gem_rbs_collection/sqlite3/2.0/pragmas.rbs +5 -0
- data/.rspec +4 -0
- data/.rubocop.yml +121 -0
- data/.simplecov +51 -0
- data/CHANGELOG.md +49 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +329 -0
- data/LICENSE.txt +21 -0
- data/README.md +225 -0
- data/Rakefile +54 -0
- data/Steepfile +50 -0
- data/bin/sxn +6 -0
- data/lib/sxn/CLI.rb +275 -0
- data/lib/sxn/commands/init.rb +137 -0
- data/lib/sxn/commands/projects.rb +350 -0
- data/lib/sxn/commands/rules.rb +435 -0
- data/lib/sxn/commands/sessions.rb +300 -0
- data/lib/sxn/commands/worktrees.rb +416 -0
- data/lib/sxn/commands.rb +13 -0
- data/lib/sxn/config/config_cache.rb +295 -0
- data/lib/sxn/config/config_discovery.rb +242 -0
- data/lib/sxn/config/config_validator.rb +562 -0
- data/lib/sxn/config.rb +259 -0
- data/lib/sxn/core/config_manager.rb +290 -0
- data/lib/sxn/core/project_manager.rb +307 -0
- data/lib/sxn/core/rules_manager.rb +306 -0
- data/lib/sxn/core/session_manager.rb +336 -0
- data/lib/sxn/core/worktree_manager.rb +281 -0
- data/lib/sxn/core.rb +13 -0
- data/lib/sxn/database/errors.rb +29 -0
- data/lib/sxn/database/session_database.rb +691 -0
- data/lib/sxn/database.rb +24 -0
- data/lib/sxn/errors.rb +76 -0
- data/lib/sxn/rules/base_rule.rb +367 -0
- data/lib/sxn/rules/copy_files_rule.rb +346 -0
- data/lib/sxn/rules/errors.rb +28 -0
- data/lib/sxn/rules/project_detector.rb +871 -0
- data/lib/sxn/rules/rules_engine.rb +485 -0
- data/lib/sxn/rules/setup_commands_rule.rb +307 -0
- data/lib/sxn/rules/template_rule.rb +262 -0
- data/lib/sxn/rules.rb +148 -0
- data/lib/sxn/runtime_validations.rb +96 -0
- data/lib/sxn/security/secure_command_executor.rb +364 -0
- data/lib/sxn/security/secure_file_copier.rb +478 -0
- data/lib/sxn/security/secure_path_validator.rb +258 -0
- data/lib/sxn/security.rb +15 -0
- data/lib/sxn/templates/common/gitignore.liquid +99 -0
- data/lib/sxn/templates/common/session-info.md.liquid +58 -0
- data/lib/sxn/templates/errors.rb +36 -0
- data/lib/sxn/templates/javascript/README.md.liquid +59 -0
- data/lib/sxn/templates/javascript/session-info.md.liquid +206 -0
- data/lib/sxn/templates/rails/CLAUDE.md.liquid +78 -0
- data/lib/sxn/templates/rails/database.yml.liquid +31 -0
- data/lib/sxn/templates/rails/session-info.md.liquid +144 -0
- data/lib/sxn/templates/template_engine.rb +346 -0
- data/lib/sxn/templates/template_processor.rb +279 -0
- data/lib/sxn/templates/template_security.rb +410 -0
- data/lib/sxn/templates/template_variables.rb +713 -0
- data/lib/sxn/templates.rb +28 -0
- data/lib/sxn/ui/output.rb +103 -0
- data/lib/sxn/ui/progress_bar.rb +91 -0
- data/lib/sxn/ui/prompt.rb +116 -0
- data/lib/sxn/ui/table.rb +183 -0
- data/lib/sxn/ui.rb +12 -0
- data/lib/sxn/version.rb +5 -0
- data/lib/sxn.rb +63 -0
- data/rbs_collection.lock.yaml +180 -0
- data/rbs_collection.yaml +39 -0
- data/scripts/test.sh +31 -0
- data/sig/external/liquid.rbs +116 -0
- data/sig/external/thor.rbs +99 -0
- data/sig/external/tty.rbs +71 -0
- data/sig/sxn/cli.rbs +46 -0
- data/sig/sxn/commands/init.rbs +38 -0
- data/sig/sxn/commands/projects.rbs +72 -0
- data/sig/sxn/commands/rules.rbs +95 -0
- data/sig/sxn/commands/sessions.rbs +62 -0
- data/sig/sxn/commands/worktrees.rbs +82 -0
- data/sig/sxn/commands.rbs +6 -0
- data/sig/sxn/config/config_cache.rbs +67 -0
- data/sig/sxn/config/config_discovery.rbs +64 -0
- data/sig/sxn/config/config_validator.rbs +64 -0
- data/sig/sxn/config.rbs +74 -0
- data/sig/sxn/core/config_manager.rbs +67 -0
- data/sig/sxn/core/project_manager.rbs +52 -0
- data/sig/sxn/core/rules_manager.rbs +54 -0
- data/sig/sxn/core/session_manager.rbs +59 -0
- data/sig/sxn/core/worktree_manager.rbs +50 -0
- data/sig/sxn/core.rbs +87 -0
- data/sig/sxn/database/errors.rbs +37 -0
- data/sig/sxn/database/session_database.rbs +151 -0
- data/sig/sxn/database.rbs +83 -0
- data/sig/sxn/errors.rbs +89 -0
- data/sig/sxn/rules/base_rule.rbs +137 -0
- data/sig/sxn/rules/copy_files_rule.rbs +65 -0
- data/sig/sxn/rules/errors.rbs +33 -0
- data/sig/sxn/rules/project_detector.rbs +115 -0
- data/sig/sxn/rules/rules_engine.rbs +118 -0
- data/sig/sxn/rules/setup_commands_rule.rbs +60 -0
- data/sig/sxn/rules/template_rule.rbs +44 -0
- data/sig/sxn/rules.rbs +287 -0
- data/sig/sxn/runtime_validations.rbs +16 -0
- data/sig/sxn/security/secure_command_executor.rbs +63 -0
- data/sig/sxn/security/secure_file_copier.rbs +79 -0
- data/sig/sxn/security/secure_path_validator.rbs +30 -0
- data/sig/sxn/security.rbs +128 -0
- data/sig/sxn/templates/errors.rbs +43 -0
- data/sig/sxn/templates/template_engine.rbs +50 -0
- data/sig/sxn/templates/template_processor.rbs +44 -0
- data/sig/sxn/templates/template_security.rbs +62 -0
- data/sig/sxn/templates/template_variables.rbs +103 -0
- data/sig/sxn/templates.rbs +104 -0
- data/sig/sxn/ui/output.rbs +50 -0
- data/sig/sxn/ui/progress_bar.rbs +39 -0
- data/sig/sxn/ui/prompt.rbs +38 -0
- data/sig/sxn/ui/table.rbs +43 -0
- data/sig/sxn/ui.rbs +63 -0
- data/sig/sxn/version.rbs +5 -0
- data/sig/sxn.rbs +29 -0
- metadata +635 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
# TypeScript RBS for Sxn::Rules::CopyFilesRule
|
2
|
+
|
3
|
+
module Sxn
|
4
|
+
module Rules
|
5
|
+
class CopyFilesRule < BaseRule
|
6
|
+
# Constants
|
7
|
+
VALID_STRATEGIES: Array[String]
|
8
|
+
REQUIRE_ENCRYPTION_PATTERNS: Array[Regexp]
|
9
|
+
|
10
|
+
# Instance variables
|
11
|
+
@file_copier: ::Sxn::Security::SecureFileCopier
|
12
|
+
|
13
|
+
# Initialize the copy files rule
|
14
|
+
def initialize: (untyped arg1, ?untyped arg2, ?untyped arg3, ?untyped arg4, ?dependencies: Array[String]) -> void
|
15
|
+
|
16
|
+
# Validate the rule configuration
|
17
|
+
def validate: () -> bool
|
18
|
+
|
19
|
+
# Apply the file copying operations
|
20
|
+
def apply: () -> bool
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
# Validate rule-specific configuration
|
25
|
+
def validate_rule_specific!: () -> void
|
26
|
+
|
27
|
+
|
28
|
+
# Delegate sensitive file detection to the file copier
|
29
|
+
def sensitive_file?: (String file_path) -> bool
|
30
|
+
|
31
|
+
# Validate individual file configuration
|
32
|
+
def validate_file_config!: (Hash[String, untyped] file_config, Integer index) -> void
|
33
|
+
|
34
|
+
# Check if permissions string is valid
|
35
|
+
def valid_permissions?: (untyped permissions) -> bool
|
36
|
+
|
37
|
+
# Convert permissions to integer format
|
38
|
+
def normalize_permissions: (untyped permissions) -> Integer
|
39
|
+
|
40
|
+
# Calculate destination path based on file config (method for tests)
|
41
|
+
def destination_path: (Hash[String, untyped] file_config) -> String
|
42
|
+
|
43
|
+
# Apply a single file operation
|
44
|
+
def apply_file_operation: (Hash[String, untyped] file_config) -> void
|
45
|
+
|
46
|
+
# Apply a copy operation
|
47
|
+
def apply_copy_operation: (String source, String destination, String source_path, String destination_path, Hash[String, untyped] file_config) -> void
|
48
|
+
|
49
|
+
# Apply a symlink operation
|
50
|
+
def apply_symlink_operation: (String source, String destination, String source_path, String destination_path, Hash[String, untyped] file_config) -> void
|
51
|
+
|
52
|
+
# Build options hash for file copying
|
53
|
+
def build_copy_options: (Hash[String, untyped] file_config) -> Hash[Symbol, untyped]
|
54
|
+
|
55
|
+
# Get copy options from file config (alias for build_copy_options)
|
56
|
+
def copy_options: (Hash[String, untyped] file_config) -> Hash[Symbol, untyped]
|
57
|
+
|
58
|
+
# Check if a file should be encrypted based on patterns and configuration
|
59
|
+
def should_encrypt_file?: (String file_path, Hash[String, untyped] file_config) -> bool
|
60
|
+
|
61
|
+
# Convert absolute path to relative path from project root
|
62
|
+
def relative_path: (String absolute_path) -> String
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# TypeScript RBS for Sxn::Rules errors
|
2
|
+
|
3
|
+
module Sxn
|
4
|
+
module Rules
|
5
|
+
# Base error class for all rule-related errors
|
6
|
+
class RuleError < ::Sxn::Error
|
7
|
+
end
|
8
|
+
|
9
|
+
# Raised when rule validation fails
|
10
|
+
class ValidationError < RuleError
|
11
|
+
end
|
12
|
+
|
13
|
+
# Raised when rule application fails
|
14
|
+
class ApplicationError < RuleError
|
15
|
+
end
|
16
|
+
|
17
|
+
# Raised when rule rollback fails
|
18
|
+
class RollbackError < RuleError
|
19
|
+
end
|
20
|
+
|
21
|
+
# Raised when dependency resolution fails
|
22
|
+
class DependencyError < RuleError
|
23
|
+
end
|
24
|
+
|
25
|
+
# Raised when command execution fails
|
26
|
+
class CommandExecutionError < RuleError
|
27
|
+
end
|
28
|
+
|
29
|
+
# Raised when path validation fails
|
30
|
+
class PathValidationError < RuleError
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# TypeScript RBS for Sxn::Rules::ProjectDetector
|
2
|
+
|
3
|
+
module Sxn
|
4
|
+
module Rules
|
5
|
+
class ProjectDetector
|
6
|
+
# Constants
|
7
|
+
PROJECT_TYPES: Hash[Symbol, Hash[Symbol, untyped]]
|
8
|
+
PACKAGE_MANAGERS: Hash[Symbol, Hash[Symbol, untyped]]
|
9
|
+
|
10
|
+
# Instance variables
|
11
|
+
@project_path: String
|
12
|
+
|
13
|
+
# Attributes
|
14
|
+
attr_reader project_path: String
|
15
|
+
|
16
|
+
# Initialize the project detector
|
17
|
+
def initialize: (String project_path) -> void
|
18
|
+
|
19
|
+
# Detect comprehensive project information
|
20
|
+
def detect_project_info: () -> Hash[Symbol, untyped]
|
21
|
+
|
22
|
+
# Detect project type for a given path (used by ConfigManager)
|
23
|
+
def detect_type: (String path) -> Symbol
|
24
|
+
|
25
|
+
# Legacy method for compatibility with tests
|
26
|
+
# Detect the primary project type
|
27
|
+
def detect_project_type: () -> Symbol
|
28
|
+
|
29
|
+
# Detect the package manager used by the project
|
30
|
+
def detect_package_manager: () -> Symbol
|
31
|
+
|
32
|
+
# Suggest default rules based on detected project characteristics
|
33
|
+
def suggest_default_rules: () -> Hash[String, untyped]
|
34
|
+
|
35
|
+
# Get detailed analysis of the project structure
|
36
|
+
def analyze_project_structure: () -> Hash[Symbol, untyped]
|
37
|
+
|
38
|
+
# Parse dependencies by type for testing
|
39
|
+
def parse_dependencies: (Symbol type) -> Array[String]
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
# Validate that the project path exists and is a directory
|
44
|
+
def validate_project_path!: () -> void
|
45
|
+
|
46
|
+
# Calculate confidence score for a project type
|
47
|
+
def calculate_type_confidence: (Symbol type, Hash[Symbol, untyped] criteria) -> Integer
|
48
|
+
|
49
|
+
# Calculate confidence score for a specific project type (test compatibility)
|
50
|
+
def calculate_confidence_score: (Symbol type) -> Integer
|
51
|
+
|
52
|
+
# Check if a file exists in the project (supports glob patterns)
|
53
|
+
def file_exists_in_project?: (String file_pattern) -> bool
|
54
|
+
|
55
|
+
# Detect primary programming language
|
56
|
+
def detect_primary_language: () -> Symbol
|
57
|
+
|
58
|
+
# Detect all languages present in the project
|
59
|
+
def detect_all_languages: () -> Array[Symbol]
|
60
|
+
|
61
|
+
# Detect web framework
|
62
|
+
def detect_framework: () -> Symbol
|
63
|
+
|
64
|
+
# Check if project has Docker configuration
|
65
|
+
def has_docker?: () -> bool
|
66
|
+
|
67
|
+
# Check if project has test configuration
|
68
|
+
def has_tests?: () -> bool
|
69
|
+
|
70
|
+
# Check if project has CI configuration
|
71
|
+
def has_ci_config?: () -> bool
|
72
|
+
|
73
|
+
# Detect database configuration
|
74
|
+
def detect_database: () -> Symbol
|
75
|
+
|
76
|
+
# Detect sensitive files that should be handled carefully
|
77
|
+
def detect_sensitive_files: () -> Array[String]
|
78
|
+
|
79
|
+
# Suggest copy files rules based on project characteristics
|
80
|
+
def suggest_copy_files_rules: (Hash[Symbol, untyped] project_info) -> Hash[String, untyped]
|
81
|
+
|
82
|
+
# Suggest setup commands based on package manager
|
83
|
+
def suggest_setup_commands_rules: (Hash[Symbol, untyped] project_info) -> Hash[String, untyped]
|
84
|
+
|
85
|
+
# Suggest template rules for documentation
|
86
|
+
def suggest_template_rules: (Hash[Symbol, untyped] project_info) -> Hash[String, untyped]
|
87
|
+
|
88
|
+
# Check if project has typical Node.js characteristics
|
89
|
+
def has_nodejs_characteristics?: () -> bool
|
90
|
+
|
91
|
+
# Helper methods for file content checking
|
92
|
+
def gemfile_contains?: (String gem_name) -> bool
|
93
|
+
def package_json_has_dependency?: (String dep_name) -> bool
|
94
|
+
def requirements_contains?: (String package_name) -> bool
|
95
|
+
def package_json_has_script?: (String script_name) -> bool
|
96
|
+
def package_json_has_main_entry?: () -> bool
|
97
|
+
def file_contains?: (String file_path, String content) -> bool
|
98
|
+
def env_contains?: (String env_var, String content) -> bool
|
99
|
+
|
100
|
+
# Analysis methods for detailed project inspection
|
101
|
+
def analyze_important_files: () -> Array[String]
|
102
|
+
def analyze_directory_structure: () -> Array[String]
|
103
|
+
def analyze_dependencies: () -> Hash[Symbol, untyped]
|
104
|
+
def analyze_configuration_files: () -> Array[String]
|
105
|
+
def analyze_scripts: () -> Hash[Symbol, untyped]
|
106
|
+
def analyze_documentation: () -> Array[String]
|
107
|
+
|
108
|
+
# Dependency parsing helpers
|
109
|
+
def parse_gemfile_lock: () -> Array[String]
|
110
|
+
def parse_gemfile: () -> Array[String]
|
111
|
+
def parse_package_json: () -> Array[String]
|
112
|
+
def parse_requirements_txt: () -> Array[String]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# TypeScript RBS for Sxn::Rules::RulesEngine
|
2
|
+
|
3
|
+
module Sxn
|
4
|
+
module Rules
|
5
|
+
class RulesEngine
|
6
|
+
# Execution result for rule application
|
7
|
+
class ExecutionResult
|
8
|
+
@applied_rules: Array[BaseRule]
|
9
|
+
@failed_rules: Array[BaseRule]
|
10
|
+
@skipped_rules: Array[Hash[Symbol, untyped]]
|
11
|
+
@total_duration: Float
|
12
|
+
@errors: Array[Hash[Symbol, untyped]]
|
13
|
+
@start_time: Time?
|
14
|
+
@end_time: Time?
|
15
|
+
|
16
|
+
attr_reader applied_rules: Array[BaseRule]
|
17
|
+
attr_reader failed_rules: Array[BaseRule]
|
18
|
+
attr_reader total_duration: Float
|
19
|
+
attr_reader errors: Array[Hash[Symbol, untyped]]
|
20
|
+
|
21
|
+
def skipped_rules: () -> Array[BaseRule]
|
22
|
+
|
23
|
+
def initialize: () -> void
|
24
|
+
def start!: () -> void
|
25
|
+
def finish!: () -> void
|
26
|
+
def add_applied_rule: (BaseRule rule) -> void
|
27
|
+
def add_failed_rule: (BaseRule rule, StandardError error) -> void
|
28
|
+
def add_skipped_rule: (BaseRule rule, String reason) -> void
|
29
|
+
def add_engine_error: (StandardError error) -> void
|
30
|
+
def success?: () -> bool
|
31
|
+
def total_rules: () -> Integer
|
32
|
+
def to_h: () -> Hash[Symbol, untyped]
|
33
|
+
end
|
34
|
+
|
35
|
+
# Constants
|
36
|
+
RULE_TYPES: Hash[String, untyped]
|
37
|
+
|
38
|
+
# Instance variables
|
39
|
+
@project_path: String
|
40
|
+
@session_path: String
|
41
|
+
@logger: untyped
|
42
|
+
@applied_rules: Array[BaseRule]
|
43
|
+
|
44
|
+
# Attributes
|
45
|
+
attr_reader project_path: String
|
46
|
+
attr_reader session_path: String
|
47
|
+
attr_reader logger: untyped
|
48
|
+
|
49
|
+
# Initialize the rules engine
|
50
|
+
def initialize: (String project_path, String session_path, ?logger: untyped) -> void
|
51
|
+
|
52
|
+
# Apply a set of rules with dependency resolution and parallel execution
|
53
|
+
def apply_rules: (Hash[String, untyped] rules_config, ?Hash[Symbol, untyped] options) -> ExecutionResult
|
54
|
+
|
55
|
+
# Rollback all applied rules in reverse order
|
56
|
+
def rollback_rules: () -> bool
|
57
|
+
|
58
|
+
# Validate rules configuration without executing
|
59
|
+
def validate_rules_config: (Hash[String, untyped] rules_config) -> Array[BaseRule]
|
60
|
+
|
61
|
+
# Strict validation that raises errors on any validation failure
|
62
|
+
def validate_rules_strict: (Array[BaseRule] rules) -> void
|
63
|
+
|
64
|
+
# Get available rule types
|
65
|
+
def available_rule_types: () -> Array[String]
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
# Default execution options
|
70
|
+
def default_options: () -> Hash[Symbol, untyped]
|
71
|
+
|
72
|
+
# Validate that paths exist and are accessible
|
73
|
+
def validate_paths!: () -> void
|
74
|
+
|
75
|
+
# Load rules from configuration
|
76
|
+
def load_rules: (Hash[String, untyped] rules_config) -> Array[BaseRule]
|
77
|
+
|
78
|
+
# Load a single rule from specification
|
79
|
+
def load_single_rule: (String rule_name, Hash[String, untyped] rule_spec) -> BaseRule
|
80
|
+
|
81
|
+
# Create a rule instance
|
82
|
+
def create_rule: (String rule_name, String rule_type, Hash[String, untyped] config, Array[String] dependencies, String session_path, String project_path) -> BaseRule
|
83
|
+
|
84
|
+
# Get rule class for a given type
|
85
|
+
def get_rule_class: (String rule_type) -> untyped
|
86
|
+
|
87
|
+
# Validate all rules
|
88
|
+
def validate_rules: (Array[BaseRule] rules) -> Array[BaseRule]
|
89
|
+
|
90
|
+
# Validate that all dependencies exist
|
91
|
+
def validate_dependencies: (Array[BaseRule] rules) -> void
|
92
|
+
|
93
|
+
# Check for circular dependencies
|
94
|
+
def check_circular_dependencies: (Array[BaseRule] rules) -> void
|
95
|
+
|
96
|
+
# Detect circular dependencies using DFS
|
97
|
+
def detect_circular_dependencies: (Array[BaseRule] rules) -> void
|
98
|
+
|
99
|
+
# DFS helper for circular dependency detection
|
100
|
+
def has_circular_dependency?: (BaseRule rule, Hash[String, BaseRule] rule_map, Set[String] visited, Set[String] rec_stack) -> bool
|
101
|
+
|
102
|
+
# Resolve execution order based on dependencies (topological sort)
|
103
|
+
def resolve_execution_order: (Array[BaseRule] rules) -> Array[Array[BaseRule]]
|
104
|
+
|
105
|
+
# Execute a phase of rules (potentially in parallel)
|
106
|
+
def execute_phase: (Array[BaseRule] phase_rules, Integer phase_index, ExecutionResult result, Hash[Symbol, untyped] options) -> void
|
107
|
+
|
108
|
+
# Execute rules in a phase sequentially
|
109
|
+
def execute_phase_sequential: (Array[BaseRule] phase_rules, ExecutionResult result, Hash[Symbol, untyped] options) -> void
|
110
|
+
|
111
|
+
# Execute rules in a phase in parallel
|
112
|
+
def execute_phase_parallel: (Array[BaseRule] phase_rules, ExecutionResult result, Hash[Symbol, untyped] options) -> void
|
113
|
+
|
114
|
+
# Execute a single rule
|
115
|
+
def execute_single_rule: (BaseRule rule, ExecutionResult result, Hash[Symbol, untyped] options, ?Mutex? mutex) -> void
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# TypeScript RBS for Sxn::Rules::SetupCommandsRule
|
2
|
+
|
3
|
+
module Sxn
|
4
|
+
module Rules
|
5
|
+
class SetupCommandsRule < BaseRule
|
6
|
+
# Constants
|
7
|
+
CONDITION_TYPES: Hash[String, Symbol]
|
8
|
+
DEFAULT_TIMEOUT: Integer
|
9
|
+
MAX_TIMEOUT: Integer
|
10
|
+
|
11
|
+
# Instance variables
|
12
|
+
@command_executor: ::Sxn::Security::SecureCommandExecutor
|
13
|
+
@executed_commands: Array[Hash[Symbol, untyped]]
|
14
|
+
|
15
|
+
# Initialize the setup commands rule
|
16
|
+
def initialize: (untyped arg1, ?untyped arg2, ?untyped arg3, ?untyped arg4, ?dependencies: Array[String]) -> void
|
17
|
+
|
18
|
+
# Validate the rule configuration
|
19
|
+
def validate: () -> bool
|
20
|
+
|
21
|
+
# Apply the command execution operations
|
22
|
+
def apply: (?Hash[untyped, untyped] context) -> bool
|
23
|
+
|
24
|
+
# Get summary of executed commands
|
25
|
+
def execution_summary: () -> Array[Hash[Symbol, untyped]]
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# Validate rule-specific configuration
|
30
|
+
def validate_rule_specific!: () -> void
|
31
|
+
|
32
|
+
# Validate individual command configuration
|
33
|
+
def validate_command_config!: (Hash[String, untyped] command_config, Integer index) -> void
|
34
|
+
|
35
|
+
# Check if condition format is valid
|
36
|
+
def valid_condition?: (untyped condition) -> bool
|
37
|
+
|
38
|
+
# Apply a single command operation
|
39
|
+
def apply_command: (Hash[String, untyped] command_config, Integer index, bool continue_on_failure) -> void
|
40
|
+
|
41
|
+
# Execute a command with the security layer
|
42
|
+
def execute_command_safely: (Hash[String, untyped] command_config) -> untyped
|
43
|
+
|
44
|
+
# Determine the working directory for command execution
|
45
|
+
def determine_working_directory: (Hash[String, untyped] command_config) -> String
|
46
|
+
|
47
|
+
# Check if command should be executed based on its condition
|
48
|
+
def should_execute_command?: (Hash[String, untyped] command_config) -> bool
|
49
|
+
|
50
|
+
# Condition evaluation methods
|
51
|
+
def file_exists?: (String path) -> bool
|
52
|
+
def file_missing?: (String path) -> bool
|
53
|
+
def directory_exists?: (String path) -> bool
|
54
|
+
def directory_missing?: (String path) -> bool
|
55
|
+
def command_available?: (String command_name) -> bool
|
56
|
+
def env_var_set?: (String var_name) -> bool
|
57
|
+
def always_true: (?untyped arg) -> bool
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# TypeScript RBS for Sxn::Rules::TemplateRule
|
2
|
+
|
3
|
+
module Sxn
|
4
|
+
module Rules
|
5
|
+
class TemplateRule < BaseRule
|
6
|
+
# Constants
|
7
|
+
SUPPORTED_ENGINES: Array[String]
|
8
|
+
|
9
|
+
# Instance variables
|
10
|
+
@template_processor: ::Sxn::Templates::TemplateProcessor
|
11
|
+
@template_variables: ::Sxn::Templates::TemplateVariables
|
12
|
+
|
13
|
+
# Initialize the template rule
|
14
|
+
def initialize: (untyped arg1, ?untyped arg2, ?untyped arg3, ?untyped arg4, ?dependencies: Array[String]) -> void
|
15
|
+
|
16
|
+
# Validate the rule configuration
|
17
|
+
def validate: () -> bool
|
18
|
+
|
19
|
+
# Apply the template processing operations
|
20
|
+
def apply: () -> bool
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
# Validate rule-specific configuration
|
25
|
+
def validate_rule_specific!: () -> void
|
26
|
+
|
27
|
+
|
28
|
+
# Validate individual template configuration
|
29
|
+
def validate_template_config!: (Hash[String, untyped] template_config, Integer index) -> void
|
30
|
+
|
31
|
+
# Apply a single template operation
|
32
|
+
def apply_template: (Hash[String, untyped] template_config, Integer index) -> void
|
33
|
+
|
34
|
+
# Build variables hash for template processing
|
35
|
+
def build_template_variables: (Hash[String, untyped] template_config) -> Hash[Symbol, untyped]
|
36
|
+
|
37
|
+
# Deep merge two hashes, with the second hash taking precedence
|
38
|
+
def deep_merge: (Hash[untyped, untyped] hash1, Hash[untyped, untyped] hash2) -> Hash[untyped, untyped]
|
39
|
+
|
40
|
+
# Extract variable names used in a template
|
41
|
+
def extract_used_variables: (String template_content) -> Array[String]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|