Conversation
…pik.config` in the Node.js SDK - Introduced `saveToOpikConfigStep` to manage Opik configuration as an INI file with merging support. - Integrated `saveToOpikConfigStep` into the Node.js configuration wizard. - Updated step exports for inclusion in the configuration flow.
…guration tool - Introduced Vitest for testing the Node.js SDK configuration tool. - Exported `parseOpikSection` and `serializeOpikSection` for unit testing. - Added comprehensive test cases for `parseOpikSection`, `serializeOpikSection`, and `saveToOpikConfigStep` logic. - Updated `tsconfig.json` to include `tests` directory. - Added new test scripts to `package.json` and updated workflows to run tests for the configuration tool.
sdks/typescript/src/opik/configure/tests/steps/save-to-opik-config.test.ts
Show resolved
Hide resolved
sdks/typescript/src/opik/configure/src/steps/save-to-opik-config.ts
Outdated
Show resolved
Hide resolved
sdks/typescript/src/opik/configure/src/steps/save-to-opik-config.ts
Outdated
Show resolved
Hide resolved
sdks/typescript/src/opik/configure/src/steps/save-to-opik-config.ts
Outdated
Show resolved
Hide resolved
…improve file path resolution - Replaced custom INI parsing/serialization logic with the `ini` package to simplify code and improve maintainability. - Added support for `OPIK_CONFIG_PATH` environment variable to allow custom configuration file paths. - Implemented fallback mechanism for invalid or non-existent `OPIK_CONFIG_PATH` directories. - Updated tests to reflect `ini` package integration and new path resolution logic.
…ATH and update fallback handling - Added logic to create directories recursively when `OPIK_CONFIG_PATH` parent directory is missing. - Improved error handling and warnings for directory creation failures. - Enhanced tests to validate directory creation and fallback behaviors.
- Introduced setup/teardown logic to ensure `OPIK_CONFIG_PATH` is isolated during tests. - Removed redundant `process.env.OPIK_CONFIG_PATH` cleanup from individual test cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Context
The TS wizard (npx opik-configure) already asks for project name — good. But it should also save it to ~/.opik.config (in addition to .env) so that both SDKs share the same configuration. This way a user who configures via one SDK doesn't have to reconfigure for the other.
Changes needed
Acceptance Criteria
Summary
The TypeScript
npx opik-configurewizard now saves configuration (includingproject_name) to~/.opik.configin addition to the project's.envfile, so both the Python and TypeScript SDKs share the same persistent configuration. Unit testing infrastructure was also added to the configure tool package.Changes by Component
TypeScript SDK
node-wizard.ts: After writing env vars to.env/.env.local, calls the newsaveToOpikConfigStepto persisturl_override,project_name, and (for cloud/self-hosted)api_keyandworkspaceto~/.opik.config.save-to-opik-config.ts(new): ImplementssaveToOpikConfigStepwhich reads, merges, and writes~/.opik.configusing theinipackage (same as the main SDK'sConfig.ts). RespectsOPIK_CONFIG_PATHenv var with tilde expansion, creates missing parent directories, and falls back to the default path with a warning if directory creation fails.steps/index.ts: Re-exports the new step.package.json: Addedini ^5.0.0(runtime dependency) andvitest ^3.0.5(dev dependency); addedtestandtest:watchscripts.tsconfig.json: Addedtestsdirectory to the TypeScript include list.vitest.config.ts(new): Minimal Vitest configuration for the configure tool package.tests/steps/save-to-opik-config.test.ts(new): 8 unit tests covering: new file creation, cloud vs local credential inclusion, merge with existing config, preservation of other INI sections, customOPIK_CONFIG_PATH(existing parent dir), parent directory auto-creation, fallback on directory creation failure, andwriteFileerror handling. Uses module-levelvi.mock('fs')for ESM compatibility and isolatesOPIK_CONFIG_PATHviabeforeEach/afterEach.Infrastructure
typescript_sdk_unit_tests.yml: Added two CI steps to install dependencies and run tests for the configure tool package (separate from the main SDK test run).Files Changed
Change checklist
Issues
AI-WATERMARK
AI-WATERMARK: yes
Testing
Introduced new unit test
Documentation
Nothing added