Skip to content
Open
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
56 changes: 56 additions & 0 deletions config/platforms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
platforms:
rules:
# Heroku: heroku.yml is 100% unique to Heroku (Docker-based deploys).
heroku-yml:
when: fs.fileExists("heroku.yml")
then: heroku
group: cloud
read_files: [Procfile, app.json, heroku.yml, runtime.txt, .python-version]

# Heroku: app.json with Heroku-specific keys (buildpacks, addons).
heroku-app-json:
when: >-
fs.fileExists("app.json")
&& (fs.fileContains("app.json", '"buildpacks"')
|| fs.fileContains("app.json", '"addons"'))
Comment on lines +14 to +15

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Heroku app.json detection uses fs.fileContains to look for the substrings "buildpacks"/"addons". This will also match those words if they appear in values (e.g., description text) rather than as JSON keys, so it isn’t actually “definitive” and can produce false positives. Consider using jq(fs.read("app.json"), ...) to test for the presence of the keys (e.g., has("buildpacks") / has("addons"), or .buildpacks != null / .addons != null) instead of a raw substring search.

Suggested change
&& (fs.fileContains("app.json", '"buildpacks"')
|| fs.fileContains("app.json", '"addons"'))
&& jq(fs.read("app.json"), 'has("buildpacks") or has("addons")')

Copilot uses AI. Check for mistakes.
then: heroku
group: cloud
read_files: [Procfile, app.json, heroku.yml, runtime.txt, .python-version]

# Heroku: Procfile alone is ambiguous (Dokku, Railway, Foreman).
# maybe results are filtered from digest/CLI output.
heroku-procfile:
when: fs.fileExists("Procfile")
maybe: heroku
group: cloud
read_files: [Procfile, app.json, heroku.yml, runtime.txt, .python-version]

# Platform.sh: per-app config or unified config.
platformsh:
when: >-
fs.fileExists(".platform.app.yaml")
|| fs.fileExists(".platform.app.yml")
|| fs.fileExists(".platform/applications.yaml")
|| fs.fileExists(".platform/applications.yml")
then: platformsh
group: cloud
read_files:
- .platform.app.yaml
- .platform.app.yml
- .platform/applications.yaml
- .platform/applications.yml
- .platform/services.yaml
- .platform/services.yml
- .platform/routes.yaml
- .platform/routes.yml

# Upsun: config in .upsun/ directory.
upsun:
when: >-
fs.glob(".upsun/*.yaml").size() > 0
|| fs.glob(".upsun/*.yml").size() > 0
then: upsun
group: cloud
read_files:
- .upsun/config.yaml
- .upsun/config.yml
60 changes: 30 additions & 30 deletions docs/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `@in`

* `@in(A, list(A))` -> `bool`
* `@in(A, map(A, B))` -> `bool`
* `@in(<A>, list(<A>))` -> `bool`
* `@in(<A>, map(<A>, <B>))` -> `bool`

### `@not_strictly_false`

* `@not_strictly_false(bool)` -> `bool`

### `@sortByAssociatedKeys`

* `<list(T)>.@sortByAssociatedKeys(list(int))` -> `list(T)`
* `<list(T)>.@sortByAssociatedKeys(list(uint))` -> `list(T)`
* `<list(T)>.@sortByAssociatedKeys(list(double))` -> `list(T)`
* `<list(T)>.@sortByAssociatedKeys(list(bool))` -> `list(T)`
* `<list(T)>.@sortByAssociatedKeys(list(google.protobuf.Duration))` -> `list(T)`
* `<list(T)>.@sortByAssociatedKeys(list(google.protobuf.Timestamp))` -> `list(T)`
* `<list(T)>.@sortByAssociatedKeys(list(string))` -> `list(T)`
* `<list(T)>.@sortByAssociatedKeys(list(bytes))` -> `list(T)`
* `<list(<T>)>.@sortByAssociatedKeys(list(int))` -> `list(<T>)`
* `<list(<T>)>.@sortByAssociatedKeys(list(uint))` -> `list(<T>)`
* `<list(<T>)>.@sortByAssociatedKeys(list(double))` -> `list(<T>)`
* `<list(<T>)>.@sortByAssociatedKeys(list(bool))` -> `list(<T>)`
* `<list(<T>)>.@sortByAssociatedKeys(list(google.protobuf.Duration))` -> `list(<T>)`
* `<list(<T>)>.@sortByAssociatedKeys(list(google.protobuf.Timestamp))` -> `list(<T>)`
* `<list(<T>)>.@sortByAssociatedKeys(list(string))` -> `list(<T>)`
* `<list(<T>)>.@sortByAssociatedKeys(list(bytes))` -> `list(<T>)`

