MCPcopy Index your code
hub / github.com/Fission-AI/OpenSpec / execute

Method execute

src/core/archive.ts:131–163  ·  view source on GitHub ↗
(changeName?: string, options: ArchiveOptions = {})

Source from the content-addressed store, hash-verified

129
130export class ArchiveCommand {
131 async execute(changeName?: string, options: ArchiveOptions = {}): Promise<void> {
132 const json = !!options.json;
133
134 let root: ResolvedOpenSpecRoot;
135 try {
136 root = await resolveOpenSpecRoot({
137 ...(options.store !== undefined ? { store: options.store } : {}),
138 ...(options.storePath !== undefined ? { storePath: options.storePath } : {}),
139 });
140 } catch (error) {
141 if (json && isRootSelectionError(error)) {
142 this.printJsonFailure(undefined, toArchiveDiagnostic(error));
143 return;
144 }
145 throw error;
146 }
147
148 if (json) {
149 try {
150 const result = await this.run(changeName, options, root, true);
151 if (!result) {
152 return;
153 }
154 console.log(JSON.stringify({ archive: result, root: toRootOutput(root) }, null, 2));
155 } catch (error) {
156 this.printJsonFailure(root, toArchiveDiagnostic(error));
157 }
158 return;
159 }
160
161 emitStoreRootBanner(root);
162 await this.run(changeName, options, root, false);
163 }
164
165 private printJsonFailure(root: ResolvedOpenSpecRoot | undefined, diagnostic: ArchiveDiagnostic): void {
166 console.log(

Callers

nothing calls this directly

Calls 7

printJsonFailureMethod · 0.95
runMethod · 0.95
resolveOpenSpecRootFunction · 0.85
isRootSelectionErrorFunction · 0.85
toArchiveDiagnosticFunction · 0.85
toRootOutputFunction · 0.85
emitStoreRootBannerFunction · 0.85

Tested by

no test coverage detected