azure-functions-cli 1.0.0-beta.93 → 5.0.0-preview.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +263 -156
  3. package/lib/copy-metadata.js +9 -0
  4. package/lib/install.js +151 -0
  5. package/lib/main.js +42 -26
  6. package/npm-shrinkwrap.json +97 -0
  7. package/package.json +40 -20
  8. package/assets/azure-functions-logo-color-raster.png +0 -0
  9. package/bin/ARMClient.Authentication.dll +0 -0
  10. package/bin/ARMClient.Library.dll +0 -0
  11. package/bin/Autofac.Integration.WebApi.dll +0 -0
  12. package/bin/Autofac.dll +0 -0
  13. package/bin/Colors.Net.dll +0 -0
  14. package/bin/DocumentDB.Spatial.Sql.dll +0 -0
  15. package/bin/EdgeJs.dll +0 -0
  16. package/bin/FSharp.Compiler.Service.MSBuild.v12.dll +0 -0
  17. package/bin/FSharp.Compiler.Service.dll +0 -0
  18. package/bin/FSharp.Core.dll +0 -0
  19. package/bin/FluentCommandLineParser.dll +0 -0
  20. package/bin/Humanizer.dll +0 -0
  21. package/bin/Ignite.SharpNetSH.dll +0 -0
  22. package/bin/Microsoft.AspNet.WebHooks.Common.dll +0 -0
  23. package/bin/Microsoft.AspNet.WebHooks.Receivers.Azure.dll +0 -0
  24. package/bin/Microsoft.AspNet.WebHooks.Receivers.Bitbucket.dll +0 -0
  25. package/bin/Microsoft.AspNet.WebHooks.Receivers.Dropbox.dll +0 -0
  26. package/bin/Microsoft.AspNet.WebHooks.Receivers.DynamicsCRM.dll +0 -0
  27. package/bin/Microsoft.AspNet.WebHooks.Receivers.Generic.dll +0 -0
  28. package/bin/Microsoft.AspNet.WebHooks.Receivers.GitHub.dll +0 -0
  29. package/bin/Microsoft.AspNet.WebHooks.Receivers.Instagram.dll +0 -0
  30. package/bin/Microsoft.AspNet.WebHooks.Receivers.MailChimp.dll +0 -0
  31. package/bin/Microsoft.AspNet.WebHooks.Receivers.Pusher.dll +0 -0
  32. package/bin/Microsoft.AspNet.WebHooks.Receivers.Salesforce.dll +0 -0
  33. package/bin/Microsoft.AspNet.WebHooks.Receivers.Slack.dll +0 -0
  34. package/bin/Microsoft.AspNet.WebHooks.Receivers.Stripe.dll +0 -0
  35. package/bin/Microsoft.AspNet.WebHooks.Receivers.Trello.dll +0 -0
  36. package/bin/Microsoft.AspNet.WebHooks.Receivers.WordPress.dll +0 -0
  37. package/bin/Microsoft.AspNet.WebHooks.Receivers.dll +0 -0
  38. package/bin/Microsoft.AspNetCore.Cryptography.Internal.dll +0 -0
  39. package/bin/Microsoft.AspNetCore.DataProtection.Abstractions.dll +0 -0
  40. package/bin/Microsoft.AspNetCore.DataProtection.dll +0 -0
  41. package/bin/Microsoft.AspNetCore.Hosting.Abstractions.dll +0 -0
  42. package/bin/Microsoft.AspNetCore.Hosting.Server.Abstractions.dll +0 -0
  43. package/bin/Microsoft.AspNetCore.Http.Abstractions.dll +0 -0
  44. package/bin/Microsoft.AspNetCore.Http.Features.dll +0 -0
  45. package/bin/Microsoft.AspNetCore.WebUtilities.dll +0 -0
  46. package/bin/Microsoft.Azure.ApiHub.Sdk.dll +0 -0
  47. package/bin/Microsoft.Azure.Documents.Client.dll +0 -0
  48. package/bin/Microsoft.Azure.Documents.ServiceInterop.dll +0 -0
  49. package/bin/Microsoft.Azure.KeyVault.Core.dll +0 -0
  50. package/bin/Microsoft.Azure.NotificationHubs.dll +0 -0
  51. package/bin/Microsoft.Azure.WebJobs.Extensions.ApiHub.dll +0 -0
  52. package/bin/Microsoft.Azure.WebJobs.Extensions.BotFramework.dll +0 -0
  53. package/bin/Microsoft.Azure.WebJobs.Extensions.DocumentDB.dll +0 -0
  54. package/bin/Microsoft.Azure.WebJobs.Extensions.MobileApps.dll +0 -0
  55. package/bin/Microsoft.Azure.WebJobs.Extensions.NotificationHubs.dll +0 -0
  56. package/bin/Microsoft.Azure.WebJobs.Extensions.SendGrid.dll +0 -0
  57. package/bin/Microsoft.Azure.WebJobs.Extensions.Twilio.dll +0 -0
  58. package/bin/Microsoft.Azure.WebJobs.Extensions.dll +0 -0
  59. package/bin/Microsoft.Azure.WebJobs.Host.dll +0 -0
  60. package/bin/Microsoft.Azure.WebJobs.Logging.dll +0 -0
  61. package/bin/Microsoft.Azure.WebJobs.Script.Extensibility.dll +0 -0
  62. package/bin/Microsoft.Azure.WebJobs.Script.WebHost.dll +0 -0
  63. package/bin/Microsoft.Azure.WebJobs.Script.dll +0 -0
  64. package/bin/Microsoft.Azure.WebJobs.ServiceBus.dll +0 -0
  65. package/bin/Microsoft.Azure.WebJobs.dll +0 -0
  66. package/bin/Microsoft.Azure.WebSites.DataProtection.dll +0 -0
  67. package/bin/Microsoft.Bot.Connector.DirectLine.dll +0 -0
  68. package/bin/Microsoft.CodeAnalysis.CSharp.Scripting.dll +0 -0
  69. package/bin/Microsoft.CodeAnalysis.CSharp.dll +0 -0
  70. package/bin/Microsoft.CodeAnalysis.Scripting.dll +0 -0
  71. package/bin/Microsoft.CodeAnalysis.dll +0 -0
  72. package/bin/Microsoft.Data.Edm.dll +0 -0
  73. package/bin/Microsoft.Data.OData.dll +0 -0
  74. package/bin/Microsoft.Data.Services.Client.dll +0 -0
  75. package/bin/Microsoft.Extensions.Configuration.Abstractions.dll +0 -0
  76. package/bin/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
  77. package/bin/Microsoft.Extensions.DependencyInjection.dll +0 -0
  78. package/bin/Microsoft.Extensions.FileProviders.Abstractions.dll +0 -0
  79. package/bin/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
  80. package/bin/Microsoft.Extensions.Options.dll +0 -0
  81. package/bin/Microsoft.Extensions.Primitives.dll +0 -0
  82. package/bin/Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll +0 -0
  83. package/bin/Microsoft.IdentityModel.Clients.ActiveDirectory.dll +0 -0
  84. package/bin/Microsoft.Rest.ClientRuntime.dll +0 -0
  85. package/bin/Microsoft.ServiceBus.Messaging.EventProcessorHost.dll +0 -0
  86. package/bin/Microsoft.ServiceBus.dll +0 -0
  87. package/bin/Microsoft.WindowsAzure.Configuration.dll +0 -0
  88. package/bin/Microsoft.WindowsAzure.Mobile.Ext.dll +0 -0
  89. package/bin/Microsoft.WindowsAzure.Mobile.dll +0 -0
  90. package/bin/Microsoft.WindowsAzure.Storage.dll +0 -0
  91. package/bin/NCrontab.dll +0 -0
  92. package/bin/Newtonsoft.Json.dll +0 -0
  93. package/bin/NuGet.Frameworks.dll +0 -0
  94. package/bin/NuGet.LibraryModel.dll +0 -0
  95. package/bin/NuGet.Versioning.dll +0 -0
  96. package/bin/NuGet.exe +0 -0
  97. package/bin/RestSharp.dll +0 -0
  98. package/bin/SendGrid.CSharp.HTTP.Client.dll +0 -0
  99. package/bin/SendGrid.SmtpApi.dll +0 -0
  100. package/bin/SendGrid.dll +0 -0
  101. package/bin/System.AppContext.dll +0 -0
  102. package/bin/System.Buffers.dll +0 -0
  103. package/bin/System.Collections.Immutable.dll +0 -0
  104. package/bin/System.Console.dll +0 -0
  105. package/bin/System.Diagnostics.FileVersionInfo.dll +0 -0
  106. package/bin/System.Diagnostics.StackTrace.dll +0 -0
  107. package/bin/System.IO.Abstractions.dll +0 -0
  108. package/bin/System.IO.FileSystem.Primitives.dll +0 -0
  109. package/bin/System.IO.FileSystem.dll +0 -0
  110. package/bin/System.Net.Http.Extensions.dll +0 -0
  111. package/bin/System.Net.Http.Formatting.dll +0 -0
  112. package/bin/System.Net.Http.Primitives.dll +0 -0
  113. package/bin/System.Reflection.Metadata.dll +0 -0
  114. package/bin/System.Security.Cryptography.Algorithms.dll +0 -0
  115. package/bin/System.Security.Cryptography.Encoding.dll +0 -0
  116. package/bin/System.Security.Cryptography.Primitives.dll +0 -0
  117. package/bin/System.Security.Cryptography.X509Certificates.dll +0 -0
  118. package/bin/System.Spatial.dll +0 -0
  119. package/bin/System.Text.Encoding.CodePages.dll +0 -0
  120. package/bin/System.Text.Encodings.Web.dll +0 -0
  121. package/bin/System.Threading.Tasks.Dataflow.dll +0 -0
  122. package/bin/System.Threading.Thread.dll +0 -0
  123. package/bin/System.ValueTuple.dll +0 -0
  124. package/bin/System.Web.Cors.dll +0 -0
  125. package/bin/System.Web.Http.Cors.dll +0 -0
  126. package/bin/System.Web.Http.SelfHost.dll +0 -0
  127. package/bin/System.Web.Http.WebHost.dll +0 -0
  128. package/bin/System.Web.Http.dll +0 -0
  129. package/bin/System.Xml.XPath.XDocument.dll +0 -0
  130. package/bin/System.Xml.XPath.dll +0 -0
  131. package/bin/System.Xml.XmlDocument.dll +0 -0
  132. package/bin/Twilio.Api.dll +0 -0
  133. package/bin/azurefunctions/functions.js +0 -129
  134. package/bin/azurefunctions/http/request.js +0 -8
  135. package/bin/azurefunctions/http/response.js +0 -78
  136. package/bin/edge/double_edge.js +0 -49
  137. package/bin/edge/edge.js +0 -172
  138. package/bin/edge/x64/edge_nativeclr.node +0 -0
  139. package/bin/edge/x64/node.dll +0 -0
  140. package/bin/edge/x86/edge_nativeclr.node +0 -0
  141. package/bin/edge/x86/node.dll +0 -0
  142. package/bin/func.exe +0 -0
  143. package/bin/func.exe.config +0 -96
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) .NET Foundation. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,156 +1,263 @@
1
- ![Azure Functions Logo](https://raw.githubusercontent.com/Azure/azure-functions-cli/master/src/Azure.Functions.Cli/npm/assets/azure-functions-logo-color-raster.png)
2
-
3
- # Azure Functions CLI
4
-
5
- The Azure Functions CLI provides a local development experience for creating, developing, testing, running, and debugging Azure Functions.
6
-
7
- ## Installing
8
-
9
- **NOTE**: This package only currently works on Windows, since the underlying Functions Host is not yet cross-platform. You can upvote this GitHub issue if you're interested in running on other platforms: [make the Azure Functions CLI cross platform](https://github.com/Azure/azure-functions-cli/issues/13).
10
-
11
- To install globally:
12
-
13
- ```
14
- npm i -g azure-functions-cli
15
- ```
16
-
17
- ### Aliases
18
-
19
- The package sets up the following global aliases:
20
-
21
- ```
22
- func
23
- azfun
24
- azure-functions
25
- ```
26
-
27
- ## Commands
28
-
29
- The CLI commands have the following basic structure:
30
-
31
- ```
32
- func [context] [context] <action> [-/--options]
33
- ```
34
-
35
- Output can be found at *%temp%\LogFiles*.
36
-
37
- ### Contexts
38
-
39
- ```
40
- azure For Azure login and working with Function Apps on Azure
41
- function For local function settings and actions
42
- functionapp For local function app settings and actions
43
- host For local Functions host settings and actions
44
- settings For local settings for your Functions host
45
- ```
46
-
47
- ### Top-level actions
48
-
49
- ```
50
- func init Create a new Function App in the current folder. Initializes git repo.
51
- func run Run a function directly
52
- ```
53
-
54
- ### Azure actions
55
-
56
- Actions in the "azure" context require logging in to Azure.
57
-
58
- ```
59
- func azure
60
-
61
- Usage: func azure [context] <action> [-/--options]
62
-
63
- Contexts:
64
- account For Azure account and subscriptions settings and actions
65
- functionapp For Azure Function App settings and actions
66
- storage For Azure Storage settings and actions
67
- subscriptions For Azure account and subscriptions settings and actions
68
-
69
- Actions:
70
- get-publish-username Get the source control publishing username for a Function App in Azure
71
- set-publish-password Set the source control publishing password for a Function App in Azure
72
- login Log in to an Azure account. Can also do "func azure login"
73
- logout Log out of Azure account. Can also do "func azure logout"
74
- portal Launch default browser with link to the current app in https://portal.azure.com
75
- ```
76
-
77
- ```
78
- func azure account
79
- Usage: func azure account <action> [-/--options]
80
-
81
- Actions:
82
- set <subscriptionId> Set the active subscription
83
- list List subscriptions for the logged in user
84
- ```
85
-
86
- ```
87
- func azure functionapp
88
- Usage: func azure functionapp <action> [-/--options]
89
-
90
- Actions:
91
- enable-git-repo Enable git repository on your Azure-hosted Function App
92
- fetch-app-settings Retrieve App Settings from your Azure-hosted Function App and store locally. Alias: fetch
93
- list List all Function Apps in the selected Azure subscription
94
- ```
95
-
96
- The `func azure storage list` command will show storage accounts in the selected subscription. You can then set up a connection string locally with this storage account name using `func settings add-storage-account`.
97
-
98
- ```
99
- func azure storage
100
- Usage: func Azure Storage <action> [-/--options]
101
-
102
- Actions:
103
- list List all Storage Accounts in the selected Azure subscription
104
- ```
105
-
106
- ### Local actions
107
-
108
- Actions that are not in the "azure" context operate on the local environment. For instance, `func settings list` will show the app settings for the current function app.
109
-
110
- ```
111
- func settings
112
- Usage: func settings [context] <action> [-/--options]
113
-
114
- Actions:
115
- add Add new local app setting to appsettings.json
116
- add-storage-account Add a local app setting using the value from an Azure Storage account. Requires Azure login.
117
- decrypt Decrypt the local settings file
118
- delete Remove a local setting
119
- encrypt Encrypt the local settings file
120
- list List local settings
121
- ```
122
-
123
- ```
124
- func function
125
- Usage: func function [context] <action> [-/--options]
126
-
127
- Actions:
128
- create Create a new Function from a template, using the Yeoman generator
129
- run Run a function directly
130
- ```
131
-
132
- For consistency, the `func init` command can also be invoked via `func function app init`.
133
-
134
- ```
135
- func functionapp init
136
- ```
137
-
138
- ## Default Directories
139
-
140
- * `CurrentDirectory`: is the default directory the functions runtime looks for functions in.
141
- * `%TMP%\LogFiles\Application\Functions`: is the default directory for logs. It mirrors the logs directory on Azure as well.
142
-
143
- ## License
144
-
145
- This project is under the benevolent umbrella of the [.NET Foundation](http://www.dotnetfoundation.org/) and is licensed under [the MIT License](LICENSE.txt)
146
-
147
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
148
-
149
- ## Contact Us
150
-
151
- For questions on Azure Functions or the CLI, you can ask questions here:
152
-
153
- - [Azure Functions MSDN Forum](https://social.msdn.microsoft.com/Forums/azure/en-US/home?forum=AzureFunctions)
154
- - [Azure-Functions tag on StackOverflow](http://stackoverflow.com/questions/tagged/azure-functions)
155
-
156
- File bugs at [Azure Functions CLI repo on GitHub](https://github.com/Azure/azure-functions-cli/issues).
1
+ ![Azure Functions Logo](https://raw.githubusercontent.com/Azure/azure-functions-core-tools/refs/heads/main/eng/res/functions.png)
2
+
3
+ |Branch|Status|
4
+ |------|------|
5
+ |main|[![Build Status](https://dev.azure.com/azfunc/public/_apis/build/status%2Fazure%2Fazure-functions-core-tools%2Fcoretools.public?repoName=Azure%2Fazure-functions-core-tools&branchName=main)](https://dev.azure.com/azfunc/public/_build/latest?definitionId=579&repoName=Azure%2Fazure-functions-core-tools&branchName=main) |
6
+ |vnext|[![Build Status](https://dev.azure.com/azfunc/public/_apis/build/status%2Fazure%2Fazure-functions-core-tools%2Fcoretools.public?repoName=Azure%2Fazure-functions-core-tools&branchName=vnext)](https://dev.azure.com/azfunc/public/_build/latest?definitionId=579&repoName=Azure%2Fazure-functions-core-tools&branchName=vnext)|
7
+
8
+ # Azure Functions Core Tools
9
+
10
+ The Azure Functions Core Tools provide a local development experience for creating, developing, testing, running, and debugging Azure Functions.
11
+
12
+ ## Installation
13
+
14
+ ### One-line install
15
+
16
+ **PowerShell** (Windows, macOS, Linux):
17
+
18
+ ```powershell
19
+ irm https://aka.ms/func-cli/install.ps1 | iex
20
+ ```
21
+
22
+ **Bash** (macOS, Linux):
23
+
24
+ ```bash
25
+ curl -sSL https://aka.ms/func-cli/install.sh | bash
26
+ ```
27
+
28
+ Both scripts auto-detect your OS and architecture, download the latest 5.x release from GitHub, and install to `~/.azure-functions`.
29
+
30
+ > v5 is currently pre-release only. Add `--prerelease` / `-Prerelease` (see below) until the first stable 5.x ships.
31
+
32
+ If a v4 `func` is already on PATH (e.g., from npm), the installer leaves it as the default and installs a `func5` wrapper alongside so you can run v5 side-by-side without breaking v4.
33
+
34
+ ### Options
35
+
36
+ Pass flags to the installer using the patterns below. The PowerShell script also supports `-WhatIf` to preview changes without writing anything, plus the standard `-Verbose`, `-SkipPath`, and `-KeepArchive` switches; the Bash script exposes the same via `--dry-run`, `--verbose`, `--skip-path`, `--keep-archive`, and prints the full list with `--help`.
37
+
38
+ | Option | PowerShell | Bash |
39
+ |--------|-----------|------|
40
+ | Include pre-releases | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -Prerelease"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --prerelease` |
41
+ | Specific version | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -Version 5.0.0"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --version 5.0.0` |
42
+ | Custom install dir | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -InstallPath ~/my-tools"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --install-path ~/my-tools` |
43
+ | Preview without writing | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -WhatIf"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --dry-run` |
44
+ | Show help | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -Help"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --help` |
45
+
46
+ The Bash script also still honours the legacy environment variables (`VERSION`, `PRERELEASE=true`, `INSTALL_DIR`, `FORCE=true`, `SOURCE`) for back-compat. Flags take precedence.
47
+
48
+ ### Unattended install
49
+
50
+ To chain commands after the installer (e.g., in CI pipelines or Dockerfiles), source the updated PATH and then run `func` directly:
51
+
52
+ **PowerShell:**
53
+
54
+ ```powershell
55
+ iex "& { $(irm https://aka.ms/func-cli/install.ps1) }"
56
+ func workload install dotnet
57
+ ```
58
+
59
+ **Bash:**
60
+
61
+ ```bash
62
+ curl -sSL https://aka.ms/func-cli/install.sh | bash
63
+ source ~/.bashrc
64
+ func workload install node
65
+ ```
66
+
67
+ The install script adds `~/.azure-functions` to your PATH automatically. In PowerShell, the current session is updated immediately. In Bash, you need to `source` your shell profile to pick up the change before running `func`.
68
+
69
+ In GitHub Actions, the installer also appends the install dir to `$GITHUB_PATH`, so `func` is on PATH in subsequent steps without needing to source anything.
70
+
71
+ ## Usage
72
+
73
+ ```bash
74
+ func <command> [path] [options]
75
+ ```
76
+
77
+ | Command | Description |
78
+ |---------|-------------|
79
+ | `func init [path]` | Initialize a new Azure Functions project |
80
+ | `func new [path]` | Create a new function from a template |
81
+ | `func run [path]` | Start the Functions host locally (alias: `func start`) |
82
+ | `func workload install <id>` | Install a language workload |
83
+ | `func workload list` | List installed workloads |
84
+ | `func version` | Display version information |
85
+ | `func help [command]` | Display help for a command |
86
+
87
+ ## Architecture
88
+
89
+ The v5 CLI is a ground-up rebuild using:
90
+
91
+ - **System.CommandLine 2.0.6** — command parsing (following the dotnet CLI model)
92
+ - **Spectre.Console** — rich terminal output (tables, prompts, spinners)
93
+ - **Dependency Injection** — Microsoft.Extensions.DependencyInjection
94
+ - **.NET 10** — target framework
95
+ - **Workload model** — core CLI + optional language workloads (dotnet, node, python, etc.)
96
+
97
+ ## Project Structure
98
+
99
+ ```
100
+ src/
101
+ Func/ # CLI application
102
+ Commands/ # Command definitions (one file per command)
103
+ Console/ # Console output abstractions (Spectre wrappers)
104
+ Workloads/ # Workload engine (contracts, manager, manifest)
105
+ Program.cs # Entry point with DI wiring
106
+ Parser.cs # Command tree composition
107
+ Abstractions/ # Public abstractions
108
+ Workloads/
109
+ <kind>/<Name>/ # An individual grouped workload
110
+ <Name>/ # An individual ungrouped workload
111
+ test/
112
+ Func.Tests/ # Unit tests core cli (xUnit + NSubstitute)
113
+ Workloads/
114
+ <kind>/<Name>.Tests/ # Unit tests for a grouped workload
115
+ <Name>.Tests/ # Unit tests for an ungrouped workload
116
+ eng/
117
+ build/ # MSBuild props and targets
118
+ ci/ # CI pipeline definitions (Azure DevOps)
119
+ scripts/ # Build and validation scripts
120
+ res/ # Resources (icons, MSI assets)
121
+ docs/
122
+ vnext.md # v5 design document
123
+ modernization.md # Modernization design document
124
+ Azure.Functions.Cli.slnx # Solution file
125
+ ```
126
+
127
+ ## Development
128
+
129
+ **Prerequisites:** .NET 10 SDK (see `global.json` for the exact version)
130
+
131
+ ### Build
132
+
133
+ ```bash
134
+ dotnet restore
135
+ dotnet build
136
+ ```
137
+
138
+ ### Test
139
+
140
+ ```bash
141
+ dotnet test
142
+ ```
143
+
144
+ ### Run Locally
145
+
146
+ ```bash
147
+ # Option 1 — dotnet run
148
+ dotnet run --project src/Func -- <command> [args]
149
+
150
+ # Option 2 — add to PATH
151
+ export PATH="$PATH:$(pwd)/out/bin/Func/debug"
152
+ func <command>
153
+ ```
154
+
155
+ ### Set Up Language Workloads
156
+
157
+ `func setup` installs the host and the selected language's stack and worker workloads,
158
+ plus templates and extension bundles where applicable. Supported stacks are `dotnet`,
159
+ `node`, `python`, `go`, `java`, and `powershell`. For example:
160
+
161
+ ```bash
162
+ func setup --features java --yes
163
+ func setup --features powershell --yes
164
+ ```
165
+
166
+ In an existing project, setup uses its configured runtime when `--features` is omitted.
167
+ `func setup --check` checks the same dependencies without installing them and returns
168
+ a nonzero exit code when a required stack workload is missing.
169
+
170
+ ### Run Locally with Workloads
171
+
172
+ One-time bootstrap (per workload you want to test, into ./.debug-workloads/):
173
+
174
+ ```bash
175
+ dotnet build src/Func/Func.csproj
176
+ dotnet build src/Workloads/Stacks/Node/Workloads.Node.csproj \
177
+ -t:DeployForDebug -p:FuncCliEnsureWorkloadInstalled=true
178
+ ```
179
+
180
+ That packs the workload, runs func workload install against `./.debug-workloads/`, and drops the freshly built DLL+PDB into the install dir.
181
+
182
+ Inner loop (after editing workload source, no re-install, no pack):
183
+
184
+ ```bash
185
+ dotnet build src/Workloads/Stacks/Node/Workloads.Node.csproj -t:DeployForDebug
186
+ ```
187
+
188
+ > Just copies the new DLL+PDB over the installed one.
189
+
190
+ Run the CLI against that home:
191
+
192
+ ```bash
193
+ export FUNC_CLI_WORKLOADS_HOME="$PWD/.debug-workloads"
194
+ ./out/bin/Func/debug/func <args>
195
+ ```
196
+
197
+ #### One-shot script
198
+
199
+ `eng/scripts/debug-workloads.ps1` wraps the above for every workload in the repo, so you can bootstrap a full home in one command:
200
+
201
+ ```bash
202
+ pwsh ./eng/scripts/debug-workloads.ps1 # all workloads
203
+ pwsh ./eng/scripts/debug-workloads.ps1 -Project Node # just one
204
+ pwsh ./eng/scripts/debug-workloads.ps1 -Feature node # everything `func setup --features node` installs
205
+ pwsh ./eng/scripts/debug-workloads.ps1 -Clean # wipe + reinstall
206
+ ```
207
+
208
+ `-Feature` accepts `host`, `runtime`, `dotnet`, `node`, `python`, `go`, `java`, `powershell` (or any combination, deduped).
209
+
210
+ Inner loop with the script (sub-second, copy-only):
211
+
212
+ ```bash
213
+ pwsh ./eng/scripts/debug-workloads.ps1 -Project Node -SkipFuncBuild
214
+ ```
215
+
216
+ Reach for the `build-workloads` skill instead when what you're testing is `func workload install` itself (feed resolution, manifest behaviour, etc.). Otherwise the script above is faster because it skips the NuGet feed.
217
+
218
+ ### Publish a Self-Contained Build
219
+
220
+ ```bash
221
+ dotnet publish src/Func/Func.csproj -c Release -r osx-arm64
222
+ ./out/pub/Func/release_osx-arm64/func --version
223
+ ```
224
+
225
+ Common runtime identifiers: `osx-arm64`, `osx-x64`, `linux-x64`, `win-x64`
226
+
227
+ ## Branches
228
+
229
+ | Branch | Description |
230
+ |--------|-------------|
231
+ | `main` | v4 — current stable release |
232
+ | `vnext` | v5 — next-generation CLI rebuild |
233
+
234
+ ## Documentation
235
+
236
+ - [Code and test Azure Functions locally](https://docs.microsoft.com/azure/azure-functions/functions-run-local)
237
+ - [Contributing Guide](CONTRIBUTING.md)
238
+ - [Design proposals](proposed/)
239
+
240
+ Files under `proposed/` capture design intent while a design is being shaped and reviewed, so they may lag the current implementation. Submit new proposals against `vnext`; after a design is accepted and implemented, move it to `accepted/` in a follow-up change.
241
+
242
+ ## Telemetry
243
+
244
+ The Azure Functions Core Tools collect usage data in order to help us improve your experience.
245
+ The data is anonymous and doesn't include any user specific or personal information. The data is collected by Microsoft.
246
+
247
+ You can opt-out of telemetry by setting the `FUNC_CLI_TELEMETRY_OPTOUT` environment variable to any value other than `no`, `n`, `0`, `false`, or `off`. The legacy `FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT` variable from Core Tools v4 is still honored.
248
+
249
+ [Microsoft privacy statement](https://privacy.microsoft.com/privacystatement)
250
+
251
+ ## License
252
+
253
+ This project is under the benevolent umbrella of the [.NET Foundation](http://www.dotnetfoundation.org/) and is licensed under [the MIT License](LICENSE).
254
+
255
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
256
+
257
+ ## Contact Us
258
+
259
+ For questions on Azure Functions or the tools:
260
+
261
+ - [Azure Functions Q&A Forum](https://docs.microsoft.com/answers/topics/azure-functions.html)
262
+ - [Azure-Functions tag on StackOverflow](http://stackoverflow.com/questions/tagged/azure-functions)
263
+ - [File bugs on GitHub](https://github.com/Azure/azure-functions-core-tools/issues)
@@ -0,0 +1,9 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const repositoryRoot = path.resolve(__dirname, '..', '..', '..', '..', '..');
5
+ const packageRoot = path.resolve(__dirname, '..');
6
+
7
+ for (const fileName of ['LICENSE', 'README.md']) {
8
+ fs.copyFileSync(path.join(repositoryRoot, fileName), path.join(packageRoot, fileName));
9
+ }
package/lib/install.js ADDED
@@ -0,0 +1,151 @@
1
+ #! /usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const https = require('https');
5
+ const { HttpsProxyAgent } = require('https-proxy-agent');
6
+ const os = require('os');
7
+ const path = require('path');
8
+ const ProgressBar = require('progress');
9
+ const yauzl = require('yauzl');
10
+ const { version } = require('../package.json');
11
+
12
+ function getRuntimeIdentifier() {
13
+ const platforms = {
14
+ darwin: 'osx',
15
+ linux: 'linux',
16
+ win32: 'win'
17
+ };
18
+ const architectures = {
19
+ arm64: 'arm64',
20
+ x64: 'x64'
21
+ };
22
+ const platform = platforms[os.platform()];
23
+ const architecture = architectures[os.arch()];
24
+
25
+ if (!platform || !architecture) {
26
+ throw new Error(`Platform '${os.platform()}-${os.arch()}' is not supported.`);
27
+ }
28
+
29
+ return `${platform}-${architecture}`;
30
+ }
31
+
32
+ function getProxyAgent() {
33
+ const proxy = process.env.npm_config_https_proxy
34
+ || process.env.npm_config_proxy
35
+ || process.env.HTTPS_PROXY
36
+ || process.env.https_proxy
37
+ || process.env.HTTP_PROXY
38
+ || process.env.http_proxy;
39
+
40
+ return proxy ? new HttpsProxyAgent(proxy) : undefined;
41
+ }
42
+
43
+ function download(url, destination, redirectCount = 0) {
44
+ return new Promise((resolve, reject) => {
45
+ const request = https.get(url, { agent: getProxyAgent() }, response => {
46
+ if ([301, 302, 307, 308].includes(response.statusCode)) {
47
+ response.resume();
48
+ if (!response.headers.location || redirectCount >= 5) {
49
+ reject(new Error(`Unable to follow redirect while downloading '${url}'.`));
50
+ return;
51
+ }
52
+
53
+ resolve(download(new URL(response.headers.location, url), destination, redirectCount + 1));
54
+ return;
55
+ }
56
+
57
+ if (response.statusCode !== 200) {
58
+ response.resume();
59
+ reject(new Error(`Failed to download '${url}'. Expected HTTP 200, received ${response.statusCode}.`));
60
+ return;
61
+ }
62
+
63
+ const total = Number(response.headers['content-length']) || 0;
64
+ const progress = total > 0
65
+ ? new ProgressBar('[:bar] Downloading Azure Functions CLI', { total, width: 18 })
66
+ : undefined;
67
+ const file = fs.createWriteStream(destination);
68
+
69
+ response.on('data', data => progress?.tick(data.length));
70
+ response.on('error', reject);
71
+ file.on('error', reject);
72
+ file.on('finish', () => file.close(resolve));
73
+ response.pipe(file);
74
+ });
75
+
76
+ request.on('error', reject);
77
+ request.setTimeout(300000, () => {
78
+ request.destroy(new Error(`Timed out downloading '${url}'.`));
79
+ });
80
+ });
81
+ }
82
+
83
+ function extractExecutable(archivePath, destination) {
84
+ const expectedEntry = os.platform() === 'win32' ? 'func.exe' : 'func';
85
+
86
+ return new Promise((resolve, reject) => {
87
+ yauzl.open(archivePath, { lazyEntries: true }, (openError, archive) => {
88
+ if (openError) {
89
+ reject(openError);
90
+ return;
91
+ }
92
+
93
+ archive.on('error', reject);
94
+ archive.on('end', () => {
95
+ reject(new Error(`Archive does not contain '${expectedEntry}'.`));
96
+ });
97
+ archive.on('entry', entry => {
98
+ if (entry.fileName !== expectedEntry) {
99
+ archive.readEntry();
100
+ return;
101
+ }
102
+
103
+ archive.openReadStream(entry, (streamError, input) => {
104
+ if (streamError) {
105
+ archive.close();
106
+ reject(streamError);
107
+ return;
108
+ }
109
+
110
+ const output = fs.createWriteStream(destination, { mode: 0o755 });
111
+ input.on('error', reject);
112
+ output.on('error', reject);
113
+ output.on('close', () => {
114
+ archive.close();
115
+ resolve();
116
+ });
117
+ input.pipe(output);
118
+ });
119
+ });
120
+ archive.readEntry();
121
+ });
122
+ });
123
+ }
124
+
125
+ async function install() {
126
+ const runtimeIdentifier = getRuntimeIdentifier();
127
+ const packageRoot = path.resolve(__dirname, '..');
128
+ const binDirectory = path.join(packageRoot, 'bin');
129
+ const archiveName = `Azure.Functions.Cli.${runtimeIdentifier}.${version}.zip`;
130
+ const archivePath = path.join(binDirectory, archiveName);
131
+ const executablePath = path.join(binDirectory, os.platform() === 'win32' ? 'func.exe' : 'func');
132
+ const endpoint = `https://cdn.functions.azure.com/public/cli/v5/${version}/${archiveName}`;
133
+
134
+ fs.rmSync(binDirectory, { recursive: true, force: true });
135
+ fs.mkdirSync(binDirectory, { recursive: true });
136
+
137
+ try {
138
+ console.log(`Downloading Azure Functions CLI from '${endpoint}'.`);
139
+ await download(endpoint, archivePath);
140
+ await extractExecutable(archivePath, executablePath);
141
+ fs.rmSync(archivePath, { force: true });
142
+ } catch (error) {
143
+ fs.rmSync(binDirectory, { recursive: true, force: true });
144
+ throw error;
145
+ }
146
+ }
147
+
148
+ install().catch(error => {
149
+ console.error(error.message);
150
+ process.exitCode = 1;
151
+ });