Hi.
Summary
There is no way to set the array-typed workflows config key via openspec config set. Any value is treated as a string and rejected by schema validation, so switching to the custom profile non-interactively is impossible — even though config set advertises "auto-coerce types" and workflows is a known top-level key.
Environment
- OpenSpec CLI: 1.4.1 (latest from npm
@fission-ai/openspec)
- Node: >= 20
- OS: Linux
- Scenario: switching the global profile from
core to custom to enable new / ff workflows
Steps to reproduce
openspec config set profile custom # OK
openspec config set workflows '["new","ff","apply","archive"]'
Actual result
Error: Invalid configuration - workflows: Invalid input: expected array, received string
profile is now left as custom while workflows is unset, so getProfileWorkflows('custom', undefined) resolves to [] (zero workflows). If openspec update runs in this state, the project loses all /opsx:* commands and skills.
Expected result
The value should be parsed as an array and stored, configuring the custom profile non-interactively (e.g. workflows: ["new","ff","apply","archive"]).
Root cause
coerceValue (core/config-schema.js) only coerces boolean, number, or string:
export function coerceValue(value, forceString = false) {
if (forceString) return value;
if (value === 'true') return true;
if (value === 'false') return false;
const num = Number(value);
if (!isNaN(num) && isFinite(num) && value.trim() !== '') return num;
return value; // arrays / JSON fall through as a raw string
}
workflows is declared as z.array(z.string()) in GlobalConfigSchema and is the only array-typed settable key. Because coerceValue never produces an array, config set workflows ... always fails Zod validation, despite workflows being present in KNOWN_TOP_LEVEL_KEYS and the command help reading "Set a value (auto-coerce types)".
Workarounds
- Interactive picker:
openspec config profile (no preset argument).
- Hand-edit
~/.config/openspec/config.json and add the workflows array manually.
Suggested fix
- JSON-parse values for array/object-typed keys in
config set (e.g. attempt JSON.parse and fall back to the current string coercion), or
- add an explicit
--json flag / a repeatable --append <workflow> form for list keys, and/or
- document that
workflows cannot be set via config set and must go through the interactive openspec config profile picker.
Related
Best regards.
Draqun
Hi.
Summary
There is no way to set the array-typed
workflowsconfig key viaopenspec config set. Any value is treated as a string and rejected by schema validation, so switching to thecustomprofile non-interactively is impossible — even thoughconfig setadvertises "auto-coerce types" andworkflowsis a known top-level key.Environment
@fission-ai/openspec)coretocustomto enablenew/ffworkflowsSteps to reproduce
Actual result
profileis now left ascustomwhileworkflowsis unset, sogetProfileWorkflows('custom', undefined)resolves to[](zero workflows). Ifopenspec updateruns in this state, the project loses all/opsx:*commands and skills.Expected result
The value should be parsed as an array and stored, configuring the
customprofile non-interactively (e.g.workflows: ["new","ff","apply","archive"]).Root cause
coerceValue(core/config-schema.js) only coercesboolean,number, orstring:workflowsis declared asz.array(z.string())inGlobalConfigSchemaand is the only array-typed settable key. BecausecoerceValuenever produces an array,config set workflows ...always fails Zod validation, despiteworkflowsbeing present inKNOWN_TOP_LEVEL_KEYSand the command help reading "Set a value (auto-coerce types)".Workarounds
openspec config profile(no preset argument).~/.config/openspec/config.jsonand add theworkflowsarray manually.Suggested fix
config set(e.g. attemptJSON.parseand fall back to the current string coercion), or--jsonflag / a repeatable--append <workflow>form for list keys, and/orworkflowscannot be set viaconfig setand must go through the interactiveopenspec config profilepicker.Related
/opsx:newnot present on the defaultcoreprofile)Best regards.
Draqun