ai-pack-cli 0.1.6__tar.gz → 0.1.7__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-pack-cli
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Home-page: https://github.com/iamraydoan/ai-pack
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -208,6 +208,20 @@ class SkeletonExtractor:
208
208
  return content
209
209
 
210
210
 
211
+ def copy_via_osc52(payload: str) -> bool:
212
+ """Attempts to copy text to the client system clipboard using OSC 52 escape sequence."""
213
+ try:
214
+ import base64
215
+ # Base64 encode the payload
216
+ b64_data = base64.b64encode(payload.encode("utf-8")).decode("ascii")
217
+ # Write to stdout using the OSC 52 escape sequence: \x1b]52;c;[base64]\x07
218
+ sys.stdout.write(f"\x1b]52;c;{b64_data}\x07")
219
+ sys.stdout.flush()
220
+ return True
221
+ except Exception:
222
+ return False
223
+
224
+
211
225
  def walk_dir(directory: str, git_files: Set[str] = None, gitignore: GitignoreMatcher = None) -> List[str]:
212
226
  """Recursively traverses directories, ignoring binaries and configured ignore directories."""
213
227
  candidates = []
@@ -462,12 +476,20 @@ def main():
462
476
  print(f"❌ Error saving to file {args.output}: {e}", file=sys.stderr)
463
477
  sys.exit(1)
464
478
  else:
479
+ copied = False
465
480
  try:
466
481
  import pyperclip
467
482
  pyperclip.copy(payload)
483
+ copied = True
468
484
  print("🚀 Successfully copied to clipboard!")
469
- except Exception as e:
470
- print(f"❌ Error copying to clipboard: {e}", file=sys.stderr)
485
+ except Exception:
486
+ # Fallback to OSC 52 (works seamlessly over SSH / remote terminal sessions)
487
+ if copy_via_osc52(payload):
488
+ copied = True
489
+ print("🚀 Successfully copied to clipboard (via OSC 52 remote sequence)!")
490
+
491
+ if not copied:
492
+ print("❌ Error copying to clipboard: Pyperclip could not find a copy/paste mechanism.", file=sys.stderr)
471
493
  print("💡 In headless Linux systems, you must install 'xclip' or 'xsel', or direct output to a file using the '-o' flag.", file=sys.stderr)
472
494
  sys.exit(1)
473
495
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-pack-cli
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Home-page: https://github.com/iamraydoan/ai-pack
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
6
6
 
7
7
  setup(
8
8
  name="ai-pack-cli",
9
- version="0.1.6",
9
+ version="0.1.7",
10
10
  py_modules=["ai_pack"],
11
11
  install_requires=[
12
12
  "pyperclip>=1.8.2",
@@ -18,17 +18,17 @@ class TestSkeletonExtractor(unittest.TestCase):
18
18
 
19
19
  @patch('ai_pack.sys.stderr', new_callable=StringIO)
20
20
  def test_get_skeleton_import_error(self, mock_stderr):
21
- with patch.dict(sys.modules, {'codesigs': None}):
22
- # Clear sys.modules of any real codesigs import to trigger ImportError
23
- original_modules = sys.modules.copy()
24
- if 'codesigs' in sys.modules:
25
- del sys.modules['codesigs']
26
- try:
21
+ # Clear sys.modules of any real codesigs import to trigger ImportError
22
+ original_modules = sys.modules.copy()
23
+ if 'codesigs' in sys.modules:
24
+ del sys.modules['codesigs']
25
+ try:
26
+ with patch.dict(sys.modules, {'codesigs': None}):
27
27
  result = SkeletonExtractor.get_skeleton("test.py", "def foo():\n pass")
28
28
  self.assertEqual(result, "def foo():\n pass")
29
29
  self.assertIn("package is required", mock_stderr.getvalue())
30
- finally:
31
- sys.modules = original_modules
30
+ finally:
31
+ sys.modules = original_modules
32
32
 
33
33
  @patch('ai_pack.sys.stderr', new_callable=StringIO)
34
34
  def test_get_skeleton_runtime_error(self, mock_stderr):
File without changes
File without changes