Skip to content

Commit c27194e

Browse files
authored
fix(go-migration): apply Crane parity gate fixes
Apply Crane Iteration 81/82 Go migration fixes, finish option parity, and keep hidden Python Click options hidden from Go help.
1 parent 9686d17 commit c27194e

15 files changed

Lines changed: 13669 additions & 30799 deletions

cmd/apm/cmd_config.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ func runConfigGet(args []string) int {
111111
fmt.Fprintf(os.Stderr, "[>] Valid keys: auto-integrate, temp-dir\n")
112112
return 1
113113
}
114+
path := configPath()
115+
if val, found := readConfigKey(path, key); found {
116+
fmt.Printf("%s: %s\n", key, val)
117+
return 0
118+
}
119+
// Return default when key is not set in config file.
114120
switch key {
115121
case "auto-integrate":
116122
fmt.Printf("auto-integrate: true\n")
@@ -140,6 +146,15 @@ func runConfigUnset(args []string) int {
140146
fmt.Fprintf(os.Stderr, "[>] Valid keys: auto-integrate, temp-dir\n")
141147
return 1
142148
}
149+
path := configPath()
150+
if path == "" {
151+
fmt.Fprintf(os.Stderr, "[x] Could not determine config path.\n")
152+
return 1
153+
}
154+
if err := removeConfigKey(path, key); err != nil {
155+
fmt.Fprintf(os.Stderr, "[x] Failed to update config: %v\n", err)
156+
return 1
157+
}
143158
fmt.Printf("[+] Config unset: %s\n", key)
144159
return 0
145160
}

cmd/apm/cmd_deps.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ func runDepsList(args []string) int {
6868
fmt.Println(" List installed APM dependencies")
6969
fmt.Println()
7070
fmt.Println("Options:")
71+
fmt.Println(" -g, --global List user-scope dependencies")
72+
fmt.Println(" --all Include all dependency scopes")
73+
fmt.Println(" --insecure Include insecure dependencies")
7174
fmt.Println(" --help Show this message and exit.")
7275
return 0
7376
}
@@ -121,6 +124,7 @@ func runDepsTree(args []string) int {
121124
fmt.Println(" Show dependency tree structure")
122125
fmt.Println()
123126
fmt.Println("Options:")
127+
fmt.Println(" -g, --global Show user-scope dependency tree")
124128
fmt.Println(" --help Show this message and exit.")
125129
return 0
126130
}
@@ -218,6 +222,8 @@ func runDepsClean(args []string) int {
218222
fmt.Println(" Remove all APM dependencies")
219223
fmt.Println()
220224
fmt.Println("Options:")
225+
fmt.Println(" --dry-run Show what would be removed without removing")
226+
fmt.Println(" --yes, -y Skip confirmation prompt")
221227
fmt.Println(" --help Show this message and exit.")
222228
return 0
223229
}
@@ -254,6 +260,12 @@ func runDepsUpdate(args []string) int {
254260
fmt.Println(" Update APM dependencies to latest refs")
255261
fmt.Println()
256262
fmt.Println("Options:")
263+
fmt.Println(" --verbose, -v Show detailed output")
264+
fmt.Println(" --force Force dependency refresh")
265+
fmt.Println(" --target, -t TARGET Target harness to update")
266+
fmt.Println(" --parallel-downloads INTEGER Max concurrent downloads")
267+
fmt.Println(" --global, -g Update user-scope dependencies")
268+
fmt.Println(" --legacy-skill-paths Use legacy per-client skill paths")
257269
fmt.Println(" --help Show this message and exit.")
258270
return 0
259271
}

cmd/apm/cmd_lockfile.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,38 @@ func writeConfigKey(path, key, value string) error {
271271
}
272272
return os.WriteFile(path, []byte(newContent), 0o644)
273273
}
274+
275+
// readConfigKey reads a top-level key from a simple YAML config file.
276+
// Returns the value and true if found, or empty string and false if not.
277+
func readConfigKey(path, key string) (string, bool) {
278+
data, err := os.ReadFile(path)
279+
if err != nil {
280+
return "", false
281+
}
282+
prefix := key + ":"
283+
for _, line := range strings.Split(string(data), "\n") {
284+
trimmed := strings.TrimSpace(line)
285+
if strings.HasPrefix(trimmed, prefix) {
286+
val := strings.TrimSpace(trimmed[len(prefix):])
287+
return val, true
288+
}
289+
}
290+
return "", false
291+
}
292+
293+
// removeConfigKey removes a top-level key line from a simple YAML config file.
294+
func removeConfigKey(path, key string) error {
295+
data, err := os.ReadFile(path)
296+
if err != nil {
297+
return nil // nothing to remove if file doesn't exist
298+
}
299+
prefix := key + ":"
300+
lines := strings.Split(string(data), "\n")
301+
var out []string
302+
for _, l := range lines {
303+
if !strings.HasPrefix(strings.TrimSpace(l), prefix) {
304+
out = append(out, l)
305+
}
306+
}
307+
return os.WriteFile(path, []byte(strings.Join(out, "\n")), 0o644)
308+
}

0 commit comments

Comments
 (0)