nococli 1.0.0 → 1.0.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.
@@ -0,0 +1,119 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, {
40
+ get: all[name],
41
+ enumerable: true,
42
+ configurable: true,
43
+ set: __exportSetter.bind(all, name)
44
+ });
45
+ };
46
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
47
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
48
+
49
+ // src/utils/paths.ts
50
+ import path from "path";
51
+ import os from "os";
52
+ import fs from "fs/promises";
53
+ function getHomeDir() {
54
+ return os.homedir();
55
+ }
56
+ function getConfig() {
57
+ const homeDir = getHomeDir();
58
+ const templateDir = path.join(homeDir, ".git-templates");
59
+ const hooksDir = path.join(templateDir, "hooks");
60
+ const hookFile = path.join(hooksDir, "commit-msg");
61
+ return {
62
+ templateDir,
63
+ hooksDir,
64
+ hookFile
65
+ };
66
+ }
67
+ function toGitPath(filePath) {
68
+ return filePath.replace(/\\/g, "/");
69
+ }
70
+ async function pathExists(filePath) {
71
+ try {
72
+ await fs.promises.access(filePath);
73
+ return true;
74
+ } catch {
75
+ return false;
76
+ }
77
+ }
78
+
79
+ // src/utils/git.ts
80
+ import { execSync } from "child_process";
81
+ function getGitConfig(key) {
82
+ try {
83
+ const value = execSync(`git config --global ${key}`, {
84
+ encoding: "utf-8",
85
+ stdio: ["pipe", "pipe", "ignore"]
86
+ }).trim();
87
+ return { exists: true, value };
88
+ } catch (error) {
89
+ return { exists: false, value: null };
90
+ }
91
+ }
92
+ function setGitConfig(key, value) {
93
+ execSync(`git config --global ${key} '${value}'`, {
94
+ encoding: "utf-8",
95
+ stdio: ["pipe", "pipe", "ignore"]
96
+ });
97
+ }
98
+ function unsetGitConfig(key) {
99
+ try {
100
+ execSync(`git config --global --unset ${key}`, {
101
+ encoding: "utf-8",
102
+ stdio: ["pipe", "pipe", "ignore"]
103
+ });
104
+ } catch {}
105
+ }
106
+ function getTemplateDir() {
107
+ return getGitConfig("init.templatedir");
108
+ }
109
+ function setTemplateDir(templatePath) {
110
+ const gitPath = toGitPath(templatePath);
111
+ setGitConfig("init.templatedir", gitPath);
112
+ }
113
+ export {
114
+ unsetGitConfig,
115
+ setTemplateDir,
116
+ setGitConfig,
117
+ getTemplateDir,
118
+ getGitConfig
119
+ };
@@ -0,0 +1,87 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, {
40
+ get: all[name],
41
+ enumerable: true,
42
+ configurable: true,
43
+ set: __exportSetter.bind(all, name)
44
+ });
45
+ };
46
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
47
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
48
+
49
+ // src/types.ts
50
+ var AI_PATTERN_REGEX = "^Co-Authored-By: (Claude|GitHub Copilot|ChatGPT|Anthropic|OpenAI|Cursor AI|AI Assistant|Tabnine|CodeWhisperer|Codeium|Replit Ghostwriter|Sourcegraph Cody|Cody).*";
51
+ var DEFAULT_AI_PATTERNS = [
52
+ {
53
+ name: "AI Co-Authors",
54
+ pattern: AI_PATTERN_REGEX
55
+ }
56
+ ];
57
+
58
+ // src/utils/hook.ts
59
+ function generateHookContent(options = {}) {
60
+ const patterns = options.patterns || DEFAULT_AI_PATTERNS;
61
+ const sedCommands = patterns.map((p) => `sed -i '/${p.pattern}/d' "$COMMIT_MSG_FILE"`).join(`
62
+ `);
63
+ return `#!/bin/bash
64
+ # git-no-ai-author: Remove AI co-author signatures from commit messages
65
+ # Generated by npx git-no-ai-author
66
+ # See: https://github.com/yourusername/git-no-ai-author
67
+
68
+ COMMIT_MSG_FILE=$1
69
+
70
+ # AI patterns to remove from commit messages
71
+ ${sedCommands}
72
+
73
+ # Remove trailing empty lines
74
+ sed -i -e :a -e '/^$/{$d;N;ba' -e '}' "$COMMIT_MSG_FILE"
75
+ `;
76
+ }
77
+ function getDefaultPatterns() {
78
+ return DEFAULT_AI_PATTERNS;
79
+ }
80
+ function getPatternNames() {
81
+ return DEFAULT_AI_PATTERNS.map((p) => p.name);
82
+ }
83
+ export {
84
+ getPatternNames,
85
+ getDefaultPatterns,
86
+ generateHookContent
87
+ };