Skip to content

Commit 04ffee4

Browse files
committed
chore(dependencies): update forge and ai-sdk versions across multiple modules
- Upgraded `github.com/xraph/forge` dependency from v0.8.0 to v0.9.1 in various modules to incorporate the latest features and improvements. - Updated `github.com/xraph/ai-sdk` from v0.0.2 to v0.0.4, enhancing functionality and compatibility. - Cleaned up `go.mod` and `go.sum` files by removing outdated entries and ensuring accurate dependency tracking. This update improves the overall stability and performance of the project.
1 parent bce139e commit 04ffee4

84 files changed

Lines changed: 416 additions & 555 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/forge/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/joho/godotenv v1.5.1
1212
github.com/stretchr/testify v1.11.1
1313
github.com/uptrace/bun v1.2.15
14-
github.com/xraph/forge v0.8.0
14+
github.com/xraph/forge v0.9.1
1515
github.com/xraph/forge/extensions/database v0.0.0-00010101000000-000000000000
1616
golang.org/x/text v0.33.0
1717
gopkg.in/yaml.v3 v3.0.1

cmd/forge/plugins/generate.go

Lines changed: 140 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ func (p *GeneratePlugin) Commands() []cli.Command {
9494
cli.WithFlag(cli.NewStringFlag("name", "n", "Migration name", "")),
9595
))
9696

