aline-ai 0.1.0__py3-none-any.whl → 0.1.1__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.1
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.1.dist-info/licenses/LICENSE,sha256=H8wTqV5IF1oHw_HbBtS1PSDU8G_q81yblEIL_JfV8Vo,1077
2
+ realign/__init__.py,sha256=rbqKcU4VX7pqy2whuU-fAUj9L1rEIEdaemJUOKCYBCc,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=4F0xmREG0rF6Pun3D2zpoCqilmtvoERyKQNl3LIhLoI,12594
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.1.dist-info/METADATA,sha256=wLufq517bkK305Ifuv1xw0uqVItKoolNuMNqrjJqRnU,1398
20
+ aline_ai-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ aline_ai-0.1.1.dist-info/entry_points.txt,sha256=h-NocHDzSueXfsepHTIdRPNQzhNZQPAztJfldd-mQTE,202
22
+ aline_ai-0.1.1.dist-info/top_level.txt,sha256=yIL3s2xv9nf1GwD5n71Aq_JEIV4AfzCIDNKBzewuRm4,8
23
+ aline_ai-0.1.1.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.1"
@@ -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
@@ -228,67 +228,58 @@ class DialogueWatcher:
228
228
 
229
229
  def _run_realign_commit(self, message: str) -> bool:
230
230
  """
231
- Run realign commit command.
231
+ Run aline commit command using Python functions directly.
232
232
 
233
233
  The command will:
234
- - Auto-initialize git and ReAlign if needed
234
+ - Auto-initialize git and Aline if needed
235
235
  - Check for session changes (modified within last 5 minutes)
236
236
  - Create empty commit if only sessions changed
237
237
  - Return True if commit was created, False otherwise
238
238
  """
239
239
  try:
240
- # Check if ReAlign is initialized
240
+ from .commands.init import init_repository
241
+ from .commands.commit import smart_commit
242
+
243
+ # Check if Aline is initialized
241
244
  realign_dir = self.repo_path / ".realign"
242
245
 
243
246
  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,
247
+ print("[MCP Watcher] Aline not initialized, initializing...", file=sys.stderr)
248
+
249
+ # Auto-initialize Aline (which also inits git if needed)
250
+ init_result = init_repository(
251
+ repo_path=str(self.repo_path),
252
+ auto_init_git=True,
253
+ skip_commit=False,
253
254
  )
254
255
 
255
- if init_result.returncode != 0:
256
- print(f"[MCP Watcher] Failed to initialize ReAlign: {init_result.stderr}", file=sys.stderr)
256
+ if not init_result.get("success"):
257
+ print(f"[MCP Watcher] Failed to initialize Aline: {init_result.get('message', 'Unknown error')}", file=sys.stderr)
257
258
  return False
258
259
 
259
- print("[MCP Watcher] ✓ ReAlign initialized successfully", file=sys.stderr)
260
+ print("[MCP Watcher] ✓ Aline initialized successfully", file=sys.stderr)
260
261
 
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,
262
+ # Now run the commit with stage_all=True
263
+ result = smart_commit(
264
+ message=message,
265
+ repo_path=str(self.repo_path),
266
+ stage_all=True,
267
+ amend=False,
268
+ no_edit=False,
268
269
  )
269
270
 
270
271
  # Check if commit was successful
271
- # realign commit returns 0 on success, 1 if no changes
272
- if result.returncode == 0:
272
+ if result.get("success"):
273
273
  return True
274
- elif "No changes detected" in result.stdout or "No changes detected" in result.stderr:
274
+ elif result.get("no_changes"):
275
275
  # No changes - this is expected, not an error
276
276
  return False
277
277
  else:
278
278
  # 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)
279
+ error_msg = result.get("message", "Unknown error")
280
+ print(f"[MCP Watcher] Commit failed: {error_msg}", file=sys.stderr)
284
281
  return False
285
282
 
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
283
  except Exception as e:
293
284
  print(f"[MCP Watcher] Commit error: {e}", file=sys.stderr)
294
285
  return False