### `bool`

Expand All @@ -102,7 +102,7 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `distinct`

* `<list(T)>.distinct()` -> `list(T)`
* `<list(<T>)>.distinct()` -> `list(<T>)`

### `double`

Expand All @@ -119,15 +119,15 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `dyn`

* `dyn(A)` -> `dyn`
* `dyn(<A>)` -> `dyn`

### `endsWith`

* `<string>.endsWith(string)` -> `bool`

### `flatten`

* `<list(list(T))>.flatten()` -> `list(T)`
* `<list(list(<T>))>.flatten()` -> `list(<T>)`
* `<list(dyn)>.flatten(int)` -> `list(dyn)`

### `format`
Expand Down Expand Up @@ -190,8 +190,8 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `in`

* `in(A, list(A))` -> `bool`
* `in(A, map(A, B))` -> `bool`
* `in(<A>, list(<A>))` -> `bool`
* `in(<A>, map(<A>, <B>))` -> `bool`

### `indexOf`

Expand Down Expand Up @@ -237,23 +237,23 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `reverse`

* `<list(T)>.reverse()` -> `list(T)`
* `<list(<T>)>.reverse()` -> `list(<T>)`
* `<string>.reverse()` -> `string`

### `size`

* `size(bytes)` -> `int`
* `<bytes>.size()` -> `int`
* `size(list(A))` -> `int`
* `<list(A)>.size()` -> `int`
* `size(map(A, B))` -> `int`
* `<map(A, B)>.size()` -> `int`
* `size(list(<A>))` -> `int`
* `<list(<A>)>.size()` -> `int`
* `size(map(<A>, <B>))` -> `int`
* `<map(<A>, <B>)>.size()` -> `int`
* `size(string)` -> `int`
* `<string>.size()` -> `int`

### `slice`

* `<list(T)>.slice(int, int)` -> `list(T)`
* `<list(<T>)>.slice(int, int)` -> `list(<T>)`

### `sort`

Expand Down Expand Up @@ -307,7 +307,7 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `type`

* `type(A)` -> `type(A)`
* `type(<A>)` -> `type(<A>)`

### `uint`

Expand All @@ -333,7 +333,7 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `!=`

* `A` `!=` `A` -> `bool`
* `<A>` `!=` `<A>` -> `bool`

### `%`

Expand All @@ -358,7 +358,7 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).
* `google.protobuf.Duration` `+` `google.protobuf.Timestamp` -> `google.protobuf.Timestamp`
* `google.protobuf.Timestamp` `+` `google.protobuf.Duration` -> `google.protobuf.Timestamp`
* `int` `+` `int` -> `int`
* `list(A)` `+` `list(A)` -> `list(A)`
* `list(<A>)` `+` `list(<A>)` -> `list(<A>)`
* `string` `+` `string` -> `string`
* `uint` `+` `uint` -> `uint`

Expand Down Expand Up @@ -413,7 +413,7 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `==`

* `A` `==` `A` -> `bool`
* `<A>` `==` `<A>` -> `bool`

### `>=`

Expand Down Expand Up @@ -451,21 +451,21 @@ Query YAML bytes (e.g. file contents) using YQ (same syntax as JQ).

### `? :`

* `bool` `?` `A` `:` `A` -> `A`
* `bool` `?` `<A>` `:` `<A>` -> `<A>`

### `[ ]`

* `list(A)` `[` `int` `]` -> `A`
* `map(A, B)` `[` `A` `]` -> `B`
* `list(<A>)` `[` `int` `]` -> `<A>`
* `map(<A>, <B>)` `[` `<A>` `]` -> `<B>`

### `not strictly false`

* `bool` `_not_strictly_false__` -> `bool`

### `in`

* `A` `in` `list(A)` -> `bool`
* `A` `in` `map(A, B)` -> `bool`
* `<A>` `in` `list(<A>)` -> `bool`
* `<A>` `in` `map(<A>, <B>)` -> `bool`

### `||`

Expand Down
Loading