devsync 0.5.5__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.
Files changed (84) hide show
  1. aiconfigkit/__init__.py +0 -0
  2. aiconfigkit/__main__.py +6 -0
  3. aiconfigkit/ai_tools/__init__.py +0 -0
  4. aiconfigkit/ai_tools/base.py +236 -0
  5. aiconfigkit/ai_tools/capability_registry.py +262 -0
  6. aiconfigkit/ai_tools/claude.py +91 -0
  7. aiconfigkit/ai_tools/claude_desktop.py +97 -0
  8. aiconfigkit/ai_tools/cline.py +92 -0
  9. aiconfigkit/ai_tools/copilot.py +92 -0
  10. aiconfigkit/ai_tools/cursor.py +109 -0
  11. aiconfigkit/ai_tools/detector.py +169 -0
  12. aiconfigkit/ai_tools/kiro.py +85 -0
  13. aiconfigkit/ai_tools/mcp_syncer.py +291 -0
  14. aiconfigkit/ai_tools/roo.py +110 -0
  15. aiconfigkit/ai_tools/translator.py +390 -0
  16. aiconfigkit/ai_tools/winsurf.py +102 -0
  17. aiconfigkit/cli/__init__.py +0 -0
  18. aiconfigkit/cli/delete.py +118 -0
  19. aiconfigkit/cli/download.py +274 -0
  20. aiconfigkit/cli/install.py +237 -0
  21. aiconfigkit/cli/install_new.py +937 -0
  22. aiconfigkit/cli/list.py +275 -0
  23. aiconfigkit/cli/main.py +454 -0
  24. aiconfigkit/cli/mcp_configure.py +232 -0
  25. aiconfigkit/cli/mcp_install.py +166 -0
  26. aiconfigkit/cli/mcp_sync.py +165 -0
  27. aiconfigkit/cli/package.py +383 -0
  28. aiconfigkit/cli/package_create.py +323 -0
  29. aiconfigkit/cli/package_install.py +472 -0
  30. aiconfigkit/cli/template.py +19 -0
  31. aiconfigkit/cli/template_backup.py +261 -0
  32. aiconfigkit/cli/template_init.py +499 -0
  33. aiconfigkit/cli/template_install.py +261 -0
  34. aiconfigkit/cli/template_list.py +172 -0
  35. aiconfigkit/cli/template_uninstall.py +146 -0
  36. aiconfigkit/cli/template_update.py +225 -0
  37. aiconfigkit/cli/template_validate.py +234 -0
  38. aiconfigkit/cli/tools.py +47 -0
  39. aiconfigkit/cli/uninstall.py +125 -0
  40. aiconfigkit/cli/update.py +309 -0
  41. aiconfigkit/core/__init__.py +0 -0
  42. aiconfigkit/core/checksum.py +211 -0
  43. aiconfigkit/core/component_detector.py +905 -0
  44. aiconfigkit/core/conflict_resolution.py +329 -0
  45. aiconfigkit/core/git_operations.py +539 -0
  46. aiconfigkit/core/mcp/__init__.py +1 -0
  47. aiconfigkit/core/mcp/credentials.py +279 -0
  48. aiconfigkit/core/mcp/manager.py +308 -0
  49. aiconfigkit/core/mcp/set_manager.py +1 -0
  50. aiconfigkit/core/mcp/validator.py +1 -0
  51. aiconfigkit/core/models.py +1661 -0
  52. aiconfigkit/core/package_creator.py +743 -0
  53. aiconfigkit/core/package_manifest.py +248 -0
  54. aiconfigkit/core/repository.py +298 -0
  55. aiconfigkit/core/secret_detector.py +438 -0
  56. aiconfigkit/core/template_manifest.py +283 -0
  57. aiconfigkit/core/version.py +201 -0
  58. aiconfigkit/storage/__init__.py +0 -0
  59. aiconfigkit/storage/library.py +429 -0
  60. aiconfigkit/storage/mcp_tracker.py +1 -0
  61. aiconfigkit/storage/package_tracker.py +234 -0
  62. aiconfigkit/storage/template_library.py +229 -0
  63. aiconfigkit/storage/template_tracker.py +296 -0
  64. aiconfigkit/storage/tracker.py +416 -0
  65. aiconfigkit/tui/__init__.py +5 -0
  66. aiconfigkit/tui/installer.py +511 -0
  67. aiconfigkit/utils/__init__.py +0 -0
  68. aiconfigkit/utils/atomic_write.py +90 -0
  69. aiconfigkit/utils/backup.py +169 -0
  70. aiconfigkit/utils/dotenv.py +128 -0
  71. aiconfigkit/utils/git_helpers.py +187 -0
  72. aiconfigkit/utils/logging.py +60 -0
  73. aiconfigkit/utils/namespace.py +134 -0
  74. aiconfigkit/utils/paths.py +205 -0
  75. aiconfigkit/utils/project.py +109 -0
  76. aiconfigkit/utils/streaming.py +216 -0
  77. aiconfigkit/utils/ui.py +194 -0
  78. aiconfigkit/utils/validation.py +187 -0
  79. devsync-0.5.5.dist-info/LICENSE +21 -0
  80. devsync-0.5.5.dist-info/METADATA +477 -0
  81. devsync-0.5.5.dist-info/RECORD +84 -0
  82. devsync-0.5.5.dist-info/WHEEL +5 -0
  83. devsync-0.5.5.dist-info/entry_points.txt +2 -0
  84. devsync-0.5.5.dist-info/top_level.txt +1 -0
