-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix: accept GitHub URLs in settings add project #1110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
leex279
merged 1 commit into
coleam00:dev
from
LocNguyenSGU:fix/issue-1108-settings-add-project-url-support
Apr 16, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { describe, expect, test } from 'bun:test'; | ||
| import { getCodebaseInput } from '@/lib/codebase-input'; | ||
|
|
||
| describe('getCodebaseInput', () => { | ||
| test('treats GitHub repository inputs as urls', () => { | ||
| expect(getCodebaseInput('https://github.com/coleam00/Archon')).toEqual({ | ||
| url: 'https://github.com/coleam00/Archon', | ||
| }); | ||
| }); | ||
|
|
||
| test('treats SSH git@ shorthand as urls', () => { | ||
| expect(getCodebaseInput('git@github.com:coleam00/Archon.git')).toEqual({ | ||
| url: 'git@github.com:coleam00/Archon.git', | ||
| }); | ||
| }); | ||
|
|
||
| test('treats ssh:// URLs as urls', () => { | ||
| expect(getCodebaseInput('ssh://git@github.com/coleam00/Archon.git')).toEqual({ | ||
| url: 'ssh://git@github.com/coleam00/Archon.git', | ||
| }); | ||
| }); | ||
|
|
||
| test('treats git:// URLs as urls', () => { | ||
| expect(getCodebaseInput('git://github.com/coleam00/Archon.git')).toEqual({ | ||
| url: 'git://github.com/coleam00/Archon.git', | ||
| }); | ||
| }); | ||
|
|
||
| test('trims surrounding whitespace before classifying', () => { | ||
| expect(getCodebaseInput(' https://github.com/a/b ')).toEqual({ | ||
| url: 'https://github.com/a/b', | ||
| }); | ||
| }); | ||
|
|
||
| test('treats relative local paths as paths', () => { | ||
| expect(getCodebaseInput('./repo')).toEqual({ path: './repo' }); | ||
| expect(getCodebaseInput('../repo')).toEqual({ path: '../repo' }); | ||
| expect(getCodebaseInput('repo')).toEqual({ path: 'repo' }); | ||
| }); | ||
|
|
||
| test('treats unix local paths as paths', () => { | ||
| expect(getCodebaseInput('/path/to/repository')).toEqual({ | ||
| path: '/path/to/repository', | ||
| }); | ||
| }); | ||
|
|
||
| test('treats home-relative paths as paths', () => { | ||
| expect(getCodebaseInput('~/src/archon')).toEqual({ | ||
| path: '~/src/archon', | ||
| }); | ||
| }); | ||
|
|
||
| test('treats windows local paths as paths', () => { | ||
| expect(getCodebaseInput('C:\\repo\\archon')).toEqual({ | ||
| path: 'C:\\repo\\archon', | ||
| }); | ||
| }); | ||
|
|
||
| test('treats windows UNC paths as paths', () => { | ||
| expect(getCodebaseInput('\\\\server\\share\\archon')).toEqual({ | ||
| path: '\\\\server\\share\\archon', | ||
| }); | ||
| }); | ||
| }); | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * Classify input for POST /api/codebases. A `url` key signals a remote clone; | ||
| * a `path` key signals registering a local/relative path (server resolves | ||
| * tilde/relative). Inputs without an explicit remote prefix fall through to `path`. | ||
| */ | ||
| export function getCodebaseInput(value: string): { path: string } | { url: string } { | ||
| const trimmed = value.trim(); | ||
| const isRemoteUrl = /^(https?:\/\/|ssh:\/\/|git@|git:\/\/)/i.test(trimmed); | ||
| return isRemoteUrl ? { url: trimmed } : { path: trimmed }; | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.