MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / isAtomicAvailable

Function isAtomicAvailable

packages/opencode-atomic-hooks/src/cli.ts:124–145  ·  view source on GitHub ↗
(
  $: Shell,
  directory: string,
)

Source from the content-addressed store, hash-verified

122 * @returns `true` if both the CLI and the `.atomic/` directory are present
123 */
124export async function isAtomicAvailable(
125 $: Shell,
126 directory: string,
127): Promise<boolean> {
128 try {
129 const version = await $`${ATOMIC_CMD} --version`
130 .cwd(directory)
131 .quiet()
132 .nothrow();
133
134 if (version.exitCode !== 0) return false;
135
136 const repo = await $`test -d ${ATOMIC_DIR}`
137 .cwd(directory)
138 .quiet()
139 .nothrow();
140
141 return repo.exitCode === 0;
142 } catch {
143 return false;
144 }
145}
146
147// =============================================================================
148// Payload Helpers

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected