Public Access
Merge branch 'main' into dev: bring in keystone->draft rename
Resolves conflicts with dev's install-logic commit by keeping draft's module path/binary names and dropping a stray junk file (.cursor/test.txt).
This commit is contained in:
commit
613efed0f2
16 files changed
+41
-50
No files matched your search
+1
-1
@@ -30,4 +30,4 @@ go.work.sum
|
|||||||
.env
|
.env
|
||||||
|
|
||||||
# Binary
|
# Binary
|
||||||
/basalt
|
/draft*
|
||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
[submodule "assets/testdata/api_tmpl"]
|
[submodule "assets/testdata/api_tmpl"]
|
||||||
path = assets/testdata/api_tmpl
|
path = assets/testdata/api_tmpl
|
||||||
url = git@gitea.fernandovideira.com:FernandoJVideira/api_tmpl.git
|
url = [email protected]:FernandoJVideira/api_tmpl.git
|
||||||
|
branch = dev
|
||||||
@@ -1,31 +1,25 @@
|
|||||||
PKG_NAME="gitea.fernandovideira.com/fernandojvideira/keystone"
|
PKG_NAME="git.fernandovideira.com/FernandoJVideira/draft"
|
||||||
|
|
||||||
version:
|
version:
|
||||||
@go run -ldflags "-X ${PKG_NAME}/cmd.version=v1.0.0" ./main.go version
|
@go run -ldflags "-X ${PKG_NAME}/cmd.version=v1.0.0" ./main.go version
|
||||||
|
|
||||||
generate-templates:
|
|
||||||
@echo "Initializing submodules..."
|
|
||||||
@git submodule update --init --recursive
|
|
||||||
@echo "Generating embedded templates..."
|
|
||||||
@go run tools/sync_templates.go
|
|
||||||
|
|
||||||
build: prepare-embed
|
build: prepare-embed
|
||||||
@echo "Building for $(GOOS)/$(GOARCH)..."
|
@echo "Building for $(GOOS)/$(GOARCH)..."
|
||||||
@GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags "-X ${PKG_NAME}/cmd.version=v0.0.1" -o $(OUTPUT) ./main.go
|
@GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags "-X ${PKG_NAME}/cmd.version=v0.0.1" -o $(OUTPUT) ./main.go
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
@$(MAKE) build GOOS=windows GOARCH=amd64 OUTPUT=keystone.exe
|
@$(MAKE) build GOOS=windows GOARCH=amd64 OUTPUT=draft_windows_amd64.exe
|
||||||
|
|
||||||
win-arm:
|
win-arm:
|
||||||
@$(MAKE) build GOOS=windows GOARCH=arm64 OUTPUT=keystone.exe
|
@$(MAKE) build GOOS=windows GOARCH=arm64 OUTPUT=draft_windows_arm64.exe
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
@$(MAKE) build GOOS=linux GOARCH=amd64 OUTPUT=keystone
|
@$(MAKE) build GOOS=linux GOARCH=amd64 OUTPUT=draft_linux_amd64
|
||||||
|
|
||||||
mac:
|
mac:
|
||||||
@$(MAKE) build GOOS=darwin GOARCH=arm64 OUTPUT=keystone
|
@$(MAKE) build GOOS=darwin GOARCH=arm64 OUTPUT=draft_darwin_arm64
|
||||||
|
|
||||||
prepare-embed:
|
prepare-embed:
|
||||||
@git submodule update --init --recursive
|
@git submodule update --init --recursive
|
||||||
@mkdir -p assets/embedded
|
@mkdir -p assets/embedded
|
||||||
@go run tools/sync_templates.go
|
@GOOS="" GOARCH="" go run tools/sync_templates.go
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Keystone
|
# Draft
|
||||||
|
|
||||||
A powerful CLI tool for bootstrapping Go API projects with best practices built-in. Keystone helps you quickly scaffold production-ready Go APIs with support for both HTTP (REST) and gRPC architectures.
|
A powerful CLI tool for bootstrapping Go API projects with best practices built-in. Draft helps you quickly scaffold production-ready Go APIs with support for both HTTP (REST) and gRPC architectures.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -17,8 +17,8 @@ A powerful CLI tool for bootstrapping Go API projects with best practices built-
|
|||||||
### From Source
|
### From Source
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/yourusername/keystone.git
|
git clone [email protected]:FernandoJVideira/draft.git
|
||||||
cd keystone
|
cd draft
|
||||||
make build
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -38,14 +38,14 @@ make windows
|
|||||||
make win-arm
|
make win-arm
|
||||||
```
|
```
|
||||||
|
|
||||||
The compiled binary will be named `basalt` (or `basalt.exe` on Windows).
|
The compiled binary will be named `draft_<os>_<arch>` (e.g. `draft_darwin_arm64`, or `draft_windows_amd64.exe` on Windows).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Create a New API Project
|
### Create a New API Project
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
keystone new api
|
draft new api
|
||||||
```
|
```
|
||||||
|
|
||||||
This interactive command will:
|
This interactive command will:
|
||||||
@@ -67,7 +67,7 @@ This interactive command will:
|
|||||||
### Generate a New Service
|
### Generate a New Service
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
keystone new service
|
draft new service
|
||||||
```
|
```
|
||||||
|
|
||||||
Creates a new service file in `internal/service/` with:
|
Creates a new service file in `internal/service/` with:
|
||||||
@@ -78,7 +78,7 @@ Creates a new service file in `internal/service/` with:
|
|||||||
### Generate a New Handler
|
### Generate a New Handler
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
keystone new handler
|
draft new handler
|
||||||
```
|
```
|
||||||
|
|
||||||
Creates a new handler in the appropriate directory:
|
Creates a new handler in the appropriate directory:
|
||||||
@@ -88,7 +88,7 @@ Creates a new handler in the appropriate directory:
|
|||||||
### Generate a Cryptographic Key
|
### Generate a Cryptographic Key
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
keystone new key
|
draft new key
|
||||||
```
|
```
|
||||||
|
|
||||||
Generates a secure random key for use in your application (default: 32 characters).
|
Generates a secure random key for use in your application (default: 32 characters).
|
||||||
@@ -96,12 +96,12 @@ Generates a secure random key for use in your application (default: 32 character
|
|||||||
### Check Version
|
### Check Version
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
keystone version
|
draft version
|
||||||
```
|
```
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
When you create a new project, Keystone generates a structured Go API with:
|
When you create a new project, Draft generates a structured Go API with:
|
||||||
|
|
||||||
```
|
```
|
||||||
your-project/
|
your-project/
|
||||||
@@ -153,8 +153,4 @@ This project is licensed under the MIT License - see the LICENSE file for detail
|
|||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
Built by LKResuts for internal usage to bootstrap Go APIs.
|
Built by LKResuts for internal usage to bootstrap Go APIs.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Note:** The binary is compiled as `basalt`, but the CLI tool is referred to as `keystone` in documentation and usage.
|
|
||||||
Vendored
+1
-1
Submodule assets/testdata/api_tmpl updated: 961bdd81d4...310c8f2211.
+3
-3
@@ -8,7 +8,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.fernandovideira.com/fernandojvideira/keystone/assets"
|
"git.fernandovideira.com/FernandoJVideira/draft/assets"
|
||||||
"github.com/manifoldco/promptui"
|
"github.com/manifoldco/promptui"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@@ -19,8 +19,8 @@ func init() {
|
|||||||
|
|
||||||
var apiCmd = &cobra.Command{
|
var apiCmd = &cobra.Command{
|
||||||
Use: "api",
|
Use: "api",
|
||||||
Short: "Create a new Keystone API project",
|
Short: "Create a new Draft API project",
|
||||||
Long: `Create a new Keystone API project with the necessary structure and files.`,
|
Long: `Create a new Draft API project with the necessary structure and files.`,
|
||||||
Run: genProject,
|
Run: genProject,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ func init() {
|
|||||||
var handlerCmd = &cobra.Command{
|
var handlerCmd = &cobra.Command{
|
||||||
Use: "handler",
|
Use: "handler",
|
||||||
Short: "Create a new handler",
|
Short: "Create a new handler",
|
||||||
Long: `Create a new handler for your Keystone project.`,
|
Long: `Create a new handler for your Draft project.`,
|
||||||
Run: genHandler,
|
Run: genHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"gitea.fernandovideira.com/fernandojvideira/keystone/assets"
|
"git.fernandovideira.com/FernandoJVideira/draft/assets"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ var defaultSize = 32
|
|||||||
var keyCmd = &cobra.Command{
|
var keyCmd = &cobra.Command{
|
||||||
Use: "key [size]",
|
Use: "key [size]",
|
||||||
Short: "Generate a new cryptographic key",
|
Short: "Generate a new cryptographic key",
|
||||||
Long: `Generate a new cryptographic key for use in Keystone projects.`,
|
Long: `Generate a new cryptographic key for use in Draft projects.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
var keyLength int
|
var keyLength int
|
||||||
if cmd.Flags().Lookup("size").Changed {
|
if cmd.Flags().Lookup("size").Changed {
|
||||||
|
|||||||
+3
-3
@@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
const oldModuleName = "github.com/FernandoJVideira/simple_bank"
|
const oldModuleName = "github.com/FernandoJVideira/api_tmpl"
|
||||||
const srcDir = "embedded/api_tmpl"
|
const srcDir = "embedded/api_tmpl"
|
||||||
|
|
||||||
type MainTemplateData struct {
|
type MainTemplateData struct {
|
||||||
@@ -18,7 +18,7 @@ func init() {
|
|||||||
|
|
||||||
var newCmd = &cobra.Command{
|
var newCmd = &cobra.Command{
|
||||||
Use: "new",
|
Use: "new",
|
||||||
Short: "Create a new Keystone project",
|
Short: "Create a new Draft project",
|
||||||
Long: `Create a new Keystone project with the necessary structure and files.`,
|
Long: `Create a new Draft project with the necessary structure and files.`,
|
||||||
Run: genProject,
|
Run: genProject,
|
||||||
}
|
}
|
||||||
+3
-3
@@ -8,9 +8,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "keystone",
|
Use: "draft",
|
||||||
Short: "Keystone is a CLI tool for bootstrapping Go APIs",
|
Short: "Draft is a CLI tool for bootstrapping Go APIs",
|
||||||
Long: `Keystone is a CLI tool built by LKResuts for internal usage to bootstrap Go APIs`,
|
Long: `Draft is a CLI tool built by LKResuts for internal usage to bootstrap Go APIs`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ type ServiceTemplateData struct {
|
|||||||
var serviceCmd = &cobra.Command{
|
var serviceCmd = &cobra.Command{
|
||||||
Use: "service",
|
Use: "service",
|
||||||
Short: "Create a new service",
|
Short: "Create a new service",
|
||||||
Long: `Create a new service for your Keystone project.`,
|
Long: `Create a new service for your Draft project.`,
|
||||||
Run: genService,
|
Run: genService,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -14,9 +14,9 @@ func init() {
|
|||||||
|
|
||||||
var versionCmd = &cobra.Command{
|
var versionCmd = &cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
Short: "Display the version of Keystone",
|
Short: "Display the version of Draft",
|
||||||
Long: `Display the current version of the Keystone CLI tool.`,
|
Long: `Display the current version of the Draft CLI tool.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Printf("Keystone CLI version: %s\n", version)
|
fmt.Printf("Draft CLI version: %s\n", version)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
module gitea.fernandovideira.com/fernandojvideira/keystone
|
module git.fernandovideira.com/FernandoJVideira/draft
|
||||||
|
|
||||||
go 1.25.5
|
go 1.25.5
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "gitea.fernandovideira.com/fernandojvideira/keystone/cmd"
|
import "git.fernandovideira.com/FernandoJVideira/draft/cmd"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cmd.Execute()
|
cmd.Execute()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
sourceDir = "assets/testdata/api_tmpl"
|
sourceDir = "assets/testdata/api_tmpl"
|
||||||
targetDir = "assets/embedded"
|
targetDir = "assets/embedded"
|
||||||
oldModuleName = "github.com/FernandoJVideira/simple_bank"
|
oldModuleName = "github.com/FernandoJVideira/api_tmpl"
|
||||||
moduleTemplate = "{{ .ModuleName }}"
|
moduleTemplate = "{{ .ModuleName }}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user