rsetup 0.1.0 → 0.1.1

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.
package/README.md CHANGED
@@ -8,7 +8,7 @@ npx rsetup --help
8
8
 
9
9
  This is the public npm name for RepoSetup. After `npm install -g rsetup`, both `rsetup` and `reposetup` work.
10
10
 
11
- This is an **early-stage** `0.1.0` release. Integrations are not all equally mature. Use `--dry-run` before changing an important project.
11
+ This is an **early-stage** `0.1.1` release. Integrations are not all equally mature. Use `--dry-run` before changing an important project.
12
12
 
13
13
  The workspace libraries `@reposetup/core`, `@reposetup/registry`, and `@reposetup/integrations` are bundled into this package. They are not published separately.
14
14
 
package/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-ISDHJ7ZF.js";
4
+ } from "./chunk-ITK26OIN.js";
5
5
 
6
6
  // src/bin.ts
7
7
  var result = await runCli(process.argv.slice(2));
@@ -8971,6 +8971,28 @@ function isSafeExecutableName(command) {
8971
8971
  function isSafeProcessArg(arg) {
8972
8972
  return !arg.includes("\0");
8973
8973
  }
8974
+ var SECRET_ASSIGNMENT = /\b([A-Za-z_]*(?:SECRET|TOKEN|PASSWORD|PASSWD|API_?KEY|CREDENTIAL)|DATABASE_URL)\s*[:=]\s*\S+/gi;
8975
+ var MAX_SNIPPET_CHARS = 2e3;
8976
+ var MAX_SNIPPET_LINES = 24;
8977
+ function summarizeFailedProcessOutput(stdout, stderr) {
8978
+ const combined = [stderr.trim(), stdout.trim()].filter((part) => part.length > 0).join("\n");
8979
+ if (combined.length === 0) {
8980
+ return void 0;
8981
+ }
8982
+ const redacted = combined.replace(SECRET_ASSIGNMENT, "$1=<redacted>");
8983
+ const lines = redacted.split(/\r?\n/).slice(-MAX_SNIPPET_LINES);
8984
+ let snippet = lines.join("\n");
8985
+ if (snippet.length > MAX_SNIPPET_CHARS) {
8986
+ snippet = snippet.slice(snippet.length - MAX_SNIPPET_CHARS);
8987
+ }
8988
+ return snippet;
8989
+ }
8990
+ function commandFailureSuggestion(snippet) {
8991
+ if (snippet?.includes("cache folder contains root-owned files") === true) {
8992
+ return "npm cannot write its cache because some files are owned by root. Run the chown command npm printed, then retry. RepoSetup will not run sudo for you.";
8993
+ }
8994
+ return "Inspect the command output, fix the project, and re-run the plan.";
8995
+ }
8974
8996
  async function executeCheckPrerequisite(operation, context) {
8975
8997
  const spec = pathPrerequisite(operation.id);
8976
8998
  if (spec === void 0) {
@@ -9014,7 +9036,7 @@ async function executeRunCommand(operation, context) {
9014
9036
  args: operation.args,
9015
9037
  cwd: cwd.absolutePath
9016
9038
  });
9017
- return commandFailure(operation.command, operation.args, result);
9039
+ return commandFailure(operation.command, operation.args, result, context);
9018
9040
  }
9019
9041
  async function executeVerify(operation, context) {
9020
9042
  if (operation.command === void 0) {
@@ -9035,7 +9057,7 @@ async function executeVerify(operation, context) {
9035
9057
  args,
9036
9058
  cwd: cwd.absolutePath
9037
9059
  });
9038
- const failed = commandFailure(operation.command, args, result);
9060
+ const failed = commandFailure(operation.command, args, result, context);
9039
9061
  if (failed === void 0) {
9040
9062
  return void 0;
9041
9063
  }
@@ -9080,7 +9102,7 @@ async function binaryExists(command, context) {
9080
9102
  });
9081
9103
  return result.notFound !== true && result.exitCode === 0;
9082
9104
  }
9083
- function commandFailure(command, args, result) {
9105
+ function commandFailure(command, args, result, context) {
9084
9106
  if (result.notFound === true) {
9085
9107
  return createRepoSetupError({
9086
9108
  code: "COMMAND_FAILED",
@@ -9092,15 +9114,22 @@ function commandFailure(command, args, result) {
9092
9114
  if (result.exitCode === 0) {
9093
9115
  return void 0;
9094
9116
  }
9117
+ const snippet = summarizeFailedProcessOutput(result.stdout, result.stderr);
9118
+ if (snippet !== void 0) {
9119
+ context.logger.info(snippet);
9120
+ context.logs.push(snippet);
9121
+ }
9122
+ const summary = `Command "${command}" exited with code ${result.exitCode}.`;
9095
9123
  return createRepoSetupError({
9096
9124
  code: "COMMAND_FAILED",
9097
- message: `Command "${command}" exited with code ${result.exitCode}.`,
9125
+ message: snippet === void 0 ? summary : `${summary}
9126
+ ${snippet}`,
9098
9127
  details: {
9099
9128
  command,
9100
9129
  args: [...args],
9101
9130
  exitCode: result.exitCode
9102
9131
  },
9103
- suggestion: "Inspect the command output, fix the project, and re-run the plan."
9132
+ suggestion: commandFailureSuggestion(snippet)
9104
9133
  });
9105
9134
  }
9106
9135
  var silentLogger = {
@@ -10751,7 +10780,7 @@ function dlx(context, pkg, args, options) {
10751
10780
  } : {
10752
10781
  type: "run_command",
10753
10782
  command: "npx",
10754
- args: [pkg, ...args],
10783
+ args: ["--yes", pkg, ...args],
10755
10784
  cwd: context.projectRoot,
10756
10785
  description: options.description,
10757
10786
  requiresNetwork: true,
@@ -11429,7 +11458,9 @@ var nextjsIntegration = defineIntegration({
11429
11458
  } : {
11430
11459
  type: "run_command",
11431
11460
  command: "npx",
11432
- args: ["create-next-app@latest", directory, ...flags],
11461
+ // npx flags must come before the package. --yes suppresses the
11462
+ // "Ok to proceed?" install prompt (npm exec / npx docs).
11463
+ args: ["--yes", "create-next-app@latest", directory, ...flags],
11433
11464
  cwd: ".",
11434
11465
  description: "Scaffold Next.js with create-next-app",
11435
11466
  requiresNetwork: true,
@@ -13427,4 +13458,4 @@ export {
13427
13458
  EXIT_CODES,
13428
13459
  runCli
13429
13460
  };
13430
- //# sourceMappingURL=chunk-ISDHJ7ZF.js.map
13461
+ //# sourceMappingURL=chunk-ITK26OIN.js.map
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EXIT_CODES,
3
3
  runCli
4
- } from "./chunk-ISDHJ7ZF.js";
4
+ } from "./chunk-ITK26OIN.js";
5
5
 
6
6
  // src/index.ts
7
7
  var packageName = "rsetup";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsetup",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",