Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/patch-add-copy-button-docs.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 101 additions & 0 deletions docs/src/components/CopyEntireFileButton.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
const { filePath, label = 'Copy instructions' } = Astro.props;
const id = `copy-btn-${Math.random().toString(36).substr(2, 9)}`;
---

<button
id={id}
type="button"
class="copy-entire-file-btn"
data-filepath={filePath}
aria-label="Copy entire instructions file to clipboard"
title="Copy entire instructions file to clipboard"
>
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
aria-hidden="true"
focusable="false"
>
<path d="M16 1H4a2 2 0 0 0-2 2v12h2V3h12V1zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm0 16H8V7h11v14z" fill="currentColor"/>
</svg>
<span class="btn-text">{label}</span>
</button>

<style>
.copy-entire-file-btn {
display: inline-flex;
align-items: center;
gap: 0.4rem;
padding: 0.4rem 0.6rem;
border-radius: 6px;
border: 1px solid var(--sl-color-hairline);
background: var(--sl-color-bg);
color: var(--sl-color-text);
cursor: pointer;
font-size: inherit;
font-family: inherit;
}

.copy-entire-file-btn:hover {
background: var(--sl-color-gray-6);
}

.copy-entire-file-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
</style>

<script>
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.copy-entire-file-btn').forEach((button) => {
const filepath = button.getAttribute('data-filepath');
if (!filepath) return;

const btnText = button.querySelector('.btn-text');
const originalText = btnText ? btnText.textContent : 'Copy instructions';

button.addEventListener('click', async () => {
try {
button.setAttribute('disabled', 'true');
if (btnText) btnText.textContent = 'Copying…';

const res = await fetch(filepath, { cache: 'no-store' });
if (!res.ok) throw new Error(`Failed to fetch file: ${res.status}`);
const text = await res.text();

// Prefer Async Clipboard API
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(text);
} else {
// Fallback
const textarea = document.createElement('textarea');
textarea.value = text;
textarea.style.position = 'fixed';
textarea.style.top = '-9999px';
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
}

if (btnText) btnText.textContent = 'Copied!';
setTimeout(() => {
button.removeAttribute('disabled');
if (btnText) btnText.textContent = originalText;
}, 2000);
} catch (e) {
console.error(e);
if (btnText) btnText.textContent = 'Error';
setTimeout(() => {
button.removeAttribute('disabled');
if (btnText) btnText.textContent = originalText;
}, 3000);
}
});
});
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ sidebar:
order: 100
---

import CopyEntireFileButton from '../../../components/CopyEntireFileButton.astro';

GitHub Agentic Workflows provide a prompt file that turns your favorite agent into
a powerful workflow authoring tool. This guide explains how to use this mode to author agentic workflows in natural language.

Expand Down Expand Up @@ -67,7 +69,7 @@ Load the prompt file into your preferred AI chat or agent interface that support

## Dictating Agentic Workflows

When creating agentic workflows using speech-to-text (dictation), you may encounter terminology mismatches and formatting issues common to voice recognition systems. To help correct these issues, use the [dictation instructions prompt](https://raw.githubusercontent.com/githubnext/gh-aw/main/.github/instructions/dictation.instructions.md).
When creating agentic workflows using speech-to-text (dictation), you may encounter terminology mismatches and formatting issues common to voice recognition systems. To help correct these issues, use the [dictation instructions prompt](https://raw.githubusercontent.com/githubnext/gh-aw/main/.github/instructions/dictation.instructions.md) or <CopyEntireFileButton filePath="https://raw.githubusercontent.com/githubnext/gh-aw/main/.github/instructions/dictation.instructions.md" label="Copy full instructions" />.

This prompt helps rephrase text captured through speech-to-text recognition by:
- Correcting project-specific terminology (e.g., "ghaw" → "gh-aw", "work flow" → "workflow")
Expand Down
Loading