Repository: JoshuaKGoldberg/template-typescript-node-package (ts)

Issue:
🐛 Bug: Initialization in newly created repo: no git remotes found from gh label list --json name
### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

After running `npx template-typescript-node-package --skip-github-api`, you're suggested to run the `npx template-typescript-node-package --mode initialize` command in the new repo. That should pass.

### Actual

First I get this error about `no git remotes found`:

```plaintext
Error: Failed initializing GitHub repository
    at withSpinner (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/shared/cli/spinners.js:16:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async initializeWithOptions (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/initializeWithOptions.js:39:5)
    at async run (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/index.js:11:7)
    at async runOrRestore (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/shared/runOrRestore.js:7:5)
    at async Object.initialize (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/index.js:9:10)
    at async bin (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/bin/index.js:47:10)
    at async file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/bin/index.js:4:20 {
  [cause]: Error: Command failed with exit code 1: gh label list --json name
  no git remotes found
      at makeError (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/execa/lib/error.js:60:11)
      at handlePromise (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/execa/index.js:124:26)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async initializeRepositoryLabels (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js:7:6)
      at async initializeGitHubRepository (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/steps/initializeGitHubRepository/index.js:6:3)
      at async file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/initializeWithOptions.js:40:7
      at async withSpinner (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/shared/cli/spinners.js:11:20)
      at async initializeWithOptions (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/initializeWithOptions.js:39:5)
      at async run (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/initialize/index.js:11:7)
      at async runOrRestore (file:///Users/josh/.npm/_npx/b39740db704b12a5/node_modules/template-typescript-node-package/lib/shared/runOrRestore.js:7:5) {
    shortMessage: 'Command failed with exit code 1: gh label list --json name',
    command: 'gh label list --json name',
    escapedCommand: 'gh label list --json name',
    exitCode: 1,
    signal: undefined,
    signalDescription: undefined,
    stdout: '',
    stderr: 'no git remotes found',
    cwd: '/Users/josh/repos/temp/testing-cta-6',
    failed: true,
    timedOut: false,
    isCanceled: false,
    killed: false
  }
}
```

### Additional Info

_No response_

Pull request description:
fix: suggest a re-run command instead of pnpm initialize after offline creation
## PR Checklist

- [x] Addresses an existing open issue: fixes #722
- [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/main/.github/CONTRIBUTING.md) were taken

## Overview

Instead of `pnpm initialize`, adds a re-run suggestion that takes in the parsed options and re-prints them in the CLI. It hardcodes `skip-github-api` and `skip-install` to `false` because they're needed for the new repo.

Patch:
diff --git a/src/create/createRerunSuggestion.ts b/src/create/createRerunSuggestion.ts
new file mode 100644
index 0000000..0223bd0
--- /dev/null
+++ b/src/create/createRerunSuggestion.ts
@@ -0,0 +1,23 @@
+import { Mode } from "../bin/mode.js";
+import { allArgOptions } from "../shared/options/args.js";
+import { Options } from "../shared/types.js";
+
+function getFirstMatchingArg(key: string) {
+	return Object.keys(allArgOptions).find(
+		(arg) => arg.replaceAll("-", "") === key.toLowerCase(),
+	);
+}
+
+export function createRerunSuggestion(mode: Mode, options: Options): string {
+	const args = Object.entries(options)
+		.filter(([, value]) => !!value)
+		.map(([key, value]) => {
+			const valueStringified = `${value}`;
+			return `--${getFirstMatchingArg(key)} ${
+				valueStringified.includes(" ") ? `"${value}"` : value
+			}`;
+		})
+		.join(" ");
+
+	return `npx template-typescript-node-package --mode ${mode} ${args}`;
+}
diff --git a/src/create/index.ts b/src/create/index.ts
index 3e236c6..6ba199d 100644
--- a/src/create/index.ts
+++ b/src/create/index.ts
@@ -6,6 +6,7 @@ import fs from "node:fs/promises";
 import { outro } from "../shared/cli/outro.js";
 import { readOptions } from "../shared/options/readOptions.js";
 import { runOrRestore } from "../shared/runOrRestore.js";
