ampproject / ampproject/amp-toolbox

Add `origins` cli subcommand

Open
#409 2 comments 0 reactions 0 assignees View on GitHub
enhancement toolbox-cli
Dominant language
HTML
Stars
459
Forks
242
PR merge metrics
No merged PRs in 30d

Description

For our cors implementation, I'd like to automatically generate the list of allowed origins at build-time (we have staging/production environments, so we can't just hard-code, and would like for them to be kept fairly up to date):

It would be convenient if (similar to the `curls` command), there was an `origins` command (notice the lack of trailing path):

```
$ npx @ampproject/toolbox-cli@canary origins https://example.com
https://example-com.cdn.ampproject.org
https://example-com.amp.cloudflare.com
https://example-com.bing-amp.com
```

I'm happy to add it! But wanted to make an issue first to see if you all have any concerns/implementation preferences.

Contributor guide

Open the contributing guide

Research direction

Start with the CLI's existing `curls` command and trace how its input and output are implemented. Add a matching `origins` command for a host URL, producing the origin list shown in the issue, and verify the command output with the project's existing CLI tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.