Atabix Architect
This is a VSCode Plugin to help developers with basic tasks.
Currently only the basic functionality of architect is working. (Creating resources)
You need a hephaestus.json
file in the base of the project to make it work.
Config
To get started, make a hephaestus.json
file in the base of your project folder.
Follow these interfaces for the correct format.
export interface Architect {
type: string;
commands: Command[];
}
export interface Command {
signature: string;
label: string;
description: string;
hidden?: boolean;
question?: string;
arguments?: Argument[];
stubs?: Stub[];
replaceables?: Replaceable[];
commands?: string[];
snippets?: Snippet[];
}
export interface Argument {
key: string;
type: ArgumentType;
question: string;
required?: boolean;
}
export enum ArgumentType {
string = 'string',
array = 'array',
int = 'int',
bool = 'bool',
}
export interface Replaceable {
search: string;
replace: string;
}
export interface Stub {
source: string;
result: string;
open?: boolean;
}
export interface Snippet {
file: string;
hook: string;
source: string;
}
Example
{
"type": "Atabase 3 - Api",
"link": "https://github.com/atabix/hephaestus/releases",
"commands": [
{
"signature": "make:resource",
"label": "Make Resource",
"description": "Creates an API endpoint resource for the specified resource.",
"question": "Name your resource (without suffix)",
"commands": [
"make:model"
]
},
{
"signature": "make:model",
"label": "Make Model",
"description": "Creates a model for the specified resource.",
"stubs": [
{
"source": "./resources/stubs/hephaestus/resource/Model.php.stub",
"result": "app/Models/DummyForwardslashNamespace/DummyStudlyNameSingular.php"
}
],
"replaceables": [
{
"search": "DummyModelNamespace",
"replace": "App\\Models"
}
]
},
{
"signature": "make:enum",
"label": "Make Enum",
"description": "Creates a new enum.",
"arguments": [
{
"key": "enums",
"type": "array",
"question": "Give enum keys.",
"required": true
}
],
"stubs": [
{
"source": "./resources/stubs/hephaestus/other/Enum.php.stub",
"result": "app/Enums/DummyForwardslashNamespace/DummyStudlyNameSingularEnum.php",
"open": true
}
],
"replaceables": [
{
"search": "DummyEnumNamespace",
"replace": "App\\Enums"
},
{
"search": "DummyExtends",
"replace": "App\\Enums\\Enum"
}
]
}
]
}
Stubs
In stubs some words are automatically replaced with the given input.
Here is an emaple file:
<?php
declare(strict_types=1);
namespace DummyModelNamespace\DummyBackslashNamespace;
use App\Models\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
/**
* DummyModelNamespace\DummyBackslashNamespace\DummyStudlyNameSingular.
*
* @property string $id
* @property Carbon $created_at
* @property Carbon|null $updated_at
*
* @method static Builder|DummyStudlyNameSingular newModelQuery()
* @method static Builder|DummyStudlyNameSingular newQuery()
* @method static Builder|DummyStudlyNameSingular query()
* @method static Builder|DummyStudlyNameSingular whereCreatedAt($value)
* @method static Builder|DummyStudlyNameSingular whereId($value)
* @method static Builder|DummyStudlyNameSingular whereUpdatedAt($value)
* @mixin \Eloquent
*/
class DummyStudlyNameSingular extends Model
{
/** @var string The table associated with the model. */
protected $table = 'DummyNamespacedSnakeNamePlural';
/** @var array<string> */
protected $fillable = [
'name',
];
/** @var array<string,string> The attributes that should be cast. */
protected $casts = [
];
/* ---------------------- Relationships ---------------------- */
/* ---------------------- Helper Functions ---------------------- */
/* ---------------------- Scopes ---------------------- */
/* ---------------------- Getters & Setters ---------------------- */
}
These are all available default replacables
- DummyNameSingular
- DummyNamePlural
- DummyLowerNameSingular
- DummyLowerNamePlural
- DummyUpperNameSingular
- DummyUpperNamePlural
- DummySlugNameSingular
- DummySlugNamePlural
- DummyNamespacedSlugNameSingular
- DummyNamespacedSlugNamePlural
- DummyCapitalNameSingular
- DummyCapitalNamePlural
- DummyNamespacedCapitalNameSingular
- DummyNamespacedCapitalNamePlural
- DummySnakeNameSingular
- DummySnakeNamePlural
- DummyNamespacedSnakeNameSingular
- DummyNamespacedSnakeNamePlural
- DummyStudlyNameSingular
- DummyStudlyNamePlural
- DummyNamespacedStudlyNameSingular
- DummyNamespacedStudlyNamePlural
- DummyCamelNameSingular
- DummyCamelNamePlural
- DummyNamespacedCamelNameSingular
- DummyNamespacedCamelNamePlural
- DummySpecialProcedureName
- DummySpecialMorphName
- /DummyForwardslashNamespace/
- \\DummyBackslashNamespace\\
- /DummyForwardslashNamespace
- \\DummyBackslashNamespace
- DummyForwardslashNamespace/
- DummyBackslashNamespace\\
- DummyForwardslashNamespace
- DummyBackslashNamespace