+import { createRerunSuggestion } from "./createRerunSuggestion.js";
 import { createWithOptions } from "./createWithOptions.js";
 
 export async function create(args: string[]) {
@@ -38,7 +39,11 @@ export async function create(args: string[]) {
 									"Consider creating a GitHub repository from the new directory:",
 								lines: [
 									`cd ${inputs.options.repository}`,
-									`pnpm run initialize`,
+									createRerunSuggestion("initialize", {
+										...inputs.options,
+										skipGitHubApi: false,
+										skipInstall: false,
+									}),
 									`git add -A`,
 									`git commit -m "feat: initial commit ✨"`,
 									`git push -u origin main`,
diff --git a/src/shared/options/readOptions.ts b/src/shared/options/readOptions.ts
index b55ba96..4221414 100644
--- a/src/shared/options/readOptions.ts
+++ b/src/shared/options/readOptions.ts
@@ -91,7 +91,7 @@ export async function readOptions(args: string[]): Promise<OctokitAndOptions> {
 			),
 			owner,
 			repository: repository,
-			skipApi: !!values["skip-github-api"],
+			skipGitHubApi: !!values["skip-github-api"],
 			skipInstall: !!values["skip-install"],
 			skipRemoval: !!values["skip-removal"],
 			skipRestore: values["skip-restore"] as boolean | undefined,
diff --git a/src/shared/types.ts b/src/shared/types.ts
index b6e11ba..d7f05ed 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -41,7 +41,7 @@ export interface Options {
 	funding: string | undefined;
 	owner: string;
 	repository: string;
-	skipApi: boolean;
+	skipGitHubApi: boolean;
 	skipInstall: boolean | undefined;
 	skipRemoval: boolean | undefined;
 	skipRestore: boolean | undefined;


Test patch:
diff --git a/src/create/createRerunSuggestion.test.ts b/src/create/createRerunSuggestion.test.ts
new file mode 100644
index 0000000..207a799
--- /dev/null
+++ b/src/create/createRerunSuggestion.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from "vitest";
+
+import { createRerunSuggestion } from "./createRerunSuggestion.js";
+
+describe("createRerunSuggestion", () => {
+	it("includes key-value pairs with mixed truthy and falsy values", () => {
+		const actual = createRerunSuggestion("initialize", {
+			author: "TestAuthor",
+			base: "everything",
+			createRepository: true,
+			description: "Test description.",
+			email: "test@test.com",
+			excludeCompliance: true,
+			excludeContributors: true,
+			excludeLintJson: true,
+			excludeLintKnip: true,
+			excludeLintMd: false,
+			excludeLintPackageJson: true,
+			excludeLintPackages: false,
+			excludeLintPerfectionist: true,
+			excludeLintSpelling: false,
+			excludeLintYml: false,
+			excludeReleases: false,
+			excludeRenovate: undefined,
+			excludeTests: undefined,
+			funding: undefined,
+			owner: "TestOwner",
+			repository: "test-repository",
+			skipGitHubApi: true,
+			skipInstall: true,
+			skipRemoval: true,
+			skipRestore: undefined,
+			skipUninstall: undefined,
+			title: "Test Title",
+		});
+
+		expect(actual).toMatchInlineSnapshot(
+			'"npx template-typescript-node-package --mode initialize --author TestAuthor --base everything --create-repository true --description \\"Test description.\\" --email test@test.com --exclude-compliance true --exclude-contributors true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
+		);
+	});
+});
diff --git a/src/shared/options/augmentOptionsWithExcludes.test.ts b/src/shared/options/augmentOptionsWithExcludes.test.ts
index 5abd237..4821f1f 100644
--- a/src/shared/options/augmentOptionsWithExcludes.test.ts
+++ b/src/shared/options/augmentOptionsWithExcludes.test.ts
@@ -25,7 +25,7 @@ const optionsBase = {
 	funding: undefined,
 	owner: "",
 	repository: "",
-	skipApi: false,
+	skipGitHubApi: false,
 	skipInstall: undefined,
 	skipRemoval: undefined,
 	skipRestore: undefined,
diff --git a/src/steps/finalizeDependencies.test.ts b/src/steps/finalizeDependencies.test.ts
index 466a439..7485b97 100644
--- a/src/steps/finalizeDependencies.test.ts
+++ b/src/steps/finalizeDependencies.test.ts
@@ -42,7 +42,7 @@ const options = {
 	funding: undefined,
 	owner: "StubOwner",
 	repository: "stub-repository",
-	skipApi: false,
+	skipGitHubApi: false,
 	skipInstall: undefined,
 	skipRemoval: undefined,
 	skipRestore: undefined,
diff --git a/src/steps/updateLocalFiles.test.ts b/src/steps/updateLocalFiles.test.ts
index ec95cc1..6d66139 100644
--- a/src/steps/updateLocalFiles.test.ts
+++ b/src/steps/updateLocalFiles.test.ts
@@ -41,7 +41,7 @@ const options = {
 	funding: undefined,
 	owner: "StubOwner",
 	repository: "stub-repository",
-	skipApi: false,
+	skipGitHubApi: false,
 	skipInstall: undefined,
 	skipRemoval: undefined,
 	skipRestore: undefined,
diff --git a/src/steps/writeReadme.test.ts b/src/steps/writeReadme.test.ts
index e94b133..b8e7cdc 100644
--- a/src/steps/writeReadme.test.ts
+++ b/src/steps/writeReadme.test.ts
@@ -45,7 +45,7 @@ const options = {
 	funding: undefined,
 	owner: "TestOwner",
 	repository: "test-repository",
-	skipApi: false,
+	skipGitHubApi: false,
 	skipInstall: true,
 	skipRemoval: false,
 	skipRestore: false,
diff --git a/src/steps/writing/creation/writePackageJson.test.ts b/src/steps/writing/creation/writePackageJson.test.ts
index 61ea864..5b0287d 100644
--- a/src/steps/writing/creation/writePackageJson.test.ts
+++ b/src/steps/writing/creation/writePackageJson.test.ts
@@ -33,7 +33,7 @@ const options = {
 	funding: undefined,
 	owner: "test-owner",
 	repository: "test-repository",
-	skipApi: false,
+	skipGitHubApi: false,
 	skipInstall: undefined,
 	skipRemoval: undefined,
 	skipRestore: undefined,