File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,11 +154,21 @@ drupalorg maintainer:release-notes <ref1> [ref2] [--format=json|md|html]
154154``` bash
155155# Install the drupalorg-cli agent skill into .claude/skills/drupalorg-cli/
156156drupalorg skill:install
157+ ```
158+
159+ ## Cache Bypass
160+
161+ Drupal.org uses HTTP caching (CDN/Varnish). If you need fresh data — e.g. after a
162+ new comment was posted — pass ` --no-cache ` to any command:
157163
158- # Clear the local API cache
159- drupalorg cache:clear
164+ ``` bash
165+ drupalorg issue:show < nid> --with-comments --format=llm --no-cache
166+ drupalorg mr:list [nid] --format=llm --no-cache
160167```
161168
169+ ` --no-cache ` sends ` Cache-Control: no-cache, no-store, must-revalidate ` and
170+ ` Pragma: no-cache ` headers so the upstream CDN returns a fresh response.
171+
162172## Error Handling
163173
164174| Error | Cause | Recovery |
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class Client
2222 */
2323 public const API_URL = 'https://www.drupal.org/api-d7/ ' ;
2424
25- public function __construct ()
25+ public function __construct (bool $ noCache = false )
2626 {
2727 $ stack = HandlerStack::create ();
2828 $ stack ->push (GuzzleRetryMiddleware::factory ([
@@ -31,16 +31,22 @@ public function __construct()
3131 'default_retry_multiplier ' => 1.5 ,
3232 ]), 'retry ' );
3333
34+ $ headers = [
35+ 'User-Agent ' => 'DrupalOrgCli/0.0.1 ' ,
36+ 'Accept ' => 'application/json ' ,
37+ 'Accept-Encoding ' => '* ' ,
38+ ];
39+ if ($ noCache ) {
40+ $ headers ['Cache-Control ' ] = 'no-cache, no-store, max-age=0 ' ;
41+ $ headers ['Pragma ' ] = 'no-cache ' ;
42+ }
43+
3444 $ this ->client = new \GuzzleHttp \Client (
3545 [
3646 'base_uri ' => self ::API_URL ,
3747 'cookies ' => true ,
3848 'handler ' => $ stack ,
39- 'headers ' => [
40- 'User-Agent ' => 'DrupalOrgCli/0.0.1 ' ,
41- 'Accept ' => 'application/json ' ,
42- 'Accept-Encoding ' => '* ' ,
43- ],
49+ 'headers ' => $ headers ,
4450 ]
4551 );
4652 }
Original file line number Diff line number Diff line change 44
55use Composer \InstalledVersions ;
66use Symfony \Component \Console \Application as ParentApplication ;
7+ use Symfony \Component \Console \Input \InputDefinition ;
8+ use Symfony \Component \Console \Input \InputOption ;
79
810class Application extends ParentApplication
911{
@@ -23,6 +25,18 @@ public function __construct()
2325 $ this ->addCommands ($ this ->getCommands ());
2426 }
2527
28+ protected function getDefaultInputDefinition (): InputDefinition
29+ {
30+ $ definition = parent ::getDefaultInputDefinition ();
31+ $ definition ->addOption (new InputOption (
32+ 'no-cache ' ,
33+ null ,
34+ InputOption::VALUE_NONE ,
35+ 'Bypass Drupal.org HTTP caching and fetch a fresh response. '
36+ ));
37+ return $ definition ;
38+ }
39+
2640 /**
2741 * @return \Symfony\Component\Console\Command\Command[]
2842 */
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ protected function initialize(
4545 ) : $ output ;
4646 $ this ->stdIn = $ input ;
4747 self ::$ interactive = $ input ->isInteractive ();
48- $ this ->client = new Client ();
48+ $ noCache = $ input ->hasOption ('no-cache ' ) && (bool ) $ input ->getOption ('no-cache ' );
49+ $ this ->client = new Client ($ noCache );
4950 }
5051
5152 protected function debug (string $ message ): void
You can’t perform that action at this time.
0 commit comments