Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds a new console project create command to enable non-interactive Adobe Developer Console project creation (by name) for a specified (or configured) organization, intended to support agent workflows.
Changes:
- Introduces
src/commands/console/project/create.jsimplementing project creation with local validation and a pre-check for duplicate project names. - Adds
test/commands/console/project/create.test.jscovering core create-path behavior and several validation/error cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
src/commands/console/project/create.js |
New CLI command to create a Console project by name/title/description with validations and org resolution. |
test/commands/console/project/create.test.js |
New unit tests validating creation inputs, org selection behavior, and basic duplicate/validation errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| command = new TheCommand() | ||
| mockConsoleCLIInstance.createProject.mockReset() |
There was a problem hiding this comment.
beforeEach only resets createProject, but several tests mutate getProjects’s resolved value. Not resetting getProjects here makes the suite more order-dependent as it grows. Consider resetting/re-initializing both mocks in beforeEach (similar to other command test suites).
| command = new TheCommand() | |
| mockConsoleCLIInstance.createProject.mockReset() | |
| command = new TheCommand() | |
| mockConsoleCLIInstance.getProjects.mockReset() | |
| mockConsoleCLIInstance.getProjects.mockResolvedValue([]) | |
| mockConsoleCLIInstance.createProject.mockReset() | |
| mockConsoleCLIInstance.createProject.mockResolvedValue(mockProject) |
| await this.initSdk() | ||
| // check name is not already in use | ||
| const projects = await this.consoleCLI.getProjects(orgId) | ||
| if (projects.find(project => project.name === projectDetails.name)) { | ||
| this.error(`Project ${projectDetails.name} already exists. Please choose a different name.`) | ||
| } | ||
|
|
||
| // if we get here, all validation passed, so call server to create project | ||
| const project = await this.consoleCLI.createProject(orgId, projectDetails) | ||
| this.log(`Project ${project.name} created successfully.`) | ||
| return project |
There was a problem hiding this comment.
This command doesn’t wrap SDK calls in a try/catch/finally and never calls cleanOutput(). Other console commands ensure LibConsoleCLI.cleanStdOut() is called in a finally block so terminal output isn’t left in a dirty state when requests fail. Consider aligning with the existing pattern (logger debug in catch + cleanOutput() in finally).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/commands/console/index.js
Outdated
| */ | ||
| printJson (data) { | ||
| this.log(JSON.stringify(data)) | ||
| this.log(JSON.stringify(data, 0, 2)) |
There was a problem hiding this comment.
JSON.stringify(data, 0, 2) relies on a non-standard-looking replacer argument (0). While it currently behaves like undefined, it’s confusing to readers and easy to misinterpret. Use null (or omit the replacer argument) to make the intent of pretty-printing explicit.
| this.log(JSON.stringify(data, 0, 2)) | |
| this.log(JSON.stringify(data, null, 2)) |
| } | ||
|
|
||
| CreateCommand.aliases = [ | ||
| 'console:project:create', |
There was a problem hiding this comment.
CreateCommand.aliases includes the command’s own canonical name (console:project:create). In oclif this is redundant and differs from the pattern in other commands (aliases are only for alternative spellings like console:project:ls). Consider removing the self-alias and keeping only true alternatives (e.g., console:project:init).
| 'console:project:create', |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| // Project title allows only alphanumeric values and spaces | ||
| if (!/^[a-zA-Z0-9\s]+$/.test(projectDetails.title)) { |
There was a problem hiding this comment.
The title validation regex uses \s, which matches tabs/newlines and other whitespace—not just spaces as the error message states. This can allow control characters in --title (e.g., newlines) and produce unexpected output/log formatting. Use a pattern that only permits literal spaces (and consider trimming) to align behavior with the validation message.
| if (!/^[a-zA-Z0-9\s]+$/.test(projectDetails.title)) { | |
| if (!/^[a-zA-Z0-9 ]+$/.test(projectDetails.title)) { |
| printJson (data) { | ||
| this.log(JSON.stringify(data)) | ||
| this.log(JSON.stringify(data, 0, 2)) | ||
| } |
There was a problem hiding this comment.
printJson() now pretty-prints JSON for all commands, which changes the --json output format across the plugin but isn’t mentioned in the PR description. If the intent is only to support structured output for project:create, consider scoping formatting changes to that command (or call this out explicitly). Also, pass null as the JSON.stringify replacer instead of 0 for clarity (0 is ignored by JSON.stringify).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
Allow create calls for new projects in dev-console. Assumes name is unique, or it will fail with the appropriate message.
This will enable agents to create new App Builder projects without user interaction.
aio console project create --name=alphaNumericName1 --title="alphaNumeric with spaces" --description="free text up to 1000 char"
--json output is now formatted for both human readability and machines
Related Issue
ACNA-4400
Motivation and Context
Agents need to be able to create projects with all parameters specified, the only other way to create a project was through `app init' with prompts for a project name,title,description ...
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: