Skip to content

Commit f736f96

Browse files
committed
fix: wpi
1 parent 1467898 commit f736f96

File tree

3 files changed

+60
-65
lines changed

3 files changed

+60
-65
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,39 +32,46 @@ jobs:
3232
composer update --prefer-stable --prefer-dist --no-interaction
3333
vendor/bin/pest --ci
3434
35-
- name: Get version from composer.json
35+
- name: Get next version
3636
id: get_version
3737
run: |
38-
VERSION=$(php -r "echo json_decode(file_get_contents('composer.json'), true)['version'] ?? 'v1.0.0';")
39-
if [[ ! $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
40-
# If no version in composer.json, use timestamp-based version
41-
VERSION="v1.0.$(date +%Y%m%d%H%M%S)"
42-
fi
43-
echo "version=$VERSION" >> $GITHUB_OUTPUT
44-
echo "tag_name=$VERSION" >> $GITHUB_OUTPUT
45-
46-
- name: Check if tag exists
47-
id: check_tag
48-
run: |
49-
if git rev-parse --verify "refs/tags/${{ steps.get_version.outputs.tag_name }}" >/dev/null 2>&1; then
50-
echo "exists=true" >> $GITHUB_OUTPUT
51-
else
52-
echo "exists=false" >> $GITHUB_OUTPUT
53-
fi
38+
# Get the latest tag
39+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
40+
echo "Latest tag: $LATEST_TAG"
41+
42+
# Extract version numbers (remove 'v' prefix)
43+
VERSION_NUM=${LATEST_TAG#v}
44+
45+
# Split version into parts
46+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_NUM"
47+
48+
# Default to 0 if parts are empty
49+
MAJOR=${MAJOR:-0}
50+
MINOR=${MINOR:-0}
51+
PATCH=${PATCH:-0}
52+
53+
# Increment patch version for every merge
54+
PATCH=$((PATCH + 1))
55+
56+
# Create new version
57+
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
58+
59+
echo "New version: $NEW_VERSION"
60+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
61+
echo "tag_name=$NEW_VERSION" >> $GITHUB_OUTPUT
5462
5563
- name: Generate changelog
5664
id: changelog
57-
if: steps.check_tag.outputs.exists == 'false'
5865
run: |
59-
# Get the latest tag
60-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
66+
# Get the previous tag for changelog
67+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
6168
62-
if [ -z "$LATEST_TAG" ]; then
69+
if [ -z "$PREVIOUS_TAG" ]; then
6370
# If no previous tags, get all commits
6471
COMMITS=$(git log --pretty=format:"* %s (%an)" --no-merges)
6572
else
6673
# Get commits since last tag
67-
COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"* %s (%an)" --no-merges)
74+
COMMITS=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"* %s (%an)" --no-merges)
6875
fi
6976
7077
# Create changelog
@@ -76,18 +83,12 @@ jobs:
7683
echo "EOF" >> $GITHUB_OUTPUT
7784
7885
- name: Create Release
79-
if: steps.check_tag.outputs.exists == 'false'
80-
uses: actions/create-release@v1
86+
uses: softprops/action-gh-release@v1
8187
env:
8288
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8389
with:
8490
tag_name: ${{ steps.get_version.outputs.tag_name }}
85-
release_name: Release ${{ steps.get_version.outputs.tag_name }}
91+
name: Release ${{ steps.get_version.outputs.tag_name }}
8692
body: ${{ steps.changelog.outputs.changelog }}
8793
draft: false
88-
prerelease: false
89-
90-
- name: Skip release (tag exists)
91-
if: steps.check_tag.outputs.exists == 'true'
92-
run: |
93-
echo "Tag ${{ steps.get_version.outputs.tag_name }} already exists. Skipping release creation."
94+
prerelease: false

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"illuminate/contracts": "^10.0|^11.0|^12.0",
2424
"illuminate/support": "^10.0|^11.0|^12.0",
2525
"laravel/mcp": "^0.1.1",
26+
"laravel/prompts": "^0.3.6",
2627
"spatie/laravel-package-tools": "^1.16",
2728
"symfony/yaml": "^6.0|^7.0"
2829
},

