Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/internal/browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/cache"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/io"
execIO "github.com/flowexec/flow/internal/io/executable"
"github.com/flowexec/flow/internal/io/library"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/context"
flowErrors "github.com/flowexec/flow/pkg/errors"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/common"
"github.com/flowexec/flow/types/executable"
)
Expand Down Expand Up @@ -137,7 +137,7 @@ func executableLibrary(ctx *context.Context, cmd *cobra.Command, _ []string) {
Substring: subStr,
Visibility: visibilityFilter,
},
io.Theme(ctx.Config.Theme.String()),
logger.Theme(ctx.Config.Theme.String()),
runFunc,
)
SetView(ctx, cmd, libraryModel)
Expand Down Expand Up @@ -218,7 +218,7 @@ func viewExecutable(ctx *context.Context, cmd *cobra.Command, args []string) {
ref := executable.NewRef(execID, verb)

exec, err := ctx.ExecutableCache.GetExecutableByRef(ref)
if err != nil && errors.Is(cache.NewExecutableNotFoundError(ref.String()), err) {
if err != nil && errors.Is(flowErrors.NewExecutableNotFoundError(ref.String()), err) {
logger.Log().Debugf("Executable %s not found in cache, syncing cache", ref)
if err := ctx.ExecutableCache.Update(); err != nil {
logger.Log().FatalErr(err)
Expand Down
7 changes: 3 additions & 4 deletions cmd/internal/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/context"
flowIO "github.com/flowexec/flow/internal/io"
cacheIO "github.com/flowexec/flow/internal/io/cache"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/internal/services/store"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/logger"
)

func RegisterCacheCmd(ctx *context.Context, rootCmd *cobra.Command) {
Expand Down Expand Up @@ -55,7 +54,7 @@ func cacheSetFunc(ctx *context.Context, cmd *cobra.Command, args []string) {
switch {
case len(args) == 1:
form, err := views.NewForm(
flowIO.Theme(ctx.Config.Theme.String()),
logger.Theme(ctx.Config.Theme.String()),
ctx.StdIn(),
ctx.StdOut(),
&views.FormField{
Expand Down
9 changes: 4 additions & 5 deletions cmd/internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/filesystem"
"github.com/flowexec/flow/internal/io"
configIO "github.com/flowexec/flow/internal/io/config"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/filesystem"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/config"
)

Expand Down Expand Up @@ -44,7 +43,7 @@ func registerConfigResetCmd(ctx *context.Context, configCmd *cobra.Command) {

func resetConfigFunc(ctx *context.Context, _ *cobra.Command, _ []string) {
form, err := views.NewForm(
io.Theme(ctx.Config.Theme.String()),
logger.Theme(ctx.Config.Theme.String()),
ctx.StdIn(),
ctx.StdOut(),
&views.FormField{
Expand Down
10 changes: 5 additions & 5 deletions cmd/internal/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/cache"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/io"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/internal/runner"
"github.com/flowexec/flow/internal/runner/engine"
"github.com/flowexec/flow/internal/runner/exec"
Expand All @@ -28,6 +25,9 @@ import (
"github.com/flowexec/flow/internal/runner/serial"
"github.com/flowexec/flow/internal/services/store"
"github.com/flowexec/flow/internal/utils/env"
"github.com/flowexec/flow/pkg/context"
flowErrors "github.com/flowexec/flow/pkg/errors"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/executable"
"github.com/flowexec/flow/types/workspace"
)
Expand Down Expand Up @@ -109,7 +109,7 @@ func execFunc(ctx *context.Context, cmd *cobra.Command, verb executable.Verb, ar
}

e, err := ctx.ExecutableCache.GetExecutableByRef(ref)
if err != nil && errors.Is(cache.NewExecutableNotFoundError(ref.String()), err) {
if err != nil && errors.Is(flowErrors.NewExecutableNotFoundError(ref.String()), err) {
logger.Log().Debugf("Executable %s not found in cache, syncing cache", ref)
if err := ctx.ExecutableCache.Update(); err != nil {
logger.Log().FatalErr(err)
Expand Down Expand Up @@ -160,7 +160,7 @@ func execFunc(ctx *context.Context, cmd *cobra.Command, verb executable.Verb, ar
// add values from the prompt param type to the env map
textInputs := pendingFormFields(ctx, e, envMap)
if len(textInputs) > 0 {
form, err := views.NewForm(io.Theme(ctx.Config.Theme.String()), ctx.StdIn(), ctx.StdOut(), textInputs...)
form, err := views.NewForm(logger.Theme(ctx.Config.Theme.String()), ctx.StdIn(), ctx.StdOut(), textInputs...)
if err != nil {
logger.Log().FatalErr(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/flags/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/logger"
)

//nolint:errcheck
Expand Down
8 changes: 4 additions & 4 deletions cmd/internal/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/filesystem"
flowIO "github.com/flowexec/flow/internal/io"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/filesystem"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/executable"
"github.com/flowexec/flow/types/workspace"
)
Expand Down Expand Up @@ -98,7 +98,7 @@ func WaitForTUI(ctx *context.Context, cmd *cobra.Command) {

func printContext(ctx *context.Context, cmd *cobra.Command) {
if TUIEnabled(ctx, cmd) {
logger.Log().Println(flowIO.Theme(ctx.Config.Theme.String()).
logger.Log().Println(logger.Theme(ctx.Config.Theme.String()).
RenderHeader(context.AppName, context.HeaderCtxKey, ctx.String(), 0))
}
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/internal/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/filesystem"
"github.com/flowexec/flow/internal/io/logs"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/filesystem"
"github.com/flowexec/flow/pkg/logger"
)

func RegisterLogsCmd(ctx *context.Context, rootCmd *cobra.Command) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/internal/mcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package internal
import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/internal/mcp"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/logger"
)

func RegisterMCPCmd(ctx *context.Context, rootCmd *cobra.Command) {
Expand Down
9 changes: 4 additions & 5 deletions cmd/internal/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/io"
"github.com/flowexec/flow/internal/io/secret"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/internal/utils"
envUtils "github.com/flowexec/flow/internal/utils/env"
"github.com/flowexec/flow/internal/vault"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/config"
)

Expand Down Expand Up @@ -50,7 +49,7 @@ func removeSecretFunc(ctx *context.Context, _ *cobra.Command, args []string) {
reference := args[0]

form, err := views.NewForm(
io.Theme(ctx.Config.Theme.String()),
logger.Theme(ctx.Config.Theme.String()),
ctx.StdIn(),
ctx.StdOut(),
&views.FormField{
Expand Down Expand Up @@ -116,7 +115,7 @@ func setSecretFunc(ctx *context.Context, cmd *cobra.Command, args []string) {
value = string(data)
case len(args) == 1:
form, err := views.NewForm(
io.Theme(ctx.Config.Theme.String()),
logger.Theme(ctx.Config.Theme.String()),
ctx.StdIn(),
ctx.StdOut(),
&views.FormField{
Expand Down
6 changes: 3 additions & 3 deletions cmd/internal/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package internal
import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/internal/cache"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/cache"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/logger"
)

func RegisterSyncCmd(ctx *context.Context, rootCmd *cobra.Command) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/internal/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"github.com/spf13/cobra"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/filesystem"
"github.com/flowexec/flow/internal/io/executable"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/internal/runner"
"github.com/flowexec/flow/internal/runner/exec"
"github.com/flowexec/flow/internal/templates"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/filesystem"
"github.com/flowexec/flow/pkg/logger"
)

func RegisterTemplateCmd(ctx *context.Context, rootCmd *cobra.Command) {
Expand Down
9 changes: 4 additions & 5 deletions cmd/internal/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import (
"golang.org/x/exp/maps"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/filesystem"
flowIO "github.com/flowexec/flow/internal/io"
vaultIO "github.com/flowexec/flow/internal/io/vault"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/internal/utils"
"github.com/flowexec/flow/internal/vault"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/filesystem"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/config"
)

Expand Down Expand Up @@ -228,7 +227,7 @@ func removeVaultFunc(ctx *context.Context, _ *cobra.Command, args []string) {
}

form, err := views.NewForm(
flowIO.Theme(ctx.Config.Theme.String()),
logger.Theme(ctx.Config.Theme.String()),
ctx.StdIn(),
ctx.StdOut(),
&views.FormField{
Expand Down
11 changes: 5 additions & 6 deletions cmd/internal/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import (
"golang.org/x/exp/maps"

"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/internal/cache"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/filesystem"
"github.com/flowexec/flow/internal/io"
workspaceIO "github.com/flowexec/flow/internal/io/workspace"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/cache"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/filesystem"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/common"
"github.com/flowexec/flow/types/config"
"github.com/flowexec/flow/types/workspace"
Expand Down Expand Up @@ -167,7 +166,7 @@ func removeWorkspaceFunc(ctx *context.Context, _ *cobra.Command, args []string)
name := args[0]

form, err := views.NewForm(
io.Theme(ctx.Config.Theme.String()),
logger.Theme(ctx.Config.Theme.String()),
ctx.StdIn(),
ctx.StdOut(),
&views.FormField{
Expand Down
16 changes: 8 additions & 8 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/flowexec/flow/cmd/internal"
"github.com/flowexec/flow/cmd/internal/flags"
"github.com/flowexec/flow/cmd/internal/version"
"github.com/flowexec/flow/internal/cache"
"github.com/flowexec/flow/internal/context"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/cache"
"github.com/flowexec/flow/pkg/context"
"github.com/flowexec/flow/pkg/logger"
)

func NewRootCmd(ctx *context.Context) *cobra.Command {
Expand Down Expand Up @@ -44,6 +44,11 @@ func NewRootCmd(ctx *context.Context) *cobra.Command {
}
internal.RegisterPersistentFlag(ctx, rootCmd, *flags.LogLevel)
internal.RegisterPersistentFlag(ctx, rootCmd, *flags.SyncCacheFlag)

rootCmd.SetOut(ctx.StdOut())
rootCmd.SetErr(ctx.StdOut())
rootCmd.SetIn(ctx.StdIn())

return rootCmd
}

Expand All @@ -54,11 +59,6 @@ func Execute(ctx *context.Context, rootCmd *cobra.Command) error {
panic("root command is not initialized")
}

rootCmd.SetOut(ctx.StdOut())
rootCmd.SetErr(ctx.StdOut())
rootCmd.SetIn(ctx.StdIn())
RegisterSubCommands(ctx, rootCmd)

if err := rootCmd.Execute(); err != nil {
return fmt.Errorf("failed to execute command: %w", err)
}
Expand Down
37 changes: 0 additions & 37 deletions internal/cache/errors.go

This file was deleted.

2 changes: 1 addition & 1 deletion internal/fileparser/fileparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"
"strings"

"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/internal/utils"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/executable"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/fileparser/fileparser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"go.uber.org/mock/gomock"

"github.com/flowexec/flow/internal/fileparser"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/logger"
"github.com/flowexec/flow/types/executable"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/io/cache/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cache

import (
"github.com/flowexec/flow/internal/io/common"
"github.com/flowexec/flow/internal/logger"
"github.com/flowexec/flow/pkg/logger"
)

func PrintCache(cache map[string]string, format string) {
Expand Down
Loading
Loading