Class: Ace::Support::Items::Atoms::FolderCompletionDetector
- Inherits:
-
Object
- Object
- Ace::Support::Items::Atoms::FolderCompletionDetector
- Defined in:
- lib/ace/support/items/atoms/folder_completion_detector.rb
Overview
Detects whether all spec files in a folder have terminal status. Used by orchestrator auto-archive: when all subtasks are done/skipped/blocked, the parent can be auto-archived.
Constant Summary collapse
- TERMINAL_STATUSES =
%w[done skipped blocked].freeze
Class Method Summary collapse
-
.all_terminal?(dir_path, spec_pattern: "*.s.md", terminal_statuses: TERMINAL_STATUSES, recursive: false) ⇒ Boolean
Check if all spec files in a directory have terminal status.
Class Method Details
.all_terminal?(dir_path, spec_pattern: "*.s.md", terminal_statuses: TERMINAL_STATUSES, recursive: false) ⇒ Boolean
Check if all spec files in a directory have terminal status.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ace/support/items/atoms/folder_completion_detector.rb', line 22 def self.all_terminal?(dir_path, spec_pattern: "*.s.md", terminal_statuses: TERMINAL_STATUSES, recursive: false) patterns = [File.join(dir_path, spec_pattern)] patterns << File.join(dir_path, "*", spec_pattern) if recursive files = patterns.flat_map { |p| Dir.glob(p) } return false if files.empty? files.all? do |file| content = File.read(file) frontmatter, = FrontmatterParser.parse(content) status = frontmatter["status"].to_s.downcase terminal_statuses.include?(status) end end |