MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / run

Function run

packages/cli/src/actions/format.ts:13–27  ·  view source on GitHub ↗
(options: Options)

Source from the content-addressed store, hash-verified

11 * CLI action for formatting a ZModel schema file.
12 */
13export async function run(options: Options) {
14 const schemaFile = getSchemaFile(options.schema);
15 let formattedContent: string;
16
17 try {
18 formattedContent = await formatDocument(fs.readFileSync(schemaFile, 'utf-8'));
19 } catch (error) {
20 console.error(colors.red('✗ Schema formatting failed.'));
21 // Re-throw to maintain CLI exit code behavior
22 throw error;
23 }
24
25 fs.writeFileSync(schemaFile, formattedContent, 'utf-8');
26 console.log(colors.green('✓ Schema formatting completed successfully.'));
27}

Callers

nothing calls this directly

Calls 3

getSchemaFileFunction · 0.90
formatDocumentFunction · 0.90
logMethod · 0.65

Tested by

no test coverage detected