97+
generateCmd.AddSubcommand(cli.NewCommand(
98+
"cli-app",
99+
"Generate a CLI application",
100+
p.generateCLIApp,
101+
cli.WithFlag(cli.NewStringFlag("name", "n", "CLI app name", "")),
102+
))
103+
97104
generateCmd.AddSubcommand(cli.NewCommand(
98105
"command",
99106
"Generate a CLI command (for CLI apps only)",
@@ -135,14 +142,6 @@ func (p *GeneratePlugin) generateApp(ctx cli.CommandContext) error {
135142

136143
var appPath string
137144

138-
isCLI := template == "cli"
139-
140-
// Determine the internal directory based on app type
141-
internalDir := "handlers"
142-
if isCLI {
143-
internalDir = "commands"
144-
}
145-
146145
if p.config.IsSingleModule() {
147146
// Single-module: create cmd/app-name and apps/app-name
148147
structure := p.config.Project.GetStructure()
@@ -156,7 +155,7 @@ func (p *GeneratePlugin) generateApp(ctx cli.CommandContext) error {
156155
return err
157156
}
158157

159-
if err := os.MkdirAll(filepath.Join(appPath, "internal", internalDir), 0755); err != nil {
158+
if err := os.MkdirAll(filepath.Join(appPath, "internal", "handlers"), 0755); err != nil {
160159
spinner.Stop(cli.Red("✗ Failed"))
161160

162161
return err
@@ -171,32 +170,23 @@ func (p *GeneratePlugin) generateApp(ctx cli.CommandContext) error {
171170
}
172171

173172
// Create .forge.yaml for app
174-
appConfig := p.generateAppConfig(name, template)
173+
appConfig := p.generateAppConfig(name)
175174
if err := os.WriteFile(filepath.Join(appPath, ".forge.yaml"), []byte(appConfig), 0644); err != nil {
176175
spinner.Stop(cli.Red("✗ Failed"))
177176

178177
return err
179178
}
180179

181-
// Create app-specific config.yaml (skip for CLI apps)
182-
if !isCLI {
183-
if err := p.createAppConfig(appPath, name, false); err != nil {
184-
spinner.Stop(cli.Red("✗ Failed"))
180+
// Create app-specific config.yaml
181+
if err := p.createAppConfig(appPath, name, false); err != nil {
182+
spinner.Stop(cli.Red("✗ Failed"))
185183

186-
return err
187-
}
184+
return err
188185
}
189186
} else {
190187
// Multi-module: create apps/app-name with go.mod
191188
appPath = filepath.Join(p.config.RootDir, "apps", name)
192-
193-
// CLI apps use cmd/{name} instead of cmd/server
194-
cmdSubDir := "server"
195-
if isCLI {
196-
cmdSubDir = name
197-
}
198-
199-
cmdPath := filepath.Join(appPath, "cmd", cmdSubDir)
189+
cmdPath := filepath.Join(appPath, "cmd", "server")
200190

201191
// Create directories
202192
if err := os.MkdirAll(cmdPath, 0755); err != nil {
@@ -205,7 +195,7 @@ func (p *GeneratePlugin) generateApp(ctx cli.CommandContext) error {
205195
return err
206196
}
207197

208-
if err := os.MkdirAll(filepath.Join(appPath, "internal", internalDir), 0755); err != nil {
198+
if err := os.MkdirAll(filepath.Join(appPath, "internal", "handlers"), 0755); err != nil {
209199
spinner.Stop(cli.Red("✗ Failed"))
210200

211201
return err
@@ -231,38 +221,145 @@ func (p *GeneratePlugin) generateApp(ctx cli.CommandContext) error {
231221
}
232222

233223
// Create .forge.yaml for app
234-
appConfig := p.generateAppConfig(name, template)
224+
appConfig := p.generateAppConfig(name)
235225
if err := os.WriteFile(filepath.Join(appPath, ".forge.yaml"), []byte(appConfig), 0644); err != nil {
236226
spinner.Stop(cli.Red("✗ Failed"))
237227

238228
return err
239229
}
240230

241-
// Create app-specific config.yaml (skip for CLI apps)
242-
if !isCLI {
243-
if err := p.createAppConfig(appPath, name, true); err != nil {
244-
spinner.Stop(cli.Red("✗ Failed"))
231+
// Create app-specific config.yaml
232+
if err := p.createAppConfig(appPath, name, true); err != nil {
233+
spinner.Stop(cli.Red("✗ Failed"))
245234

246-
return err
247-
}
235+
return err
248236
}
249237
}
250238

251239
spinner.Stop(cli.Green(fmt.Sprintf("✓ App %s created successfully!", name)))
252240

253241
ctx.Println("")
254242
ctx.Success("Next steps:")
243+
ctx.Println(" 1. Review app config at apps/" + name + "/config.yaml")
244+
ctx.Println(" 2. (Optional) Create config.local.yaml for local overrides")
245+
ctx.Println(" 3. Run: forge dev -a", name)
246+
247+
return nil
248+
}
249+
250+
func (p *GeneratePlugin) generateCLIApp(ctx cli.CommandContext) error {
251+
if p.config == nil {
252+
ctx.Error(errors.New("no .forge.yaml found in current directory or any parent"))
253+
ctx.Println("")
254+
ctx.Info("This doesn't appear to be a Forge project.")
255+
ctx.Info("To initialize a new project, run:")
256+
ctx.Println(" forge init")
257+
258+
return errors.New("not a forge project")
259+
}
260+
261+
name := ctx.String("name")
262+
if name == "" {
263+
var err error
264+
265+
name, err = ctx.Prompt("CLI app name:")
266+
if err != nil {
267+
return err
268+
}
269+
}
270+
271+
spinner := ctx.Spinner(fmt.Sprintf("Generating CLI app %s...", name))
272+
273+
var appPath string
274+
275+
if p.config.IsSingleModule() {
276+
// Single-module: create cmd/app-name and apps/app-name
277+
structure := p.config.Project.GetStructure()
278+
cmdPath := filepath.Join(p.config.RootDir, structure.Cmd, name)
279+
appPath = filepath.Join(p.config.RootDir, structure.Apps, name)
280+
281+
// Create directories
282+
if err := os.MkdirAll(cmdPath, 0755); err != nil {
283+
spinner.Stop(cli.Red("✗ Failed"))
284+
285+
return err
286+
}
287+
288+
if err := os.MkdirAll(filepath.Join(appPath, "internal", "commands"), 0755); err != nil {
289+
spinner.Stop(cli.Red("✗ Failed"))
290+
291+
return err
292+
}
255293

256-
if isCLI {
257-
ctx.Println(" 1. Review the generated main.go")
258-
ctx.Println(" 2. Add commands using: forge generate command --app " + name)
259-
ctx.Println(" 3. Build: go build -o " + name)
294+
// Create main.go
295+
mainContent := p.generateCLIMainFile(name)
296+
if err := os.WriteFile(filepath.Join(cmdPath, "main.go"), []byte(mainContent), 0644); err != nil {
297+
spinner.Stop(cli.Red("✗ Failed"))
298+
299+
return err
300+
}
301+
302+
// Create .forge.yaml for CLI app
303+
appConfig := p.generateCLIAppConfig(name)
304+
if err := os.WriteFile(filepath.Join(appPath, ".forge.yaml"), []byte(appConfig), 0644); err != nil {
305+
spinner.Stop(cli.Red("✗ Failed"))
306+
307+
return err
308+
}
260309
} else {
261-
ctx.Println(" 1. Review app config at apps/" + name + "/config.yaml")
262-
ctx.Println(" 2. (Optional) Create config.local.yaml for local overrides")
263-
ctx.Println(" 3. Run: forge dev -a", name)
310+
// Multi-module: create apps/app-name with go.mod
311+
appPath = filepath.Join(p.config.RootDir, "apps", name)
312+
cmdPath := filepath.Join(appPath, "cmd", name)
313+
314+
// Create directories
315+
if err := os.MkdirAll(cmdPath, 0755); err != nil {
316+
spinner.Stop(cli.Red("✗ Failed"))
317+
318+
return err
319+
}
320+
321+
if err := os.MkdirAll(filepath.Join(appPath, "internal", "commands"), 0755); err != nil {
322+
spinner.Stop(cli.Red("✗ Failed"))
323+
324+
return err
325+
}
326+
327+
// Create go.mod
328+
modulePath := fmt.Sprintf("%s/apps/%s", p.config.Project.Module, name)
329+
version := getLatestForgeVersion()
330+
331+
goModContent := fmt.Sprintf("module %s\n\ngo 1.24.0\n\nrequire github.com/xraph/forge v%s\n", modulePath, version)
332+
if err := os.WriteFile(filepath.Join(appPath, "go.mod"), []byte(goModContent), 0644); err != nil {
333+
spinner.Stop(cli.Red("✗ Failed"))
334+
335+
return err
336+
}
337+
338+
// Create main.go
339+
mainContent := p.generateCLIMainFile(name)
340+
if err := os.WriteFile(filepath.Join(cmdPath, "main.go"), []byte(mainContent), 0644); err != nil {
341+
spinner.Stop(cli.Red("✗ Failed"))
342+
343+
return err
344+
}
345+
346+
// Create .forge.yaml for CLI app
347+
appConfig := p.generateCLIAppConfig(name)
348+
if err := os.WriteFile(filepath.Join(appPath, ".forge.yaml"), []byte(appConfig), 0644); err != nil {
349+
spinner.Stop(cli.Red("✗ Failed"))
350+
351+
return err
352+
}
264353
}
265354

355+
spinner.Stop(cli.Green(fmt.Sprintf("✓ CLI app %s created successfully!", name)))
356+
357+
ctx.Println("")
358+
ctx.Success("Next steps:")
359+
ctx.Println(" 1. Review the generated main.go")
360+
ctx.Println(" 2. Add commands using: forge generate command --app " + name)
361+
ctx.Println(" 3. Build: go build -o " + name)
362+
266363
return nil
267364
}
268365

@@ -892,10 +989,6 @@ func (p *GeneratePlugin) printModelInfo(ctx cli.CommandContext, baseType string)
892989
// Template generation functions
893990

894991
func (p *GeneratePlugin) generateMainFile(name, template string) string {
895-
if template == "cli" {
896-
return p.generateCLIMainFile(name)
897-
}
898-
899992
return fmt.Sprintf(`package main
900993
901994
import (
@@ -970,17 +1063,17 @@ func main() {
9701063
`, name, name)
9711064
}
9721065

973-
func (p *GeneratePlugin) generateAppConfig(name, template string) string {
974-
if template == "cli" {
975-
return fmt.Sprintf(`app:
1066+
func (p *GeneratePlugin) generateCLIAppConfig(name string) string {
1067+
return fmt.Sprintf(`app:
9761068
name: "%s"
9771069
type: "cli"
9781070
9791071
build:
9801072
output: "%s"
9811073
`, name, name)
982-
}
1074+
}
9831075

1076+
func (p *GeneratePlugin) generateAppConfig(name string) string {
9841077
return fmt.Sprintf(`app:
9851078
name: "%s"
9861079
type: "web"

examples/cors_preflight/go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,12 @@ require (
6363
go.yaml.in/yaml/v3 v3.0.4 // indirect
6464
golang.org/x/crypto v0.46.0 // indirect
6565
golang.org/x/exp v0.0.0-20250808145144-a408d31f581a // indirect
66-
golang.org/x/mod v0.31.0 // indirect
6766
golang.org/x/net v0.48.0 // indirect
6867
golang.org/x/oauth2 v0.30.0 // indirect
69-
golang.org/x/sync v0.19.0 // indirect
7068
golang.org/x/sys v0.39.0 // indirect
7169
golang.org/x/term v0.38.0 // indirect
7270
golang.org/x/text v0.33.0 // indirect
7371
golang.org/x/time v0.12.0 // indirect
74-
golang.org/x/tools v0.40.0 // indirect
7572
google.golang.org/protobuf v1.36.10 // indirect
7673
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
7774
gopkg.in/inf.v0 v0.9.1 // indirect

examples/cors_preflight/go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL
3333
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
3434
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
3535
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
36-
github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk=
37-
github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
3836
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
3937
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
4038
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
@@ -217,11 +215,9 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b
217215
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
218216
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
219217
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
220-
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
221-
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
218+
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
222219
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
223-
github.com/quic-go/quic-go v0.55.0 h1:zccPQIqYCXDt5NmcEabyYvOnomjs8Tlwl7tISjJh9Mk=
224-
github.com/quic-go/quic-go v0.55.0/go.mod h1:DR51ilwU1uE164KuWXhinFcKWGlEjzys2l8zUl5Ss1U=
220+
github.com/quic-go/quic-go v0.57.0 h1:AsSSrrMs4qI/hLrKlTH/TGQeTMY0ib1pAOX7vA3AdqE=
225221
github.com/quic-go/quic-go v0.57.0/go.mod h1:ly4QBAjHA2VhdnxhojRsCUOeJwKYg+taDlos92xb1+s=
226222
github.com/quic-go/webtransport-go v0.9.0 h1:jgys+7/wm6JarGDrW+lD/r9BGqBAmqY/ssklE09bA70=
227223
github.com/quic-go/webtransport-go v0.9.0/go.mod h1:4FUYIiUc75XSsF6HShcLeXXYZJ9AGwo/xh3L8M/P1ao=

examples/di-patterns/go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,12 @@ require (
6363
go.yaml.in/yaml/v3 v3.0.4 // indirect
6464
golang.org/x/crypto v0.46.0 // indirect
6565
golang.org/x/exp v0.0.0-20250808145144-a408d31f581a // indirect
66-
golang.org/x/mod v0.31.0 // indirect
6766
golang.org/x/net v0.48.0 // indirect
6867
golang.org/x/oauth2 v0.30.0 // indirect
69-
golang.org/x/sync v0.19.0 // indirect
7068
golang.org/x/sys v0.39.0 // indirect
7169
golang.org/x/term v0.38.0 // indirect
7270
golang.org/x/text v0.33.0 // indirect
7371
golang.org/x/time v0.12.0 // indirect
74-
golang.org/x/tools v0.40.0 // indirect
7572
google.golang.org/protobuf v1.36.10 // indirect
7673
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
7774
gopkg.in/inf.v0 v0.9.1 // indirect

examples/di-patterns/go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL
3333
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
3434
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
3535
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
36-
github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk=
37-
github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
3836
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
3937
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
4038
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
@@ -217,11 +215,9 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b
217215
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
218216
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
219217
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
220-
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
221-
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
218+
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
222219
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
223-
github.com/quic-go/quic-go v0.55.0 h1:zccPQIqYCXDt5NmcEabyYvOnomjs8Tlwl7tISjJh9Mk=
224-
github.com/quic-go/quic-go v0.55.0/go.mod h1:DR51ilwU1uE164KuWXhinFcKWGlEjzys2l8zUl5Ss1U=
220+
github.com/quic-go/quic-go v0.57.0 h1:AsSSrrMs4qI/hLrKlTH/TGQeTMY0ib1pAOX7vA3AdqE=
225221
github.com/quic-go/quic-go v0.57.0/go.mod h1:ly4QBAjHA2VhdnxhojRsCUOeJwKYg+taDlos92xb1+s=
226222
github.com/quic-go/webtransport-go v0.9.0 h1:jgys+7/wm6JarGDrW+lD/r9BGqBAmqY/ssklE09bA70=
227223
github.com/quic-go/webtransport-go v0.9.0/go.mod h1:4FUYIiUc75XSsF6HShcLeXXYZJ9AGwo/xh3L8M/P1ao=

examples/farp-auto-detection/go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ replace github.com/xraph/forge => ../..
77
replace github.com/xraph/forge/extensions/discovery => ../../extensions/discovery
88

99
require (
10-
github.com/xraph/forge v0.8.6
10+
github.com/xraph/forge v0.9.1
1111
github.com/xraph/forge/extensions/discovery v0.0.0-00010101000000-000000000000
1212
)
1313

@@ -79,15 +79,12 @@ require (
7979
go.yaml.in/yaml/v3 v3.0.4 // indirect
8080
golang.org/x/crypto v0.46.0 // indirect
8181
golang.org/x/exp v0.0.0-20250808145144-a408d31f581a // indirect
82-
golang.org/x/mod v0.31.0 // indirect
8382
golang.org/x/net v0.48.0 // indirect
8483
golang.org/x/oauth2 v0.30.0 // indirect
85-
golang.org/x/sync v0.19.0 // indirect
8684
golang.org/x/sys v0.39.0 // indirect
8785
golang.org/x/term v0.38.0 // indirect
8886
golang.org/x/text v0.33.0 // indirect
8987
golang.org/x/time v0.12.0 // indirect
90-
golang.org/x/tools v0.40.0 // indirect
9188
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
9289
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
9390
google.golang.org/grpc v1.76.0 // indirect

0 commit comments

Comments
 (0)