diff options
Diffstat (limited to 'plugins/code-modernization/workflows/reimagine-scaffold.js')
| -rw-r--r-- | plugins/code-modernization/workflows/reimagine-scaffold.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/code-modernization/workflows/reimagine-scaffold.js b/plugins/code-modernization/workflows/reimagine-scaffold.js index 84060558..36a77f8a 100644 --- a/plugins/code-modernization/workflows/reimagine-scaffold.js +++ b/plugins/code-modernization/workflows/reimagine-scaffold.js @@ -7,8 +7,14 @@ export const meta = { phases: [{ title: 'Scaffold', detail: 'one agent per approved service' }], } -const system = args && args.system -const services = args && args.services +// `args` may arrive as the caller's raw JSON string rather than the parsed +// object, depending on the invoking runtime; normalize so both work. A string +// that is not valid JSON falls through and the requires-args check reports it. +const ARGS = typeof args === 'string' ? (() => { try { return JSON.parse(args) } catch (e) { return args } })() : args + + +const system = ARGS && ARGS.system +const services = ARGS && ARGS.services if (!system || !Array.isArray(services) || services.length === 0) { throw new Error( 'modernize-reimagine-scaffold requires args: {system: "<system-dir>", services: [{name: "...", responsibilities: "..."}]} — run it only after the architecture is approved', |
