diff --git a/aio/content/cli-src/.gitignore b/aio/content/cli-src/.gitignore
index 7255efa0bc..c5245735cb 100644
--- a/aio/content/cli-src/.gitignore
+++ b/aio/content/cli-src/.gitignore
@@ -1 +1,3 @@
-yarn.lock
\ No newline at end of file
+/node_modules
+package.json
+yarn.lock
diff --git a/aio/content/cli-src/package.json b/aio/content/cli-src/package.json
deleted file mode 100644
index d5bcd7f65c..0000000000
--- a/aio/content/cli-src/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "dependencies": {
-    "@angular/cli": "https://github.com/angular/cli-builds#master"
-  }
-}
diff --git a/aio/tools/transforms/cli-docs-package/extract-cli-commands.js b/aio/tools/transforms/cli-docs-package/extract-cli-commands.js
index fc755c8c9e..13eed58796 100644
--- a/aio/tools/transforms/cli-docs-package/extract-cli-commands.js
+++ b/aio/tools/transforms/cli-docs-package/extract-cli-commands.js
@@ -1,7 +1,16 @@
-const shelljs = require('shelljs');
-const {resolve}  = require('canonical-path');
+const {resolve} = require('canonical-path');
+const sh = require('shelljs');
 const {CONTENTS_PATH} = require('../config');
 
-shelljs.cd(resolve(CONTENTS_PATH, 'cli-src'));
-shelljs.exec('git clean -Xfd');
-shelljs.exec('yarn install');
+const cliGitRef = process.argv[2] || 'master';  // Can be a branch, commit or tag.
+const pkgContent = JSON.stringify({
+  dependencies: {
+    '@angular/cli': `https://github.com/angular/cli-builds#${cliGitRef}`,
+  },
+}, null, 2);
+
+sh.set('-e');
+sh.cd(resolve(CONTENTS_PATH, 'cli-src'));
+sh.exec('git clean -Xfd');
+sh.echo(pkgContent).to('package.json');
+sh.exec('yarn install --no-lockfile --non-interactive');