johankit 0.1.3 → 0.1.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.
@@ -1,21 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.copy = void 0;
3
+ exports.copy = copy;
4
4
  const scan_1 = require("../../core/scan");
5
5
  const clipboard_1 = require("../../core/clipboard");
6
6
  async function copy(input) {
7
- let snapshot;
8
- if (Array.isArray(input)) {
9
- snapshot = input.map(path => {
10
- const fileSnapshot = (0, scan_1.scanDir)(path);
11
- if (fileSnapshot.length !== 1) {
12
- throw new Error(`Expected single file for path: ${path}`);
13
- }
14
- return fileSnapshot[0];
15
- });
16
- }
17
- else {
18
- snapshot = (0, scan_1.scanDir)(input);
7
+ let snapshot = [];
8
+ const paths = Array.isArray(input) ? input : [input];
9
+ for (const p of paths) {
10
+ const scanned = (0, scan_1.scanDir)(p);
11
+ snapshot.push(...scanned);
19
12
  }
20
13
  const clipboardJSON = JSON.stringify(snapshot, null, 2);
21
14
  try {
@@ -26,4 +19,3 @@ async function copy(input) {
26
19
  }
27
20
  return clipboardJSON;
28
21
  }
29
- exports.copy = copy;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.paste = void 0;
6
+ exports.paste = paste;
7
7
  // src/cli/commands/paste.ts
8
8
  const write_1 = require("../../core/write");
9
9
  const clipboard_1 = require("../../core/clipboard");
@@ -46,4 +46,3 @@ async function paste(dir) {
46
46
  process.exit(1);
47
47
  }
48
48
  }
49
- exports.paste = paste;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prompt = void 0;
3
+ exports.prompt = prompt;
4
4
  // src/cli/commands/prompt.ts
5
5
  const scan_1 = require("../../core/scan");
6
6
  const clipboard_1 = require("../../core/clipboard");
@@ -86,4 +86,3 @@ ${userPrompt}
86
86
  process.stderr.write("\n✖ Failed to copy to clipboard (output only)\n");
87
87
  }
88
88
  }
89
- exports.prompt = prompt;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sync = void 0;
3
+ exports.sync = sync;
4
4
  // src/cli/commands/sync.ts
5
5
  const scan_1 = require("../../core/scan");
6
6
  const diff_1 = require("../../core/diff");
@@ -78,7 +78,6 @@ USER REQUEST
78
78
  process.exit(1);
79
79
  }
80
80
  }