src/Commands/InstallCommand.php

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@
66

77
use Illuminate\Console\Command;
88
use Illuminate\Support\Facades\File;
9+
use Laravel\Prompts\Concerns\Colors;
10+
11+
use function Laravel\Prompts\intro;
12+
use function Laravel\Prompts\note;
913

1014
class InstallCommand extends Command
1115
{
16+
use Colors;
1217
protected $signature = 'restify-boost:install';
1318

1419
protected $description = 'Install and configure the Restify Boost package';
1520

1621
public function handle(): int
1722
{
23+
$this->displayRestifyHeader();
1824
$this->displayWelcome();
1925

2026
// Publish configuration file
@@ -24,16 +30,6 @@ public function handle(): int
2430
'--force' => true,
2531
]);
2632

27-
// Verify Laravel Restify is installed
28-
$this->line('Checking Laravel Restify installation...');
29-
if (! $this->verifyRestifyInstallation()) {
30-
$this->error('Laravel Restify package not found!');
31-
$this->line('Please install Laravel Restify first:');
32-
$this->line('composer require binaryk/laravel-restify');
33-
34-
return self::FAILURE;
35-
}
36-
3733
// Check documentation availability
3834
$this->line('Checking documentation availability...');
3935
$this->checkDocumentationPaths();
@@ -49,12 +45,29 @@ public function handle(): int
4945
return self::SUCCESS;
5046
}
5147

48+
private function displayRestifyHeader(): void
49+
{
50+
note($this->restifyLogo());
51+
intro('✦ Laravel Restify MCP :: Install :: We Must REST ✦');
52+
}
53+
54+
private function restifyLogo(): string
55+
{
56+
return
57+
<<<'HEADER'
58+
██████╗ ███████╗ ███████╗ ████████╗ ██╗ ███████╗ ██╗ ██╗
59+
██╔══██╗ ██╔════╝ ██╔════╝ ╚══██╔══╝ ██║ ██╔════╝ ╚██╗ ██╔╝
60+
██████╔╝ █████╗ ███████╗ ██║ ██║ █████╗ ╚████╔╝
61+
██╔══██╗ ██╔══╝ ╚════██║ ██║ ██║ ██╔══╝ ╚██╔╝
62+
██║ ██║ ███████╗ ███████║ ██║ ██║ ██║ ██║
63+
╚═╝ ╚═╝ ╚══════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
64+
HEADER;
65+
}
66+
5267
protected function displayWelcome(): void
5368
{
54-
$this->newLine();
55-
$this->info('┌─────────────────────────────────────────┐');
56-
$this->info('│ Restify Boost Setup │');
57-
$this->info('└─────────────────────────────────────────┘');
69+
$appName = config('app.name', 'Your Laravel App');
70+
note("Let's give {$this->bgBlue($this->white($this->bold($appName)))} a RESTful boost with Restify MCP!");
5871
$this->newLine();
5972
$this->line('This will set up Restify Boost to provide Laravel Restify');
6073
$this->line('documentation access to AI assistants like Claude Code.');
@@ -278,26 +291,6 @@ protected function createMcpConfigFile(): bool
278291
}
279292
}
280293

281-
protected function verifyRestifyInstallation(): bool
282-
{
283-
// Check if Laravel Restify is in composer.lock
284-
$composerLock = base_path('composer.lock');
285-
if (! File::exists($composerLock)) {
286-
return false;
287-
}
288-
289-
$lockData = json_decode(File::get($composerLock), true);
290-
foreach (($lockData['packages'] ?? []) as $package) {
291-
if ($package['name'] === 'binaryk/laravel-restify') {
292-
$this->info('Found Laravel Restify version: '.$package['version']);
293-
294-
return true;
295-
}
296-
}
297-
298-
return false;
299-
}
300-
301294
protected function checkDocumentationPaths(): void
302295
{
303296
$primaryPath = config('restify-boost.docs.paths.primary');

0 commit comments

Comments
 (0)