Add Contentstack Authentication toggle to project creation, Add support for choosing namespace in case of multiple github connections and Update package versions and server logs query - #213
Conversation
Set the isContentstackAuthenticationEnabled environment field when creating a new Launch project, for both the GitHub and FileUpload flows. Contentstack Authentication is enabled by default; users can opt out with the new --disable-cs-auth flag or by answering "no" at the interactive prompt (which defaults to enabled). #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…onnections. - Added functionality to scope queries to the selected GitHub connection namespace in BaseClass methods detectFramework and selectBranch. - Updated GitHub adapter to handle multiple user connections, allowing users to select a namespace or use a --namespace flag. - Enhanced tests to cover new namespace selection logic and ensure proper handling of GitHub connections. - Updated GraphQL queries and types to include namespace information for user connections. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Tejas Talekar <tejas.talekar@contentstack.com> Co-Authored-By: Claude <noreply@anthropic.com>
… updated windowed server logs query
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
There was a problem hiding this comment.
Pull request overview
This PR updates the Launch CLI project-creation flows to support (1) a Contentstack Authentication toggle, (2) selecting a GitHub “namespace” when multiple GitHub connections exist, and (3) aligns server logs polling with the updated GetServerlessLogsV2 GraphQL API while bumping dependency versions.
Changes:
- Added
--enable-cs-auth/--disable-cs-authflags + interactive prompt wiring for Contentstack Authentication in GitHub and File Upload project creation. - Added GitHub connection namespace support (GraphQL query + selection/prompting + scoping repo/branch/framework queries).
- Updated serverless logs GraphQL query to
GetServerlessLogsV2and bumped package versions.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/util/logs-polling-utilities.test.ts | Updates mocked watch payload field to getServerlessLogsV2. |
| src/util/logs-polling-utilities.ts | Reads serverless logs from data.getServerlessLogsV2.logs. |
| src/types/launch.ts | Extends config typing with isContentstackAuthenticationEnabled and userConnection.namespace. |
| src/graphql/queries.ts | Adds namespace to userConnections query; updates serverless logs query to V2; removes connectionUid from projects query selection. |
| src/commands/launch/logs.ts | Fixes environment selection so deployments come from the selected environment. |
| src/commands/launch/index.ts | Adds namespace, enable-cs-auth, and disable-cs-auth flags and updates help strings. |
| src/adapters/github.ts | Implements cs-auth prompting/flags, namespace selection among multiple GitHub connections, and scopes repository queries by namespace. |
| src/adapters/github.test.ts | Adds unit tests for namespace selection/scoping and cs-auth prompting/flags behavior. |
| src/adapters/file-upload.ts | Implements cs-auth prompting/flags behavior for file-upload project creation. |
| src/adapters/file-upload.test.ts | Adds unit tests for cs-auth prompting/flags behavior (table-driven for prompt answers). |
| src/adapters/base-class.ts | Scopes framework detection and branch selection GraphQL queries by userConnection.namespace; updates GitHub connect URL. |
| src/adapters/base-class.test.ts | Adds tests ensuring framework/branch queries include namespace. |
| package.json | Bumps package version + dependency versions (cli-command, cli-utilities, adm-zip). |
| package-lock.json | Lockfile updates reflecting bumped deps and transitive changes. |
| .talismanrc | Updates package-lock checksum and adds checksum ignores for new/updated adapter tests. |
| .github/workflows/sca-scan.yml | Adds explicit workflow permissions for SCA scan job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (enableCsAuth) { | ||
| this.config.isContentstackAuthenticationEnabled = true; | ||
| } else if (disableCsAuth) { | ||
| this.config.isContentstackAuthenticationEnabled = false; | ||
| } else { | ||
| this.config.isContentstackAuthenticationEnabled = (await ux.inquire({ | ||
| type: 'confirm', | ||
| name: 'contentstackAuth', | ||
| message: | ||
| // eslint-disable-next-line max-len | ||
| 'Enable Contentstack Authentication? Restricts access to this environment to members of your Contentstack organization.', | ||
| default: true, | ||
| })) as boolean; | ||
| } |
| if (enableCsAuth) { | ||
| this.config.isContentstackAuthenticationEnabled = true; | ||
| } else if (disableCsAuth) { | ||
| this.config.isContentstackAuthenticationEnabled = false; | ||
| } else { | ||
| this.config.isContentstackAuthenticationEnabled = (await cliux.inquire({ | ||
| type: 'confirm', | ||
| name: 'contentstackAuth', | ||
| message: | ||
| // eslint-disable-next-line max-len | ||
| 'Enable Contentstack Authentication? Restricts access to this environment to members of your Contentstack organization.', | ||
| default: true, | ||
| })) as boolean; | ||
| } |
| } else if (matchingConnections.length > 1) { | ||
| const selectedNamespace = await ux.inquire({ | ||
| type: 'search-list', | ||
| name: 'userConnection', | ||
| message: 'Choose a GitHub Namespace', | ||
| choices: map(matchingConnections, (connection) => connection.namespace || connection.userUid), | ||
| }); | ||
| userConnection = find( | ||
| matchingConnections, | ||
| (connection) => (connection.namespace || connection.userUid) === selectedNamespace, | ||
| ); | ||
| } else { | ||
| userConnection = matchingConnections[0]; | ||
| } |
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@master |
| - filename: package-lock.json | ||
| checksum: ffb77989c6fe554cdd79ebe0cbd07c0ce4329dd65b3e9a9089db4abb7b9be2b3 | ||
| checksum: c94ce0fbbbedcbad4dceef8168971831ed82aad85824db579f2497dcd49aecab | ||
| - filename: src/adapters/github.test.ts | ||
| checksum: b3d3d3a3c14adde103152d2ac4e1c4b7121a5f7533a87c3cc600f6d25fb59d1b | ||
| - filename: src/adapters/file-upload.test.ts | ||
| checksum: 962fd8b45578914926d20857ddc3d1bc2fa19e8b192c6dfdc03d214ae1898b59 |
feat: Add Contentstack Authentication toggle to project creation
feat: add support for choosing namespace in case of multiple github connections
fix: update GitHub connection URL to direct users to connected accounts settings
chore: bump cli-command to 1.8.4 and cli-utilities to 1.18.5
fix: Update get Server logs query to GetServerlessLogsV2 to match the updated windowed server logs query