81
- exports.sync = sync;
82
81
  function readStdin() {
83
82
  return new Promise(resolve => {
84
83
  let data = "";
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.tree = void 0;
6
+ exports.tree = tree;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const ts_morph_1 = require("ts-morph");
9
9
  /**
@@ -96,7 +96,6 @@ async function tree(dir) {
96
96
  }
97
97
  return tree;
98
98
  }
99
- exports.tree = tree;
100
99
  function safeType(fn) {
101
100
  try {
102
101
  return fn();
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readClipboard = exports.copyToClipboard = void 0;
3
+ exports.copyToClipboard = copyToClipboard;
4
+ exports.readClipboard = readClipboard;
4
5
  // src/core/clipboard.ts
5
6
  const child_process_1 = require("child_process");
6
7
  let memoryClipboard = "";
@@ -44,7 +45,6 @@ function copyToClipboard(text) {
44
45
  });
45
46
  });
46
47
  }
47
- exports.copyToClipboard = copyToClipboard;
48
48
  function readClipboard() {
49
49
  return new Promise((resolve, reject) => {
50
50
  let command;
@@ -86,4 +86,3 @@ function readClipboard() {
86
86
  });
87
87
  });
88
88
  }
89
- exports.readClipboard = readClipboard;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.loadConfig = void 0;
6
+ exports.loadConfig = loadConfig;
7
7
  // src/core/config.ts
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const fs_1 = require("fs");
@@ -49,4 +49,3 @@ function loadConfig(basePath) {
49
49
  };
50
50
  }
51
51
  }
52
- exports.loadConfig = loadConfig;
package/dist/core/diff.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.applyDiff = void 0;
6
+ exports.applyDiff = applyDiff;
7
7
  // src/core/diff.ts
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
@@ -26,4 +26,3 @@ function applyDiff(basePath, patches) {
26
26
  }
27
27
  }
28
28
  }
29
- exports.applyDiff = applyDiff;
package/dist/core/git.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ensureGitCommit = void 0;
6
+ exports.ensureGitCommit = ensureGitCommit;
7
7
  // src/core/git.ts
8
8
  const child_process_1 = require("child_process");
9
9
  const crypto_1 = __importDefault(require("crypto"));
@@ -40,4 +40,3 @@ function ensureGitCommit(message) {
40
40
  // noop: no git or nothing to commit
41
41
  }
42
42
  }
43
- exports.ensureGitCommit = ensureGitCommit;
package/dist/core/scan.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.scanDir = void 0;
6
+ exports.scanDir = scanDir;
7
7
  // src/core/scan.ts
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
@@ -64,4 +64,3 @@ function scanDir(basePath, options = {}) {
64
64
  loop(base);
65
65
  return result;
66
66
  }
67
- exports.scanDir = scanDir;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validatePatches = void 0;
3
+ exports.validatePatches = validatePatches;
4
4
  /**
5
5
  * Valida se um objeto se parece com um Patch de DiffPatch válido.
6
6
  * Não faz validação completa de esquema (JSON Schema), mas verifica a estrutura básica.
@@ -38,4 +38,3 @@ function validatePatches(patches) {
38
38
  // Assume que o array validado está no formato correto de DiffPatch[]
39
39
  return patches;
40
40
  }
41
- exports.validatePatches = validatePatches;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validatePatches = void 0;
3
+ exports.validatePatches = validatePatches;
4
4
  function validatePatches(json) {
5
5
  if (!Array.isArray(json)) {
6
6
  throw new Error("Validation Error: Input is not a JSON array.");
@@ -21,4 +21,3 @@ function validatePatches(json) {
21
21
  return item;
22
22
  });
23
23
  }
24
- exports.validatePatches = validatePatches;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.writeFiles = void 0;
6
+ exports.writeFiles = writeFiles;
7
7
  // src/core/write.ts
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
@@ -21,4 +21,3 @@ function writeFiles(basePath, files, commit = true) {
21
21
  fs_1.default.writeFileSync(fullPath, file.content, "utf8");
22
22
  }
23
23
  }
24
- exports.writeFiles = writeFiles;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = cleanCodeBlock;
3
4
  function cleanCodeBlock(content) {
4
5
  const langMatch = content.match(/^```(\w+)?/);
5
6
  const lang = langMatch ? langMatch[1] : null;
@@ -9,4 +10,3 @@ function cleanCodeBlock(content) {
9
10
  cleaned = cleaned.trim();
10
11
  return { lang, cleaned };
11
12
  }
12
- exports.default = cleanCodeBlock;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = createAsciiTree;
3
4
  function createAsciiTree(files) {
4
5
  let out = "";
5
6
  files.forEach((file, i) => {
@@ -43,4 +44,3 @@ function createAsciiTree(files) {
43
44
  });
44
45
  return out;
45
46
  }
46
- exports.default = createAsciiTree;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "johankit",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -14,9 +14,9 @@
14
14
  "keywords": [],
15
15
  "author": "",
16
16
  "license": "ISC",
17
- "type": "commonjs",
18
17
  "devDependencies": {
19
18
  "@types/jest": "^29.5.3",
19
+ "@types/js-yaml": "^4.0.9",
20
20
  "@types/node": "^25.0.1",
21
21
  "jest": "^29.5.0",
22
22
  "ts-jest": "^29.1.0",
package/tsconfig.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "exclude": ["types.ts"],
2
3
  "compilerOptions": {
3
4
  "target": "ES2020",
4
5
  "module": "NodeNext",