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.
Files changed (156) hide show
  1. checksums.yaml +7 -0
  2. data/.gem_rbs_collection/addressable/2.8/.rbs_meta.yaml +9 -0
  3. data/.gem_rbs_collection/addressable/2.8/addressable.rbs +62 -0
  4. data/.gem_rbs_collection/async/2.12/.rbs_meta.yaml +9 -0
  5. data/.gem_rbs_collection/async/2.12/async.rbs +119 -0
  6. data/.gem_rbs_collection/async/2.12/kernel.rbs +5 -0
  7. data/.gem_rbs_collection/async/2.12/manifest.yaml +7 -0
  8. data/.gem_rbs_collection/bcrypt/3.1/.rbs_meta.yaml +9 -0
  9. data/.gem_rbs_collection/bcrypt/3.1/bcrypt.rbs +47 -0
  10. data/.gem_rbs_collection/bcrypt/3.1/manifest.yaml +2 -0
  11. data/.gem_rbs_collection/bigdecimal/3.1/.rbs_meta.yaml +9 -0
  12. data/.gem_rbs_collection/bigdecimal/3.1/bigdecimal-math.rbs +119 -0
  13. data/.gem_rbs_collection/bigdecimal/3.1/bigdecimal.rbs +1630 -0
  14. data/.gem_rbs_collection/concurrent-ruby/1.1/.rbs_meta.yaml +9 -0
  15. data/.gem_rbs_collection/concurrent-ruby/1.1/array.rbs +4 -0
  16. data/.gem_rbs_collection/concurrent-ruby/1.1/executor.rbs +26 -0
  17. data/.gem_rbs_collection/concurrent-ruby/1.1/hash.rbs +4 -0
  18. data/.gem_rbs_collection/concurrent-ruby/1.1/map.rbs +65 -0
  19. data/.gem_rbs_collection/concurrent-ruby/1.1/promises.rbs +249 -0
  20. data/.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs +5 -0
  21. data/.gem_rbs_collection/diff-lcs/1.5/.rbs_meta.yaml +9 -0
  22. data/.gem_rbs_collection/diff-lcs/1.5/diff-lcs.rbs +11 -0
  23. data/.gem_rbs_collection/listen/3.9/.rbs_meta.yaml +9 -0
  24. data/.gem_rbs_collection/listen/3.9/listen.rbs +25 -0
  25. data/.gem_rbs_collection/listen/3.9/listener.rbs +24 -0
  26. data/.gem_rbs_collection/mini_mime/0.1/.rbs_meta.yaml +9 -0
  27. data/.gem_rbs_collection/mini_mime/0.1/mini_mime.rbs +14 -0
  28. data/.gem_rbs_collection/parallel/1.20/.rbs_meta.yaml +9 -0
  29. data/.gem_rbs_collection/parallel/1.20/parallel.rbs +86 -0
  30. data/.gem_rbs_collection/rake/13.0/.rbs_meta.yaml +9 -0
  31. data/.gem_rbs_collection/rake/13.0/manifest.yaml +2 -0
  32. data/.gem_rbs_collection/rake/13.0/rake.rbs +39 -0
  33. data/.gem_rbs_collection/rubocop-ast/1.46/.rbs_meta.yaml +9 -0
  34. data/.gem_rbs_collection/rubocop-ast/1.46/rubocop-ast.rbs +822 -0
  35. data/.gem_rbs_collection/sqlite3/2.0/.rbs_meta.yaml +9 -0
  36. data/.gem_rbs_collection/sqlite3/2.0/database.rbs +20 -0
  37. data/.gem_rbs_collection/sqlite3/2.0/pragmas.rbs +5 -0
  38. data/.rspec +4 -0
  39. data/.rubocop.yml +121 -0
  40. data/.simplecov +51 -0
  41. data/CHANGELOG.md +49 -0
  42. data/Gemfile +24 -0
  43. data/Gemfile.lock +329 -0
  44. data/LICENSE.txt +21 -0
  45. data/README.md +225 -0
  46. data/Rakefile +54 -0
  47. data/Steepfile +50 -0
  48. data/bin/sxn +6 -0
  49. data/lib/sxn/CLI.rb +275 -0
  50. data/lib/sxn/commands/init.rb +137 -0
  51. data/lib/sxn/commands/projects.rb +350 -0
  52. data/lib/sxn/commands/rules.rb +435 -0
  53. data/lib/sxn/commands/sessions.rb +300 -0
  54. data/lib/sxn/commands/worktrees.rb +416 -0
  55. data/lib/sxn/commands.rb +13 -0
  56. data/lib/sxn/config/config_cache.rb +295 -0
  57. data/lib/sxn/config/config_discovery.rb +242 -0
  58. data/lib/sxn/config/config_validator.rb +562 -0
  59. data/lib/sxn/config.rb +259 -0
  60. data/lib/sxn/core/config_manager.rb +290 -0
  61. data/lib/sxn/core/project_manager.rb +307 -0
  62. data/lib/sxn/core/rules_manager.rb +306 -0
  63. data/lib/sxn/core/session_manager.rb +336 -0
  64. data/lib/sxn/core/worktree_manager.rb +281 -0
  65. data/lib/sxn/core.rb +13 -0
  66. data/lib/sxn/database/errors.rb +29 -0
  67. data/lib/sxn/database/session_database.rb +691 -0
  68. data/lib/sxn/database.rb +24 -0
  69. data/lib/sxn/errors.rb +76 -0
  70. data/lib/sxn/rules/base_rule.rb +367 -0
  71. data/lib/sxn/rules/copy_files_rule.rb +346 -0
  72. data/lib/sxn/rules/errors.rb +28 -0
  73. data/lib/sxn/rules/project_detector.rb +871 -0
  74. data/lib/sxn/rules/rules_engine.rb +485 -0
  75. data/lib/sxn/rules/setup_commands_rule.rb +307 -0
  76. data/lib/sxn/rules/template_rule.rb +262 -0
  77. data/lib/sxn/rules.rb +148 -0
  78. data/lib/sxn/runtime_validations.rb +96 -0
  79. data/lib/sxn/security/secure_command_executor.rb +364 -0
  80. data/lib/sxn/security/secure_file_copier.rb +478 -0
  81. data/lib/sxn/security/secure_path_validator.rb +258 -0
  82. data/lib/sxn/security.rb +15 -0
  83. data/lib/sxn/templates/common/gitignore.liquid +99 -0
  84. data/lib/sxn/templates/common/session-info.md.liquid +58 -0
  85. data/lib/sxn/templates/errors.rb +36 -0
  86. data/lib/sxn/templates/javascript/README.md.liquid +59 -0
  87. data/lib/sxn/templates/javascript/session-info.md.liquid +206 -0
  88. data/lib/sxn/templates/rails/CLAUDE.md.liquid +78 -0
  89. data/lib/sxn/templates/rails/database.yml.liquid +31 -0
  90. data/lib/sxn/templates/rails/session-info.md.liquid +144 -0
  91. data/lib/sxn/templates/template_engine.rb +346 -0
  92. data/lib/sxn/templates/template_processor.rb +279 -0
  93. data/lib/sxn/templates/template_security.rb +410 -0
  94. data/lib/sxn/templates/template_variables.rb +713 -0
  95. data/lib/sxn/templates.rb +28 -0
  96. data/lib/sxn/ui/output.rb +103 -0
  97. data/lib/sxn/ui/progress_bar.rb +91 -0
  98. data/lib/sxn/ui/prompt.rb +116 -0
  99. data/lib/sxn/ui/table.rb +183 -0
  100. data/lib/sxn/ui.rb +12 -0
  101. data/lib/sxn/version.rb +5 -0
  102. data/lib/sxn.rb +63 -0
  103. data/rbs_collection.lock.yaml +180 -0
  104. data/rbs_collection.yaml +39 -0
  105. data/scripts/test.sh +31 -0
  106. data/sig/external/liquid.rbs +116 -0
  107. data/sig/external/thor.rbs +99 -0
  108. data/sig/external/tty.rbs +71 -0
  109. data/sig/sxn/cli.rbs +46 -0
  110. data/sig/sxn/commands/init.rbs +38 -0
  111. data/sig/sxn/commands/projects.rbs +72 -0
  112. data/sig/sxn/commands/rules.rbs +95 -0
  113. data/sig/sxn/commands/sessions.rbs +62 -0
  114. data/sig/sxn/commands/worktrees.rbs +82 -0
  115. data/sig/sxn/commands.rbs +6 -0
  116. data/sig/sxn/config/config_cache.rbs +67 -0
  117. data/sig/sxn/config/config_discovery.rbs +64 -0
  118. data/sig/sxn/config/config_validator.rbs +64 -0
  119. data/sig/sxn/config.rbs +74 -0
  120. data/sig/sxn/core/config_manager.rbs +67 -0
  121. data/sig/sxn/core/project_manager.rbs +52 -0
  122. data/sig/sxn/core/rules_manager.rbs +54 -0
  123. data/sig/sxn/core/session_manager.rbs +59 -0
  124. data/sig/sxn/core/worktree_manager.rbs +50 -0
  125. data/sig/sxn/core.rbs +87 -0
  126. data/sig/sxn/database/errors.rbs +37 -0
  127. data/sig/sxn/database/session_database.rbs +151 -0
  128. data/sig/sxn/database.rbs +83 -0
  129. data/sig/sxn/errors.rbs +89 -0
  130. data/sig/sxn/rules/base_rule.rbs +137 -0
  131. data/sig/sxn/rules/copy_files_rule.rbs +65 -0
  132. data/sig/sxn/rules/errors.rbs +33 -0
  133. data/sig/sxn/rules/project_detector.rbs +115 -0
  134. data/sig/sxn/rules/rules_engine.rbs +118 -0
  135. data/sig/sxn/rules/setup_commands_rule.rbs +60 -0
  136. data/sig/sxn/rules/template_rule.rbs +44 -0
  137. data/sig/sxn/rules.rbs +287 -0
  138. data/sig/sxn/runtime_validations.rbs +16 -0
  139. data/sig/sxn/security/secure_command_executor.rbs +63 -0
  140. data/sig/sxn/security/secure_file_copier.rbs +79 -0
  141. data/sig/sxn/security/secure_path_validator.rbs +30 -0
  142. data/sig/sxn/security.rbs +128 -0
  143. data/sig/sxn/templates/errors.rbs +43 -0
  144. data/sig/sxn/templates/template_engine.rbs +50 -0
  145. data/sig/sxn/templates/template_processor.rbs +44 -0
  146. data/sig/sxn/templates/template_security.rbs +62 -0
  147. data/sig/sxn/templates/template_variables.rbs +103 -0
  148. data/sig/sxn/templates.rbs +104 -0
  149. data/sig/sxn/ui/output.rbs +50 -0
  150. data/sig/sxn/ui/progress_bar.rbs +39 -0
  151. data/sig/sxn/ui/prompt.rbs +38 -0
  152. data/sig/sxn/ui/table.rbs +43 -0
  153. data/sig/sxn/ui.rbs +63 -0
  154. data/sig/sxn/version.rbs +5 -0
  155. data/sig/sxn.rbs +29 -0
  156. metadata +635 -0
