MCPcopy
hub / github.com/Doorman11991/smallcode / save

Method save

src/session/contract_store.js:95–102  ·  view source on GitHub ↗
(contract)

Source from the content-addressed store, hash-verified

93 }
94
95 save(contract) {
96 if (!(contract instanceof Contract)) contract = new Contract(contract);
97 const dir = contractDir(contract.id, this.cwd);
98 fs.mkdirSync(dir, { recursive: true });
99 writeAtomic(statePath(contract.id, this.cwd), JSON.stringify(contract.toJSON(), null, 2) + '\n');
100 writeAtomic(path.join(dir, 'contract.md'), renderContractMd(contract));
101 writeAtomic(path.join(dir, 'assertions.md'), renderAssertionsMd(contract));
102 }
103
104 list() {
105 const root = contractsDir(this.cwd);

Callers 5

activateMethod · 0.95
createMethod · 0.95
markAssertionMethod · 0.95
abortMethod · 0.95
completeMethod · 0.95

Calls 6

contractDirFunction · 0.85
writeAtomicFunction · 0.85
statePathFunction · 0.85
renderContractMdFunction · 0.85
renderAssertionsMdFunction · 0.85
toJSONMethod · 0.45

Tested by

no test coverage detected