alp-code 0.9.0

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 (204) hide show
  1. package/CHANGELOG.md +770 -0
  2. package/LICENSE +21 -0
  3. package/README.md +295 -0
  4. package/alp.config.yaml +5 -0
  5. package/dist/src/agents/agent-definition.js +28 -0
  6. package/dist/src/agents/capability-catalog.js +33 -0
  7. package/dist/src/agents/compaction.js +36 -0
  8. package/dist/src/agents/errors.js +12 -0
  9. package/dist/src/agents/librarian.js +38 -0
  10. package/dist/src/agents/main.js +37 -0
  11. package/dist/src/agents/memory-grant.js +29 -0
  12. package/dist/src/agents/model-context.js +70 -0
  13. package/dist/src/agents/modes.js +134 -0
  14. package/dist/src/agents/oracle.js +36 -0
  15. package/dist/src/agents/read-thread.js +38 -0
  16. package/dist/src/agents/registry.js +238 -0
  17. package/dist/src/agents/render-identity.js +38 -0
  18. package/dist/src/agents/review.js +37 -0
  19. package/dist/src/agents/search.js +37 -0
  20. package/dist/src/agents/shared/house-rules.js +33 -0
  21. package/dist/src/agents/shared/principal.js +18 -0
  22. package/dist/src/agents/shared/voice.js +29 -0
  23. package/dist/src/agents/titling.js +32 -0
  24. package/dist/src/agents/types.js +15 -0
  25. package/dist/src/backend/execution-backend.js +2 -0
  26. package/dist/src/backend/local-execution-store.js +144 -0
  27. package/dist/src/backend/local-process-backend.js +533 -0
  28. package/dist/src/backend/local-supervisor.js +104 -0
  29. package/dist/src/cli/alp.js +380 -0
  30. package/dist/src/cli/commands/context.js +203 -0
  31. package/dist/src/cli/commands/delegate.js +136 -0
  32. package/dist/src/cli/commands/identity-sync.js +31 -0
  33. package/dist/src/cli/commands/init.js +184 -0
  34. package/dist/src/cli/commands/mode.js +22 -0
  35. package/dist/src/cli/commands/principal.js +114 -0
  36. package/dist/src/cli/commands/run-main.js +90 -0
  37. package/dist/src/cli/commands/runtime.js +21 -0
  38. package/dist/src/cli/mode-preference-store.js +62 -0
  39. package/dist/src/cli/mode-selector.js +178 -0
  40. package/dist/src/cli/update-check.js +77 -0
  41. package/dist/src/context/checkpoint.js +134 -0
  42. package/dist/src/context/compact-journal.js +153 -0
  43. package/dist/src/context/compact-payload.js +121 -0
  44. package/dist/src/context/continuity.js +70 -0
  45. package/dist/src/context/types.js +2 -0
  46. package/dist/src/delegation/backend-registry.js +40 -0
  47. package/dist/src/delegation/delegation-service.js +300 -0
  48. package/dist/src/delegation/types.js +12 -0
  49. package/dist/src/execution/execution-policy.js +96 -0
  50. package/dist/src/execution/execution-service.js +115 -0
  51. package/dist/src/execution/execution-store.js +78 -0
  52. package/dist/src/execution/identity-capsule.js +65 -0
  53. package/dist/src/execution/types.js +12 -0
  54. package/dist/src/hooks/execution-bridge.js +84 -0
  55. package/dist/src/index.js +4 -0
  56. package/dist/src/memory/adapters/markdown-file-store.js +257 -0
  57. package/dist/src/memory/adapters/memory-api-client.js +2 -0
  58. package/dist/src/memory/adapters/memory-path-mapper.js +76 -0
  59. package/dist/src/memory/adapters/remote-api-store.js +25 -0
  60. package/dist/src/memory/context-ranker.js +21 -0
  61. package/dist/src/memory/errors.js +58 -0
  62. package/dist/src/memory/memory-service.js +149 -0
  63. package/dist/src/memory/memory-store.js +2 -0
  64. package/dist/src/memory/types.js +2 -0
  65. package/dist/src/policy/capability-policy.js +29 -0
  66. package/dist/src/policy/delegation-policy.js +25 -0
  67. package/dist/src/policy/errors.js +10 -0
  68. package/dist/src/policy/invariants.js +31 -0
  69. package/dist/src/policy/memory-policy.js +22 -0
  70. package/dist/src/policy/policy-engine.js +85 -0
  71. package/dist/src/policy/types.js +8 -0
  72. package/dist/src/policy/workspace-policy.js +77 -0
  73. package/dist/src/principal/principal-profile-store.js +89 -0
  74. package/dist/src/runtime/adapter-files.js +147 -0
  75. package/dist/src/runtime/claude-adapter.js +177 -0
  76. package/dist/src/runtime/codex-adapter.js +169 -0
  77. package/dist/src/runtime/permission-rules.js +156 -0
  78. package/dist/src/runtime/render-session-context.js +124 -0
  79. package/dist/src/runtime/render-task-input.js +33 -0
  80. package/dist/src/runtime/runtime-adapter.js +2 -0
  81. package/dist/src/runtime/runtime-preference-store.js +66 -0
  82. package/dist/src/runtime/runtime-selector.js +178 -0
  83. package/dist/src/runtime/types.js +2 -0
  84. package/dist/src/runtime/windows-shim.js +57 -0
  85. package/dist/src/state-paths.js +49 -0
  86. package/dist/src/workflow/output-validator.js +27 -0
  87. package/dist/src/workflow/repair-policy.js +8 -0
  88. package/dist/src/workflow/types.js +22 -0
  89. package/dist/src/workflow/workflow-runner.js +81 -0
  90. package/hooks/compact-record.cjs +109 -0
  91. package/hooks/session-boot.cjs +112 -0
  92. package/hooks/session-end.cjs +34 -0
  93. package/package.json +48 -0
  94. package/scaffold/memory/INDEX.md +27 -0
  95. package/scaffold/memory/README.md +76 -0
  96. package/scaffold/memory/projects/INDEX.md +22 -0
  97. package/scaffold/memory/projects/PROTOCOL.md +128 -0
  98. package/scaffold/memory/projects/_template/PROJECT.md +45 -0
  99. package/scripts/alp.cjs +126 -0
  100. package/scripts/alp.ps1 +4 -0
  101. package/scripts/alp.sh +3 -0
  102. package/scripts/bootstrap.cjs +144 -0
  103. package/scripts/checkout-release.cjs +30 -0
  104. package/scripts/delegate.cjs +19 -0
  105. package/scripts/doctor.cjs +158 -0
  106. package/scripts/doctor.sh +3 -0
  107. package/scripts/ensure-state.cjs +22 -0
  108. package/scripts/lib/cli-link.cjs +375 -0
  109. package/scripts/lib/codex-role.cjs +18 -0
  110. package/scripts/lib/delegation/command-runner.cjs +108 -0
  111. package/scripts/lib/delegation/config.cjs +81 -0
  112. package/scripts/lib/install-paths.cjs +154 -0
  113. package/scripts/lib/release-manifest.cjs +42 -0
  114. package/scripts/lib/semver-lite.cjs +20 -0
  115. package/scripts/lib/state.cjs +274 -0
  116. package/scripts/lib/uninstall.cjs +252 -0
  117. package/scripts/lib/update-check-worker.cjs +21 -0
  118. package/scripts/lib/update.cjs +395 -0
  119. package/scripts/run-role.cjs +42 -0
  120. package/scripts/run-role.ps1 +4 -0
  121. package/scripts/run-role.sh +3 -0
  122. package/scripts/sync-project-index.sh +167 -0
  123. package/skills/agent-memory/SKILL.md +109 -0
  124. package/skills/alp-debug/SKILL.md +90 -0
  125. package/skills/alp-debug/references/defense-in-depth.md +118 -0
  126. package/skills/alp-debug/references/investigation-methodology.md +106 -0
  127. package/skills/alp-debug/references/log-and-ci-analysis.md +96 -0
  128. package/skills/alp-debug/references/performance-diagnostics.md +112 -0
  129. package/skills/alp-debug/references/reporting-standards.md +120 -0
  130. package/skills/alp-debug/references/root-cause-tracing.md +134 -0
  131. package/skills/alp-debug/references/systematic-debugging.md +93 -0
  132. package/skills/alp-debug/references/verification.md +86 -0
  133. package/skills/alp-debug/scripts/find-polluter.sh +63 -0
  134. package/skills/alp-debug/scripts/find-polluter.test.md +102 -0
  135. package/skills/alp-plan/SKILL.md +128 -0
  136. package/skills/alp-plan/references/archive-workflow.md +77 -0
  137. package/skills/alp-plan/references/codebase-understanding.md +55 -0
  138. package/skills/alp-plan/references/output-standards.md +96 -0
  139. package/skills/alp-plan/references/plan-organization.md +129 -0
  140. package/skills/alp-plan/references/red-team-personas.md +76 -0
  141. package/skills/alp-plan/references/red-team-workflow.md +81 -0
  142. package/skills/alp-plan/references/research-phase.md +57 -0
  143. package/skills/alp-plan/references/scope-challenge.md +82 -0
  144. package/skills/alp-plan/references/solution-design.md +76 -0
  145. package/skills/alp-plan/references/validate-question-framework.md +89 -0
  146. package/skills/alp-plan/references/validate-workflow.md +83 -0
  147. package/skills/alp-predict/SKILL.md +98 -0
  148. package/skills/alp-scenario/SKILL.md +86 -0
  149. package/skills/code-review/SKILL.md +111 -0
  150. package/skills/code-review/references/code-review-reception.md +114 -0
  151. package/skills/code-review/references/edge-case-scouting.md +78 -0
  152. package/skills/code-review/references/verification-before-completion.md +117 -0
  153. package/skills/delegation/SKILL.md +46 -0
  154. package/skills/docs-seeker/.env.example +15 -0
  155. package/skills/docs-seeker/SKILL.md +87 -0
  156. package/skills/docs-seeker/package.json +25 -0
  157. package/skills/docs-seeker/references/advanced.md +82 -0
  158. package/skills/docs-seeker/references/context7-patterns.md +68 -0
  159. package/skills/docs-seeker/references/errors.md +72 -0
  160. package/skills/docs-seeker/scripts/analyze-llms-txt.js +211 -0
  161. package/skills/docs-seeker/scripts/detect-topic.js +172 -0
  162. package/skills/docs-seeker/scripts/fetch-docs.js +213 -0
  163. package/skills/docs-seeker/scripts/tests/run-tests.js +72 -0
  164. package/skills/docs-seeker/scripts/tests/test-analyze-llms.js +119 -0
  165. package/skills/docs-seeker/scripts/tests/test-detect-topic.js +112 -0
  166. package/skills/docs-seeker/scripts/tests/test-fetch-docs.js +84 -0
  167. package/skills/docs-seeker/scripts/utils/env-loader.js +94 -0
  168. package/skills/docs-seeker/workflows/library-search.md +73 -0
  169. package/skills/docs-seeker/workflows/repo-analysis.md +90 -0
  170. package/skills/docs-seeker/workflows/topic-search.md +69 -0
  171. package/skills/git/SKILL.md +121 -0
  172. package/skills/git/references/branch-management.md +90 -0
  173. package/skills/git/references/commit-standards.md +82 -0
  174. package/skills/git/references/gh-cli-guide.md +132 -0
  175. package/skills/git/references/safety-protocols.md +86 -0
  176. package/skills/git/references/workflow-commit.md +89 -0
  177. package/skills/git/references/workflow-merge.md +63 -0
  178. package/skills/git/references/workflow-pr.md +70 -0
  179. package/skills/git/references/workflow-push.md +62 -0
  180. package/skills/gkg/SKILL.md +87 -0
  181. package/skills/gkg/references/cli-commands.md +92 -0
  182. package/skills/gkg/references/http-api.md +99 -0
  183. package/skills/gkg/references/language-support.md +54 -0
  184. package/skills/problem-solving/SKILL.md +86 -0
  185. package/skills/problem-solving/references/attribution.md +48 -0
  186. package/skills/problem-solving/references/collision-zone-thinking.md +71 -0
  187. package/skills/problem-solving/references/inversion-exercise.md +88 -0
  188. package/skills/problem-solving/references/meta-pattern-recognition.md +80 -0
  189. package/skills/problem-solving/references/scale-game.md +82 -0
  190. package/skills/problem-solving/references/simplification-cascades.md +83 -0
  191. package/skills/problem-solving/references/when-stuck.md +76 -0
  192. package/skills/repomix/SKILL.md +94 -0
  193. package/skills/repomix/references/configuration.md +134 -0
  194. package/skills/repomix/references/usage-patterns.md +106 -0
  195. package/skills/repomix/scripts/.coverage +0 -0
  196. package/skills/repomix/scripts/README.md +179 -0
  197. package/skills/repomix/scripts/repomix_batch.py +455 -0
  198. package/skills/repomix/scripts/repos.example.json +15 -0
  199. package/skills/repomix/scripts/requirements.txt +15 -0
  200. package/skills/repomix/scripts/tests/test_repomix_batch.py +531 -0
  201. package/skills/research/SKILL.md +107 -0
  202. package/skills/security-scan/SKILL.md +101 -0
  203. package/skills/security-scan/references/secret-patterns.md +75 -0
  204. package/skills/security-scan/references/vulnerability-patterns.md +136 -0
@@ -0,0 +1,455 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Batch process multiple repositories using Repomix.
4
+
5
+ This script processes multiple repositories (local or remote) using the repomix CLI tool.
6
+ Supports configuration through environment variables loaded from multiple .env file locations.
7
+ """
8
+
9
+ import os
10
+ import sys
11
+ import subprocess
12
+ import json
13
+ from pathlib import Path
14
+ from typing import List, Dict, Optional, Tuple
15
+ from dataclasses import dataclass
16
+ import argparse
17
+
18
+
19
+ @dataclass
20
+ class RepomixConfig:
21
+ """Configuration for repomix execution."""
22
+ style: str = "xml"
23
+ output_dir: str = "repomix-output"
24
+ remove_comments: bool = False
25
+ include_pattern: Optional[str] = None
26
+ ignore_pattern: Optional[str] = None
27
+ no_security_check: bool = False
28
+ verbose: bool = False
29
+
30
+
31
+ class EnvLoader:
32
+ """Load environment variables from multiple .env file locations."""
33
+
34
+ @staticmethod
35
+ def load_env_files() -> Dict[str, str]:
36
+ """
37
+ Load environment variables from .env files in order of precedence.
38
+
39
+ Order: process.env > skill/.env > skills/.env > .claude/.env
40
+
41
+ Returns:
42
+ Dictionary of environment variables
43
+ """
44
+ env_vars = {}
45
+ script_dir = Path(__file__).parent.resolve()
46
+
47
+ # Define search paths in reverse order (lowest to highest priority)
48
+ search_paths = [
49
+ script_dir.parent.parent.parent / ".env", # .claude/.env
50
+ script_dir.parent.parent / ".env", # skills/.env
51
+ script_dir.parent / ".env", # skill/.env (repomix/.env)
52
+ ]
53
+
54
+ # Load from files (lower priority first)
55
+ for env_path in search_paths:
56
+ if env_path.exists():
57
+ env_vars.update(EnvLoader._parse_env_file(env_path))
58
+
59
+ # Override with process environment (highest priority)
60
+ env_vars.update(os.environ)
61
+
62
+ return env_vars
63
+
64
+ @staticmethod
65
+ def _parse_env_file(path: Path) -> Dict[str, str]:
66
+ """
67
+ Parse a .env file and return key-value pairs.
68
+
69
+ Args:
70
+ path: Path to .env file
71
+
72
+ Returns:
73
+ Dictionary of environment variables
74
+ """
75
+ env_vars = {}
76
+ try:
77
+ with open(path, 'r', encoding='utf-8') as f:
78
+ for line in f:
79
+ line = line.strip()
80
+ # Skip comments and empty lines
81
+ if not line or line.startswith('#'):
82
+ continue
83
+ # Parse KEY=VALUE
84
+ if '=' in line:
85
+ key, value = line.split('=', 1)
86
+ key = key.strip()
87
+ value = value.strip()
88
+ # Remove quotes if present
89
+ if value.startswith('"') and value.endswith('"'):
90
+ value = value[1:-1]
91
+ elif value.startswith("'") and value.endswith("'"):
92
+ value = value[1:-1]
93
+ env_vars[key] = value
94
+ except Exception as e:
95
+ print(f"Warning: Failed to parse {path}: {e}", file=sys.stderr)
96
+
97
+ return env_vars
98
+
99
+
100
+ class RepomixBatchProcessor:
101
+ """Process multiple repositories with repomix."""
102
+
103
+ def __init__(self, config: RepomixConfig):
104
+ """
105
+ Initialize batch processor.
106
+
107
+ Args:
108
+ config: Repomix configuration
109
+ """
110
+ self.config = config
111
+ self.env_vars = EnvLoader.load_env_files()
112
+
113
+ def check_repomix_installed(self) -> bool:
114
+ """
115
+ Check if repomix is installed and accessible.
116
+
117
+ Returns:
118
+ True if repomix is installed, False otherwise
119
+ """
120
+ try:
121
+ result = subprocess.run(
122
+ ["repomix", "--version"],
123
+ capture_output=True,
124
+ text=True,
125
+ timeout=5,
126
+ env=self.env_vars
127
+ )
128
+ return result.returncode == 0
129
+ except (subprocess.SubprocessError, FileNotFoundError):
130
+ return False
131
+
132
+ def process_repository(
133
+ self,
134
+ repo_path: str,
135
+ output_name: Optional[str] = None,
136
+ is_remote: bool = False
137
+ ) -> Tuple[bool, str]:
138
+ """
139
+ Process a single repository with repomix.
140
+
141
+ Args:
142
+ repo_path: Path to local repository or remote repository URL
143
+ output_name: Custom output filename (optional)
144
+ is_remote: Whether repo_path is a remote URL
145
+
146
+ Returns:
147
+ Tuple of (success, message)
148
+ """
149
+ # Create output directory if it doesn't exist
150
+ output_dir = Path(self.config.output_dir)
151
+ output_dir.mkdir(parents=True, exist_ok=True)
152
+
153
+ # Determine output filename
154
+ if output_name:
155
+ output_file = output_dir / output_name
156
+ else:
157
+ if is_remote:
158
+ # Extract repo name from URL
159
+ repo_name = repo_path.rstrip('/').split('/')[-1]
160
+ else:
161
+ repo_name = Path(repo_path).name
162
+
163
+ extension = self._get_extension(self.config.style)
164
+ output_file = output_dir / f"{repo_name}-output.{extension}"
165
+
166
+ # Build repomix command
167
+ cmd = self._build_command(repo_path, output_file, is_remote)
168
+
169
+ if self.config.verbose:
170
+ print(f"Executing: {' '.join(cmd)}")
171
+
172
+ try:
173
+ result = subprocess.run(
174
+ cmd,
175
+ capture_output=True,
176
+ text=True,
177
+ timeout=300, # 5 minute timeout
178
+ env=self.env_vars
179
+ )
180
+
181
+ if result.returncode == 0:
182
+ return True, f"Successfully processed {repo_path} -> {output_file}"
183
+ else:
184
+ error_msg = result.stderr or result.stdout or "Unknown error"
185
+ return False, f"Failed to process {repo_path}: {error_msg}"
186
+
187
+ except subprocess.TimeoutExpired:
188
+ return False, f"Timeout processing {repo_path} (exceeded 5 minutes)"
189
+ except Exception as e:
190
+ return False, f"Error processing {repo_path}: {str(e)}"
191
+
192
+ def _build_command(
193
+ self,
194
+ repo_path: str,
195
+ output_file: Path,
196
+ is_remote: bool
197
+ ) -> List[str]:
198
+ """
199
+ Build repomix command with configuration options.
200
+
201
+ Args:
202
+ repo_path: Path to repository
203
+ output_file: Output file path
204
+ is_remote: Whether this is a remote repository
205
+
206
+ Returns:
207
+ Command as list of strings
208
+ """
209
+ cmd = ["npx" if is_remote else "repomix"]
210
+
211
+ if is_remote:
212
+ cmd.extend(["repomix", "--remote", repo_path])
213
+ else:
214
+ cmd.append(repo_path)
215
+
216
+ # Add configuration options
217
+ cmd.extend(["--style", self.config.style])
218
+ cmd.extend(["-o", str(output_file)])
219
+
220
+ if self.config.remove_comments:
221
+ cmd.append("--remove-comments")
222
+
223
+ if self.config.include_pattern:
224
+ cmd.extend(["--include", self.config.include_pattern])
225
+
226
+ if self.config.ignore_pattern:
227
+ cmd.extend(["-i", self.config.ignore_pattern])
228
+
229
+ if self.config.no_security_check:
230
+ cmd.append("--no-security-check")
231
+
232
+ if self.config.verbose:
233
+ cmd.append("--verbose")
234
+
235
+ return cmd
236
+
237
+ @staticmethod
238
+ def _get_extension(style: str) -> str:
239
+ """
240
+ Get file extension for output style.
241
+
242
+ Args:
243
+ style: Output style (xml, markdown, json, plain)
244
+
245
+ Returns:
246
+ File extension
247
+ """
248
+ extensions = {
249
+ "xml": "xml",
250
+ "markdown": "md",
251
+ "json": "json",
252
+ "plain": "txt"
253
+ }
254
+ return extensions.get(style, "xml")
255
+
256
+ def process_batch(
257
+ self,
258
+ repositories: List[Dict[str, str]]
259
+ ) -> Dict[str, List[str]]:
260
+ """
261
+ Process multiple repositories.
262
+
263
+ Args:
264
+ repositories: List of repository configurations
265
+ Each dict should contain:
266
+ - 'path': Repository path or URL
267
+ - 'output': Optional output filename
268
+ - 'remote': Optional boolean for remote repos
269
+
270
+ Returns:
271
+ Dictionary with 'success' and 'failed' lists
272
+ """
273
+ results = {"success": [], "failed": []}
274
+
275
+ for repo in repositories:
276
+ repo_path = repo.get("path")
277
+ if not repo_path:
278
+ results["failed"].append("Missing 'path' in repository config")
279
+ continue
280
+
281
+ output_name = repo.get("output")
282
+ is_remote = repo.get("remote", False)
283
+
284
+ success, message = self.process_repository(
285
+ repo_path,
286
+ output_name,
287
+ is_remote
288
+ )
289
+
290
+ if success:
291
+ results["success"].append(message)
292
+ else:
293
+ results["failed"].append(message)
294
+
295
+ print(message)
296
+
297
+ return results
298
+
299
+
300
+ def load_repositories_from_file(file_path: str) -> List[Dict[str, str]]:
301
+ """
302
+ Load repository configurations from JSON file.
303
+
304
+ Expected format:
305
+ [
306
+ {"path": "/path/to/repo", "output": "custom.xml"},
307
+ {"path": "owner/repo", "remote": true},
308
+ ...
309
+ ]
310
+
311
+ Args:
312
+ file_path: Path to JSON file
313
+
314
+ Returns:
315
+ List of repository configurations
316
+ """
317
+ try:
318
+ with open(file_path, 'r', encoding='utf-8') as f:
319
+ data = json.load(f)
320
+ if isinstance(data, list):
321
+ return data
322
+ else:
323
+ print(f"Error: Expected array in {file_path}", file=sys.stderr)
324
+ return []
325
+ except json.JSONDecodeError as e:
326
+ print(f"Error: Invalid JSON in {file_path}: {e}", file=sys.stderr)
327
+ return []
328
+ except Exception as e:
329
+ print(f"Error: Failed to read {file_path}: {e}", file=sys.stderr)
330
+ return []
331
+
332
+
333
+ def main():
334
+ """Main entry point for the script."""
335
+ parser = argparse.ArgumentParser(
336
+ description="Batch process multiple repositories with repomix"
337
+ )
338
+
339
+ # Input options
340
+ parser.add_argument(
341
+ "repos",
342
+ nargs="*",
343
+ help="Repository paths or URLs to process"
344
+ )
345
+ parser.add_argument(
346
+ "-f", "--file",
347
+ help="JSON file containing repository configurations"
348
+ )
349
+
350
+ # Output options
351
+ parser.add_argument(
352
+ "--style",
353
+ choices=["xml", "markdown", "json", "plain"],
354
+ default="xml",
355
+ help="Output format (default: xml)"
356
+ )
357
+ parser.add_argument(
358
+ "-o", "--output-dir",
359
+ default="repomix-output",
360
+ help="Output directory (default: repomix-output)"
361
+ )
362
+
363
+ # Processing options
364
+ parser.add_argument(
365
+ "--remove-comments",
366
+ action="store_true",
367
+ help="Remove comments from source files"
368
+ )
369
+ parser.add_argument(
370
+ "--include",
371
+ help="Include pattern (glob)"
372
+ )
373
+ parser.add_argument(
374
+ "--ignore",
375
+ help="Ignore pattern (glob)"
376
+ )
377
+ parser.add_argument(
378
+ "--no-security-check",
379
+ action="store_true",
380
+ help="Disable security checks"
381
+ )
382
+ parser.add_argument(
383
+ "-v", "--verbose",
384
+ action="store_true",
385
+ help="Verbose output"
386
+ )
387
+ parser.add_argument(
388
+ "--remote",
389
+ action="store_true",
390
+ help="Treat all repos as remote URLs"
391
+ )
392
+
393
+ args = parser.parse_args()
394
+
395
+ # Create configuration
396
+ config = RepomixConfig(
397
+ style=args.style,
398
+ output_dir=args.output_dir,
399
+ remove_comments=args.remove_comments,
400
+ include_pattern=args.include,
401
+ ignore_pattern=args.ignore,
402
+ no_security_check=args.no_security_check,
403
+ verbose=args.verbose
404
+ )
405
+
406
+ # Initialize processor
407
+ processor = RepomixBatchProcessor(config)
408
+
409
+ # Check if repomix is installed
410
+ if not processor.check_repomix_installed():
411
+ print("Error: repomix is not installed or not in PATH", file=sys.stderr)
412
+ print("Install with: npm install -g repomix", file=sys.stderr)
413
+ return 1
414
+
415
+ # Collect repositories to process
416
+ repositories = []
417
+
418
+ # Load from file if specified
419
+ if args.file:
420
+ repositories.extend(load_repositories_from_file(args.file))
421
+
422
+ # Add command line repositories
423
+ if args.repos:
424
+ for repo_path in args.repos:
425
+ repositories.append({
426
+ "path": repo_path,
427
+ "remote": args.remote
428
+ })
429
+
430
+ # Validate we have repositories to process
431
+ if not repositories:
432
+ print("Error: No repositories specified", file=sys.stderr)
433
+ print("Use: repomix_batch.py <repo1> <repo2> ...", file=sys.stderr)
434
+ print("Or: repomix_batch.py -f repos.json", file=sys.stderr)
435
+ return 1
436
+
437
+ # Process batch
438
+ print(f"Processing {len(repositories)} repositories...")
439
+ results = processor.process_batch(repositories)
440
+
441
+ # Print summary
442
+ print("\n" + "=" * 50)
443
+ print(f"Success: {len(results['success'])}")
444
+ print(f"Failed: {len(results['failed'])}")
445
+
446
+ if results['failed']:
447
+ print("\nFailed repositories:")
448
+ for failure in results['failed']:
449
+ print(f" - {failure}")
450
+
451
+ return 0 if not results['failed'] else 1
452
+
453
+
454
+ if __name__ == "__main__":
455
+ sys.exit(main())
@@ -0,0 +1,15 @@
1
+ [
2
+ {
3
+ "path": "/path/to/local/repo",
4
+ "output": "local-repo-output.xml"
5
+ },
6
+ {
7
+ "path": "owner/repo",
8
+ "remote": true,
9
+ "output": "remote-repo.xml"
10
+ },
11
+ {
12
+ "path": "https://github.com/yamadashy/repomix",
13
+ "remote": true
14
+ }
15
+ ]
@@ -0,0 +1,15 @@
1
+ # Repomix Skill Dependencies
2
+ # Python 3.10+ required
3
+
4
+ # No Python package dependencies - uses only standard library
5
+
6
+ # Testing dependencies (dev)
7
+ pytest>=8.0.0
8
+ pytest-cov>=4.1.0
9
+ pytest-mock>=3.12.0
10
+
11
+ # Note: This script requires the Repomix CLI tool
12
+ # Install Repomix globally:
13
+ # npm install -g repomix
14
+ # pnpm add -g repomix
15
+ # yarn global add repomix