Skip to content

Commit 2e77f11

Browse files
kernel-internal[bot]cursoragentsjmiller609
authored
CLI: Update hypeman SDK to 121774f79f5d and add new commands/flags (#42)
* CLI: Update Hypeman Go SDK to fae578c6868a3ad232e67a8bd323b9fb307451d3 Update hypeman-go dependency from v0.11.0 to v0.11.1. A full enumeration of SDK methods and CLI commands was performed. No coverage gaps were found - all SDK methods have corresponding CLI commands and all param fields have corresponding flags. Co-authored-by: Cursor <cursoragent@cursor.com> * CLI: Update hypeman SDK to 40bbd485e7 and add --state/--metadata flags to ps - Updated hypeman-go to v0.12.0 (40bbd485e7a89cd21ae08554502e9dedf4999efc) - Added --state flag to `hypeman ps` for server-side state filtering - Added --metadata flag to `hypeman ps` for metadata key-value filtering - Updated Instances.List calls to pass InstanceListParams (new required param) Made-with: Cursor * CLI: Update hypeman SDK to 1f34cf2541 and add --cpus/--memory flags to build Update hypeman-go SDK from v0.12.0 to v0.13.0 (1f34cf2541337d9ec4a39f74581bba9cdcb1ec1b). Add missing CLI flags for BuildNewParams fields: - --cpus: Number of vCPUs for builder VM - --memory: Memory limit for builder VM in MB Made-with: Cursor * CLI: Update Hypeman Go SDK to 9cd8f5ca0926682c2f1c1148adf3f5d1e289b7f6 Update hypeman-go dependency from v0.13.0 to v0.14.0. Full coverage analysis performed: all SDK methods have corresponding CLI commands and all param fields have corresponding CLI flags. No coverage gaps found. Made-with: Cursor * fix ps filtering and metadata handling * add inspect and fork commands with sdk-based calls * Hide envs by default on output * show id of forked vm * CLI: Update hypeman SDK to 121774f79f5d and add stats command - Updated hypeman-go SDK to 121774f79f5d404da0acba442e011c9d5f9710fb - Added `hypeman stats <instance>` command for real-time resource utilization - Refactored fork command to use SDK's InstanceForkParams instead of custom struct Made-with: Cursor * Remove stats command from CLI --------- Co-authored-by: kernel-internal[bot] <260533166+kernel-internal[bot]@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Steven Miller <sjmiller609@gmail.com>
1 parent b3961ad commit 2e77f11

3 files changed

Lines changed: 8 additions & 16 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/google/go-containerregistry v0.20.7
1111
github.com/gorilla/websocket v1.5.3
1212
github.com/itchyny/json2yaml v0.1.4
13-
github.com/kernel/hypeman-go v0.14.0
13+
github.com/kernel/hypeman-go v0.15.0
1414
github.com/knadh/koanf/parsers/yaml v1.1.0
1515
github.com/knadh/koanf/providers/env v1.1.0
1616
github.com/knadh/koanf/providers/file v1.2.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnV
7676
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
7777
github.com/itchyny/json2yaml v0.1.4 h1:/pErVOXGG5iTyXHi/QKR4y3uzhLjGTEmmJIy97YT+k8=
7878
github.com/itchyny/json2yaml v0.1.4/go.mod h1:6iudhBZdarpjLFRNj+clWLAkGft+9uCcjAZYXUH9eGI=
79-
github.com/kernel/hypeman-go v0.14.0 h1:FeeVJly5TzkAYZdxuSfn/8Sz5qZZtUlPQQvUQOAOhg4=
80-
github.com/kernel/hypeman-go v0.14.0/go.mod h1:guRrhyP9QW/ebUS1UcZ0uZLLJeGAAhDNzSi68U4M9hI=
79+
github.com/kernel/hypeman-go v0.15.0 h1:igcd8tArES1FMbuzEGjQ9HqPF3Zwi6yAvHoE4dkKx4Y=
80+
github.com/kernel/hypeman-go v0.15.0/go.mod h1:guRrhyP9QW/ebUS1UcZ0uZLLJeGAAhDNzSi68U4M9hI=
8181
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
8282
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
8383
github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=

pkg/cmd/fork.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@ func handleFork(ctx context.Context, cmd *cli.Command) error {
5656
opts = append(opts, debugMiddlewareOption)
5757
}
5858

59-
params := instanceForkParams{
59+
params := hypeman.InstanceForkParams{
6060
Name: targetName,
6161
}
6262
if cmd.IsSet("from-running") {
63-
fromRunning := cmd.Bool("from-running")
64-
params.FromRunning = &fromRunning
63+
params.FromRunning = hypeman.Opt(cmd.Bool("from-running"))
6564
}
6665
if targetState != "" {
67-
params.TargetState = &targetState
66+
params.TargetState = hypeman.InstanceForkParamsTargetState(targetState)
6867
}
6968

7069
fmt.Fprintf(os.Stderr, "Forking %s to %s...\n", source, targetName)
@@ -77,8 +76,8 @@ func handleFork(ctx context.Context, cmd *cli.Command) error {
7776
opts = append(opts, option.WithResponseBodyInto(&raw))
7877
}
7978

80-
var forked hypeman.Instance
81-
if err := client.Post(ctx, fmt.Sprintf("instances/%s/fork", sourceID), params, &forked, opts...); err != nil {
79+
forked, err := client.Instances.Fork(ctx, sourceID, params, opts...)
80+
if err != nil {
8281
return err
8382
}
8483

@@ -87,7 +86,6 @@ func handleFork(ctx context.Context, cmd *cli.Command) error {
8786
return ShowJSON(os.Stdout, "instance fork", obj, format, transform)
8887
}
8988

90-
// Output instance ID (useful for scripting)
9189
fmt.Println(forked.ID)
9290
fmt.Fprintf(os.Stderr, "Forked %s as %s (state: %s)\n", source, forked.Name, forked.State)
9391
return nil
@@ -107,9 +105,3 @@ func normalizeForkTargetState(state string) (string, error) {
107105
return "", fmt.Errorf("invalid target state: %s (must be Stopped, Standby, or Running)", state)
108106
}
109107
}
110-
111-
type instanceForkParams struct {
112-
Name string `json:"name"`
113-
FromRunning *bool `json:"from_running,omitempty"`
114-
TargetState *string `json:"target_state,omitempty"`
115-
}

0 commit comments

Comments
 (0)