{"id":18381,"library":"gemini-configparser","title":"gemini-configparser","description":"A configuration parser module for the Gemini (testplane) testing framework, version 1.4.2. It provides a declarative way to define configuration schemas using composable functions like `option`, `section`, `map`, and `root`. Supports parsing from CLI arguments, environment variables, and objects with validation and transformation. Differentiates from alternatives like `convict` by being tightly integrated with Gemini/testplane and offering a nested structure with functions.","status":"active","version":"1.4.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install gemini-configparser","lang":"bash","label":"npm"},{"cmd":"yarn add gemini-configparser","lang":"bash","label":"yarn"},{"cmd":"pnpm add gemini-configparser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default import is not supported; use named import.","wrong":"import option from 'gemini-configparser'","symbol":"option","correct":"import { option } from 'gemini-configparser'"},{"note":"CommonJS require works but TypeScript prefers import.","wrong":"const section = require('gemini-configparser').section","symbol":"section","correct":"import { section } from 'gemini-configparser'"},{"note":"map is a named export, not a submodule.","wrong":"const map = require('gemini-configparser/map')","symbol":"map","correct":"import { map } from 'gemini-configparser'"},{"note":"root is exported as named export.","wrong":"const root = require('gemini-configparser').root","symbol":"root","correct":"import { root } from 'gemini-configparser'"}],"quickstart":{"code":"import { root, section, option } from 'gemini-configparser';\n\nconst configParser = root(section({\n  server: section({\n    port: option({\n      defaultValue: 8080,\n      parseEnv: Number,\n      parseCli: Number,\n      validate: (v) => { if (v < 0) throw new Error('port must be positive'); }\n    }),\n    host: option({\n      defaultValue: 'localhost',\n      parseEnv: String,\n      parseCli: String\n    })\n  })\n}), {\n  envPrefix: 'MY_APP_',\n  cliPrefix: '--'\n});\n\nconst config = configParser({\n  options: { server: { port: 3000 } },\n  env: { MY_APP_SERVER_HOST: '0.0.0.0' },\n  argv: ['--server:port', '4000']\n});\n\nconsole.log(config); // { server: { port: 4000, host: '0.0.0.0' } }","lang":"typescript","description":"Defines a config parser with nested sections, options with defaults and validation, then parses from options, env, and CLI arguments."},"warnings":[{"fix":"Include all possible keys in the section definition.","message":"All keys in the schema must be defined; unknown keys in input will be treated as errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Wrap with Number() or String() as shown in quickstart.","message":"parseCli and parseEnv functions are applied to the raw string value; ensure they handle strings correctly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If you need a dynamic default, provide a function: defaultValue: (config, node) => ...","message":"defaultValue can be a function receiving config and currentNode for dynamic defaults.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.4.2':15 'altern':49 'argument':38 'cli':37 'compos':26 'configpars':3 'configur':5,23 'convict':51 'declar':19 'defin':22 'differenti':47 'environ':39 'framework':13 'function':27,64 'gemini':2,10 'gemini-configpars':1 'gemini/testplane':57 'integr':55 'javascript':65 'like':28,50 'map':31 'modul':7 'nest':61 'object':42 'offer':59 'option':29 'pars':35 'parser':6 'provid':17 'root':33 'schema':24 'section':30 'structur':62 'support':34 'test':12 'testplan':11 'tight':54 'transform':46 'typescript':66 'use':25 'valid':44 'variabl':40 'version':14 'way':20","created_at":"2026-04-25T07:37:56.769225+00:00","updated_at":"2026-04-25T07:37:56.769225+00:00","problems":[{"fix":"Remove the unknown key from input or add it to the section definition.","cause":"Input data contains a key not defined in the schema.","error":"Error: Unknown field 'extraField'"},{"fix":"Ensure parseEnv/parseCli functions return the correct type; e.g., Number(rawValue) for numbers.","cause":"parseEnv or parseCli returns a non-number when Number is expected.","error":"Error: Expected number, got string"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/gemini-configparser","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}