Skip to content

Conversation

m-Bilal
Copy link
Member

@m-Bilal m-Bilal commented Jul 14, 2025

No description provided.

@m-Bilal m-Bilal requested a review from Copilot July 14, 2025 19:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes hardcoded file paths by sourcing default OpenAPI and output directory locations from the app context, ensuring correct handling of user-mounted volumes in the DDN workspace.

  • Replaced literal defaults for --open-api and directory options in CLI commands with Context methods
  • Introduced getUserMountedFilePath() and getDefaultOpenapiDocumentFileUri() in the context singleton
  • Refactored the dependency install step to always run in the user-mounted directory

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/cli/update.ts Updated --open-api and --output-directory option defaults and descriptions to use context getters
src/cli/init.ts Imported context and swapped hardcoded defaults for --open-api and --out-dir to context methods
src/app/writer/index.ts Simplified the npm install invocation to always use the user-mounted directory from context
src/app/context.ts Added getUserMountedFilePath() and getDefaultOpenapiDocumentFileUri() with a new constant
Comments suppressed due to low confidence (3)

src/cli/init.ts:19

  • The init command's --open-api option currently doesn’t support environment variable overrides; consider chaining .env('NDC_OAS_DOCUMENT_URI') here to match the update command behavior.
    `URI of OAS Document. Defaults to ${context.getInstance().getDefaultOpenapiDocumentFileUri()}`,

src/cli/init.ts:24

  • Consider adding .env('HASURA_CONFIGURATION_DIRECTORY') for the --out-dir option to allow overriding via environment variable, matching the pattern in update.ts.
    `Output Directory. Defaults to ${context.getInstance().getUserMountedFilePath()}`,

src/app/context.ts:216

  • The path module is used here but not imported in this file—add import path from 'path'; (or import * as path from 'path';) at the top.
    return path.join(this.getUserMountedFilePath(), OPENAPI_SWAGGER_FILE_NAME);

@m-Bilal m-Bilal merged commit a776ac8 into main Jul 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant