Skip to content
Draft
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
1 change: 1 addition & 0 deletions cli/azd/extensions/azure.ai.agents/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ capabilities:
- lifecycle-events
- mcp-server
- service-target-provider
- metadata
providers:
- name: azure.ai.agent
type: service-target
Expand Down
3 changes: 2 additions & 1 deletion cli/azd/extensions/azure.ai.agents/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices v1.8.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0
github.com/azure/azure-dev/cli/azd v0.0.0-20260109002911-7e0ee49fe5ac
github.com/azure/azure-dev/cli/azd v0.0.0-20260116183934-428498d0f124
github.com/braydonk/yaml v0.9.0
github.com/drone/envsubst v1.0.3
github.com/fatih/color v1.18.0
Expand Down Expand Up @@ -74,6 +74,7 @@ require (
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/stretchr/testify v1.11.1 // indirect
Expand Down
6 changes: 4 additions & 2 deletions cli/azd/extensions/azure.ai.agents/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWp
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/azure/azure-dev/cli/azd v0.0.0-20260109002911-7e0ee49fe5ac h1:ow5lGEF+3dB4Jps7EVWvQKb46/sXK4GzDexumF1bjuI=
github.com/azure/azure-dev/cli/azd v0.0.0-20260109002911-7e0ee49fe5ac/go.mod h1:j+bdvNwQPdYtSfFe/xbfWqYr8Guw9hiP1JOVpIBERj0=
github.com/azure/azure-dev/cli/azd v0.0.0-20260116183934-428498d0f124 h1:V3jGfHri9K94pW8BjnPB3RmZkKHkXcwe9naOHR63P8A=
github.com/azure/azure-dev/cli/azd v0.0.0-20260116183934-428498d0f124/go.mod h1:j+bdvNwQPdYtSfFe/xbfWqYr8Guw9hiP1JOVpIBERj0=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
Expand Down Expand Up @@ -192,6 +192,8 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
Expand Down
9 changes: 9 additions & 0 deletions cli/azd/extensions/azure.ai.agents/internal/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"net/url"
"os"
Expand Down Expand Up @@ -99,6 +100,14 @@ func newInitCommand(rootFlags rootFlagsDefinition) *cobra.Command {
}
defer azdClient.Close()

// Wait for debugger if AZD_EXT_DEBUG is set
if err := azdext.WaitForDebugger(ctx, azdClient); err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, azdext.ErrDebuggerAborted) {
return nil
}
return fmt.Errorf("failed waiting for debugger: %w", err)
}

