@jannael/glinter 1.0.0 → 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.
Files changed (2) hide show
  1. package/dist/index.js +43 -20
  2. package/package.json +58 -58
package/dist/index.js CHANGED
@@ -5,15 +5,29 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
@@ -1155,43 +1169,52 @@ ${r ? t("cyan", E2) : ""}
1155
1169
  var Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
1156
1170
  var je = `${t("gray", d2)} `;
1157
1171
 
1158
- // src/main.ts
1172
+ // src/add-command.ts
1159
1173
  var {$: $2 } = globalThis.Bun;
1160
1174
  async function main() {
1161
- const output = await $2`git status --porcelain`.quiet().text();
1175
+ const output = await $2`git status --porcelain -z`.quiet().text();
1162
1176
  if (!output.trim()) {
1163
1177
  console.log("\x1B[32m\u2714\x1B[0m No changes detected.");
1164
1178
  return;
1165
1179
  }
1166
1180
  const warnings = new Set;
1167
- const lines = output.trim().split(`
1168
- `);
1169
- const changes = lines.map((line) => {
1170
- const status = line.slice(0, 2);
1171
- const file = line.slice(2).trim();
1181
+ const entries = output.split("\x00");
1182
+ const changes = [];
1183
+ for (let i = 0;i < entries.length; i++) {
1184
+ const entry = entries[i];
1185
+ if (!entry)
1186
+ continue;
1187
+ const status = entry.slice(0, 2);
1188
+ const file = entry.slice(3);
1189
+ let displayPath = file;
1190
+ const value = file;
1191
+ if (status.startsWith("R") || status.startsWith("C")) {
1192
+ const source = entries[++i];
1193
+ displayPath = `${source} -> ${file}`;
1194
+ }
1172
1195
  let label = "";
1173
1196
  if (status.includes("M")) {
1174
- label = `\x1B[33mmodified:\x1B[0m ${file}`;
1197
+ label = `\x1B[33mmodified:\x1B[0m ${displayPath}`;
1175
1198
  } else if (status.includes("A") || status.includes("?")) {
1176
- label = `\x1B[32mnew file:\x1B[0m ${file}`;
1199
+ label = `\x1B[32mnew file:\x1B[0m ${displayPath}`;
1177
1200
  } else if (status.includes("D")) {
1178
- label = `\x1B[31mdeleted:\x1B[0m ${file}`;
1201
+ label = `\x1B[31mdeleted:\x1B[0m ${displayPath}`;
1179
1202
  } else if (status.includes("R")) {
1180
- label = `\x1B[35mrenamed:\x1B[0m ${file}`;
1203
+ label = `\x1B[35mrenamed:\x1B[0m ${displayPath}`;
1181
1204
  } else {
1182
- label = `${status}: ${file}`;
1205
+ label = `${status}: ${displayPath}`;
1183
1206
  }
1184
- return { value: file, label };
1185
- }).filter((change) => {
1186
- const isSensitive = change.value.includes(".env") || change.value.includes("node_modules");
1187
- if (change.value.includes(".env")) {
1207
+ const isSensitive = value.includes(".env") || value.includes("node_modules");
1208
+ if (value.includes(".env")) {
1188
1209
  warnings.add("\x1B[33m .env file hidden\x1B[0m (Add to .gitignore to avoid leaks)");
1189
1210
  }
1190
- if (change.value.includes("node_modules")) {
1211
+ if (value.includes("node_modules")) {
1191
1212
  warnings.add("\x1B[33m node_modules hidden\x1B[0m (Add to .gitignore to save space)");
1192
1213
  }
1193
- return !isSensitive;
1194
- });
1214
+ if (!isSensitive) {
1215
+ changes.push({ value, label });
1216
+ }
1217
+ }
1195
1218
  if (changes.length === 0) {
1196
1219
  console.log("\x1B[32m\u2714\x1B[0m All changes are either staged or sensitive (like .env).");
1197
1220
  return;
package/package.json CHANGED
@@ -1,58 +1,58 @@
1
- {
2
- "name": "@jannael/glinter",
3
- "version": "1.0.0",
4
- "description": "A high-performance, transparent Git wrapper with interactive staging",
5
- "type": "module",
6
- "private": false,
7
- "license": "MIT",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/jannael/glinter"
11
- },
12
- "author": {
13
- "name": "Jannael",
14
- "url": "https://github.com/jannael"
15
- },
16
- "homepage": "https://github.com/jannael/glinter#readme",
17
- "bugs": {
18
- "url": "https://github.com/jannael/glinter/issues"
19
- },
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
- "keywords": [
24
- "git",
25
- "cli",
26
- "wrapper",
27
- "interactive",
28
- "staging"
29
- ],
30
- "files": [
31
- "dist"
32
- ],
33
- "exports": {
34
- ".": "./dist/index.js"
35
- },
36
- "scripts": {
37
- "dev": "bun run src/index.ts",
38
- "build": "bun build ./src/index.ts --outfile=./dist/index.js --target=bun",
39
- "prepublishOnly": "bun run build"
40
- },
41
- "bin": {
42
- "g": "./dist/index.js"
43
- },
44
- "engines": {
45
- "bun": ">=1.0.0"
46
- },
47
- "devDependencies": {
48
- "@biomejs/biome": "2.4.10",
49
- "@types/bun": "latest"
50
- },
51
- "peerDependencies": {
52
- "typescript": "5",
53
- "bun": ">=1.0.0"
54
- },
55
- "dependencies": {
56
- "@clack/prompts": "1.2.0"
57
- }
58
- }
1
+ {
2
+ "name": "@jannael/glinter",
3
+ "version": "1.0.2",
4
+ "description": "A high-performance, transparent Git wrapper with interactive staging",
5
+ "type": "module",
6
+ "private": false,
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Jannael/Glinter.git"
11
+ },
12
+ "author": {
13
+ "name": "Jannael",
14
+ "url": "https://github.com/jannael"
15
+ },
16
+ "homepage": "https://github.com/jannael/glinter#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/jannael/glinter/issues"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "keywords": [
24
+ "git",
25
+ "cli",
26
+ "wrapper",
27
+ "interactive",
28
+ "staging"
29
+ ],
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "exports": {
34
+ ".": "./dist/index.js"
35
+ },
36
+ "scripts": {
37
+ "dev": "bun run src/index.ts",
38
+ "build": "bun build ./src/index.ts --outfile=./dist/index.js --target=bun",
39
+ "prepublishOnly": "bun run build"
40
+ },
41
+ "bin": {
42
+ "g": "./dist/index.js"
43
+ },
44
+ "engines": {
45
+ "bun": ">=1.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@biomejs/biome": "2.4.10",
49
+ "@types/bun": "latest"
50
+ },
51
+ "peerDependencies": {
52
+ "bun": ">=1.0.0",
53
+ "typescript": "5"
54
+ },
55
+ "dependencies": {
56
+ "@clack/prompts": "1.2.0"
57
+ }
58
+ }