Migrate core to the vanity module path
This commit is contained in:
11
README.md
11
README.md
@@ -18,14 +18,15 @@ defines the shared visibility policy.
|
|||||||
|
|
||||||
| Module | Package | Provides |
|
| Module | Package | Provides |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `gitea.maximumdirect.net/eric/CommandKit` | `commandkit` | Typed commands, bindings, execution reporting and outcomes, help, and version. |
|
| `go.maximumdirect.net/commandkit` | `commandkit` | Typed commands, bindings, execution reporting and outcomes, help, and version. |
|
||||||
| `gitea.maximumdirect.net/eric/CommandKit/integrations/ckconfig` | `ckconfig` | ConfigKit-backed `config` scopes, including configuration source evidence. |
|
| `gitea.maximumdirect.net/eric/CommandKit/integrations/ckconfig` | `ckconfig` | ConfigKit-backed `config` scopes, including configuration source evidence. |
|
||||||
| `gitea.maximumdirect.net/eric/CommandKit/integrations/ckprompt` | `ckprompt` | PromptKit engine configuration/comparison, five catalogs, named inspection, requirements discovery, concrete request validation, and native smoke tests. |
|
| `gitea.maximumdirect.net/eric/CommandKit/integrations/ckprompt` | `ckprompt` | PromptKit engine configuration/comparison, five catalogs, named inspection, requirements discovery, concrete request validation, and native smoke tests. |
|
||||||
|
|
||||||
Importing an integration does not install commands. Pass its declaration to
|
Importing an integration does not install commands. The integrations currently
|
||||||
`commandkit.New` or `App.Register` to install it. The integrations depend on the
|
use the old core module identity and cannot be composed with the new core path.
|
||||||
core and their selected upstream libraries; the core does not depend on either
|
The planned matched releases are `go.maximumdirect.net/ckconfig v0.2.0` and
|
||||||
integration.
|
`go.maximumdirect.net/ckprompt v0.2.0`, using core v0.3.0. See the
|
||||||
|
[consumer guide](docs/consumers/guide.md#module-selection) for migration details.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|||||||
4
app.go
4
app.go
@@ -3,8 +3,8 @@ package commandkit
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/alias"
|
"go.maximumdirect.net/commandkit/internal/alias"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
// App owns one command registry and its application identity. Each App has an
|
// App owns one command registry and its application identity. Each App has an
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ValueFlag declares a singleton flag with a typed parser, optional default,
|
// ValueFlag declares a singleton flag with a typed parser, optional default,
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
yaml "go.yaml.in/yaml/v4"
|
yaml "go.yaml.in/yaml/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
const commandKitModulePath = "gitea.maximumdirect.net/eric/CommandKit"
|
const commandKitModulePath = "go.maximumdirect.net/commandkit"
|
||||||
|
|
||||||
type helpInput struct {
|
type helpInput struct {
|
||||||
Targets Supplied[[]string]
|
Targets Supplied[[]string]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ func TestCommandKitBuildIdentityProjectsEffectiveModuleVersion(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "main module tag",
|
name: "main module tag",
|
||||||
info: &debug.BuildInfo{Main: debug.Module{Path: commandKitModulePath, Version: "v1.2.3"}},
|
info: &debug.BuildInfo{Main: debug.Module{Path: "go.maximumdirect.net/commandkit", Version: "v1.2.3"}},
|
||||||
want: "v1.2.3",
|
want: "v1.2.3",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Command is an opaque, reusable declaration of canonical commands and groups.
|
// Command is an opaque, reusable declaration of canonical commands and groups.
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Completion declares opt-in shell script generation for the executable
|
// Completion declares opt-in shell script generation for the executable
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package commandkit
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
type completionContext struct {
|
type completionContext struct {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCompletionCommandContext(t *testing.T) {
|
func TestCompletionCommandContext(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package commandkit
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
type completionTargetKind uint8
|
type completionTargetKind uint8
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCompletionFlagAndValuePositions(t *testing.T) {
|
func TestCompletionFlagAndValuePositions(t *testing.T) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func completeRequest(snapshot *routingSnapshot, words []string) (commandmeta.CompletionResult, error) {
|
func completeRequest(snapshot *routingSnapshot, words []string) (commandmeta.CompletionResult, error) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCompletionQueryDispatch(t *testing.T) {
|
func TestCompletionQueryDispatch(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Existing consumer code can compare these metadata values or use them as keys.
|
// Existing consumer code can compare these metadata values or use them as keys.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandkit "gitea.maximumdirect.net/eric/CommandKit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPublicInstallationAcceptsMixedDeclarations(t *testing.T) {
|
func TestPublicInstallationAcceptsMixedDeclarations(t *testing.T) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
CommandKit is distributed as three Go modules. Start with the core and add an
|
CommandKit is distributed as three Go modules. Start with the core and add an
|
||||||
integration module only when the application uses that library. Core and
|
integration module only when the application uses that library. Core and
|
||||||
integration command factories return canonical `commandkit.Command` values.
|
compatible integration command factories return canonical `commandkit.Command` values.
|
||||||
Applications may install those alongside application-owned `RoutingRule`
|
Applications may install those alongside application-owned `RoutingRule`
|
||||||
declarations through `commandkit.New` or `App.Register`; routing rules are
|
declarations through `commandkit.New` or `App.Register`; routing rules are
|
||||||
installed at the application root, not as group children.
|
installed at the application root, not as group children.
|
||||||
@@ -11,10 +11,18 @@ installed at the application root, not as group children.
|
|||||||
|
|
||||||
| Import | Use when |
|
| Import | Use when |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `gitea.maximumdirect.net/eric/CommandKit` | The application needs typed command declarations and common CLI behavior. |
|
| `go.maximumdirect.net/commandkit` | The application needs typed command declarations and common CLI behavior. |
|
||||||
| `gitea.maximumdirect.net/eric/CommandKit/integrations/ckconfig` | The application wants ConfigKit-backed configuration scopes and reports. |
|
| `gitea.maximumdirect.net/eric/CommandKit/integrations/ckconfig` | The application wants ConfigKit-backed configuration scopes and reports. |
|
||||||
| `gitea.maximumdirect.net/eric/CommandKit/integrations/ckprompt` | The application wants PromptKit engine configuration/comparison, five catalogs, named inspection, requirements discovery, request validation, or native smoke testing. |
|
| `gitea.maximumdirect.net/eric/CommandKit/integrations/ckprompt` | The application wants PromptKit engine configuration/comparison, five catalogs, named inspection, requirements discovery, request validation, or native smoke testing. |
|
||||||
|
|
||||||
|
The integration paths in the table are their current source identities; they
|
||||||
|
use the old core path and do not compose with `go.maximumdirect.net/commandkit`.
|
||||||
|
For the new core v0.3.0 identity, the planned matched releases are
|
||||||
|
`go.maximumdirect.net/ckconfig v0.2.0` and `go.maximumdirect.net/ckprompt v0.2.0`.
|
||||||
|
Update application imports and dependency versions together when those releases
|
||||||
|
are available. Old and new core paths have distinct Go type identities.
|
||||||
|
Install the new core with `go get go.maximumdirect.net/commandkit@v0.3.0`.
|
||||||
|
|
||||||
The two integrations are independent optional imports. `ckprompt` uses the
|
The two integrations are independent optional imports. `ckprompt` uses the
|
||||||
public scope and error contracts from `ckconfig`; importing it does not add the
|
public scope and error contracts from `ckconfig`; importing it does not add the
|
||||||
`config` family. An application that wants both families passes both returned
|
`config` family. An application that wants both families passes both returned
|
||||||
@@ -44,7 +52,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
commandkit "gitea.maximumdirect.net/eric/CommandKit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GreetInput struct {
|
type GreetInput struct {
|
||||||
|
|||||||
@@ -99,7 +99,10 @@ Sibling-checkout references in retired planning records are historical review
|
|||||||
evidence, not build dependencies. Implemented contracts belong in CommandKit
|
evidence, not build dependencies. Implemented contracts belong in CommandKit
|
||||||
under their canonical owners.
|
under their canonical owners.
|
||||||
|
|
||||||
The root module does not traverse nested modules. During development, use a
|
The root module does not traverse nested modules. During the vanity-path
|
||||||
|
migration, integrations still import the old core identity and cannot compose
|
||||||
|
with the migrated root until their own module migrations are complete. After
|
||||||
|
the matched migrations, during development use a
|
||||||
local workspace for all three modules; it is ignored and must not be committed.
|
local workspace for all three modules; it is ignored and must not be committed.
|
||||||
If a local `go.work` already exists, preserve it and add these module directories:
|
If a local `go.work` already exists, preserve it and add these module directories:
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ own the optional ConfigKit and PromptKit integrations. The
|
|||||||
[architecture policy](../policy/architecture.md) owns normative boundaries;
|
[architecture policy](../policy/architecture.md) owns normative boundaries;
|
||||||
this page inventories the implemented owners.
|
this page inventories the implemented owners.
|
||||||
|
|
||||||
|
The core module now declares `go.maximumdirect.net/commandkit`. The integration
|
||||||
|
modules retain their old module and core import identities until their planned
|
||||||
|
matched releases; Go treats those identities as distinct.
|
||||||
|
|
||||||
## Root `commandkit`
|
## Root `commandkit`
|
||||||
|
|
||||||
The root facade owns captured canonical command declarations, application-owned
|
The root facade owns captured canonical command declarations, application-owned
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
CommandKit v0.3.0 adds application-owned command and flag aliases and shared
|
CommandKit v0.3.0 moves core to `go.maximumdirect.net/commandkit`, adds
|
||||||
invocation reporting. This pre-1.0 minor release also updates the installation
|
application-owned command and flag aliases, shared invocation reporting, and
|
||||||
|
shell completion. This pre-1.0 minor release also updates the installation
|
||||||
declaration type and Invocation struct shape, replaces the error-first outcome
|
declaration type and Invocation struct shape, replaces the error-first outcome
|
||||||
and diagnostic-delivery APIs, and reserves reporting flag names; review the
|
and diagnostic-delivery APIs, and reserves reporting flag names; review the
|
||||||
migration guidance before upgrading.
|
migration guidance before upgrading.
|
||||||
@@ -27,9 +28,22 @@ migration guidance before upgrading.
|
|||||||
`Outcome.WithExplanation`; attach an optional operation error separately with
|
`Outcome.WithExplanation`; attach an optional operation error separately with
|
||||||
`Outcome.WithCause`. Returned `Outcome.Presentation` records output and
|
`Outcome.WithCause`. Returned `Outcome.Presentation` records output and
|
||||||
diagnostic delivery observations without changing the operation cause.
|
diagnostic delivery observations without changing the operation cause.
|
||||||
|
- Install the optional `Completion` command and declare static choices or
|
||||||
|
path hints for interactive shell completion. Bash, Zsh, and Fish scripts
|
||||||
|
use the application's captured commands and routing metadata.
|
||||||
|
- Maintainer release tooling now uses the root-selected ReleaseKit v0.9.0 tool,
|
||||||
|
with separate source publication and optional page-only hosted delivery.
|
||||||
|
|
||||||
## Compatibility and migration
|
## Compatibility and migration
|
||||||
|
|
||||||
|
Change core imports from `gitea.maximumdirect.net/eric/CommandKit` to
|
||||||
|
`go.maximumdirect.net/commandkit` and select v0.3.0. These paths identify
|
||||||
|
different Go packages, so their types cannot be mixed. Applications using the
|
||||||
|
integrations should migrate together to the forthcoming matched
|
||||||
|
`go.maximumdirect.net/ckconfig v0.2.0` and
|
||||||
|
`go.maximumdirect.net/ckprompt v0.2.0` releases, which depend on the new core;
|
||||||
|
the existing integration releases retain their old identities.
|
||||||
|
|
||||||
`New` and `App.Register` now accept `...Declaration` instead of `...Command`.
|
`New` and `App.Register` now accept `...Declaration` instead of `...Command`.
|
||||||
Command, group, and integration command factories still return `Command`, so
|
Command, group, and integration command factories still return `Command`, so
|
||||||
individual factory calls can be passed directly. A `[]Command` cannot be
|
individual factory calls can be passed directly. A `[]Command` cannot be
|
||||||
@@ -65,10 +79,10 @@ remains Go 1.26.8. Core v0.3.0 must be published before preparing dependent
|
|||||||
integration releases that adopt it and record downloaded dependency sums; this
|
integration releases that adopt it and record downloaded dependency sums; this
|
||||||
release does not change their v0.1.0 release records.
|
release does not change their v0.1.0 release records.
|
||||||
|
|
||||||
See the [consumer guide](https://gitea.maximumdirect.net/eric/CommandKit/src/tag/v0.3.0/docs/consumers/guide.md),
|
See the [consumer guide](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.3.0/docs/consumers/guide.md),
|
||||||
[CLI reference](https://gitea.maximumdirect.net/eric/CommandKit/src/tag/v0.3.0/docs/cli.md),
|
[CLI reference](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.3.0/docs/cli.md),
|
||||||
and [maintainer release procedure](https://gitea.maximumdirect.net/eric/CommandKit/src/tag/v0.3.0/docs/release.md).
|
and [maintainer release procedure](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.3.0/docs/release.md).
|
||||||
|
|
||||||
[COPYRIGHT](https://gitea.maximumdirect.net/eric/CommandKit/src/tag/v0.3.0/COPYRIGHT) |
|
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.3.0/COPYRIGHT) |
|
||||||
[LICENSE](https://gitea.maximumdirect.net/eric/CommandKit/src/tag/v0.3.0/LICENSE) |
|
[LICENSE](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.3.0/LICENSE) |
|
||||||
[ATTRIBUTION](https://gitea.maximumdirect.net/eric/CommandKit/src/tag/v0.3.0/docs/oss/attribution.md)
|
[ATTRIBUTION](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.3.0/docs/oss/attribution.md)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# CommandKit vanity migration and dependency alignment plan
|
# CommandKit vanity migration and dependency alignment plan
|
||||||
|
|
||||||
Status: planned; Stages 1–7 are not started.
|
Status: Stage 1 complete; Stages 2–7 are not started.
|
||||||
|
|
||||||
This plan is for the Luna coding agent implementing the
|
This plan is for the Luna coding agent implementing the
|
||||||
[feature roadmap](integration-dependency-alignment.md). Follow the stages in
|
[feature roadmap](integration-dependency-alignment.md). Follow the stages in
|
||||||
@@ -100,7 +100,10 @@ than permanently changing proxy settings. Retain authentic downloaded sums.
|
|||||||
|
|
||||||
## Stage 1: Migrate core identity and prepare its release candidate
|
## Stage 1: Migrate core identity and prepare its release candidate
|
||||||
|
|
||||||
**Status:** not started.
|
**Completed.** The root module, owned imports, component build identity,
|
||||||
|
consumer guidance, and v0.3.0 release note use the new core identity. The
|
||||||
|
focused build-identity test passed offline with Go 1.26.8; affected links and
|
||||||
|
whitespace were checked. The complete candidate suite belongs to publication.
|
||||||
|
|
||||||
1. Change only the root module declaration to `go.maximumdirect.net/commandkit`.
|
1. Change only the root module declaration to `go.maximumdirect.net/commandkit`.
|
||||||
Migrate root-owned imports in production files, root/external tests, internal
|
Migrate root-owned imports in production files, root/external tests, internal
|
||||||
|
|||||||
@@ -24,8 +24,10 @@ Bash. Build it with the basename shown above, load
|
|||||||
the script for your shell using the [CLI reference](../../docs/cli.md#shell-completion),
|
the script for your shell using the [CLI reference](../../docs/cli.md#shell-completion),
|
||||||
and try completing `core-example report d` or `core-example ws gr`.
|
and try completing `core-example report d` or `core-example ws gr`.
|
||||||
|
|
||||||
Integration factories also return `commandkit.Command` and can be passed
|
Compatible integration factories also return `commandkit.Command` and can be
|
||||||
directly to `New` beside `commandkit.Alias` or flag-alias declarations. For a
|
passed directly to `New` beside `commandkit.Alias` or flag-alias declarations.
|
||||||
|
The current integrations still use the old core identity; the planned matched
|
||||||
|
vanity-path releases will use the new core identity. For a
|
||||||
command-only `[]commandkit.Command`, convert its elements into a
|
command-only `[]commandkit.Command`, convert its elements into a
|
||||||
`[]commandkit.Declaration` before appending routing rules; Go cannot expand the
|
`[]commandkit.Declaration` before appending routing rules; Go cannot expand the
|
||||||
command slice as `...commandkit.Declaration`. The
|
command slice as `...commandkit.Declaration`. The
|
||||||
@@ -33,7 +35,5 @@ command slice as `...commandkit.Declaration`. The
|
|||||||
shows both forms, and the [composed consumer](../../integrations/ckprompt/examples/composed)
|
shows both forms, and the [composed consumer](../../integrations/ckprompt/examples/composed)
|
||||||
is the maintained integration example.
|
is the maintained integration example.
|
||||||
|
|
||||||
These aliases use the current local CommandKit source. Published CommandKit
|
These aliases require core v0.3.0. Repository contributors can run its test with
|
||||||
v0.2.0 does not include alias declarations; consumers can use them after the
|
|
||||||
next core release. Repository contributors can run its test with
|
|
||||||
`go test ./examples/core` from the root.
|
`go test ./examples/core` from the root.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
commandkit "gitea.maximumdirect.net/eric/CommandKit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
type greetInput struct {
|
type greetInput struct {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandkit "gitea.maximumdirect.net/eric/CommandKit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAliasesReachCoreExampleCommand(t *testing.T) {
|
func TestAliasesReachCoreExampleCommand(t *testing.T) {
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Execute parses and dispatches one invocation. args excludes the executable
|
// Execute parses and dispatches one invocation. args excludes the executable
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandkit "gitea.maximumdirect.net/eric/CommandKit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestExecuteRunsTypedCommandsWithFreshInvocationState(t *testing.T) {
|
func TestExecuteRunsTypedCommandsWithFreshInvocationState(t *testing.T) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
type resolvedFlagAlias struct {
|
type resolvedFlagAlias struct {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flagAliasCommand(name string, flags ...Flag[struct{}]) Command {
|
func flagAliasCommand(name string, flags ...Flag[struct{}]) Command {
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module gitea.maximumdirect.net/eric/CommandKit
|
module go.maximumdirect.net/commandkit
|
||||||
|
|
||||||
go 1.26.0
|
go 1.26.0
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package commandkit
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *App) helpView(route routeResult, snapshot *routingSnapshot) commandmeta.HelpView {
|
func (a *App) helpView(route routeResult, snapshot *routingSnapshot) commandmeta.HelpView {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package alias
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
type symbolKind uint8
|
type symbolKind uint8
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestResolveWithProvenanceCarriesInputOriginsThroughChains(t *testing.T) {
|
func TestResolveWithProvenanceCarriesInputOriginsThroughChains(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package alias
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mapping replaces Source with Target when Source is the longest matching
|
// Mapping replaces Source with Target when Source is the longest matching
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestResolverUsesLongestTokenPrefixAndPreservesSuffix(t *testing.T) {
|
func TestResolverUsesLongestTokenPrefixAndPreservesSuffix(t *testing.T) {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
|
||||||
spfcobra "github.com/spf13/cobra"
|
spfcobra "github.com/spf13/cobra"
|
||||||
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CompletionQueryToken is the hidden request understood by generated scripts.
|
// CompletionQueryToken is the hidden request understood by generated scripts.
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
|
||||||
spfcobra "github.com/spf13/cobra"
|
spfcobra "github.com/spf13/cobra"
|
||||||
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCompletionScriptGeneration(t *testing.T) {
|
func TestCompletionScriptGeneration(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func interpretFlagTokens(argv []string, flags []commandmeta.Flag, aliases []commandmeta.FlagAlias) ([]string, map[string][]string, []commandmeta.FlagOccurrence, *commandmeta.Failure) {
|
func interpretFlagTokens(argv []string, flags []commandmeta.Flag, aliases []commandmeta.FlagAlias) ([]string, map[string][]string, []commandmeta.FlagOccurrence, *commandmeta.Failure) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flagGrammarTree() *commandmeta.Command {
|
func flagGrammarTree() *commandmeta.Command {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
|
|
||||||
spfcobra "github.com/spf13/cobra"
|
spfcobra "github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
|
||||||
spfcobra "github.com/spf13/cobra"
|
spfcobra "github.com/spf13/cobra"
|
||||||
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Command = commandmeta.Command
|
type Command = commandmeta.Command
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *App) parse(args []string, options commandmeta.ParseOptions) commandmeta.Result {
|
func (a *App) parse(args []string, options commandmeta.ParseOptions) commandmeta.Result {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newReportingParseApp(t *testing.T) *App {
|
func newReportingParseApp(t *testing.T) *App {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAppParseUsesRegisteredBindingsWithTheAdapter(t *testing.T) {
|
func TestAppParseUsesRegisteredBindingsWithTheAdapter(t *testing.T) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
commandkit "gitea.maximumdirect.net/eric/CommandKit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
var performanceUsageCause = errors.New("benchmark usage result")
|
var performanceUsageCause = errors.New("benchmark usage result")
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
internalalias "gitea.maximumdirect.net/eric/CommandKit/internal/alias"
|
internalalias "go.maximumdirect.net/commandkit/internal/alias"
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
"go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Register adds a batch of canonical commands and routing rules to the
|
// Register adds a batch of canonical commands and routing rules to the
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
type registryInput struct{ value string }
|
type registryInput struct{ value string }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
commandmeta "gitea.maximumdirect.net/eric/CommandKit/internal/commandmeta"
|
commandmeta "go.maximumdirect.net/commandkit/internal/commandmeta"
|
||||||
)
|
)
|
||||||
|
|
||||||
type reportingMode uint8
|
type reportingMode uint8
|
||||||
|
|||||||
2
route.go
2
route.go
@@ -3,7 +3,7 @@ package commandkit
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.maximumdirect.net/eric/CommandKit/internal/commandpath"
|
"go.maximumdirect.net/commandkit/internal/commandpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
type routeKind uint8
|
type routeKind uint8
|
||||||
|
|||||||
4
testdata/completion/main.go
vendored
4
testdata/completion/main.go
vendored
@@ -6,8 +6,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
commandkit "gitea.maximumdirect.net/eric/CommandKit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
internalcobra "gitea.maximumdirect.net/eric/CommandKit/internal/cobra"
|
internalcobra "go.maximumdirect.net/commandkit/internal/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user