mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 04:01:56 +00:00
feat(coding-agent): add SSH URL support for git packages
Use hosted-git-info library for robust parsing of SSH URLs (git@host:path and ssh://) in addition to HTTPS. SSH and HTTPS URLs for the same repo are now properly deduplicated.
This commit is contained in:
parent
0404a93e33
commit
fba9a8aece
9 changed files with 576 additions and 48 deletions
|
|
@ -33,6 +33,7 @@ import { allTools } from "./core/tools/index.js";
|
|||
import { runMigrations, showDeprecationWarnings } from "./migrations.js";
|
||||
import { InteractiveMode, runPrintMode, runRpcMode } from "./modes/index.js";
|
||||
import { initTheme, stopThemeWatcher } from "./modes/interactive/theme/theme.js";
|
||||
import { parseGitUrl } from "./utils/git.js";
|
||||
|
||||
/**
|
||||
* Read all content from piped stdin.
|
||||
|
|
@ -122,15 +123,13 @@ function normalizeExtensionSource(source: string): { type: "npm" | "git" | "loca
|
|||
const match = spec.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@.+)?$/);
|
||||
return { type: "npm", key: match?.[1] ?? spec };
|
||||
}
|
||||
if (source.startsWith("git:")) {
|
||||
const repo = source.slice("git:".length).trim().split("@")[0] ?? "";
|
||||
return { type: "git", key: repo.replace(/^https?:\/\//, "").replace(/\.git$/, "") };
|
||||
}
|
||||
// Raw git URLs
|
||||
if (source.startsWith("https://") || source.startsWith("http://")) {
|
||||
const repo = source.split("@")[0] ?? "";
|
||||
return { type: "git", key: repo.replace(/^https?:\/\//, "").replace(/\.git$/, "") };
|
||||
|
||||
// Try parsing as git URL
|
||||
const parsed = parseGitUrl(source);
|
||||
if (parsed) {
|
||||
return { type: "git", key: `${parsed.host}/${parsed.path}` };
|
||||
}
|
||||
|
||||
return { type: "local", key: source };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue