-
Notifications
You must be signed in to change notification settings - Fork 35
enable agentic workflows #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7a882de
600f9de
ca19c3f
dc0dde7
c618263
16ad23c
00b4501
010c361
00d5e86
eb6ffde
27cc8ba
d37a99b
bb03e00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -192,6 +192,9 @@ class InitCommand extends TemplatesCommand { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.error(`Extension(s) '${notFound.join(', ')}' not found in the Template Registry.`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return extensionTemplates.map(t => t.name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (flags.yes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // with --yes and no explicit template, default to standalone app (no prompts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (!flags['standalone-app']) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const noLogin = flags.import || !flags.login | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let [searchCriteria, orderByCriteria] = await this.getSearchCriteria(orgSupportedServices) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -210,9 +213,12 @@ class InitCommand extends TemplatesCommand { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async ensureDevTermAccepted (consoleCLI, orgId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async ensureDevTermAccepted (consoleCLI, orgId, skipPrompts = false) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const isTermAccepted = await consoleCLI.checkDevTermsForOrg(orgId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!isTermAccepted) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (skipPrompts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.error('Developer Terms of Service have not been accepted for this organization. Please run `aio app init` without --yes to accept the terms first.') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const terms = await consoleCLI.getDevTermsForOrg() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const confirmDevTerms = await consoleCLI.prompt.promptConfirm(`${terms.text} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \nYou have not accepted the Developer Terms of Service. Go to ${hyperlinker('https://www.adobe.com/go/developer-terms', 'https://www.adobe.com/go/developer-terms')} to view the terms. Do you accept the terms? (y/n):`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -294,26 +300,65 @@ class InitCommand extends TemplatesCommand { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async selectConsoleOrg (consoleCLI, flags) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const organizations = await consoleCLI.getOrganizations() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const selectedOrg = await consoleCLI.promptForSelectOrganization(organizations, { orgId: flags.org, orgCode: flags.org }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.ensureDevTermAccepted(consoleCLI, selectedOrg.id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!organizations || organizations.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.error('No organizations found for the logged-in user') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // initially select the first org, if multiple orgs are present, prompt user to select one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let selectedOrg = organizations[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (organizations.length > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (flags.yes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.log(`Auto-selecting organization: '${selectedOrg.name || selectedOrg.id}'`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selectedOrg = await consoleCLI.promptForSelectOrganization(organizations, { orgId: flags.org, orgCode: flags.org }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // initially select the first org, if multiple orgs are present, prompt user to select one | |
| let selectedOrg = organizations[0] | |
| if (organizations.length > 1) { | |
| if (flags.yes) { | |
| this.log(`Auto-selecting organization: '${selectedOrg.name || selectedOrg.id}'`) | |
| } else { | |
| selectedOrg = await consoleCLI.promptForSelectOrganization(organizations, { orgId: flags.org, orgCode: flags.org }) | |
| } | |
| let selectedOrg | |
| if (flags.org) { | |
| selectedOrg = organizations.find(org => | |
| org.id === flags.org || | |
| org.orgId === flags.org || | |
| org.code === flags.org || | |
| org.orgCode === flags.org || | |
| org.name === flags.org | |
| ) | |
| if (!selectedOrg) { | |
| this.error(`Organization '${flags.org}' not found for the logged-in user`) | |
| } | |
| if (flags.yes) { | |
| this.log(`Auto-selecting organization: '${selectedOrg.name || selectedOrg.id}'`) | |
| } | |
| } else { | |
| // initially select the first org, if multiple orgs are present, prompt user to select one | |
| selectedOrg = organizations[0] | |
| if (organizations.length > 1) { | |
| if (flags.yes) { | |
| this.log(`Auto-selecting organization: '${selectedOrg.name || selectedOrg.id}'`) | |
| } else { | |
| selectedOrg = await consoleCLI.promptForSelectOrganization(organizations, { orgId: flags.org, orgCode: flags.org }) | |
| } | |
| } |
Copilot
AI
Apr 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getProjects(org.id) is executed before the --yes early-return branch but its result is unused when flags.yes is true, adding an avoidable network/API call to non-interactive runs. Consider moving the getProjects call into the non---yes branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback name uses Date.now() which returns milliseconds since epoch (e.g., app1718000000000) — 16 chars. Project names may have length constraints. Consider a shorter fallback like a truncated timestamp or random suffix.
| generatedTitle = data.title || generatedName | |
| generatedName = `app${Date.now().toString(36)}` | |
| generatedTitle = generatedName |
Copilot
AI
Apr 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the --yes path you always create a new Console project, ignoring --project even if the user provided it. This can create unexpected projects in CI; consider: if --project is provided, resolve it from getProjects() and use it (or error if not found) instead of auto-creating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition if (flags.project && !flags.yes) combined with the else branch means: if flags.project is set AND flags.yes is true, it falls into the else branch and calls promptForCreateProjectDetails interactively — defeating the purpose of --yes. The intent should be: error if project not found regardless of --yes, or auto-create. The original code errored when flags.project was set; this change silently ignores a user-specified project that wasn't found.
| { allowCreate: true } | |
| if (flags.project) { | |
| this.error(`--project ${flags.project} not found`) | |
| } else { | |
| // user has escaped project selection prompt, let's create a new one | |
| const projectDetails = await consoleCLI.promptForCreateProjectDetails() | |
| project = await consoleCLI.createProject(org.id, projectDetails) | |
| project.isNew = true | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Re-raised] The condition if (flags.project && !flags.yes) is dead code in this branch because flags.yes is always false here (the flags.yes path returns early above). More importantly, this is a regression: if flags.project was provided but promptForSelectProject returned null (project not found), the original code errored. Now it silently falls into the else and creates a new project with interactively collected details, ignoring the user's explicit --project value.
| } else { | |
| // User chose to create a new project — collect details interactively and create it. | |
| const projectDetails = await consoleCLI.promptForCreateProjectDetails() | |
| project = await consoleCLI.createProject(org.id, projectDetails) | |
| project.isNew = true | |
| } | |
| // user has escaped project selection prompt, let's create a new one | |
| const projectDetails = await consoleCLI.promptForCreateProjectDetails() | |
| project = await consoleCLI.createProject(org.id, projectDetails) | |
| project.isNew = true | |
| } | |
| return project | |
| } | |
| if (flags.project) { | |
| this.error(`--project ${flags.project} not found`) | |
| } else { | |
| // User chose to create a new project — collect details interactively and create it. | |
| const projectDetails = await consoleCLI.promptForCreateProjectDetails() | |
| project = await consoleCLI.createProject(org.id, projectDetails) | |
| project.isNew = true | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When flags.yes is true and a workspace doesn't exist, it silently auto-creates it. But if the user did NOT pass --confirm-new-workspace and also did NOT pass --yes, the original code would also skip the prompt and auto-create (only prompts when confirm-new-workspace is set). The condition !flags.yes && flags['confirm-new-workspace'] means: only prompt when NOT yes AND confirm-new-workspace is set. This looks correct, but it's worth verifying the else branch (auto-create) is safe when yes=false and confirm-new-workspace=false — which is the existing behavior preserved here.
| if (!flags.yes && flags['confirm-new-workspace']) { | |
| if (!flags.yes && flags['confirm-new-workspace']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When flags.yes is true and there are multiple orgs, the code auto-selects organizations[0] (the first org). However, if flags.org is also provided, it should try to match the specified org rather than blindly picking the first one. This silently ignores --org flag when --yes is set with multiple orgs.