azureContext, projectConfig, environment, err := ensureAzureContext(ctx, flags, azdClient)
if err != nil {
return fmt.Errorf("failed to ground into a project context: %w", err)
Expand Down
40 changes: 40 additions & 0 deletions cli/azd/extensions/azure.ai.agents/internal/cmd/metadata.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package cmd

import (
"encoding/json"
"fmt"

"github.com/azure/azure-dev/cli/azd/pkg/azdext"
"github.com/spf13/cobra"
)

func newMetadataCommand() *cobra.Command {
return &cobra.Command{
Use: "metadata",
Short: "Generate extension metadata including command structure and configuration schemas",
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
// Get root command for metadata generation
rootCmd := cmd.Root()

// Generate extension metadata with commands and configuration
metadata := azdext.GenerateExtensionMetadata(
"1.0", // schema version
"azure.ai.agents", // extension id
rootCmd,
)

// Output as JSON
jsonBytes, err := json.MarshalIndent(metadata, "", " ")
if err != nil {
return fmt.Errorf("failed to marshal metadata: %w", err)
}

fmt.Println(string(jsonBytes))
return nil
},
}
}
1 change: 1 addition & 0 deletions cli/azd/extensions/azure.ai.agents/internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func NewRootCommand() *cobra.Command {
rootCmd.AddCommand(newVersionCommand())
rootCmd.AddCommand(newInitCommand(rootFlags))
rootCmd.AddCommand(newMcpCommand())
rootCmd.AddCommand(newMetadataCommand())

return rootCmd
}
1 change: 1 addition & 0 deletions cli/azd/extensions/azure.ai.finetune/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version: 0.0.8-preview
language: go
capabilities:
- custom-commands
- metadata
examples:
- name: init
description: Initialize a new AI fine-tuning project.
Expand Down
12 changes: 9 additions & 3 deletions cli/azd/extensions/azure.ai.finetune/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices v1.8.0
github.com/azure/azure-dev/cli/azd v0.0.0-20260108010518-45071d9a61bc
github.com/azure/azure-dev/cli/azd v0.0.0-20260116183934-428498d0f124
github.com/braydonk/yaml v0.9.0
github.com/fatih/color v1.18.0
github.com/openai/openai-go/v3 v3.2.0
github.com/sethvargo/go-retry v0.3.0
github.com/spf13/cobra v1.10.1
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand All @@ -23,8 +25,10 @@ require (
github.com/alecthomas/chroma/v2 v2.20.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/buger/goterm v1.0.4 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/charmbracelet/colorprofile v0.3.2 // indirect
github.com/charmbracelet/glamour v0.10.0 // indirect
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 // indirect
Expand All @@ -44,10 +48,12 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/mailru/easyjson v0.9.1 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.19 // indirect
Expand All @@ -61,14 +67,15 @@ require (
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/stretchr/testify v1.11.1 // indirect
github.com/theckman/yacspin v0.13.12 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yuin/goldmark v1.7.13 // indirect
github.com/yuin/goldmark-emoji v1.0.6 // indirect
Expand All @@ -86,5 +93,4 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20251007200510-49b9836ed3ff // indirect
google.golang.org/grpc v1.76.0 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
16 changes: 14 additions & 2 deletions cli/azd/extensions/azure.ai.finetune/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWp
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/azure/azure-dev/cli/azd v0.0.0-20260108010518-45071d9a61bc h1:Wei/1LT53Ojk96VwCL2SEXU9HxVtqU+a2DdAqYsLQlQ=
github.com/azure/azure-dev/cli/azd v0.0.0-20260108010518-45071d9a61bc/go.mod h1:j+bdvNwQPdYtSfFe/xbfWqYr8Guw9hiP1JOVpIBERj0=
github.com/azure/azure-dev/cli/azd v0.0.0-20260116183934-428498d0f124 h1:V3jGfHri9K94pW8BjnPB3RmZkKHkXcwe9naOHR63P8A=
github.com/azure/azure-dev/cli/azd v0.0.0-20260116183934-428498d0f124/go.mod h1:j+bdvNwQPdYtSfFe/xbfWqYr8Guw9hiP1JOVpIBERj0=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
Expand All @@ -47,6 +49,8 @@ github.com/braydonk/yaml v0.9.0 h1:ewGMrVmEVpsm3VwXQDR388sLg5+aQ8Yihp6/hc4m+h4=
github.com/braydonk/yaml v0.9.0/go.mod h1:hcm3h581tudlirk8XEUPDBAimBPbmnL0Y45hCRl47N4=
github.com/buger/goterm v1.0.4 h1:Z9YvGmOih81P0FbVtEYTFF6YsSgxSUKEhf/f9bTMXbY=
github.com/buger/goterm v1.0.4/go.mod h1:HiFWV3xnkolgrBV3mY8m0X0Pumt4zg4QhbdOzQtB8tE=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/charmbracelet/colorprofile v0.3.2 h1:9J27WdztfJQVAQKX2WOlSSRB+5gaKqqITmrvb1uTIiI=
github.com/charmbracelet/colorprofile v0.3.2/go.mod h1:mTD5XzNeWHj8oqHb+S1bssQb7vIHbepiebQ2kPKVKbI=
github.com/charmbracelet/glamour v0.10.0 h1:MtZvfwsYCx8jEPFJm3rIBFIMZUfUJ765oX8V6kXldcY=
Expand Down Expand Up @@ -108,6 +112,8 @@ github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4Dvx
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E=
github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
Expand All @@ -125,6 +131,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=
github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
Expand Down Expand Up @@ -166,6 +174,8 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
Expand Down Expand Up @@ -199,6 +209,8 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
Expand Down
9 changes: 9 additions & 0 deletions cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package cmd
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/url"
"os"
Expand Down Expand Up @@ -81,6 +82,14 @@ func newInitCommand(rootFlags rootFlagsDefinition) *cobra.Command {
}
defer azdClient.Close()

// Wait for debugger if AZD_EXT_DEBUG is set
if err := azdext.WaitForDebugger(ctx, azdClient); err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, azdext.ErrDebuggerAborted) {
return nil
}
return fmt.Errorf("failed waiting for debugger: %w", err)
}

