aidp 0.49.17 → 0.49.19
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/lib/aidp/harness/completion_checker.rb +26 -4
- data/lib/aidp/shell_executor.rb +8 -2
- data/lib/aidp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 229127ce8581e8c5bdb52bcaf5f29ef631478f6f87c48fcc28feb0ba947288f0
|
|
4
|
+
data.tar.gz: badaf5c96b27e6fe122725049b8df3ad96b8cdd3bb8048906b3e3938ef88b12a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 31350c11a98b2946408390b711dcdac751f679ed9a071bf8c9cff0f025bb0f6bfb04a314994a5863bb1f0d7b29180a475bb8ecc353492c86900f9cc89cfc764d
|
|
7
|
+
data.tar.gz: 673575daca822c6a84074d93388c94a59b0c39aeff6c3c9f435a483deca2e6fad4ca4ce3d5626b83d0a9cd49f42f465f59e8afe278629826f3cc33530db28267
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../shell_executor"
|
|
4
|
+
|
|
3
5
|
module Aidp
|
|
4
6
|
module Harness
|
|
5
7
|
# Checks completion criteria for the workflow
|
|
6
8
|
class CompletionChecker
|
|
7
|
-
def initialize(project_dir, workflow_type = :exploration)
|
|
9
|
+
def initialize(project_dir, workflow_type = :exploration, command_executor: Aidp::ShellExecutor.new)
|
|
8
10
|
@project_dir = project_dir
|
|
9
11
|
@workflow_type = workflow_type
|
|
12
|
+
@command_executor = command_executor
|
|
10
13
|
@completion_results = {}
|
|
11
14
|
end
|
|
12
15
|
|
|
@@ -81,10 +84,29 @@ module Aidp
|
|
|
81
84
|
build_commands.any? { |cmd| run_project_command(cmd) }
|
|
82
85
|
end
|
|
83
86
|
|
|
84
|
-
# Run a detected command
|
|
85
|
-
# shell command string from the library-provided project path
|
|
87
|
+
# Run a detected command without letting a shell interpret it.
|
|
86
88
|
def run_project_command(cmd)
|
|
87
|
-
|
|
89
|
+
require "shellwords"
|
|
90
|
+
argv = Shellwords.split(cmd).flat_map { |arg| expand_arg(arg) }
|
|
91
|
+
return false if argv.empty?
|
|
92
|
+
|
|
93
|
+
@command_executor.run_argv(
|
|
94
|
+
*argv,
|
|
95
|
+
chdir: @project_dir,
|
|
96
|
+
out: File::NULL,
|
|
97
|
+
err: File::NULL
|
|
98
|
+
).success?
|
|
99
|
+
rescue ArgumentError, Errno::ENOENT
|
|
100
|
+
false
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Expand shell-style glob tokens (e.g. test/**/*_test.rb) within the
|
|
104
|
+
# project directory, since argument-form execution skips shell globbing.
|
|
105
|
+
def expand_arg(arg)
|
|
106
|
+
return [arg] unless arg.match?(/[*?\[{}]/)
|
|
107
|
+
|
|
108
|
+
matches = Dir.chdir(@project_dir) { Dir.glob(arg) }
|
|
109
|
+
matches.empty? ? [arg] : matches
|
|
88
110
|
end
|
|
89
111
|
|
|
90
112
|
def documentation_complete?
|
data/lib/aidp/shell_executor.rb
CHANGED
|
@@ -61,9 +61,15 @@ module Aidp
|
|
|
61
61
|
#
|
|
62
62
|
# @param command [Array<String>] the command and its arguments
|
|
63
63
|
# @return [Result] captured stdout/stderr with the exit status
|
|
64
|
-
def run_argv(*command)
|
|
64
|
+
def run_argv(*command, **opts)
|
|
65
65
|
require "open3"
|
|
66
|
-
|
|
66
|
+
program, *args = command.map(&:to_s)
|
|
67
|
+
raise ArgumentError, "command must not be blank" if program.nil? || program.empty?
|
|
68
|
+
|
|
69
|
+
# The [program, argv0] form forces direct execution even when a command
|
|
70
|
+
# has no arguments. Passing one string to Open3 can otherwise invoke a
|
|
71
|
+
# shell when that string contains shell metacharacters.
|
|
72
|
+
stdout, stderr, status = Open3.capture3([program, program], *args, **opts)
|
|
67
73
|
Result.new(stdout: stdout, stderr: stderr, exit_status: status.exitstatus)
|
|
68
74
|
end
|
|
69
75
|
|
data/lib/aidp/version.rb
CHANGED