Skip to content

Commit 01b8f76

Browse files
Merge pull request #1 from bootstrapguru/fixes_composer_installable_bug
Bug Fix: Package is not installable globally via composer
2 parents 791d81b + 80dd569 commit 01b8f76

File tree

16 files changed

+3903
-3899
lines changed

16 files changed

+3903
-3899
lines changed

app/Attributes/Description.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
namespace App\Attributes;
44

5-
65
use Attribute;
76

87
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PARAMETER)]
98
final class Description
109
{
1110
public function __construct(
1211
public string $value,
13-
) {
14-
}
12+
) {}
1513
}

app/Commands/DroidCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
use App\Utils\OnBoardingSteps;
77
use Exception;
88
use Illuminate\Console\Command;
9-
use function Termwind\{ask, render};
109

10+
use function Termwind\ask;
11+
use function Termwind\render;
1112

1213
class DroidCommand extends Command
1314
{
@@ -21,7 +22,7 @@ class DroidCommand extends Command
2122
public function handle(): int
2223
{
2324
$onBoardingSteps = new OnBoardingSteps();
24-
if (!$onBoardingSteps->isCompleted()) {
25+
if (! $onBoardingSteps->isCompleted()) {
2526
return self::FAILURE;
2627
}
2728

@@ -39,7 +40,7 @@ public function handle(): int
3940
break;
4041
}
4142

42-
$chatAssistant->getAnswer($threadRun, $message);
43+
$chatAssistant->getAnswer($threadRun, $message);
4344
}
4445

4546
return self::SUCCESS;

app/Providers/AppServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace App\Providers;
44

55
use App\Utils\OnBoardingSteps;
6-
use Dotenv\Dotenv;
76
use Exception;
87
use Illuminate\Support\ServiceProvider;
98

109
class AppServiceProvider extends ServiceProvider
1110
{
1211
/**
1312
* Bootstrap any application services.
13+
*
1414
* @throws Exception
1515
*/
1616
public function boot(): void

app/Services/ChatAssistant.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
use OpenAI;
1212
use OpenAI\Client;
1313
use OpenAI\Responses\Threads\Runs\ThreadRunResponse;
14+
1415
use function Laravel\Prompts\spin;
1516
use function Termwind\render;
1617

1718
class ChatAssistant
1819
{
19-
2020
use HasTools;
2121

2222
private Client $client;
@@ -40,7 +40,7 @@ public function __construct()
4040

4141
public function createAssistant()
4242
{
43-
return $this->client->assistants()->create([
43+
return $this->client->assistants()->create([
4444
'name' => 'Droid Dev',
4545
'model' => config('droid.model'),
4646
'description' => 'Droid Dev is a code generation assistant for Web applications',
@@ -98,7 +98,7 @@ public function loadAnswer(ThreadRunResponse $threadRun): string
9898
'Fetching response...'
9999
);
100100

101-
if ($threadRun->status === 'requires_action' && $threadRun->requiredAction->type === 'submit_tool_outputs') {
101+
if ($threadRun->status === 'requires_action' && $threadRun->requiredAction->type === 'submit_tool_outputs') {
102102
$requiredAction = $threadRun->requiredAction->toArray();
103103
$toolCalls = $requiredAction['submit_tool_outputs']['tool_calls'];
104104

@@ -128,7 +128,7 @@ public function loadAnswer(ThreadRunResponse $threadRun): string
128128

129129
public function retrieveThread($threadRun)
130130
{
131-
while(in_array($threadRun->status, ['queued', 'in_progress'])) {
131+
while (in_array($threadRun->status, ['queued', 'in_progress'])) {
132132
$threadRun = $this->client->threads()->runs()->retrieve(
133133
threadId: $threadRun->threadId,
134134
runId: $threadRun->id,
@@ -137,5 +137,4 @@ public function retrieveThread($threadRun)
137137

138138
return $threadRun;
139139
}
140-
141140
}

app/Services/FileTreeLister.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public function __construct()
1616
$this->loadGitignore();
1717
}
1818

19-
public function listTree(string $path = null): string
19+
public function listTree(?string $path = null): string
2020
{
2121
$path = $path ?? Storage::path(DIRECTORY_SEPARATOR);
2222

23-
if (!File::exists($path) || !File::isDirectory($path)) {
23+
if (! File::exists($path) || ! File::isDirectory($path)) {
2424
return "The path {$path} does not exist or is not a directory.";
2525
}
2626

@@ -62,7 +62,7 @@ protected function listDirectoryContents(string $path, string $prefix = ''): str
6262
$items = File::directories($path);
6363
$files = File::files($path);
6464
} catch (DirectoryNotFoundException $e) {
65-
throw new DirectoryNotFoundException("Error: " . $e->getMessage());
65+
throw new DirectoryNotFoundException('Error: '.$e->getMessage());
6666
}
6767

6868
foreach ($items as $index => $directory) {
@@ -73,8 +73,8 @@ protected function listDirectoryContents(string $path, string $prefix = ''): str
7373
continue;
7474
}
7575

76-
$output .= $prefix . '├── ' . $directoryName . PHP_EOL;
77-
$output .= $this->listDirectoryContents($directory, $prefix . ($index === array_key_last($items) && empty($files) ? ' ' : ''));
76+
$output .= $prefix.'├── '.$directoryName.PHP_EOL;
77+
$output .= $this->listDirectoryContents($directory, $prefix.($index === array_key_last($items) && empty($files) ? ' ' : ''));
7878
}
7979

8080
foreach ($files as $file) {
@@ -85,7 +85,7 @@ protected function listDirectoryContents(string $path, string $prefix = ''): str
8585
continue;
8686
}
8787

88-
$output .= $prefix . '├── ' . $fileName . PHP_EOL;
88+
$output .= $prefix.'├── '.$fileName.PHP_EOL;
8989
}
9090

9191
return $output;

app/Tools/ListFiles.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
use App\Attributes\Description;
66
use App\Services\FileTreeLister;
77
use Symfony\Component\Finder\Exception\DirectoryNotFoundException;
8+
89
use function Termwind\render;
910

1011
#[Description('List all files and sub directories in the specified path. Use this when you need to list all files and directories.')]
11-
final class ListFiles {
12-
12+
final class ListFiles
13+
{
1314
public function handle(
1415
#[Description('directory name to list files from. Default is the base path.')]
1516
string $path,
@@ -19,7 +20,7 @@ public function handle(
1920
$fileTreeLister = new FileTreeLister();
2021
$list = $fileTreeLister->listTree($path);
2122
render(view('tool', [
22-
'name' => 'ListFiles from ' . $path,
23+
'name' => 'ListFiles from '.$path,
2324
'output' => $list,
2425
]));
2526

app/Tools/ReadFile.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
use App\Attributes\Description;
66
use Illuminate\Support\Facades\Storage;
7+
78
use function Termwind\render;
89

910
#[Description('Read content from an existing file at the specified path. Use this when you need to read content from a file.')]
10-
final class ReadFile {
11-
11+
final class ReadFile
12+
{
1213
public function handle(
1314
#[Description('Absolute File path to read content from')]
1415
string $file_path,
@@ -24,6 +25,7 @@ public function handle(
2425
'name' => 'ReadFile',
2526
'output' => $file_path,
2627
]));
28+
2729
return Storage::get($file_path);
2830
}
2931

@@ -35,5 +37,4 @@ public function handle(
3537

3638
return $output;
3739
}
38-
3940
}

app/Tools/UpdateFile.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
use App\Attributes\Description;
66
use Illuminate\Support\Facades\Storage;
7+
78
use function Termwind\render;
89

910
#[Description('Update the content of an existing file at the specified path. Use this when you need to update the existing of a file after write_to_file returns a suggestion to merge the content.')]
10-
final class UpdateFile {
11-
11+
final class UpdateFile
12+
{
1213
public function handle(
1314
#[Description('File path to write content to')]
1415
string $file_path,
@@ -25,10 +26,10 @@ public function handle(
2526
$directory = dirname($file_path);
2627

2728
// Ensure the directory exists
28-
if (!Storage::exists($directory)) {
29+
if (! Storage::exists($directory)) {
2930
render(view('tool', [
3031
'name' => 'WriteToFile',
31-
'output' => 'Directory not found. Creating '. $directory,
32+
'output' => 'Directory not found. Creating '.$directory,
3233
]));
3334
Storage::makeDirectory($directory, 0755, true);
3435
}
@@ -43,5 +44,4 @@ public function handle(
4344

4445
return $output;
4546
}
46-
4747
}

app/Tools/WriteToFile.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
use App\Attributes\Description;
66
use Illuminate\Support\Facades\Storage;
7+
78
use function Termwind\render;
89

910
#[Description('Write content to an existing file at the specified path. Use this when you need to write content to a file.')]
10-
final class WriteToFile {
11-
11+
final class WriteToFile
12+
{
1213
public function handle(
1314
#[Description('Relative File path to write content to')]
1415
string $file_path,
@@ -30,14 +31,15 @@ public function handle(
3031
'name' => 'WriteToFile',
3132
'output' => 'The file already exists in the path, attempting to merge....',
3233
]));
34+
3335
// Append the new content to the file
34-
return 'The file already exists in the path, Make sure to merge your suggestion with the existing file without any breaking changes. Once, they are merged, call the update_file function. The current contents of the file are '. $fileContent;
36+
return 'The file already exists in the path, Make sure to merge your suggestion with the existing file without any breaking changes. Once, they are merged, call the update_file function. The current contents of the file are '.$fileContent;
3537
}
3638

3739
$directory = dirname($file_path);
3840

3941
// Ensure the directory exists
40-
if (!Storage::exists($directory)) {
42+
if (! Storage::exists($directory)) {
4143
Storage::makeDirectory($directory, 0755, true);
4244
}
4345

@@ -51,5 +53,4 @@ public function handle(
5153

5254
return $output;
5355
}
54-
5556
}

0 commit comments

Comments
 (0)