docs: hint at jq file injection for safe-output body fields - #48909
Merged
Conversation
…tion Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
hint: add jq file injection example to safe outputs CLI proxy instruction
docs: hint at jq file injection for safe-output body fields
Jul 29, 2026
Copilot created this pull request from a session on behalf of
pelikhan
July 29, 2026 14:31
View session
pelikhan
marked this pull request as ready for review
July 29, 2026 14:33
Contributor
There was a problem hiding this comment.
Pull request overview
Adds file-based jq -Rs guidance for constructing safe-output body payloads.
Changes:
- Documents file-to-JSON body injection.
- Clarifies unsupported
@filenameexpansion. - Adds a patch changeset.
Show a summary per file
| File | Description |
|---|---|
actions/setup/md/safe_outputs_prompt.md |
Adds concise file-injection guidance. |
actions/setup/md/mcp_cli_tools_prompt.md |
Adds a detailed jq -Rs example. |
.changeset/hint-jq-file-injection-safe-outputs-prompt.md |
Records the documentation change. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Medium
Comment on lines
+18
to
+19
| jq -Rs --arg discussion_number "$DISCUSSION_NUMBER" \ | ||
| '{discussion_number: ($discussion_number|tonumber), body: .}' \ |
| temporary_id: optional cross-reference field for future resources created by safe outputs. Canonical form: '#aw_' followed by 3–12 alphanumeric or underscore characters — e.g., '#aw_abc1', '#aw_pr_fix'. Pattern: /^#?aw_[A-Za-z0-9_]{3,12}$/i (the '#' prefix is optional; bare 'aw_abc1' is accepted and normalised to '#aw_abc1' automatically). Use this form for all field values (temporary_id, item_number, issue_number, parent, etc.). In body/markdown text, '#aw_abc1' references are replaced with the real issue/PR number after creation. Omit entirely when not needed. | ||
|
|
||
| **Note**: safeoutputs tools do NOT support `@filename` file name expansion. Always provide content inline — do not use `@filename` references in tool arguments. | ||
| **Note**: safeoutputs tools do NOT support `@filename` file name expansion. Always provide content inline — do not use `@filename` references in tool arguments. To inject an entire file as the `body` field, use `jq -Rs` to read it as a JSON string and pipe the resulting payload: `jq -Rs '{body: .}' file.md | safeoutputs update_discussion .` |
| discussion-body.md \ | ||
| | safeoutputs update_discussion . | ||
| ``` | ||
| `jq -Rs` reads the file as a raw string (`-R`) and slurps it into a single JSON string value (`-s`), so `body` is always a valid JSON field. Piping `cat file | safeoutputs ...` does not populate `body` and will be rejected. |
Contributor
|
🎉 This pull request is included in a new release. Release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agents editing large bodies (issues, discussions, PRs) must currently re-embed the full content inline in the safe-output payload, increasing token cost. A
jq -Rspipe pattern avoids this by reading from a local file without@filenameexpansion (which safeoutputs rejects).Changes
mcp_cli_tools_prompt.md: Adds ajq -Rsexample alongside the existing stdin-pipe pattern, with a note explaining why rawcat file | safeoutputs ...is rejected (body field not populated → validation error):safe_outputs_prompt.md: Extends the@filename-not-supported note to point agents towardjq -Rsas the correct alternative.