MCPcopy
hub / github.com/CodebuffAI/codebuff / versionExists

Function versionExists

packages/internal/src/utils/version-utils.ts:136–157  ·  view source on GitHub ↗
(params: {
  agentId: string
  version: Version
  publisherId: string
  db: CodebuffPgDatabase
})

Source from the content-addressed store, hash-verified

134 * Check if a specific version already exists for an agent
135 */
136export async function versionExists(params: {
137 agentId: string
138 version: Version
139 publisherId: string
140 db: CodebuffPgDatabase
141}): Promise<boolean> {
142 const { agentId, version, publisherId, db } = params
143
144 const existingAgent = await db
145 .select()
146 .from(schema.agentConfig)
147 .where(
148 and(
149 eq(schema.agentConfig.id, agentId),
150 eq(schema.agentConfig.version, stringifyVersion(version)),
151 eq(schema.agentConfig.publisher_id, publisherId),
152 ),
153 )
154 .then((rows) => rows[0])
155
156 return !!existingAgent
157}

Callers 2

POSTFunction · 0.90

Calls 2

stringifyVersionFunction · 0.85
fromMethod · 0.80

Tested by

no test coverage detected