MCPcopy Create free account
hub / github.com/SethGammon/Citadel / contractFromArgs

Function contractFromArgs

scripts/loops.js:108–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106}
107
108function contractFromArgs() {
109 const template = arg('--template');
110 const options = {};
111 const set = (key, value) => {
112 if (value !== null && value !== undefined && value !== '') options[key] = value;
113 };
114
115 set('id', arg('--id'));
116 set('type', arg('--type', template ? null : 'loop'));
117 set('title', arg('--title') || arg('--goal') || arg('--command'));
118 set('goal', arg('--goal') || arg('--title') || arg('--command'));
119 set('command', arg('--command'));
120 set('verifierCommand', arg('--verify'));
121 set('cadence', arg('--cadence'));
122 set('triggerKind', arg('--trigger', arg('--cadence') ? 'scheduled' : 'manual'));
123 set('scope', arg('--scope'));
124 set('reviewArtifact', arg('--artifact'));
125 const maxAttempts = arg('--max-attempts');
126 if (maxAttempts !== null) options.maxAttempts = Number(maxAttempts);
127
128 if (template) return instantiateLoopTemplate(template, options);
129 return createLoopContract(options);
130}
131
132function main() {
133 const mode = process.argv[2] || 'list';

Callers 1

mainFunction · 0.85

Calls 4

setFunction · 0.85
instantiateLoopTemplateFunction · 0.85
createLoopContractFunction · 0.85
argFunction · 0.70

Tested by

no test coverage detected