Skip to content

feat(platform): add init from-existing flag to sync app config into godaddy.toml - #254

Open
mguerrero3-godaddy wants to merge 5 commits into
mainfrom
feat/generate-toml-from-existing-app
Open

feat(platform): add init from-existing flag to sync app config into godaddy.toml#254
mguerrero3-godaddy wants to merge 5 commits into
mainfrom
feat/generate-toml-from-existing-app

Conversation

@mguerrero3-godaddy

Copy link
Copy Markdown
Collaborator

PR description:

Context

While testing dev platform It was clear the ties there exist between the app and the cli. On one of those experimentation steps, It was noticed that for applications created from the developer portal, there's no way to get Its godaddy.toml downloaded from the portal, neither generated from the CLI. For being able to, for example, register a webhook (which can't be done on the dev portal), a .toml file is needed to identify the app, and since the app was created on the portal, a manual creation of the .toml was necessary.

This isn't solving a bug, but rather proposing an extension to existent capabilities to generate a toml file reading the app config files, and also adding the ability for the CLI to reach the subscriptions (this don't expose a e.g. platform app list subscription) as may be out of scope, (but that's doable with the changes here), but rather reads those to ensure those are correctly mapped to the .toml

Changes

  • Adds gddy platform app init --from-existing <NAME>: fetches an already-registered application's remote config and its latest release's webhook subscriptions, and writes them into godaddy.toml, before this was only possible through the init (creating a new app)
  • Extends the ApplicationWithLatestRelease GraphQL query with clientId and releases.subscriptions { name url events }, and adds relativize_webhook_url so fetched webhook URLs come back in the same /webhooks/... shape as hand-authored entries.
  • Version is resolved from the latest release (falling back to the local manifest, then 0.0.0); actions/dependencies/extensions/settings are preserved from the existing local file, since those aren't tracked remotely.
  • Guards against silently discarding unpublished local changes: if subscriptions.webhook has entries not present in the latest published release (e.g. added via add subscription but not yet released), the command prompts for confirmation (or errors non-interactively) unless --force is passed.

Copilot AI lite review requested due to automatic review settings September 10, 2026 16:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are confirmed correctness/UX/security issues in the new --from-existing path (URL origin relativization, ignored flags, inconsistent URL validation, and a broken user-facing message) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new gddy platform app init --from-existing <NAME> flow to sync an already-registered application’s remote config and latest release webhook subscriptions into godaddy.toml, aligning remote webhook URLs with local /webhooks/... conventions.

Changes:

  • Add --from-existing (+ --force) to platform app init, fetching app data and latest release subscriptions and writing them into godaddy.toml.
  • Extend the app GraphQL query to include clientId and latest release subscriptions { name url events }.
  • Introduce relativize_webhook_url (with tests) to convert same-origin webhook URLs to relative paths while preserving query/fragment.
File summaries
File Description
rust/src/config/mod.rs Adds relativize_webhook_url helper + unit tests for URL/path normalization.
rust/src/application/commands/schemas.rs Updates ApplicationInit output schema to allow fields omitted by --from-existing and adds optional subscriptions output.
rust/src/application/commands/init.rs Implements --from-existing flow, subscription syncing, and overwrite safety prompt/--force behavior.
rust/src/application/client.rs Extends ApplicationWithLatestRelease query and adds a test to assert the new selection set.
Review details

Suppressed comments (1)

rust/src/application/commands/init.rs:154

  • This non-interactive error message also contains the doubled apostrophe '{name}''s ..., which will render incorrectly.
    Err(cli_engine::CliCoreError::message(format!(
        "local subscriptions.webhook has unpublished changes not present in '{name}''s \
         latest release and would be overwritten: {subscriptions}. Run `gddy platform app \
         release` first to publish them, or re-run with --force to discard them."
    )))
  • Files reviewed: 4/4 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust/src/application/commands/init.rs
Comment thread rust/src/application/commands/init.rs
Comment thread rust/src/config/mod.rs Outdated
Comment thread rust/src/application/commands/init.rs
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.

2 participants