diff --git a/CHANGELOG.md b/CHANGELOG.md index cc76a06c..b04aeedd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## v3.44.0 - 2025-06-08 - Added `uuid`, `randInt` and `randIntN` template functions (#1346, #2225 by @pd93). diff --git a/internal/version/version.txt b/internal/version/version.txt index 0fe676c5..faf0dcbb 100644 --- a/internal/version/version.txt +++ b/internal/version/version.txt @@ -1 +1 @@ -3.43.3 +3.44.0 diff --git a/package-lock.json b/package-lock.json index 028abd63..e1eae383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@go-task/cli", - "version": "3.43.3", + "version": "3.44.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index ef114b8a..9529436e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@go-task/cli", - "version": "3.43.3", + "version": "3.44.0", "description": "A task runner / simpler Make alternative written in Go", "scripts": { "postinstall": "go-npm install", diff --git a/website/docs/changelog.mdx b/website/docs/changelog.mdx index 773ba2ba..36a1509a 100644 --- a/website/docs/changelog.mdx +++ b/website/docs/changelog.mdx @@ -5,6 +5,35 @@ sidebar_position: 14 # Changelog +## v3.44.0 - 2025-06-08 + +- Added `uuid`, `randInt` and `randIntN` template functions (#1346, #2225 by + @pd93). +- Added new `CLI_ARGS_LIST` array variable which contains the arguments passed + to Task after the `--` (the same as `CLI_ARGS`, but an array instead of a + string). (#2138, #2139, #2140 by @pd93). +- Added `toYaml` and `fromYaml` templating functions (#2217, #2219 by @pd93). +- Added `task` field the `--list --json` output (#2256 by @aleksandersh). +- Added the ability to + [pin included taskfiles](https://taskfile.dev/next/experiments/remote-taskfiles/#manual-checksum-pinning) + by specifying a checksum. This works with both local and remote Taskfiles + (#2222, #2223 by @pd93). +- When using the + [Remote Taskfiles experiment](https://github.com/go-task/task/issues/1317), + any credentials used in the URL will now be redacted in Task's output (#2100, + #2220 by @pd93). +- Fixed fuzzy suggestions not working when misspelling a task name (#2192, #2200 + by @vmaerten). +- Fixed a bug where taskfiles in directories containing spaces created + directories in the wrong location (#2208, #2216 by @pd93). +- Added support for dual JSON schema files, allowing changes without affecting + the current schema. The current schemas will only be updated during releases. + (#2211 by @vmaerten). +- Improved fingerprint documentation by specifying that the method can be set at + the root level to apply to all tasks (#2233 by @vmaerten). +- Fixed some watcher regressions after #2048 (#2199, #2202, #2241, #2196 by + @wazazaby, #2271 by @andreynering). + ## v3.43.3 - 2025-04-27 Reverted the changes made in #2113 and #2186 that affected the diff --git a/website/static/schema.json b/website/static/schema.json index 0a942697..0a229bed 100644 --- a/website/static/schema.json +++ b/website/static/schema.json @@ -684,6 +684,10 @@ "vars": { "description": "A set of variables to apply to the included Taskfile.", "$ref": "#/definitions/vars" + }, + "checksum": { + "description": "The checksum of the file you expect to include. If the checksum does not match, the file will not be included.", + "type": "string" } } } diff --git a/website/versioned_docs/version-latest/changelog.mdx b/website/versioned_docs/version-latest/changelog.mdx index 773ba2ba..36a1509a 100644 --- a/website/versioned_docs/version-latest/changelog.mdx +++ b/website/versioned_docs/version-latest/changelog.mdx @@ -5,6 +5,35 @@ sidebar_position: 14 # Changelog +## v3.44.0 - 2025-06-08 + +- Added `uuid`, `randInt` and `randIntN` template functions (#1346, #2225 by + @pd93). +- Added new `CLI_ARGS_LIST` array variable which contains the arguments passed + to Task after the `--` (the same as `CLI_ARGS`, but an array instead of a + string). (#2138, #2139, #2140 by @pd93). +- Added `toYaml` and `fromYaml` templating functions (#2217, #2219 by @pd93). +- Added `task` field the `--list --json` output (#2256 by @aleksandersh). +- Added the ability to + [pin included taskfiles](https://taskfile.dev/next/experiments/remote-taskfiles/#manual-checksum-pinning) + by specifying a checksum. This works with both local and remote Taskfiles + (#2222, #2223 by @pd93). +- When using the + [Remote Taskfiles experiment](https://github.com/go-task/task/issues/1317), + any credentials used in the URL will now be redacted in Task's output (#2100, + #2220 by @pd93). +- Fixed fuzzy suggestions not working when misspelling a task name (#2192, #2200 + by @vmaerten). +- Fixed a bug where taskfiles in directories containing spaces created + directories in the wrong location (#2208, #2216 by @pd93). +- Added support for dual JSON schema files, allowing changes without affecting + the current schema. The current schemas will only be updated during releases. + (#2211 by @vmaerten). +- Improved fingerprint documentation by specifying that the method can be set at + the root level to apply to all tasks (#2233 by @vmaerten). +- Fixed some watcher regressions after #2048 (#2199, #2202, #2241, #2196 by + @wazazaby, #2271 by @andreynering). + ## v3.43.3 - 2025-04-27 Reverted the changes made in #2113 and #2186 that affected the diff --git a/website/versioned_docs/version-latest/experiments/remote_taskfiles.mdx b/website/versioned_docs/version-latest/experiments/remote_taskfiles.mdx index b9c2d1f2..b8154224 100644 --- a/website/versioned_docs/version-latest/experiments/remote_taskfiles.mdx +++ b/website/versioned_docs/version-latest/experiments/remote_taskfiles.mdx @@ -182,9 +182,11 @@ includes: ## Security +### Automatic checksums + Running commands from sources that you do not control is always a potential -security risk. For this reason, we have added some checks when using remote -Taskfiles: +security risk. For this reason, we have added some automatic checks when using +remote Taskfiles: 1. When running a task from a remote Taskfile for the first time, Task will print a warning to the console asking you to check that you are sure that you @@ -209,6 +211,38 @@ flag. Before enabling this flag, you should: containing a commit hash) to prevent Task from automatically accepting a prompt that says a remote Taskfile has changed. +### Manual checksum pinning + +Alternatively, if you expect the contents of your remote files to be a constant +value, you can pin the checksum of the included file instead: + +```yaml +version: '3' + +includes: + included: + taskfile: https://taskfile.dev + checksum: c153e97e0b3a998a7ed2e61064c6ddaddd0de0c525feefd6bba8569827d8efe9 +``` + +This will disable the automatic checksum prompts discussed above. However, if +the checksums do not match, Task will exit immediately with an error. When +setting this up for the first time, you may not know the correct value of the +checksum. There are a couple of ways you can obtain this: + +1. Add the include normally without the `checksum` key. The first time you run + the included Taskfile, a `.task/remote` temporary directory is created. Find + the correct set of files for your included Taskfile and open the file that + ends with `.checksum`. You can copy the contents of this file and paste it + into the `checksum` key of your include. This method is safest as it allows + you to inspect the downloaded Taskfile before you pin it. +2. Alternatively, add the include with a temporary random value in the + `checksum` key. When you try to run the Taskfile, you will get an error that + will report the incorrect expected checksum and the actual checksum. You can + copy the actual checksum and replace your temporary random value. + +### TLS + Task currently supports both `http` and `https` URLs. However, the `http` requests will not execute by default unless you run the task with the `--insecure` flag. This is to protect you from accidentally running a remote diff --git a/website/versioned_docs/version-latest/reference/cli.mdx b/website/versioned_docs/version-latest/reference/cli.mdx index e5094a9a..55ab128f 100644 --- a/website/versioned_docs/version-latest/reference/cli.mdx +++ b/website/versioned_docs/version-latest/reference/cli.mdx @@ -104,6 +104,7 @@ structure: "tasks": [ { "name": "", + "task": "", "desc": "", "summary": "", "up_to_date": false, diff --git a/website/versioned_docs/version-latest/reference/schema.mdx b/website/versioned_docs/version-latest/reference/schema.mdx index f426e3fa..8339f510 100644 --- a/website/versioned_docs/version-latest/reference/schema.mdx +++ b/website/versioned_docs/version-latest/reference/schema.mdx @@ -34,6 +34,7 @@ toc_max_heading_level: 5 | `internal` | `bool` | `false` | Stops any task in the included Taskfile from being callable on the command line. These commands will also be omitted from the output when used with `--list`. | | `aliases` | `[]string` | | Alternative names for the namespace of the included Taskfile. | | `vars` | `map[string]Variable` | | A set of variables to apply to the included Taskfile. | +| `checksum` | `string` | | The checksum of the file you expect to include. If the checksum does not match, the file will not be included. | :::info diff --git a/website/versioned_docs/version-latest/reference/templating.mdx b/website/versioned_docs/version-latest/reference/templating.mdx index 98d45bae..0cb714a7 100644 --- a/website/versioned_docs/version-latest/reference/templating.mdx +++ b/website/versioned_docs/version-latest/reference/templating.mdx @@ -102,7 +102,8 @@ special variable will be overridden. | Var | Description | |--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| -| `CLI_ARGS` | Contain all extra arguments passed after `--` when calling Task through the CLI. | +| `CLI_ARGS` | Contain all extra arguments passed after `--` when calling Task through the CLI as a string. | +| `CLI_ARGS_LIST` | Contain all extra arguments passed after `--` when calling Task through the CLI as a shell parsed list. | | `CLI_FORCE` | A boolean containing whether the `--force` or `--force-all` flags were set. | | `CLI_SILENT` | A boolean containing whether the `--silent` flag was set. | | `CLI_VERBOSE` | A boolean containing whether the `--verbose` flag was set. | @@ -269,6 +270,10 @@ description here for completeness. For detailed usage, please refer to the | `b32enc` | Encodes a string into base 32. | | `b32dec` | Decodes a string from base 32. | +:::note +YAML encoding functions are [provided directly by Task](#task-functions). +::: + #### [List Functions][list-functions] | Function | Description | @@ -336,6 +341,10 @@ description here for completeness. For detailed usage, please refer to the | `osExt` | Returns the file extension of a filepath. | | `osIsAbs` | Checks if a filepath is absolute. | +:::note +More filepath encoding functions are [provided directly by Task](#task-functions). +::: + #### [Flow Control Functions][flow-control-functions] | Function | Description | @@ -375,7 +384,7 @@ Lastly, Task itself provides a few functions: | Function | Description | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `OS` | Returns the operating system. Possible values are `windows`, `linux`, `darwin` (macOS) and `freebsd`. | -| `ARCH` | Returns the architecture Task was compiled to: `386`, `amd64`, `arm` or `s390x`. | +| `ARCH` | Returns the architecture Task was compiled to: `386`, `amd64`, `arm` or `s390x`. | | `numCPU` | Returns the number of logical CPU's usable by the current process. | | `splitLines` | Splits Unix (`\n`) and Windows (`\r\n`) styled newlines. | | `catLines` | Replaces Unix (`\n`) and Windows (`\r\n`) styled newlines with a space. | @@ -388,6 +397,11 @@ Lastly, Task itself provides a few functions: | `relPath` | Converts an absolute path (second argument) into a relative path, based on a base path (first argument). The same as Go's [filepath.Rel](https://pkg.go.dev/path/filepath#Rel). | | `merge` | Creates a new map that is a copy of the first map with the keys of each subsequent map merged into it. If there is a duplicate key, the value of the last map with that key is used. | | `spew` | Returns the Go representation of a specific variable. Useful for debugging. Uses the [davecgh/go-spew](https://github.com/davecgh/go-spew) package. | +| `fromYaml`\* | Decodes a YAML string into an object. | +| `toYaml`\* | Encodes an object as a YAML string. | +| `uuid` | Generates a new pseudo-random UUIDv4 string. | +| `randInt` | Generates a new pseudo-random, non-negative, 32bit integer. Generated numbers are not suitable for security-sensitive work. | +| `randIntN` | Generates a new pseudo-random, non-negative, 32bit integer in the half-open interval `[0,n)`. Generated numbers are not suitable for security-sensitive work. | {/* prettier-ignore-start */} [text/template]: https://pkg.go.dev/text/template diff --git a/website/versioned_docs/version-latest/usage.mdx b/website/versioned_docs/version-latest/usage.mdx index eda391a0..9590cf4f 100644 --- a/website/versioned_docs/version-latest/usage.mdx +++ b/website/versioned_docs/version-latest/usage.mdx @@ -781,7 +781,10 @@ tasks: If you prefer these check to be made by the modification timestamp of the files, instead of its checksum (content), just set the `method` property to -`timestamp`. +`timestamp`. This can be done at two levels: + +At the task level for a specific task: + ```yaml version: '3' @@ -797,6 +800,24 @@ tasks: method: timestamp ``` +At the root level of the Taskfile to apply it globally to all tasks: + +```yaml +version: '3' + +method: timestamp # Will be the default for all tasks + +tasks: + build: + cmds: + - go build . + sources: + - ./*.go + generates: + - app{{exeExt}} +``` + + In situations where you need more flexibility the `status` keyword can be used. You can even combine the two. See the documentation for [status](#using-programmatic-checks-to-indicate-a-task-is-up-to-date) for an @@ -2360,6 +2381,21 @@ if called by another task, either directly or as a dependency. ::: +:::caution + +The watcher can misbehave in certain scenarios, in particular for long-running +servers. +There is a known bug where child processes of the running might not be killed +appropriately. It's adviced to avoid running commands as `go run` and prefer +`go build [...] && ./binary` instead. + +If you are having issues, you might want to try tools specifically designed for +live-reloading, like [Air](https://github.com/air-verse/air/). Also, be sure to +[report any issues](https://github.com/go-task/task/issues/new?template=bug_report.yml) +to us. + +::: + {/* prettier-ignore-start */} [gotemplate]: https://golang.org/pkg/text/template/ [templating-reference]: ./reference/templating.mdx