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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ below describes the current layout as the migration proceeds.
- `internal/testutil/console/` contains shared synthetic Windows console records
and observer fixtures used only by native feature tests.
- `internal/app/` owns invocation, request-environment scope, completion setup,
output policy, and exit-status selection. Command assembly still uses the
output policy, help assembly, and exit-status selection. Command assembly still uses the
existing generated tree during the layout migration.
- `api_reference/openapi.transformed.yml` contains the OpenAPI specification
used by the mock server.
Expand Down
3 changes: 2 additions & 1 deletion cmd/openai/error_coverage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/openai/openai-cli/generated/commands"
"github.com/openai/openai-cli/internal/app"
"github.com/openai/openai-cli/internal/requestflag"
"github.com/openai/openai-cli/pkg/custom"
"github.com/urfave/cli/v3"
Expand Down Expand Up @@ -310,7 +311,7 @@ func TestMainErrorCoverageManifestProcess(t *testing.T) {
}
root := commands.Command
root.Flags = append(root.Flags, custom.NewRequestHeaderFlag())
if _, _, err := custom.ConfigureHelp(root, []string{"openai", "--help"}); err != nil {
if _, _, err := app.ConfigureHelp(root, []string{"openai", "--help"}); err != nil {
t.Fatal(err)
}
custom.ConfigureCommandErrors(root)
Expand Down
4 changes: 4 additions & 0 deletions docs/architecture/repository-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,7 @@ entrypoint contracts, check platform compilation, and verify that generated file
and dependency manifests are untouched. For generator changes, additionally
verify regenerated snapshots and a repeat generation with no unexplained drift.
Keep release, signing, CODEOWNER, merge-queue, and trusted-main controls intact.

Help assembly and its contracts live in `internal/app/`: root flag descriptions,
feature help content, flag groups, and admin setup guidance are configured there
in the existing order. Rendering remains in `internal/clihelp/`.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package custom
package app

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/custom/help.go → internal/app/help.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package custom
package app

import (
"strings"
Expand Down
9 changes: 5 additions & 4 deletions pkg/custom/help_test.go → internal/app/help_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package custom
package app

import (
"bytes"
Expand All @@ -11,6 +11,7 @@ import (
imagecommands "github.com/openai/openai-cli/internal/commands/images"
requestconfig "github.com/openai/openai-cli/internal/request"
"github.com/openai/openai-cli/internal/requestflag"
"github.com/openai/openai-cli/pkg/custom"
"github.com/urfave/cli/v3"
)

Expand Down Expand Up @@ -156,9 +157,9 @@ func TestConfigureHelpPreservesImageGuidance(t *testing.T) {
{Name: "unrelated", Description: "Keep this description", CustomHelpTemplate: "Keep this template"},
}}
root := &cli.Command{Name: "openai", Commands: []*cli.Command{images}}
imagecommands.ConfigureSaving(root, ImageSavingOptions())
imagecommands.RegisterPreview(root, ImagePreviewOptions())
imagecommands.RegisterModels(root, ImageModelOptions())
imagecommands.ConfigureSaving(root, custom.ImageSavingOptions())
imagecommands.RegisterPreview(root, custom.ImagePreviewOptions())
imagecommands.RegisterModels(root, custom.ImageModelOptions())
wantGuidance := map[string][]string{
"generate": {"interactive terminal", "picker reopens", "Ctrl+C exits", "~/Downloads/gpt-images/", "--format json", "without --name or --output-dir", "depend on the model"},
"edit": {"Replace photo.png", "Keeps your original", "~/Downloads/gpt-images/", "existing folder", "--format json", "depend on the model"},
Expand Down
2 changes: 1 addition & 1 deletion internal/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Run(ctx context.Context, argv []string) int {
prepareForAutocomplete(app)
}

args, _, err := custom.ConfigureHelp(app, argv)
args, _, err := ConfigureHelp(app, argv)
custom.ConfigureCommandErrors(app)

if err == nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/clihelp/request_inputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"strings"
"testing"

"github.com/openai/openai-cli/internal/app"
"github.com/openai/openai-cli/internal/clihelp"
localcommands "github.com/openai/openai-cli/internal/commands"
"github.com/openai/openai-cli/internal/requestflag"
"github.com/openai/openai-cli/pkg/custom"
"github.com/urfave/cli/v3"
)

Expand Down Expand Up @@ -55,7 +55,7 @@ func TestDescribeRequestInputsSurvivesResourceCloning(t *testing.T) {
clihelp.DescribeRequestInputs(root)
localcommands.ConfigureSubgroups(root)
args := append(append([]string{"openai"}, path...), "--help")
args, _, err := custom.ConfigureHelp(root, args)
args, _, err := app.ConfigureHelp(root, args)
if err != nil {
t.Fatal(err)
}
Expand Down
Loading