Skip to content

Add deep-link support and fetch samples from GitHub URLs#16750

Merged
Mossaka merged 1 commit intomainfrom
feat/editor-deeplinks
Feb 19, 2026
Merged

Add deep-link support and fetch samples from GitHub URLs#16750
Mossaka merged 1 commit intomainfrom
feat/editor-deeplinks

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 19, 2026

Summary

  • Replace hardcoded inline workflow templates (~290 lines) with on-demand fetching from raw.githubusercontent.com/githubnext/agentics
  • Add hash-based deep linking so users can share direct URLs to specific samples or arbitrary GitHub workflow files
  • Auto-convert github.com/blob/ URLs to raw.githubusercontent.com URLs
  • Cache fetched content in-memory to avoid redundant requests

Deep-link formats

Format Example
Built-in sample /editor/#issue-triage
Raw GitHub URL /editor/#https://raw.githubusercontent.com/user/repo/main/workflow.md
GitHub blob URL /editor/#https://github.com/user/repo/blob/main/workflow.md

Test plan

  • Open editor with no hash — loads Hello World default
  • Open /editor/#issue-triage — fetches and loads Issue Triage from agentics repo
  • Open /editor/#ci-doctor — fetches CI Doctor
  • Use dropdown to switch samples — hash updates, content fetches
  • Open /editor/#https://github.com/githubnext/agentics/blob/main/workflows/daily-repo-status.md — auto-converts to raw URL and loads
  • Switch back to Hello World after loading a remote sample — no fetch needed (inline)
  • Re-select a previously fetched sample — loads from cache (no network)
  • Test with invalid URL hash — shows error banner

🤖 Generated with Claude Code

Replace hardcoded sample workflow content with on-demand fetching from
raw.githubusercontent.com/githubnext/agentics. Add hash-based deep
linking so users can share direct links to specific samples or
arbitrary GitHub workflow files:

  /editor/#issue-triage
  /editor/#https://github.com/user/repo/blob/main/workflow.md

GitHub blob URLs are auto-converted to raw URLs. Fetched content is
cached in-memory to avoid redundant requests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 19, 2026 04:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the workflow editor by replacing ~290 lines of hardcoded workflow templates with on-demand fetching from the GitHub agentics repository. It introduces hash-based deep linking that allows users to share direct URLs to specific workflow samples or arbitrary GitHub workflow files. The implementation includes automatic URL conversion from GitHub blob URLs to raw URLs and in-memory caching to avoid redundant network requests.

Changes:

  • Restructured the SAMPLES object to use URL references instead of inline content for most samples
  • Added URL conversion, fetching, and caching infrastructure with toRawGitHubUrl() and fetchContent()
  • Implemented hash-based deep linking with support for sample keys and arbitrary GitHub URLs
  • Updated initialization flow to load content from URL hash on startup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 19 to +51
@@ -27,295 +31,77 @@ engine: copilot

Say hello to the world! Check the current date and time, and greet the user warmly.
`,
},
'issue-triage': {
label: 'Issue Triage',
url: `${AGENTICS_RAW}/issue-triage.md`,
},
'ci-doctor': {
label: 'CI Doctor',
url: `${AGENTICS_RAW}/ci-doctor.md`,
},
'contribution-check': {
label: 'Contribution Guidelines Checker',
url: `${AGENTICS_RAW}/contribution-guidelines-checker.md`,
},
'daily-repo-status': {
label: 'Daily Repo Status',
url: `${AGENTICS_RAW}/daily-repo-status.md`,
},
};
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The label properties in the SAMPLES object (lines 21, 36, 40, 44, 48) are defined but never used in the code. The dropdown options are hardcoded in the HTML file. Consider either removing these unused label properties or dynamically generating the dropdown options from the SAMPLES object to maintain a single source of truth.

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +84
async function fetchContent(url) {
const rawUrl = toRawGitHubUrl(url);
if (contentCache.has(rawUrl)) return contentCache.get(rawUrl);
const resp = await fetch(rawUrl);
if (!resp.ok) throw new Error(`Failed to fetch ${rawUrl}: ${resp.status}`);
const text = await resp.text();
contentCache.set(rawUrl, text);
return text;
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The fetchContent function does not validate or sanitize arbitrary URLs before fetching them. Consider adding URL validation to ensure only allowed domains (e.g., raw.githubusercontent.com, github.com) are accessed, or implement appropriate CORS handling and error messaging for external URLs.

Copilot uses AI. Check for mistakes.
await loadFromUrl(hash);
return true;
}

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

When an invalid hash is provided (not a recognized sample key and not a URL starting with http:// or https://), the function silently returns false without showing any error feedback to the user. According to the test plan, invalid URL hashes should show an error banner.

Suggested change
// Invalid hash: show an error banner according to the test plan
setStatus('error', 'Invalid URL hash');
errorText.textContent = 'Unrecognized sample key or URL in address bar.';
errorBanner.classList.remove('d-none');

Copilot uses AI. Check for mistakes.
Comment on lines +242 to +266
async function loadSample(key) {
const sample = SAMPLES[key];
if (!sample) return;

// Sync dropdown
sampleSelect.value = key;
setHashQuietly(key);

if (sample.content) {
setEditorContent(sample.content);
return;
}

// Fetch from URL
setStatus('compiling', 'Fetching...');
try {
const text = await fetchContent(sample.url);
sample.content = text; // cache on the sample object too
setEditorContent(text);
} catch (err) {
setStatus('error', 'Fetch failed');
errorText.textContent = err.message;
errorBanner.classList.remove('d-none');
}
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

There is no mechanism to cancel or track in-flight fetch requests. If a user rapidly switches between samples or changes the hash multiple times, multiple fetch requests will execute concurrently, and the last one to complete will set the editor content regardless of which sample the user actually selected most recently. Consider tracking and cancelling pending fetch requests (e.g., using AbortController) or implementing request queuing to ensure the displayed content matches the user's current selection.

Copilot uses AI. Check for mistakes.
@Mossaka Mossaka merged commit c7913a8 into main Feb 19, 2026
49 checks passed
@Mossaka Mossaka deleted the feat/editor-deeplinks branch February 19, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants