aidp 0.49.18 → 0.49.20
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 +13 -7
- data/lib/aidp/shell_executor.rb +9 -5
- 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: 3bcae0816a7d6d049e039d8670fd6b8e21e7e9228af2d0b996853c38f39b2bd6
|
|
4
|
+
data.tar.gz: f7aeae62f6ce57552d31885a69461ea00c50bf9d4f30056a3f76ea563b174eb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81497e0b2050c4e9d06e45a0251123e792993694b64e5015b6a0f907ab1dc22bd576266c11a2254afed433285570cf459152d357c01ea345e0cc99a7279f7d38
|
|
7
|
+
data.tar.gz: 873e5c878b464542b6a533222db9842bf7303e06d29d868b020588079c6eb957ff51b4b2238b027cf15ce2579588bba8ad8ef4f841f47305eb5cfd71a5a1dfed
|
|
@@ -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,17 +84,20 @@ module Aidp
|
|
|
81
84
|
build_commands.any? { |cmd| run_project_command(cmd) }
|
|
82
85
|
end
|
|
83
86
|
|
|
84
|
-
# Run a detected command
|
|
85
|
-
# tokenized with Shellwords and executed in argument form, so the shell
|
|
86
|
-
# never interprets the library-provided command string. The [cmdname,
|
|
87
|
-
# argv0] pair forces argument form even for a single-token command,
|
|
88
|
-
# which system would otherwise execute via /bin/sh -c.
|
|
87
|
+
# Run a detected command without letting a shell interpret it.
|
|
89
88
|
def run_project_command(cmd)
|
|
90
89
|
require "shellwords"
|
|
91
90
|
argv = Shellwords.split(cmd).flat_map { |arg| expand_arg(arg) }
|
|
92
91
|
return false if argv.empty?
|
|
93
92
|
|
|
94
|
-
|
|
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
|
|
95
101
|
end
|
|
96
102
|
|
|
97
103
|
# Expand shell-style glob tokens (e.g. test/**/*_test.rb) within the
|
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
|
|
|
@@ -81,7 +87,6 @@ module Aidp
|
|
|
81
87
|
# @raise [ArgumentError] when the command line is blank, has
|
|
82
88
|
# unbalanced quotes, or uses shell operators/redirections
|
|
83
89
|
def run_line(command, **opts)
|
|
84
|
-
require "open3"
|
|
85
90
|
require "shellwords"
|
|
86
91
|
argv = Shellwords.split(command.to_s)
|
|
87
92
|
raise ArgumentError, "command must not be blank" if argv.empty?
|
|
@@ -113,8 +118,7 @@ module Aidp
|
|
|
113
118
|
"split into program and arguments"
|
|
114
119
|
end
|
|
115
120
|
|
|
116
|
-
|
|
117
|
-
Result.new(stdout: stdout, stderr: stderr, exit_status: status.exitstatus)
|
|
121
|
+
run_argv(*argv, **opts)
|
|
118
122
|
end
|
|
119
123
|
|
|
120
124
|
# Run a command via system(), optionally suppressing output
|
data/lib/aidp/version.rb
CHANGED