@biffo/cli 0.185.4 → 0.185.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +36 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -824,6 +824,29 @@ function classifyUpgradeBranches(refs, currentBranch) {
824
824
  // src/adapters/git/index.ts
825
825
  var GitAdapter = class {
826
826
  /** True if `cwd` is inside a git working tree. */
827
+ /**
828
+ * The committer identity git would resolve here, or `null` per unresolved value
829
+ * (#737).
830
+ *
831
+ * `git config --get` exits 1 when a key is unset, which `execa` throws on — so a
832
+ * missing value is caught and reported as `null` rather than as an error. That
833
+ * distinction is the whole point: an unset identity is a condition the caller
834
+ * must act on, not a failure of this lookup.
835
+ *
836
+ * No `cwd` resolves against the process's own configuration, which is what the
837
+ * scaffold's throwaway temp dir inherits.
838
+ */
839
+ async configuredIdentity(cwd) {
840
+ const read2 = async (key) => {
841
+ try {
842
+ const { stdout } = await execa2("git", ["config", "--get", key], cwd ? { cwd } : {});
843
+ return stdout.trim() || null;
844
+ } catch {
845
+ return null;
846
+ }
847
+ };
848
+ return { name: await read2("user.name"), email: await read2("user.email") };
849
+ }
827
850
  async isGitRepo(cwd) {
828
851
  try {
829
852
  await execa2("git", ["rev-parse", "--is-inside-work-tree"], { cwd });
@@ -5652,6 +5675,7 @@ async function runSiblingCreate(github, aws, coreAws, git, config, session, opti
5652
5675
  const totalSteps = 8;
5653
5676
  const { org, repo } = githubRepo(config);
5654
5677
  const pathPrefix = resolvePathPrefix(config);
5678
+ assertGitIdentity(await git.configuredIdentity());
5655
5679
  if (!session.completedSteps.includes("verify_credentials")) {
5656
5680
  log.step(1, totalSteps, "Verifying AWS credentials...");
5657
5681
  await aws.verifyCredentials();
@@ -5944,6 +5968,18 @@ function readExistingSiblingOrigins(filePath) {
5944
5968
  throw err;
5945
5969
  }
5946
5970
  }
5971
+ function assertGitIdentity(identity) {
5972
+ const missing = [identity.name ? null : "user.name", identity.email ? null : "user.email"].filter(
5973
+ (v) => v !== null
5974
+ );
5975
+ if (missing.length === 0) return;
5976
+ throw new Error(
5977
+ `git has no ${missing.join(" or ")} configured, so the scaffold commit would fail after the GitHub repository had already been created. Set it first:
5978
+ ` + missing.map(
5979
+ (k) => ` git config --global ${k} "${k === "user.name" ? "Your Name" : "you@example.com"}"`
5980
+ ).join("\n")
5981
+ );
5982
+ }
5947
5983
  function assertCoreSupportsSiblingRouting(cloneDir, coreRepo, pathPrefix = "x") {
5948
5984
  const cdnVarsPath = join20(cloneDir, "modules", "cloud", "aws", "cdn", "variables.tf");
5949
5985
  let declaresSiblingOrigins = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.185.4",
3
+ "version": "0.185.5",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",