azureContext, projectConfig, environment, err := ensureAzureContext(ctx, flags, azdClient)
if err != nil {
return fmt.Errorf("failed to ground into a project context: %w", err)
Expand Down
40 changes: 40 additions & 0 deletions cli/azd/extensions/azure.ai.finetune/internal/cmd/metadata.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package cmd

import (
"encoding/json"
"fmt"

"github.com/azure/azure-dev/cli/azd/pkg/azdext"
"github.com/spf13/cobra"
)

func newMetadataCommand() *cobra.Command {
return &cobra.Command{
Use: "metadata",
Short: "Generate extension metadata including command structure and configuration schemas",
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
// Get root command for metadata generation
rootCmd := cmd.Root()

// Generate extension metadata with commands and configuration
metadata := azdext.GenerateExtensionMetadata(
"1.0", // schema version
"azure.ai.finetune", // extension id
rootCmd,
)

// Output as JSON
jsonBytes, err := json.MarshalIndent(metadata, "", " ")
if err != nil {
return fmt.Errorf("failed to marshal metadata: %w", err)
}

fmt.Println(string(jsonBytes))
return nil
},
}
}
26 changes: 26 additions & 0 deletions cli/azd/extensions/azure.ai.finetune/internal/cmd/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package cmd

import (
"context"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -60,6 +62,14 @@ func newOperationSubmitCommand() *cobra.Command {
}
defer azdClient.Close()

// Wait for debugger if AZD_EXT_DEBUG is set
if err := azdext.WaitForDebugger(ctx, azdClient); err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, azdext.ErrDebuggerAborted) {
return nil
}
return fmt.Errorf("failed waiting for debugger: %w", err)
}

// Show spinner while creating job
spinner := ux.NewSpinner(&ux.SpinnerOptions{
Text: "creating fine-tuning job...",
Expand Down Expand Up @@ -162,6 +172,14 @@ func newOperationShowCommand() *cobra.Command {
}
defer azdClient.Close()

// Wait for debugger if AZD_EXT_DEBUG is set
if err := azdext.WaitForDebugger(ctx, azdClient); err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, azdext.ErrDebuggerAborted) {
return nil
}
return fmt.Errorf("failed waiting for debugger: %w", err)
}

// Show spinner while fetching job
spinner := ux.NewSpinner(&ux.SpinnerOptions{
Text: "Fine-Tuning Job Details",
Expand Down Expand Up @@ -260,6 +278,14 @@ func newOperationListCommand() *cobra.Command {
}
defer azdClient.Close()

// Wait for debugger if AZD_EXT_DEBUG is set
if err := azdext.WaitForDebugger(ctx, azdClient); err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, azdext.ErrDebuggerAborted) {
return nil
}
return fmt.Errorf("failed waiting for debugger: %w", err)
}

// Show spinner while fetching jobs
spinner := ux.NewSpinner(&ux.SpinnerOptions{
Text: "Fine-Tuning Jobs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func NewRootCommand() *cobra.Command {
rootCmd.AddCommand(newVersionCommand())
rootCmd.AddCommand(newInitCommand(rootFlags))
rootCmd.AddCommand(newOperationCommand())
rootCmd.AddCommand(newMetadataCommand())

return rootCmd
}
1 change: 1 addition & 0 deletions cli/azd/extensions/azure.coding-agent/extension.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
capabilities:
- custom-commands
- metadata
displayName: Coding agent configuration extension
description: This extension configures GitHub Copilot Coding Agent access to Azure
id: azure.coding-agent
Expand Down
Loading
Loading