MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / getArtifact

Function getArtifact

src/artifacts/store.ts:229–238  ·  view source on GitHub ↗
(cwd: string, id: string, version?: number)

Source from the content-addressed store, hash-verified

227
228/** Read a specific version's content (defaults to current). */
229export async function getArtifact(cwd: string, id: string, version?: number): Promise<{ manifest: ArtifactManifest; version: number; content: string; absFile: string }> {
230 const manifest = await readManifest(cwd, id);
231 if (!manifest) throw new Error(`Artifact "${id}" not found.`);
232 const v = version ?? manifest.current;
233 const entry = manifest.versions.find(x => x.v === v);
234 if (!entry) throw new Error(`Artifact "${id}" has no version ${v}.`);
235 const absFile = path.join(artifactDir(cwd, id), entry.file);
236 const content = await fs.readFile(absFile, 'utf-8');
237 return { manifest, version: v, content, absFile };
238}
239
240/** Roll the "current" pointer back to an earlier (existing) version — no new file. */
241export async function rollbackArtifact(cwd: string, id: string, toVersion: number, write: WriteFn, now = new Date().toISOString()): Promise<ArtifactManifest> {

Callers 6

mainFunction · 0.90
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
renderCurrentFunction · 0.85

Calls 2

artifactDirFunction · 0.85
readManifestFunction · 0.70

Tested by 1

mainFunction · 0.72