@@ -0,0 +1,499 @@
1
+ """Template repository scaffolding command."""
2
+
3
+ from pathlib import Path
4
+ from typing import Optional
5
+
6
+ import typer
7
+ from rich.console import Console
8
+
9
+ console = Console()
10
+
11
+
12
+ def init_command(
13
+ directory: str = typer.Argument(..., help="Directory name for new template repository"),
14
+ namespace: Optional[str] = typer.Option(
15
+ None,
16
+ "--namespace",
17
+ "-n",
18
+ help="Default namespace for templates (default: directory name)",
19
+ ),
20
+ description: Optional[str] = typer.Option(
21
+ None,
22
+ "--description",
23
+ "-d",
24
+ help="Repository description",
25
+ ),
26
+ author: Optional[str] = typer.Option(
27
+ None,
28
+ "--author",
29
+ "-a",
30
+ help="Author name",
31
+ ),
32
+ force: bool = typer.Option(
33
+ False,
34
+ "--force",
35
+ "-f",
36
+ help="Overwrite existing directory",
37
+ ),
38
+ ) -> None:
39
+ """
40
+ Create a new template repository with scaffolded structure.
41
+
42
+ This command creates a ready-to-use template repository with:
43
+ - Properly formatted templatekit.yaml
44
+ - Example templates with documentation
45
+ - Directory structure for instructions, commands, and hooks
46
+ - README with usage instructions
47
+ - .gitignore for Python projects
48
+
49
+ Example:
50
+ # Create basic template repo
51
+ inskit template init my-templates
52
+
53
+ # Create with custom namespace and description
54
+ inskit template init company-standards \\
55
+ --namespace acme \\
56
+ --description "ACME Corp engineering standards" \\
57
+ --author "ACME Engineering Team"
58
+
59
+ # Overwrite existing directory
60
+ inskit template init my-templates --force
61
+ """
62
+ try:
63
+ # Handle typer.Option objects when called directly (in tests)
64
+ # When called via CLI, Typer processes these; when called directly, they remain as Option objects
65
+ import typer.models
66
+
67
+ if isinstance(namespace, typer.models.OptionInfo):
68
+ namespace = None
69
+ if isinstance(description, typer.models.OptionInfo):
70
+ description = None
71
+ if isinstance(author, typer.models.OptionInfo):
72
+ author = None
73
+
74
+ # Convert to Path
75
+ repo_path = Path(directory).resolve()
76
+
77
+ # Check if directory exists
78
+ if repo_path.exists() and not force:
79
+ console.print(f"[red]Error: Directory '{directory}' already exists[/red]")
80
+ console.print("Use --force to overwrite")
81
+ raise typer.Exit(1)
82
+
83
+ # Use directory name as default namespace
84
+ if namespace is None:
85
+ namespace = directory.replace("-", "_").replace(" ", "_")
86
+
87
+ # Set defaults
88
+ if description is None:
89
+ description = f"Template repository for {namespace}"
90
+ if author is None:
91
+ author = "Your Name"
92
+
93
+ # Create directory structure
94
+ console.print(f"\n[cyan]Creating template repository: {directory}[/cyan]\n")
95
+
96
+ repo_path.mkdir(parents=True, exist_ok=True)
97
+
98
+ # Create IDE-agnostic template directories
99
+ (repo_path / "templates" / "instructions").mkdir(parents=True, exist_ok=True)
100
+ (repo_path / "templates" / "commands").mkdir(parents=True, exist_ok=True)
101
+ (repo_path / "templates" / "hooks").mkdir(parents=True, exist_ok=True)
102
+
103
+ # Create templatekit.yaml
104
+ manifest_content = f"""# Template Repository Manifest
105
+ # See: https://github.com/troylar/instructionkit
106
+
107
+ name: {description}
108
+ description: {description}
109
+ version: 1.0.0
110
+ author: {author}
111
+
112
+ templates:
113
+ # Example instruction/rule template
114
+ - name: example-instruction
115
+ description: Example coding standards and best practices
116
+ files:
117
+ - path: templates/instructions/example-instruction.md
118
+ ide: all # IDE-agnostic: works with Claude, Cursor, Windsurf, Copilot
119
+ tags: [example, standards]
120
+
121
+ # Example slash command template
122
+ - name: example-command
123
+ description: Example slash command for common task
124
+ files:
125
+ - path: templates/commands/example-command.md
126
+ ide: all # IDE-agnostic: works with any supported IDE
127
+ tags: [example, productivity]
128
+
129
+ # Example hook template
130
+ - name: example-hook
131
+ description: Example pre-prompt hook for context injection
132
+ files:
133
+ - path: templates/hooks/example-hook.md
134
+ ide: all # IDE-agnostic: works with any supported IDE
135
+ tags: [example, automation]
136
+
137
+ # Optional: Group related templates into bundles
138
+ bundles:
139
+ - name: getting-started
140
+ description: Example bundle with all starter templates
141
+ templates:
142
+ - example-instruction
143
+ - example-command
144
+ tags: [example]
145
+ """
146
+ (repo_path / "templatekit.yaml").write_text(manifest_content, encoding="utf-8")
147
+ console.print("✓ Created templatekit.yaml")
148
+
149
+ # Create example instruction
150
+ instruction_content = """# Example Coding Standards
151
+
152
+ This is an example instruction/rule template. It will appear in your IDE's rules/instructions.
153
+
154
+ ## Purpose
155
+
156
+ Replace this content with your team's coding standards, best practices, or guidelines.
157
+
158
+ ## What to Include
159
+
160
+ - **Coding Standards**: Formatting, naming conventions, style guides
161
+ - **Best Practices**: Design patterns, error handling, testing approaches
162
+ - **Team Conventions**: PR guidelines, commit message formats, branch naming
163
+ - **Security**: OWASP guidelines, authentication patterns, data handling
164
+
165
+ ## Example: Python Coding Standards
166
+
167
+ ### Naming Conventions
168
+ - Use `snake_case` for functions and variables
169
+ - Use `PascalCase` for classes
170
+ - Use `UPPER_CASE` for constants
171
+
172
+ ### Type Hints
173
+ Always use type hints for function signatures:
174
+
175
+ ```python
176
+ def process_data(input: str, count: int = 10) -> list[str]:
177
+ \"\"\"Process input data and return results.\"\"\"
178
+ return input.split()[:count]
179
+ ```
180
+
181
+ ### Documentation
182
+ All public functions must have docstrings following Google style.
183
+
184
+ ## Customization
185
+
186
+ 1. Replace this content with your standards
187
+ 2. Add multiple instruction files for different topics
188
+ 3. Update templatekit.yaml to reference new files
189
+ 4. Commit to Git and share with your team!
190
+
191
+ ---
192
+ *Generated by InstructionKit - https://github.com/troylar/instructionkit*
193
+ """
194
+ (repo_path / "templates" / "instructions" / "example-instruction.md").write_text(
195
+ instruction_content, encoding="utf-8"
196
+ )
197
+ console.print("✓ Created templates/instructions/example-instruction.md")
198
+
199
+ # Create example command
200
+ command_content = """# Example Command
201
+
202
+ This is an example slash command template. Users can invoke it with `/example-command`.
203
+
204
+ ## Purpose
205
+
206
+ Replace this with your custom command logic. Slash commands are powerful automation tools.
207
+
208
+ ## Command Instructions
209
+
210
+ When this command is invoked:
211
+
212
+ 1. **Analyze** the current project context
213
+ 2. **Perform** the specific task (testing, refactoring, code review, etc.)
214
+ 3. **Report** results back to the user
215
+
216
+ ## Example: Run Tests Command
217
+
218
+ ```markdown
219
+ # Run Tests
220
+
221
+ I will run the project's test suite and provide a comprehensive report.
222
+
223
+ ## Steps:
224
+ 1. Detect test framework (pytest, unittest, jest, etc.)
225
+ 2. Run all tests with coverage
226
+ 3. Parse and summarize results
227
+ 4. Highlight failing tests with details
228
+ 5. Show coverage metrics
229
+
230
+ ## Execution:
231
+ - Run: `pytest --cov --cov-report=term`
232
+ - Parse output
233
+ - Create summary table
234
+ ```
235
+
236
+ ## Customization Ideas
237
+
238
+ **Common Commands:**
239
+ - `/test-api` - Run API integration tests
240
+ - `/review-pr` - Perform code review checklist
241
+ - `/generate-docs` - Auto-generate documentation
242
+ - `/refactor` - Suggest refactoring improvements
243
+ - `/security-scan` - Check for security issues
244
+
245
+ **Best Practices:**
246
+ 1. Clear purpose and expected output
247
+ 2. Step-by-step execution plan
248
+ 3. Error handling instructions
249
+ 4. Output formatting guidelines
250
+
251
+ ---
252
+ *Generated by InstructionKit - https://github.com/troylar/instructionkit*
253
+ """
254
+ (repo_path / "templates" / "commands" / "example-command.md").write_text(command_content, encoding="utf-8")
255
+ console.print("✓ Created templates/commands/example-command.md")
256
+
257
+ # Create example hook
258
+ hook_content = """# Example Pre-Prompt Hook
259
+
260
+ This is an example hook that runs before each AI prompt.
261
+
262
+ ## Purpose
263
+
264
+ Hooks automatically inject context or modify AI behavior without manual intervention.
265
+
266
+ ## Hook Types
267
+
268
+ ### Pre-Prompt Hook
269
+ Runs before user's prompt is sent. Use for:
270
+ - Adding project context
271
+ - Injecting recent changes
272
+ - Setting behavioral guidelines
273
+
274
+ ### Post-Response Hook
275
+ Runs after AI response. Use for:
276
+ - Logging interactions
277
+ - Validating output
278
+ - Triggering follow-up actions
279
+
280
+ ## Example: Context Injection
281
+
282
+ ```markdown
283
+ Before responding, please consider:
284
+
285
+ ## Project Context
286
+ - Framework: Django 4.2
287
+ - Python: 3.11
288
+ - Database: PostgreSQL
289
+ - Deployment: AWS ECS
290
+
291
+ ## Current Sprint
292
+ Focus: API performance optimization
293
+ Priority: Reduce response times by 30%
294
+
295
+ ## Recent Changes
296
+ [Automatically inject git log summary]
297
+ ```
298
+
299
+ ## Customization
300
+
301
+ 1. Replace with your project-specific context
302
+ 2. Add dynamic content (git logs, recent files, etc.)
303
+ 3. Set team-wide guidelines
304
+ 4. Configure IDE-specific behavior
305
+
306
+ ## Best Practices
307
+
308
+ - Keep hooks concise (< 200 words)
309
+ - Focus on actionable context
310
+ - Update regularly as project evolves
311
+ - Test hook behavior before deploying
312
+
313
+ ---
314
+ *Generated by InstructionKit - https://github.com/troylar/instructionkit*
315
+ """
316
+ (repo_path / "templates" / "hooks" / "example-hook.md").write_text(hook_content, encoding="utf-8")
317
+ console.print("✓ Created templates/hooks/example-hook.md")
318
+
319
+ # Create README.md
320
+ readme_content = f"""# {description}
321
+
322
+ Template repository for InstructionKit - distributes IDE-specific artifacts
323
+ (instructions, commands, hooks) to your team.
324
+
325
+ ## 📦 What's Included
326
+
327
+ This repository contains templates for AI coding tools (Claude Code, Cursor, Windsurf, GitHub Copilot):
328
+
329
+ - **Instructions/Rules** - Coding standards and best practices
330
+ - **Commands** - Slash commands for common workflows
331
+ - **Hooks** - Automation hooks for context injection
332
+
333
+ ## 🚀 Installation
334
+
335
+ Team members can install these templates using InstructionKit:
336
+
337
+ ```bash
338
+ # Install from this repository
339
+ inskit template install <YOUR_REPO_URL> --as {namespace}
340
+
341
+ # List installed templates
342
+ inskit template list
343
+
344
+ # Validate installation
345
+ inskit template validate
346
+ ```
347
+
348
+ ## 📝 Usage
349
+
350
+ After installation, templates are installed to your IDE-specific directories:
351
+ - **Claude Code**: `.claude/rules/`, `.claude/commands/`, `.claude/hooks/`
352
+ - **Cursor**: `.cursor/rules/`
353
+ - **Windsurf**: `.windsurf/rules/`
354
+ - **GitHub Copilot**: `.github/copilot/instructions/`
355
+
356
+ The template system automatically translates to the correct format for each IDE.
357
+
358
+ ## 🛠️ Customization
359
+
360
+ ### Adding New Templates
361
+
362
+ 1. Create template file in the `templates/` directory (IDE-agnostic):
363
+ - Instructions: `templates/instructions/my-template.md`
364
+ - Commands: `templates/commands/my-command.md`
365
+ - Hooks: `templates/hooks/my-hook.md`
366
+
367
+ 2. Register in `templatekit.yaml`:
368
+
369
+ ```yaml
370
+ templates:
371
+ - name: my-template
372
+ description: Description of what this template does
373
+ files:
374
+ - path: templates/instructions/my-template.md
375
+ ide: all # Works with any IDE
376
+ tags: [your, tags]
377
+ ```
378
+
379
+ 3. Commit and push:
380
+
381
+ ```bash
382
+ git add .
383
+ git commit -m "feat: add my-template"
384
+ git push
385
+ ```
386
+
387
+ 4. Team members update:
388
+
389
+ ```bash
390
+ inskit template update {namespace}
391
+ ```
392
+
393
+ ### Template Types
394
+
395
+ - `instruction` - Coding standards, guidelines, best practices
396
+ - `command` - Slash commands for automation
397
+ - `hook` - Pre/post-prompt hooks for context
398
+
399
+ ### Bundles
400
+
401
+ Group related templates:
402
+
403
+ ```yaml
404
+ bundles:
405
+ - name: python-stack
406
+ description: Complete Python development setup
407
+ templates:
408
+ - python-standards
409
+ - test-command
410
+ - pre-prompt-hook
411
+ tags: [python]
412
+ ```
413
+
414
+ ## 📚 Documentation
415
+
416
+ - [InstructionKit Documentation](https://github.com/troylar/instructionkit)
417
+ - [Template System Guide](https://github.com/troylar/instructionkit#templates)
418
+ - [Manifest Reference](https://github.com/troylar/instructionkit#template-repository-structure)
419
+
420
+ ## 🤝 Contributing
421
+
422
+ 1. Create feature branch: `git checkout -b feature/new-template`
423
+ 2. Add/modify templates
424
+ 3. Update `templatekit.yaml`
425
+ 4. Test locally: `inskit template install . --as {namespace}`
426
+ 5. Commit and push
427
+ 6. Create pull request
428
+
429
+ ## 📄 License
430
+
431
+ Add your license here (MIT, Apache 2.0, etc.)
432
+
433
+ ---
434
+ *Generated by [InstructionKit](https://github.com/troylar/instructionkit)*
435
+ """
436
+ (repo_path / "README.md").write_text(readme_content, encoding="utf-8")
437
+ console.print("✓ Created README.md")
438
+
439
+ # Create .gitignore
440
+ gitignore_content = """# InstructionKit
441
+ .instructionkit/
442
+
443
+ # Python
444
+ __pycache__/
445
+ *.py[cod]
446
+ *$py.class
447
+ *.so
448
+ .Python
449
+ venv/
450
+ env/
451
+ ENV/
452
+
453
+ # IDE
454
+ .vscode/
455
+ .idea/
456
+ *.swp
457
+ *.swo
458
+ .DS_Store
459
+
460
+ # Distribution
461
+ dist/
462
+ build/
463
+ *.egg-info/
464
+ """
465
+ (repo_path / ".gitignore").write_text(gitignore_content, encoding="utf-8")
466
+ console.print("✓ Created .gitignore")
467
+
468
+ # Success message
469
+ console.print("\n[green]✓ Template repository created successfully![/green]\n")
470
+
471
+ console.print("[cyan]Next steps:[/cyan]")
472
+ console.print(f" 1. cd {directory}")
473
+ console.print(" 2. Customize templates in templates/ directory")
474
+ console.print(" 3. Update templatekit.yaml with your templates")
475
+ console.print(" 4. Initialize git: git init && git add . && git commit -m 'Initial commit'")
476
+ console.print(" 5. Push to GitHub/GitLab/Bitbucket")
477
+ console.print(f" 6. Install to any IDE: inskit template install <repo-url> --as {namespace} --ide <ide>")
478
+
479
+ console.print("\n[cyan]Repository structure (IDE-agnostic):[/cyan]")
480
+ console.print(f"{directory}/")
481
+ console.print("├── templatekit.yaml # Template manifest")
482
+ console.print("├── README.md # Usage documentation")
483
+ console.print("├── .gitignore # Git ignore rules")
484
+ console.print("└── templates/ # IDE-agnostic templates")
485
+ console.print(" ├── instructions/")
486
+ console.print(" │ └── example-instruction.md")
487
+ console.print(" ├── commands/")
488
+ console.print(" │ └── example-command.md")
489
+ console.print(" └── hooks/")
490
+ console.print(" └── example-hook.md")
491
+
492
+ console.print("\n[dim]Test locally:[/dim]")
493
+ console.print(f" inskit template install {repo_path} --as {namespace}")
494
+
495
+ except typer.Exit:
496
+ raise
497
+ except Exception as e:
498
+ console.print(f"\n[red]Error: {e}[/red]")
499
+ raise typer.Exit(1)