@@ -0,0 +1,180 @@
1
+ ---
2
+ path: ".gem_rbs_collection"
3
+ gems:
4
+ - name: addressable
5
+ version: '2.8'
6
+ source:
7
+ type: git
8
+ name: ruby/gem_rbs_collection
9
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
10
+ remote: https://github.com/ruby/gem_rbs_collection.git
11
+ repo_dir: gems
12
+ - name: async
13
+ version: '2.12'
14
+ source:
15
+ type: git
16
+ name: ruby/gem_rbs_collection
17
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
18
+ remote: https://github.com/ruby/gem_rbs_collection.git
19
+ repo_dir: gems
20
+ - name: base64
21
+ version: 0.3.0
22
+ source:
23
+ type: rubygems
24
+ - name: bcrypt
25
+ version: '3.1'
26
+ source:
27
+ type: git
28
+ name: ruby/gem_rbs_collection
29
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
30
+ remote: https://github.com/ruby/gem_rbs_collection.git
31
+ repo_dir: gems
32
+ - name: benchmark
33
+ version: '0'
34
+ source:
35
+ type: stdlib
36
+ - name: bigdecimal
37
+ version: '3.1'
38
+ source:
39
+ type: git
40
+ name: ruby/gem_rbs_collection
41
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
42
+ remote: https://github.com/ruby/gem_rbs_collection.git
43
+ repo_dir: gems
44
+ - name: concurrent-ruby
45
+ version: '1.1'
46
+ source:
47
+ type: git
48
+ name: ruby/gem_rbs_collection
49
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
50
+ remote: https://github.com/ruby/gem_rbs_collection.git
51
+ repo_dir: gems
52
+ - name: diff-lcs
53
+ version: '1.5'
54
+ source:
55
+ type: git
56
+ name: ruby/gem_rbs_collection
57
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
58
+ remote: https://github.com/ruby/gem_rbs_collection.git
59
+ repo_dir: gems
60
+ - name: digest
61
+ version: '0'
62
+ source:
63
+ type: stdlib
64
+ - name: ffi
65
+ version: 1.17.2
66
+ source:
67
+ type: rubygems
68
+ - name: fileutils
69
+ version: '0'
70
+ source:
71
+ type: stdlib
72
+ - name: io-console
73
+ version: '0'
74
+ source:
75
+ type: stdlib
76
+ - name: json
77
+ version: '0'
78
+ source:
79
+ type: stdlib
80
+ - name: listen
81
+ version: '3.9'
82
+ source:
83
+ type: git
84
+ name: ruby/gem_rbs_collection
85
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
86
+ remote: https://github.com/ruby/gem_rbs_collection.git
87
+ repo_dir: gems
88
+ - name: logger
89
+ version: '0'
90
+ source:
91
+ type: stdlib
92
+ - name: mini_mime
93
+ version: '0.1'
94
+ source:
95
+ type: git
96
+ name: ruby/gem_rbs_collection
97
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
98
+ remote: https://github.com/ruby/gem_rbs_collection.git
99
+ repo_dir: gems
100
+ - name: monitor
101
+ version: '0'
102
+ source:
103
+ type: stdlib
104
+ - name: openssl
105
+ version: '0'
106
+ source:
107
+ type: stdlib
108
+ - name: optparse
109
+ version: '0'
110
+ source:
111
+ type: stdlib
112
+ - name: parallel
113
+ version: '1.20'
114
+ source:
115
+ type: git
116
+ name: ruby/gem_rbs_collection
117
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
118
+ remote: https://github.com/ruby/gem_rbs_collection.git
119
+ repo_dir: gems
120
+ - name: pathname
121
+ version: '0'
122
+ source:
123
+ type: stdlib
124
+ - name: pp
125
+ version: '0'
126
+ source:
127
+ type: stdlib
128
+ - name: prettyprint
129
+ version: '0'
130
+ source:
131
+ type: stdlib
132
+ - name: prism
133
+ version: 1.4.0
134
+ source:
135
+ type: rubygems
136
+ - name: rake
137
+ version: '13.0'
138
+ source:
139
+ type: git
140
+ name: ruby/gem_rbs_collection
141
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
142
+ remote: https://github.com/ruby/gem_rbs_collection.git
143
+ repo_dir: gems
144
+ - name: rbs
145
+ version: 3.9.4
146
+ source:
147
+ type: rubygems
148
+ - name: rbs_rails
149
+ version: 0.12.1
150
+ source:
151
+ type: rubygems
152
+ - name: rdoc
153
+ version: '0'
154
+ source:
155
+ type: stdlib
156
+ - name: rubocop-ast
157
+ version: '1.46'
158
+ source:
159
+ type: git
160
+ name: ruby/gem_rbs_collection
161
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
162
+ remote: https://github.com/ruby/gem_rbs_collection.git
163
+ repo_dir: gems
164
+ - name: socket
165
+ version: '0'
166
+ source:
167
+ type: stdlib
168
+ - name: sqlite3
169
+ version: '2.0'
170
+ source:
171
+ type: git
172
+ name: ruby/gem_rbs_collection
173
+ revision: 6a12ebdb5a08a2eecc32622efce9c644684c1c52
174
+ remote: https://github.com/ruby/gem_rbs_collection.git
175
+ repo_dir: gems
176
+ - name: tsort
177
+ version: '0'
178
+ source:
179
+ type: stdlib
180
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,39 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # Search path for RBS files
10
+ path: .gem_rbs_collection
11
+
12
+ # Gem dependencies
13
+ gems:
14
+ - name: thor
15
+ ignore: true # Has RBS but causes conflicts
16
+ - name: tty-prompt
17
+ ignore: true # No RBS available
18
+ - name: tty-table
19
+ ignore: true # No RBS available
20
+ - name: tty-progressbar
21
+ ignore: true # No RBS available
22
+ - name: pastel
23
+ ignore: true # No RBS available
24
+ - name: liquid
25
+ ignore: true # No RBS available
26
+ - name: rspec
27
+ ignore: true # Only for tests
28
+ - name: faker
29
+ ignore: true # Only for tests
30
+ - name: climate_control
31
+ ignore: true # Only for tests
32
+ - name: webmock
33
+ ignore: true # Only for tests
34
+ - name: steep
35
+ ignore: true # Type checker itself
36
+ - name: rubocop
37
+ ignore: true # Linter
38
+ - name: parser
39
+ ignore: true # Causes conflicts
data/scripts/test.sh ADDED
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ # Test runner script for sxn gem
4
+ # Ensures tests run with the correct Ruby version
5
+
6
+ set -e
7
+
8
+ # Check if mise is available
9
+ if ! command -v mise &> /dev/null; then
10
+ echo "Error: mise is not installed or not in PATH"
11
+ exit 1
12
+ fi
13
+
14
+ # Use mise to run tests with the correct Ruby version
15
+ echo "Running tests with Ruby $(mise exec ruby@3.4.5 -- ruby -v)"
16
+ echo "----------------------------------------"
17
+
18
+ if [ $# -eq 0 ]; then
19
+ # Run all config and config_manager related tests by default
20
+ mise exec ruby@3.4.5 -- bundle exec rspec \
21
+ spec/unit/config_spec.rb \
22
+ spec/unit/config/config_cache_spec.rb \
23
+ spec/unit/config/config_discovery_spec.rb \
24
+ spec/unit/config/config_manager_spec.rb \
25
+ spec/unit/config/config_validator_spec.rb \
26
+ spec/unit/core/config_manager_spec.rb \
27
+ --format progress
28
+ else
29
+ # Run specific test files provided as arguments
30
+ mise exec ruby@3.4.5 -- bundle exec rspec "$@"
31
+ fi
@@ -0,0 +1,116 @@
1
+ # Basic Liquid template engine type definitions for Sxn
2
+
3
+ module Liquid
4
+ class Template
5
+ def self.parse: (String source, ?Hash[Symbol, untyped]? options) -> Template
6
+ def self.error_mode: () -> Symbol
7
+ def self.error_mode=: (Symbol mode) -> void
8
+ def self.file_system: () -> untyped
9
+ def self.file_system=: (untyped file_system) -> void
10
+
11
+ def render: (?Hash[String, untyped]? assigns, ?Hash[Symbol, untyped]? options) -> String
12
+ def render!: (?Hash[String, untyped]? assigns, ?Hash[Symbol, untyped]? options) -> String
13
+ def errors: () -> Array[StandardError]
14
+ def warnings: () -> Array[untyped]
15
+ def root: () -> untyped
16
+ def assigns: () -> Hash[String, untyped]
17
+ def instance_assigns: () -> Hash[String, untyped]
18
+ def registers: () -> Hash[Symbol, untyped]
19
+ end
20
+
21
+ class Error < ::StandardError
22
+ end
23
+
24
+ class SyntaxError < Error
25
+ end
26
+
27
+ class ArgumentError < Error
28
+ end
29
+
30
+ class FileSystemError < Error
31
+ end
32
+
33
+ class StandardError < Error
34
+ end
35
+
36
+ class StackLevelError < Error
37
+ end
38
+
39
+ class MemoryError < Error
40
+ end
41
+
42
+ class ZeroDivisionError < Error
43
+ end
44
+
45
+ class FloatDomainError < Error
46
+ end
47
+
48
+ class UndefinedVariable < Error
49
+ end
50
+
51
+ class UndefinedDropMethod < Error
52
+ end
53
+
54
+ class UndefinedFilter < Error
55
+ end
56
+
57
+ class MethodOverrideError < Error
58
+ end
59
+
60
+ class DisabledError < Error
61
+ end
62
+
63
+ class Context
64
+ def initialize: (?Hash[Symbol, untyped] environments, ?Hash[Symbol, untyped] outer_scope, ?Hash[Symbol, untyped] registers, ?bool rethrow_errors) -> void
65
+ def registers: () -> Hash[Symbol, untyped]
66
+ def environments: () -> Array[Hash[String, untyped]]
67
+ def scopes: () -> Array[Hash[String, untyped]]
68
+ end
69
+
70
+ module StandardFilters
71
+ def size: (untyped input) -> Integer
72
+ def downcase: (String input) -> String
73
+ def upcase: (String input) -> String
74
+ def capitalize: (String input) -> String
75
+ def strip: (String input) -> String
76
+ def rstrip: (String input) -> String
77
+ def lstrip: (String input) -> String
78
+ def strip_html: (String input) -> String
79
+ def strip_newlines: (String input) -> String
80
+ def newline_to_br: (String input) -> String
81
+ def replace: (String input, String string, String replacement) -> String
82
+ def replace_first: (String input, String string, String replacement) -> String
83
+ def remove: (String input, String string) -> String
84
+ def remove_first: (String input, String string) -> String
85
+ def truncate: (String input, Integer length, ?String ellipsis) -> String
86
+ def truncatewords: (String input, Integer words, ?String ellipsis) -> String
87
+ def prepend: (String input, String string) -> String
88
+ def append: (String input, String string) -> String
89
+ def slice: (String input, Integer offset, ?Integer? length) -> String
90
+ def split: (String input, String pattern) -> Array[String]
91
+ def join: (Array[untyped] input, String glue) -> String
92
+ def sort: (Array[untyped] input) -> Array[untyped]
93
+ def sort_natural: (Array[untyped] input) -> Array[untyped]
94
+ def uniq: (Array[untyped] input) -> Array[untyped]
95
+ def reverse: (Array[untyped] input) -> Array[untyped]
96
+ def map: (Array[untyped] input, String property) -> Array[untyped]
97
+ def compact: (Array[untyped] input) -> Array[untyped]
98
+ def first: (Array[untyped] array) -> untyped
99
+ def last: (Array[untyped] array) -> untyped
100
+ def abs: (Numeric input) -> Numeric
101
+ def plus: (Numeric input, Numeric operand) -> Numeric
102
+ def minus: (Numeric input, Numeric operand) -> Numeric
103
+ def times: (Numeric input, Numeric operand) -> Numeric
104
+ def divided_by: (Numeric input, Numeric operand) -> Numeric
105
+ def modulo: (Numeric input, Numeric operand) -> Numeric
106
+ def round: (Numeric input, ?Integer precision) -> Numeric
107
+ def ceil: (Numeric input) -> Integer
108
+ def floor: (Numeric input) -> Integer
109
+ def default: (untyped input, untyped default_value) -> untyped
110
+ def date: (untyped input, String format) -> String
111
+ def escape: (String input) -> String
112
+ def escape_once: (String input) -> String
113
+ def url_encode: (String input) -> String
114
+ def url_decode: (String input) -> String
115
+ end
116
+ end
@@ -0,0 +1,99 @@
1
+ # Basic Thor type definitions for Sxn
2
+ class Thor
3
+ def self.exit_on_failure?: () -> bool
4
+
5
+ # Class-level DSL methods
6
+ def self.desc: (String usage, String description) -> void
7
+ def self.method_option: (Symbol name, ?Hash[Symbol, untyped] options) -> void
8
+ def self.method_options: (Hash[Symbol, untyped] options) -> void
9
+ def self.default_task: (Symbol task_name) -> void
10
+ def self.map: (Hash[String, Symbol] mappings) -> void
11
+ def self.class_option: (Symbol name, ?Hash[Symbol, untyped] options) -> void
12
+
13
+ # Instance methods
14
+ def options: () -> Hash[Symbol, untyped]
15
+ def say: (String message, ?Symbol? color) -> void
16
+ def say_status: (String status, String message, ?Symbol? color) -> void
17
+ def ask: (String question, ?Hash[Symbol, untyped] options) -> String
18
+ def yes?: (String question, ?Hash[Symbol, untyped] options) -> bool
19
+ def no?: (String question, ?Hash[Symbol, untyped] options) -> bool
20
+ def error: (String message) -> void
21
+ def set_color: (String message, Symbol color) -> String
22
+ def inside: (String dir) { () -> void } -> void
23
+ def run: (String command, ?Hash[Symbol, untyped] options) -> void
24
+ def invoke: (Symbol task, ?Array[untyped] args) -> void
25
+
26
+ # Error handling
27
+ class Error < ::StandardError
28
+ end
29
+
30
+ class MalformattedArgumentError < Error
31
+ end
32
+
33
+ class UnknownArgumentError < Error
34
+ end
35
+
36
+ class RequiredArgumentMissingError < Error
37
+ end
38
+
39
+ class InvocationError < Error
40
+ end
41
+ end
42
+
43
+ # Thor::Group for command groups
44
+ class Thor::Group < Thor
45
+ end
46
+
47
+ # Thor::Actions module for file manipulation and command execution
48
+ module Thor::Actions
49
+ def create_file: (String destination, ?String? content, ?Hash[Symbol, untyped] config) -> void
50
+ def add_file: (String destination, ?String? source, ?Hash[Symbol, untyped] config) -> void
51
+ def create_link: (String destination, String source, ?Hash[Symbol, untyped] config) -> void
52
+ def directory: (String source, String destination, ?Hash[Symbol, untyped] config) -> void
53
+ def empty_directory: (String destination, ?Hash[Symbol, untyped] config) -> void
54
+ def inside: (String dir, ?Hash[Symbol, untyped] config) { () -> void } -> void
55
+ def run: (String command, ?Hash[Symbol, untyped] config) -> void
56
+ def run_ruby_script: (String command, ?Hash[Symbol, untyped] config) -> void
57
+ def thor: (String command, ?Hash[Symbol, untyped] config) -> void
58
+ def chmod: (String path, Integer mode, ?Hash[Symbol, untyped] config) -> void
59
+ def gsub_file: (String path, Regexp | String flag, String | Proc replacement, ?Hash[Symbol, untyped] config) -> void
60
+ def append_to_file: (String path, String | Proc content, ?Hash[Symbol, untyped] config) -> void
61
+ def prepend_to_file: (String path, String | Proc content, ?Hash[Symbol, untyped] config) -> void
62
+ def inject_into_class: (String path, String klass, String | Proc content, ?Hash[Symbol, untyped] config) -> void
63
+ def inject_into_module: (String path, String module_name, String | Proc content, ?Hash[Symbol, untyped] config) -> void
64
+ def inject_into_file: (String destination, String | Proc content, ?Hash[Symbol, untyped] config) -> void
65
+ def insert_into_file: (String destination, String | Proc content, ?Hash[Symbol, untyped] config) -> void
66
+ def comment_lines: (String path, Regexp | String flag, ?Hash[Symbol, untyped] config) -> void
67
+ def uncomment_lines: (String path, Regexp | String flag, ?Hash[Symbol, untyped] config) -> void
68
+ def remove_file: (String path, ?Hash[Symbol, untyped] config) -> void
69
+ def copy_file: (String source, String destination, ?Hash[Symbol, untyped] config) -> void
70
+ def link_file: (String source, String destination, ?Hash[Symbol, untyped] config) -> void
71
+ def get: (String source, String destination, ?Hash[Symbol, untyped] config) -> void
72
+ def template: (String source, String destination, ?Hash[Symbol, untyped] config) -> void
73
+ def relative_to_original_destination_root: (String path, ?bool remove_dot) -> String
74
+ def source_paths: () -> Array[String]
75
+ def destination_root: () -> String
76
+ def destination_root=: (String path) -> void
77
+ def in_root: () { () -> void } -> void
78
+ def apply: (String path, ?Hash[Symbol, untyped] config) -> void
79
+ def action: (Class action_class, *untyped args) -> void
80
+ end
81
+
82
+ # Thor::Shell module for output
83
+ module Thor::Shell
84
+ class Basic
85
+ def say: (String message, ?Symbol? color) -> void
86
+ def say_status: (String status, String message, ?Symbol? color) -> void
87
+ def ask: (String question, ?Hash[Symbol, untyped] options) -> String
88
+ def yes?: (String question) -> bool
89
+ def no?: (String question) -> bool
90
+ def error: (String message) -> void
91
+ def set_color: (String message, Symbol color) -> String
92
+ end
93
+
94
+ class Color < Basic
95
+ end
96
+
97
+ class HTML < Basic
98
+ end
99
+ end
@@ -0,0 +1,71 @@
1
+ # Basic TTY gem type definitions for Sxn
2
+
3
+ module TTY
4
+ class Prompt
5
+ def initialize: (?Hash[Symbol, untyped] options) -> void
6
+ def ask: (String question, ?Hash[Symbol, untyped] options) -> String
7
+ def yes?: (String question) -> bool
8
+ def no?: (String question) -> bool
9
+ def select: (String question, Array[untyped] choices, ?Hash[Symbol, untyped] options) -> untyped
10
+ def multi_select: (String question, Array[untyped] choices, ?Hash[Symbol, untyped] options) -> Array[untyped]
11
+ def mask: (String question) -> String
12
+ def keypress: (String message, ?Hash[Symbol, untyped] options) -> String
13
+ def error: (String message) -> void
14
+ def warn: (String message) -> void
15
+ def ok: (String message) -> void
16
+ def say: (String message) -> void
17
+ end
18
+
19
+ class Table
20
+ def initialize: (Array[Array[untyped]] rows, ?Array[String]? header) -> void
21
+ def render: (?Hash[Symbol, untyped] options) -> String
22
+ def <<: (Array[untyped] row) -> self
23
+ def to_s: () -> String
24
+ end
25
+
26
+ class ProgressBar
27
+ def initialize: (String format, ?Hash[Symbol, untyped] options) -> void
28
+ def advance: (?Integer step) -> void
29
+ def update: (Hash[Symbol, untyped] tokens) -> void
30
+ def finish: () -> void
31
+ def reset: () -> void
32
+ def complete?: () -> bool
33
+ def current: () -> Integer
34
+ def total: () -> Integer
35
+ def total=: (Integer value) -> void
36
+ def ratio: () -> Float
37
+ def percent: () -> Integer
38
+ def log: (String message) -> void
39
+ def stop: () -> void
40
+ end
41
+ end
42
+
43
+ # Pastel for terminal colors
44
+ class Pastel
45
+ def initialize: (?Hash[Symbol, untyped] options) -> void
46
+ def red: (String text) -> String
47
+ def green: (String text) -> String
48
+ def yellow: (String text) -> String
49
+ def blue: (String text) -> String
50
+ def magenta: (String text) -> String
51
+ def cyan: (String text) -> String
52
+ def white: (String text) -> String
53
+ def black: (String text) -> String
54
+ def bright_red: (String text) -> String
55
+ def bright_green: (String text) -> String
56
+ def bright_yellow: (String text) -> String
57
+ def bright_blue: (String text) -> String
58
+ def bright_magenta: (String text) -> String
59
+ def bright_cyan: (String text) -> String
60
+ def bright_white: (String text) -> String
61
+ def bright_black: (String text) -> String
62
+ def bold: (String text) -> String
63
+ def dim: (String text) -> String
64
+ def italic: (String text) -> String
65
+ def underline: (String text) -> String
66
+ def inverse: (String text) -> String
67
+ def hide: (String text) -> String
68
+ def strike: (String text) -> String
69
+ def strip: (String text) -> String
70
+ def decorate: (String text, *Symbol colors) -> String
71
+ end
data/sig/sxn/cli.rbs ADDED
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sxn
4
+ # Main CLI class using Thor framework
5
+ class CLI < ::Thor
6
+ @ui: Sxn::UI::Output
7
+
8
+ def self.exit_on_failure?: () -> true
9
+
10
+ def initialize: (?Array[String] args, ?Hash[Symbol, untyped] local_options, ?Hash[Symbol, untyped] config) -> void
11
+
12
+ def version: () -> void
13
+
14
+ def init: (?String? folder) -> void
15
+
16
+ def add: (String session_name) -> void
17
+
18
+ def use: (String session_name) -> void
19
+
20
+ def list: () -> void
21
+
22
+ def current: () -> void
23
+
24
+ def projects: (?String? subcommand, *String args) -> void
25
+
26
+ def sessions: (?String? subcommand, *String args) -> void
27
+
28
+ def worktree: (?String? subcommand, *String args) -> void
29
+
30
+ def rules: (?String? subcommand, *String args) -> void
31
+
32
+ def status: () -> void
33
+
34
+ def config: () -> void
35
+
36
+ private
37
+
38
+ def setup_environment: () -> void
39
+
40
+ def handle_error: (StandardError error) -> void
41
+
42
+ def show_status: () -> void
43
+
44
+ def show_config: () -> void
45
+ end
46
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sxn
4
+ module Commands
5
+ # Initialize sxn in a project folder
6
+ class Init < Thor
7
+ include Thor::Actions
8
+
9
+ @ui: Sxn::UI::Output
10
+ @prompt: Sxn::UI::Prompt
11
+ @config_manager: Sxn::Core::ConfigManager
12
+
13
+ # Initialize the command with Thor arguments
14
+ def initialize: (?Array[String] args, ?Hash[Symbol, untyped] local_options, ?Hash[Symbol, untyped] config) -> void
15
+
16
+ # Initialize sxn in a project folder
17
+ # @param folder Optional folder path for sessions
18
+ def init: (?String? folder) -> void
19
+
20
+ private
21
+
22
+ # Determine the sessions folder based on options and user input
23
+ # @param folder Optional folder path provided
24
+ # @return Sessions folder path
25
+ def determine_sessions_folder: (String? folder) -> String
26
+
27
+ # Auto-detect projects in the current directory
28
+ def auto_detect_projects: () -> void
29
+
30
+ # Register detected projects with the project manager
31
+ # @param projects Array of detected project configurations
32
+ def register_detected_projects: (Array[Hash[Symbol, untyped]] projects) -> void
33
+
34
+ # Display next steps after initialization
35
+ def display_next_steps: () -> void
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sxn
4
+ module Commands
5
+ # Manage project configurations
6
+ class Projects < Thor
7
+ include Thor::Actions
8
+
9
+ @ui: Sxn::UI::Output
10
+ @prompt: Sxn::UI::Prompt
11
+ @table: Sxn::UI::Table
12
+ @config_manager: Sxn::Core::ConfigManager
13
+ @project_manager: Sxn::Core::ProjectManager
14
+
15
+ # Initialize the command with Thor arguments
16
+ def initialize: (?Array[String] args, ?Hash[Symbol, untyped] local_options, ?Hash[Symbol, untyped] config) -> void
17
+
18
+ # Add a project
19
+ # @param name Project name
20
+ # @param path Project path
21
+ def add: (?String? name, ?String? path) -> void
22
+
23
+ # Remove a project
24
+ # @param name Project name
25
+ def remove: (?String? name) -> void
26
+
27
+ # List all projects
28
+ def list: () -> void
29
+
30
+ # Scan for projects and optionally register them
31
+ # @param base_path Base path to scan from
32
+ def scan: (?String? base_path) -> void
33
+
34
+ # Validate a project configuration
35
+ # @param name Project name
36
+ def validate: (?String? name) -> void
37
+
38
+ # Show detailed project information
39
+ # @param name Project name
40
+ def info: (?String? name) -> void
41
+
42
+ private
43
+
44
+ # Ensure the project is initialized, exit if not
45
+ def ensure_initialized!: () -> void
46
+
47
+ # Display project information
48
+ # @param project Project configuration hash
49
+ # @param detailed Whether to show detailed information
50
+ def display_project_info: (Hash[Symbol, untyped] project, ?detailed: bool) -> void
51
+
52
+ # Display available commands for a project
53
+ # @param project_name Project name
54
+ def display_project_commands: (String project_name) -> void
55
+
56
+ # Display detected projects
57
+ # @param projects Array of detected projects
58
+ def display_detected_projects: (Array[Hash[Symbol, untyped]] projects) -> void
59
+
60
+ # Register projects from detection
61
+ # @param projects Array of projects to register
62
+ def register_projects: (Array[Hash[Symbol, untyped]] projects) -> void
63
+
64
+ # List projects with validation
65
+ # @param projects Array of projects
66
+ def list_with_validation: (Array[Hash[Symbol, untyped]] projects) -> void
67
+
68
+ # Suggest adding a project
69
+ def suggest_add_project: () -> void
70
+ end
71
+ end
72
+ end