feat(phase4): Quick Edit, Contents API commit flow, editor workspace
- portable UTF-8 base64 helpers (Hermes-safe), used for file round-trips - endpoints: updateFileContents, createFileContents, createPull - hooks: useCommitFile (invalidates repo cache), useCreatePull - FileEdit screen: native monospace editor, dirty/discard, branch picker, commit-to-new-branch, protected-branch handling, post-commit PR creation; stale-SHA 409 surfaces as a conflict message - settings: editor URL template; repo overview 'Open in editor' (no token) - tests: base64 round-trips (accents/emoji), editor URL expansion
This commit is contained in:
1 parent
ddd834b7ac
commit
c9dd49446a
18 files changed
+733
-29
No files matched your search
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Expands the user's editor/IDE URL template for the repository action.
|
||||
*
|
||||
* The template is opened with `Linking.openURL` only — the API token is never
|
||||
* part of the template or the resulting URL, so IDE auth stays separate.
|
||||
*/
|
||||
|
||||
export interface EditorUrlParts {
|
||||
owner: string;
|
||||
name: string;
|
||||
cloneUrl?: string;
|
||||
htmlUrl?: string;
|
||||
}
|
||||
|
||||
/** Replaces `{owner}`, `{repo}`, `{cloneUrl}` and `{htmlUrl}`, URI-encoding each value. */
|
||||
export function buildEditorUrl(template: string, parts: EditorUrlParts): string {
|
||||
return template
|
||||
.split('{owner}')
|
||||
.join(encodeURIComponent(parts.owner))
|
||||
.split('{repo}')
|
||||
.join(encodeURIComponent(parts.name))
|
||||
.split('{cloneUrl}')
|
||||
.join(encodeURIComponent(parts.cloneUrl ?? ''))
|
||||
.split('{htmlUrl}')
|
||||
.join(encodeURIComponent(parts.htmlUrl ?? ''));
|
||||
}
|
||||
Reference in new issue
Block a user