aline-ai 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.4
2
2
  Name: aline-ai
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Shared AI memory; everyone knows everything in teams
5
5
  Author: Sharemind
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
- aline_ai-0.1.0.dist-info/licenses/LICENSE,sha256=H8wTqV5IF1oHw_HbBtS1PSDU8G_q81yblEIL_JfV8Vo,1077
2
- realign/__init__.py,sha256=yt4R6O6rr0ImHHhNF1YOZbJxsINC7-45rDxl0OXK7ig,68
1
+ aline_ai-0.1.2.dist-info/licenses/LICENSE,sha256=H8wTqV5IF1oHw_HbBtS1PSDU8G_q81yblEIL_JfV8Vo,1077
2
+ realign/__init__.py,sha256=vbGKpkjVJG35eBo-5-ncGbNP095pDzKws749XISLcJg,68
3
3
  realign/claude_detector.py,sha256=NLxI0zJWcqNxNha9jAy9AslTMwHKakCc9yPGdkrbiFE,3028
4
4
  realign/cli.py,sha256=bkwS329jMDEkrUEihXRN2DDyeTKE6HbAysoDxxskZ8g,941
5
5
  realign/codex_detector.py,sha256=RI3JbZgebrhoqpRfTBMfclYCAISN7hZAHVW3bgftJpU,4428
@@ -7,17 +7,17 @@ realign/config.py,sha256=jarinbr0mA6e5DmgY19b_VpMnxk6SOYTwyvB9luq0ww,7207
7
7
  realign/hooks.py,sha256=qhAeuln_62OgTq0vboZcUAuP2apOrNn58vSZqKwNmWQ,36456
8
8
  realign/logging_config.py,sha256=KvkKktF-bkUu031y9vgUoHpsbnOw7ud25jhpzliNZwA,4929
9
9
  realign/mcp_server.py,sha256=NaT1c7dCNfOvmBPkBMpWI63wqmJQ3wQP2MiMqNUmFIQ,15346
10
- realign/mcp_watcher.py,sha256=AN5skK8qoVkXLCABkAsEcWC7lx2zJi24lwJQSXn2Ixk,13143
10
+ realign/mcp_watcher.py,sha256=jxr4em27hw79N9d-lYCbu4dGclzG7OyPuPFtPeeadMM,13122
11
11
  realign/redactor.py,sha256=uZvLKKGrRGJm-qM8S4XJyJK6i0CSSby_wbKiay7VGJw,8148
12
12
  realign/commands/__init__.py,sha256=GG6IMw6fUBQAXGJDFJvOOQgv6pkiRSfMh8z3AYXTyRM,31
13
13
  realign/commands/auto_commit.py,sha256=_DOw7nt9q3tD_Y3qDL9IFKAUG1hM4qH_xZ-9nyBc2Bc,7451
14
- realign/commands/commit.py,sha256=_A2znDOLldtlkB4RfAc-otLa0soOYv5SSQgtKq7Qbk4,6580
14
+ realign/commands/commit.py,sha256=T5Cb6dfawNQXisztsCFminEaFg4jH5v6u88jkGMGOFI,9007
15
15
  realign/commands/config.py,sha256=oarvn6UuGT8svd2h5_8M_ueV5QWOCUOn8SYoa4XYjs8,6500
16
16
  realign/commands/init.py,sha256=EpSzh2Dd2EmEQ_wo3vAsg6Uq7_YOlQWIpzIkZa_2y0A,11863
17
17
  realign/commands/search.py,sha256=0CZaXll99wtd01MRiZk5NAblxgogc4RUAzMyJunvckE,18044
18
18
  realign/commands/show.py,sha256=P1waa94-AKJr9XjagkE40OHMXzE6IwC74DpeDKqwsqw,16693
19
- aline_ai-0.1.0.dist-info/METADATA,sha256=ZVUw6gLA1LJr34rmE7uVtdylss85X6PgGwBHRU17mGY,1398
20
- aline_ai-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- aline_ai-0.1.0.dist-info/entry_points.txt,sha256=h-NocHDzSueXfsepHTIdRPNQzhNZQPAztJfldd-mQTE,202
22
- aline_ai-0.1.0.dist-info/top_level.txt,sha256=yIL3s2xv9nf1GwD5n71Aq_JEIV4AfzCIDNKBzewuRm4,8
23
- aline_ai-0.1.0.dist-info/RECORD,,
19
+ aline_ai-0.1.2.dist-info/METADATA,sha256=MLVqx9fJTsUyeAxe9ZZogkfYBv9GGb-DXbcdwPwbxt0,1398
20
+ aline_ai-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ aline_ai-0.1.2.dist-info/entry_points.txt,sha256=h-NocHDzSueXfsepHTIdRPNQzhNZQPAztJfldd-mQTE,202
22
+ aline_ai-0.1.2.dist-info/top_level.txt,sha256=yIL3s2xv9nf1GwD5n71Aq_JEIV4AfzCIDNKBzewuRm4,8
23
+ aline_ai-0.1.2.dist-info/RECORD,,
realign/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Aline - AI Agent Chat Session Tracker."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.2"
@@ -106,6 +106,82 @@ def stage_all_changes():
106
106
  raise typer.Exit(1)
