nococli 1.0.1 → 1.0.2

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/dist/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import { createRequire } from "node:module";
2
3
  var __create = Object.create;
3
4
  var __getProtoOf = Object.getPrototypeOf;
@@ -11298,10 +11299,10 @@ function getPatternNames() {
11298
11299
  }
11299
11300
 
11300
11301
  // src/utils/git.ts
11301
- import { execSync } from "child_process";
11302
+ import { execFileSync } from "child_process";
11302
11303
  function getGitConfig(key) {
11303
11304
  try {
11304
- const value = execSync(`git config --global ${key}`, {
11305
+ const value = execFileSync("git", ["config", "--global", key], {
11305
11306
  encoding: "utf-8",
11306
11307
  stdio: ["pipe", "pipe", "ignore"]
11307
11308
  }).trim();
@@ -11311,14 +11312,14 @@ function getGitConfig(key) {
11311
11312
  }
11312
11313
  }
11313
11314
  function setGitConfig(key, value) {
11314
- execSync(`git config --global ${key} '${value}'`, {
11315
+ execFileSync("git", ["config", "--global", key, value], {
11315
11316
  encoding: "utf-8",
11316
11317
  stdio: ["pipe", "pipe", "ignore"]
11317
11318
  });
11318
11319
  }
11319
11320
  function unsetGitConfig(key) {
11320
11321
  try {
11321
- execSync(`git config --global --unset ${key}`, {
11322
+ execFileSync("git", ["config", "--global", "--unset", key], {
11322
11323
  encoding: "utf-8",
11323
11324
  stdio: ["pipe", "pipe", "ignore"]
11324
11325
  });
@@ -13533,8 +13534,8 @@ var Listr = class {
13533
13534
  var import_prompts = __toESM(require_prompts3(), 1);
13534
13535
  var logger2 = new Logger;
13535
13536
  var program2 = new Command;
13536
- program2.name("nococli").description("Remove AI co-author signatures from git commits").version("1.0.0");
13537
- program2.command("install").description("Install noco hook globally for all new git repositories").option("-f, --force", "Overwrite existing hook without prompting").option("-s, --silent", "Silent mode - no output").action(async (options) => {
13537
+ async function runInstallCommand() {
13538
+ let installResult = null;
13538
13539
  const tasks = new Listr([
13539
13540
  {
13540
13541
  title: "Checking current git configuration",
@@ -13549,9 +13550,12 @@ program2.command("install").description("Install noco hook globally for all new
13549
13550
  {
13550
13551
  title: "Installing hook",
13551
13552
  task: async () => {
13552
- const result = await install({ silent: true });
13553
- if (!result.success) {
13554
- throw new Error(result.message);
13553
+ installResult = await install({ silent: true });
13554
+ if (!installResult.success) {
13555
+ throw new Error(installResult.message);
13556
+ }
13557
+ if (installResult.needsInit) {
13558
+ return "Hook created, but git template directory still points elsewhere";
13555
13559
  }
13556
13560
  }
13557
13561
  }
@@ -13564,7 +13568,12 @@ program2.command("install").description("Install noco hook globally for all new
13564
13568
  try {
13565
13569
  await tasks.run();
13566
13570
  logger2.blank();
13567
- logger2.success("✨ Installation complete!");
13571
+ if (installResult?.needsInit) {
13572
+ logger2.warning("Hook installed, but git is still using another template directory.");
13573
+ logger2.info("Update your global git config, then re-run `git init` in existing repos.");
13574
+ } else {
13575
+ logger2.success("✨ Installation complete!");
13576
+ }
13568
13577
  logger2.blank();
13569
13578
  logger2.info("AI signatures that will be removed:");
13570
13579
  getPatternNames().forEach((p) => logger2.info(` ${source_default.dim("•")} ${p}`));
@@ -13575,7 +13584,9 @@ program2.command("install").description("Install noco hook globally for all new
13575
13584
  logger2.error(error instanceof Error ? error.message : "Installation failed");
13576
13585
  process.exit(1);
13577
13586
  }
13578
- });
13587
+ }
13588
+ program2.name("nococli").description("Remove AI co-author signatures from git commits").version("1.0.2");
13589
+ program2.command("install").description("Install noco hook globally for all new git repositories").option("-f, --force", "Overwrite existing hook without prompting").option("-s, --silent", "Silent mode - no output").action(runInstallCommand);
13579
13590
  program2.command("uninstall").description("Remove noco hook from your system").option("-c, --remove-config", "Also remove git template directory config").option("-s, --silent", "Silent mode - no output").action(async (options) => {
13580
13591
  if (!options.silent) {
13581
13592
  const response = await import_prompts.default({
@@ -13650,4 +13661,8 @@ program2.command("patterns").description("List all AI co-author signature patter
13650
13661
  logger2.table(["Status", "Pattern"], table);
13651
13662
  logger2.info(`${patterns.length} patterns will be removed from commits`);
13652
13663
  });
13653
- program2.parse();
13664
+ if (process.argv.length <= 2) {
13665
+ await runInstallCommand();
13666
+ } else {
13667
+ program2.parse();
13668
+ }
package/dist/install.js CHANGED
@@ -3251,10 +3251,10 @@ function getPatternNames() {
3251
3251
  }
3252
3252
 
3253
3253
  // src/utils/git.ts
3254
- import { execSync } from "child_process";
3254
+ import { execFileSync } from "child_process";
3255
3255
  function getGitConfig(key) {
3256
3256
  try {
3257
- const value = execSync(`git config --global ${key}`, {
3257
+ const value = execFileSync("git", ["config", "--global", key], {
3258
3258
  encoding: "utf-8",
3259
3259
  stdio: ["pipe", "pipe", "ignore"]
3260
3260
  }).trim();
@@ -3264,14 +3264,14 @@ function getGitConfig(key) {
3264
3264
  }
3265
3265
  }
3266
3266
  function setGitConfig(key, value) {
3267
- execSync(`git config --global ${key} '${value}'`, {
3267
+ execFileSync("git", ["config", "--global", key, value], {
3268
3268
  encoding: "utf-8",
3269
3269
  stdio: ["pipe", "pipe", "ignore"]
3270
3270
  });
3271
3271
  }
3272
3272
  function unsetGitConfig(key) {
3273
3273
  try {
3274
- execSync(`git config --global --unset ${key}`, {
3274
+ execFileSync("git", ["config", "--global", "--unset", key], {
3275
3275
  encoding: "utf-8",
3276
3276
  stdio: ["pipe", "pipe", "ignore"]
3277
3277
  });
package/dist/uninstall.js CHANGED
@@ -3216,10 +3216,10 @@ async function pathExists(filePath) {
3216
3216
  }
3217
3217
 
3218
3218
  // src/utils/git.ts
3219
- import { execSync } from "child_process";
3219
+ import { execFileSync } from "child_process";
3220
3220
  function getGitConfig(key) {
3221
3221
  try {
3222
- const value = execSync(`git config --global ${key}`, {
3222
+ const value = execFileSync("git", ["config", "--global", key], {
3223
3223
  encoding: "utf-8",
3224
3224
  stdio: ["pipe", "pipe", "ignore"]
3225
3225
  }).trim();
@@ -3229,14 +3229,14 @@ function getGitConfig(key) {
3229
3229
  }
3230
3230
  }
3231
3231
  function setGitConfig(key, value) {
3232
- execSync(`git config --global ${key} '${value}'`, {
3232
+ execFileSync("git", ["config", "--global", key, value], {
3233
3233
  encoding: "utf-8",
3234
3234
  stdio: ["pipe", "pipe", "ignore"]
3235
3235
  });
3236
3236
  }
3237
3237
  function unsetGitConfig(key) {
3238
3238
  try {
3239
- execSync(`git config --global --unset ${key}`, {
3239
+ execFileSync("git", ["config", "--global", "--unset", key], {
3240
3240
  encoding: "utf-8",
3241
3241
  stdio: ["pipe", "pipe", "ignore"]
3242
3242
  });
package/dist/utils/git.js CHANGED
@@ -77,10 +77,10 @@ async function pathExists(filePath) {
77
77
  }
78
78
 
79
79
  // src/utils/git.ts
80
- import { execSync } from "child_process";
80
+ import { execFileSync } from "child_process";
81
81
  function getGitConfig(key) {
82
82
  try {
83
- const value = execSync(`git config --global ${key}`, {
83
+ const value = execFileSync("git", ["config", "--global", key], {
84
84
  encoding: "utf-8",
85
85
  stdio: ["pipe", "pipe", "ignore"]
86
86
  }).trim();
@@ -90,14 +90,14 @@ function getGitConfig(key) {
90
90
  }
91
91
  }
92
92
  function setGitConfig(key, value) {
93
- execSync(`git config --global ${key} '${value}'`, {
93
+ execFileSync("git", ["config", "--global", key, value], {
94
94
  encoding: "utf-8",
95
95
  stdio: ["pipe", "pipe", "ignore"]
96
96
  });
97
97
  }
98
98
  function unsetGitConfig(key) {
99
99
  try {
100
- execSync(`git config --global --unset ${key}`, {
100
+ execFileSync("git", ["config", "--global", "--unset", key], {
101
101
  encoding: "utf-8",
102
102
  stdio: ["pipe", "pipe", "ignore"]
103
103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nococli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Keep your code yours — remove AI co-author signatures from git commits",
5
5
  "type": "module",
6
6
  "main": "./dist/install.js",
@@ -8,9 +8,10 @@
8
8
  "noco": "./dist/cli.js"
9
9
  },
10
10
  "scripts": {
11
- "build": "bun build ./src/cli.ts ./src/install.ts ./src/uninstall.ts ./src/types.ts ./src/utils/logger.ts ./src/utils/paths.ts ./src/utils/hook.ts ./src/utils/git.ts --outdir ./dist --target bun && bun build ./src/cli.ts ./src/install.ts ./src/uninstall.ts ./src/types.ts ./src/utils/logger.ts ./src/utils/paths.ts ./src/utils/hook.ts ./src/utils/git.ts --outdir ./dist --target node",
11
+ "build": "bun build ./src/cli.ts ./src/install.ts ./src/uninstall.ts ./src/types.ts ./src/utils/logger.ts ./src/utils/paths.ts ./src/utils/hook.ts ./src/utils/git.ts --outdir ./dist --target bun && bun build ./src/cli.ts ./src/install.ts ./src/uninstall.ts ./src/types.ts ./src/utils/logger.ts ./src/utils/paths.ts ./src/utils/hook.ts ./src/utils/git.ts --outdir ./dist --target node && node -e \"const fs=require('fs'); const p='./dist/cli.js'; fs.writeFileSync(p, '#!/usr/bin/env node\\n' + fs.readFileSync(p, 'utf8'));\"",
12
12
  "dev": "bun run src/cli.ts",
13
- "test": "bun test"
13
+ "test": "bun test",
14
+ "test:e2e": "node ./scripts/e2e-install.mjs"
14
15
  },
15
16
  "keywords": [
16
17
  "git",