Make the documentation runnable, and fix the config examples - #12
Merged
Conversation
Three surfaces claimed things that were not true, and the one command we recommend first was gated behind a note telling the reader it would not work. **The QA note was false.** README and the CLI both said detect_config lives on the QA environment and that --api-url must be pointed there. Checked against production: POST https://app.ptc.wpml.org/api/v1/detect_config returns 200 with a real body, anonymously, no token. `ptc init` completes against the default URL. Removed from the README, from `show_init_help` and from the 404 hint, which now says what a 404 there actually means. While there: the quick start passed PTC_API_TOKEN to `init`, which does not need one — detect_config is anonymous, and the CLI itself logs that. **A README example failed on copy-paste.** `--file-tag-name=feature-branch` exits 1 with "Unknown option". The `=` form is implemented for --api-url, --api-token, --monitor-interval, --monitor-max-attempts and --action only, and README:85 uses a working --api-url=..., so the rule cannot be inferred. Fixed the example and wrote the rule down under Main Options. Widening the parser is the other way to resolve this; it changes CLI behaviour and needs a release, so it is not in a documentation fix. **Both CI blocks were stale.** The GitHub one pinned v1.0.0, used actions/checkout@v4 and peter-evans/create-pull-request@v5, and opened a fresh PR per run; the GitLab one never downloaded the CLI and triggered on merge_requests, which is not loop-safe. Both are now what `ptc init` prints, verified by running it. The version-pinning example moved v1.0.0 -> v1.0.3. **Dependencies.** The generated GitLab job installed `jq`, which appears nowhere in this script, and omitted `unzip`, which unpacks every download. Checked alpine:3.22: unzip is present as a busybox applet and extraction works, so the recipe was not broken — but it is named now so it survives an image swap. git stays: the push step needs it, the CLI does not. **Three of five examples did not parse.** java-app, react-app and wordpress-wpsite were KEY=VALUE files using {lang}; each died with "Missing 'files:' section", and only {{lang}} is ever substituted. Rewritten as YAML the parser accepts, renamed .config -> .yml since the extension is what suggested the wrong format. config.local.yml.example taught api_token:, deprecated and ignored since v1.0.x — it now shows the env var instead. **Why nothing caught this:** no test ever fed an example to the parser. Added tests/test-config-examples.sh, which builds a scratch project from each config and runs a real --dry-run. Confirmed it fails on the old files before trusting it: dropping the previous java-app.config back in turns it red on both the format and the placeholder. Suite: 230 assertions across 7 files, 0 failures. `bash -n` clean. Every fenced block in the README parses as what it is labelled (four Troubleshooting blocks showed CLI output while tagged bash; they are `text` now), and every link resolves. The wiki half of this ticket is pushed separately as 3d3282d. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation and shipped examples, plus one new test suite. No CLI behaviour changes.
detect_confignoteThe README and the CLI both said
detect_confighad to be reached at a different host. It answers on the default API host without a token:ptc initis the first command the docs recommend, so that note stood between a new user and their first run. Removed from the README, fromshow_init_helpand from the 404 hint, which now says what a 404 there means. The quick start also passed a token toinit, which needs none.A README example could not be copied
./ptc-cli.sh -c config.yml --file-tag-name=feature-branchexits 1. The=form is implemented for--api-url,--api-token,--monitor-interval,--monitor-max-attemptsand--actiononly, while another example in the same file uses a working--api-url=…, so the rule was not inferable. The example now uses the separate-argument form, and the rule is written down under Main Options.Accepting
=everywhere is the other way to resolve this. That changes CLI behaviour and needs a release, so it is not part of a documentation change.Both CI blocks were out of date
ptc initprintsptc initprintsChecked by running
ptc initfor a GitHub project and a GitLab project and diffing its output against the page.Dependencies in the generated job
It installed
jq, which this script never invokes, and did not nameunzip, which unpacks every download.alpine:3.22providesunzipas a busybox applet and extraction works, so the job ran either way — naming it keeps it working if the image is ever swapped.gitstays for the push step.Three of five examples could not be used
java-app,react-appandwordpress-wpsitewereKEY=VALUEfiles with a single-brace placeholder. Each stopped atMissing 'files:' section, and only{{lang}}is substituted. They are YAML now, renamed.config→.ymlsince the extension is what suggested the wrong format.config.local.yml.exampleno longer showsapi_token:, ignored with a warning for several releases.New suite
Nothing had ever fed an example to the parser.
tests/test-config-examples.shbuilds a scratch project from each config's declared paths, runs a real--dry-run, then checks the placeholder form and the absence of a token key.Confirmed it reports the previous files as failures before relying on it:
Verification
bash -n ptc-cli.shcleanbashand aretextnowAlso drops internal tracker identifiers from source comments throughout.