107
107
 
108
108
 
109
+ def smart_commit(
110
+ message: str,
111
+ repo_path: str = ".",
112
+ stage_all: bool = False,
113
+ amend: bool = False,
114
+ no_edit: bool = False,
115
+ ) -> dict:
116
+ """
117
+ Smart commit function for programmatic use (returns dict instead of using Typer).
118
+
119
+ Returns:
120
+ dict with keys: success, message, no_changes, commit_hash
121
+ """
122
+ try:
123
+ # Check if we're in a git repository
124
+ result = subprocess.run(
125
+ ["git", "rev-parse", "--show-toplevel"],
126
+ cwd=repo_path,
127
+ capture_output=True,
128
+ text=True,
129
+ )
130
+ if result.returncode != 0:
131
+ return {"success": False, "message": "Not in a git repository", "no_changes": False}
132
+
133
+ repo_root = Path(result.stdout.strip())
134
+
135
+ # Stage all changes if requested
136
+ if stage_all:
137
+ subprocess.run(["git", "add", "-A"], cwd=repo_path, check=True)
138
+
139
+ # Check for file changes and session changes
140
+ has_files = has_file_changes()
141
+ has_sessions, session_files = has_session_changes(repo_root)
142
+
143
+ # No changes detected
144
+ if not has_files and not has_sessions:
145
+ return {"success": False, "message": "No changes detected", "no_changes": True}
146
+
147
+ # Build git commit command
148
+ commit_cmd = ["git", "commit", "-m", message]
149
+
150
+ if amend:
151
+ commit_cmd.append("--amend")
152
+ if no_edit:
153
+ commit_cmd.append("--no-edit")
154
+
155
+ # If only session changes, use --allow-empty
156
+ if has_sessions and not has_files:
157
+ commit_cmd.append("--allow-empty")
158
+
159
+ # Execute git commit
160
+ result = subprocess.run(
161
+ commit_cmd,
162
+ cwd=repo_path,
163
+ capture_output=True,
164
+ text=True,
165
+ )
166
+
167
+ if result.returncode != 0:
168
+ return {"success": False, "message": result.stderr or result.stdout, "no_changes": False}
169
+
170
+ # Get commit hash
171
+ hash_result = subprocess.run(
172
+ ["git", "rev-parse", "--short", "HEAD"],
173
+ cwd=repo_path,
174
+ capture_output=True,
175
+ text=True,
176
+ )
177
+ commit_hash = hash_result.stdout.strip() if hash_result.returncode == 0 else "unknown"
178
+
179
+ return {"success": True, "message": "Commit created", "commit_hash": commit_hash, "no_changes": False}
180
+
181
+ except Exception as e:
182
+ return {"success": False, "message": str(e), "no_changes": False}
183
+
184
+
109
185
  def commit_command(
110
186
  message: Optional[str] = typer.Option(None, "--message", "-m", help="Commit message"),
111
187
  all_files: bool = typer.Option(False, "--all", "-a", help="Stage all changes before commit"),
realign/mcp_watcher.py CHANGED
@@ -119,12 +119,18 @@ class DialogueWatcher:
119
119
  try:
120
120
  current_sizes = self._get_session_sizes()
121
121
 
122
+ # Debug: log if no sessions found (only once)
123
+ if not current_sizes and not hasattr(self, '_no_session_warned'):
124
+ print(f"[MCP Watcher] Warning: No active sessions found for repo: {self.repo_path}", file=sys.stderr)
125
+ self._no_session_warned = True
126
+
122
127
  # Detect changed files
123
128
  changed_files = []
124
129
  for path, size in current_sizes.items():
125
130
  old_size = self.last_session_sizes.get(path, 0)
126
131
  if size > old_size:
127
132
  changed_files.append(Path(path))
133
+ print(f"[MCP Watcher] Session file changed: {Path(path).name} ({old_size} -> {size} bytes)", file=sys.stderr)
128
134
 
129
135
  if changed_files:
130
136
  # File changed - cancel any pending commit and schedule a new one
@@ -211,6 +217,8 @@ class DialogueWatcher:
211
217
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
212
218
  message = f"chore: Auto-commit MCP session ({timestamp})"
213
219
 
220
+ print(f"[MCP Watcher] Attempting commit with message: {message}", file=sys.stderr)
221
+
214
222
  # Use realign commit command
215
223
  result = await asyncio.get_event_loop().run_in_executor(
216
224
  None,
@@ -228,67 +236,58 @@ class DialogueWatcher:
228
236
 
229
237
  def _run_realign_commit(self, message: str) -> bool:
230
238
  """
231
- Run realign commit command.
239
+ Run aline commit command using Python functions directly.
232
240
 
233
241
  The command will:
234
- - Auto-initialize git and ReAlign if needed
242
+ - Auto-initialize git and Aline if needed
235
243
  - Check for session changes (modified within last 5 minutes)
236
244
  - Create empty commit if only sessions changed
237
245
  - Return True if commit was created, False otherwise
238
246
  """
239
247
  try:
240
- # Check if ReAlign is initialized
248
+ from .commands.init import init_repository
249
+ from .commands.commit import smart_commit
250
+
251
+ # Check if Aline is initialized
241
252
  realign_dir = self.repo_path / ".realign"
242
253
 
243
254
  if not realign_dir.exists():
244
- print("[MCP Watcher] ReAlign not initialized, initializing...", file=sys.stderr)
245
-
246
- # Auto-initialize ReAlign (which also inits git if needed)
247
- init_result = subprocess.run(
248
- ["realign", "init", "--yes"],
249
- cwd=self.repo_path,
250
- capture_output=True,
251
- text=True,
252
- timeout=30,
255
+ print("[MCP Watcher] Aline not initialized, initializing...", file=sys.stderr)
256
+
257
+ # Auto-initialize Aline (which also inits git if needed)
258
+ init_result = init_repository(
259
+ repo_path=str(self.repo_path),
260
+ auto_init_git=True,
261
+ skip_commit=False,
253
262
  )
254
263
 
255
- if init_result.returncode != 0:
256
- print(f"[MCP Watcher] Failed to initialize ReAlign: {init_result.stderr}", file=sys.stderr)
264
+ if not init_result.get("success"):
265
+ print(f"[MCP Watcher] Failed to initialize Aline: {init_result.get('message', 'Unknown error')}", file=sys.stderr)
257
266
  return False
258
267
 
259
- print("[MCP Watcher] ✓ ReAlign initialized successfully", file=sys.stderr)
268
+ print("[MCP Watcher] ✓ Aline initialized successfully", file=sys.stderr)
260
269
 
261
- # Now run the commit with -a to stage all file changes
262
- result = subprocess.run(
263
- ["realign", "commit", "-a", "-m", message],
264
- cwd=self.repo_path,
265
- capture_output=True,
266
- text=True,
267
- timeout=30,
270
+ # Now run the commit with stage_all=True
271
+ result = smart_commit(
272
+ message=message,
273
+ repo_path=str(self.repo_path),
274
+ stage_all=True,
275
+ amend=False,
276
+ no_edit=False,
268
277
  )
269
278
 
270
279
  # Check if commit was successful
271
- # realign commit returns 0 on success, 1 if no changes
272
- if result.returncode == 0:
280
+ if result.get("success"):
273
281
  return True
274
- elif "No changes detected" in result.stdout or "No changes detected" in result.stderr:
282
+ elif result.get("no_changes"):
275
283
  # No changes - this is expected, not an error
276
284
  return False
277
285
  else:
278
286
  # Log the error for debugging
279
- error_msg = result.stderr or result.stdout
280
- if "Not in a git repository" in error_msg:
281
- print("[MCP Watcher] Not in a git repository - this shouldn't happen after init!", file=sys.stderr)
282
- else:
283
- print(f"[MCP Watcher] Commit failed: {error_msg}", file=sys.stderr)
287
+ error_msg = result.get("message", "Unknown error")
288
+ print(f"[MCP Watcher] Commit failed: {error_msg}", file=sys.stderr)
284
289
  return False
285
290
 
286
- except subprocess.TimeoutExpired:
287
- print("[MCP Watcher] Commit command timed out", file=sys.stderr)
288
- return False
289
- except FileNotFoundError:
290
- print("[MCP Watcher] realign command not found in PATH", file=sys.stderr)
291
- return False
292
291
  except Exception as e:
293
292
  print(f"[MCP Watcher] Commit error: {e}", file=sys.stderr)
294
293
  return False