zjcode 0.0.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.
Files changed (163) hide show
  1. deepagents_code/__init__.py +42 -0
  2. deepagents_code/__main__.py +6 -0
  3. deepagents_code/_ask_user_types.py +90 -0
  4. deepagents_code/_cli_context.py +96 -0
  5. deepagents_code/_constants.py +41 -0
  6. deepagents_code/_debug.py +148 -0
  7. deepagents_code/_debug_buffer.py +204 -0
  8. deepagents_code/_env_vars.py +411 -0
  9. deepagents_code/_fake_models.py +66 -0
  10. deepagents_code/_git.py +521 -0
  11. deepagents_code/_paths.py +69 -0
  12. deepagents_code/_server_config.py +576 -0
  13. deepagents_code/_session_stats.py +235 -0
  14. deepagents_code/_startup_error.py +45 -0
  15. deepagents_code/_testing_models.py +305 -0
  16. deepagents_code/_textual_patches.py +420 -0
  17. deepagents_code/_tool_stream.py +694 -0
  18. deepagents_code/_version.py +46 -0
  19. deepagents_code/agent.py +1976 -0
  20. deepagents_code/app.py +19239 -0
  21. deepagents_code/app.tcss +438 -0
  22. deepagents_code/approval_mode.py +131 -0
  23. deepagents_code/ask_user.py +306 -0
  24. deepagents_code/auth_display.py +185 -0
  25. deepagents_code/auth_store.py +545 -0
  26. deepagents_code/built_in_skills/__init__.py +5 -0
  27. deepagents_code/built_in_skills/remember/SKILL.md +118 -0
  28. deepagents_code/built_in_skills/skill-creator/SKILL.md +383 -0
  29. deepagents_code/built_in_skills/skill-creator/scripts/init_skill.py +366 -0
  30. deepagents_code/built_in_skills/skill-creator/scripts/quick_validate.py +158 -0
  31. deepagents_code/client/__init__.py +1 -0
  32. deepagents_code/client/commands/__init__.py +1 -0
  33. deepagents_code/client/commands/auth.py +541 -0
  34. deepagents_code/client/commands/config.py +714 -0
  35. deepagents_code/client/commands/mcp.py +250 -0
  36. deepagents_code/client/commands/tools.py +416 -0
  37. deepagents_code/client/launch/__init__.py +1 -0
  38. deepagents_code/client/launch/server.py +978 -0
  39. deepagents_code/client/launch/server_manager.py +540 -0
  40. deepagents_code/client/non_interactive.py +1758 -0
  41. deepagents_code/client/remote_client.py +794 -0
  42. deepagents_code/clipboard.py +217 -0
  43. deepagents_code/command_registry.py +450 -0
  44. deepagents_code/config.py +4829 -0
  45. deepagents_code/config_manifest.py +1451 -0
  46. deepagents_code/configurable_model.py +577 -0
  47. deepagents_code/default_agent_prompt.md +12 -0
  48. deepagents_code/doctor.py +559 -0
  49. deepagents_code/editor.py +142 -0
  50. deepagents_code/event_bus.py +411 -0
  51. deepagents_code/extras_info.py +661 -0
  52. deepagents_code/file_ops.py +576 -0
  53. deepagents_code/formatting.py +135 -0
  54. deepagents_code/goal_rubric.py +497 -0
  55. deepagents_code/goal_tools.py +459 -0
  56. deepagents_code/hooks.py +348 -0
  57. deepagents_code/input.py +1041 -0
  58. deepagents_code/integrations/__init__.py +1 -0
  59. deepagents_code/integrations/openai_codex.py +551 -0
  60. deepagents_code/integrations/sandbox_config.py +198 -0
  61. deepagents_code/integrations/sandbox_factory.py +1124 -0
  62. deepagents_code/integrations/sandbox_provider.py +137 -0
  63. deepagents_code/integrations/sandbox_registry.py +350 -0
  64. deepagents_code/iterm_cursor_guide.py +176 -0
  65. deepagents_code/local_context.py +926 -0
  66. deepagents_code/main.py +3985 -0
  67. deepagents_code/managed_tools.py +642 -0
  68. deepagents_code/mcp_auth.py +1950 -0
  69. deepagents_code/mcp_config.py +176 -0
  70. deepagents_code/mcp_disabled.py +212 -0
  71. deepagents_code/mcp_login_service.py +281 -0
  72. deepagents_code/mcp_oauth_ui.py +199 -0
  73. deepagents_code/mcp_providers/__init__.py +23 -0
  74. deepagents_code/mcp_providers/_registry.py +39 -0
  75. deepagents_code/mcp_providers/base.py +133 -0
  76. deepagents_code/mcp_providers/github.py +102 -0
  77. deepagents_code/mcp_providers/slack.py +175 -0
  78. deepagents_code/mcp_tools.py +2427 -0
  79. deepagents_code/mcp_trust.py +207 -0
  80. deepagents_code/media_utils.py +826 -0
  81. deepagents_code/memory_guard.py +474 -0
  82. deepagents_code/model_config.py +4156 -0
  83. deepagents_code/notifications.py +247 -0
  84. deepagents_code/offload.py +402 -0
  85. deepagents_code/onboarding.py +223 -0
  86. deepagents_code/output.py +69 -0
  87. deepagents_code/paste_collapse.py +103 -0
  88. deepagents_code/project_utils.py +231 -0
  89. deepagents_code/py.typed +0 -0
  90. deepagents_code/reasoning_effort.py +641 -0
  91. deepagents_code/reliable_rubric.py +97 -0
  92. deepagents_code/resume_state.py +237 -0
  93. deepagents_code/server_graph.py +310 -0
  94. deepagents_code/session_end_summary.py +329 -0
  95. deepagents_code/sessions.py +1716 -0
  96. deepagents_code/skills/__init__.py +18 -0
  97. deepagents_code/skills/commands.py +1252 -0
  98. deepagents_code/skills/invocation.py +112 -0
  99. deepagents_code/skills/load.py +196 -0
  100. deepagents_code/skills/trust.py +547 -0
  101. deepagents_code/state_migration.py +136 -0
  102. deepagents_code/subagents.py +278 -0
  103. deepagents_code/system_prompt.md +204 -0
  104. deepagents_code/terminal_capabilities.py +115 -0
  105. deepagents_code/terminal_escape.py +287 -0
  106. deepagents_code/theme.py +891 -0
  107. deepagents_code/todo_list_prompt.md +12 -0
  108. deepagents_code/tool_catalog.py +509 -0
  109. deepagents_code/tool_display.py +367 -0
  110. deepagents_code/tools.py +516 -0
  111. deepagents_code/tui/__init__.py +1 -0
  112. deepagents_code/tui/textual_adapter.py +2553 -0
  113. deepagents_code/tui/widgets/__init__.py +9 -0
  114. deepagents_code/tui/widgets/_js_eval_display.py +139 -0
  115. deepagents_code/tui/widgets/_links.py +261 -0
  116. deepagents_code/tui/widgets/agent_selector.py +420 -0
  117. deepagents_code/tui/widgets/approval.py +602 -0
  118. deepagents_code/tui/widgets/ask_user.py +515 -0
  119. deepagents_code/tui/widgets/auth.py +1997 -0
  120. deepagents_code/tui/widgets/autocomplete.py +890 -0
  121. deepagents_code/tui/widgets/chat_input.py +3181 -0
  122. deepagents_code/tui/widgets/codex_auth.py +452 -0
  123. deepagents_code/tui/widgets/cwd_switch.py +242 -0
  124. deepagents_code/tui/widgets/debug_console.py +868 -0
  125. deepagents_code/tui/widgets/diff.py +252 -0
  126. deepagents_code/tui/widgets/effort_selector.py +189 -0
  127. deepagents_code/tui/widgets/goal_review.py +390 -0
  128. deepagents_code/tui/widgets/goal_status.py +50 -0
  129. deepagents_code/tui/widgets/history.py +194 -0
  130. deepagents_code/tui/widgets/install_confirm.py +248 -0
  131. deepagents_code/tui/widgets/launch_init.py +482 -0
  132. deepagents_code/tui/widgets/loading.py +227 -0
  133. deepagents_code/tui/widgets/mcp_login.py +539 -0
  134. deepagents_code/tui/widgets/mcp_reconnect.py +212 -0
  135. deepagents_code/tui/widgets/mcp_viewer.py +1634 -0
  136. deepagents_code/tui/widgets/message_store.py +999 -0
  137. deepagents_code/tui/widgets/messages.py +3846 -0
  138. deepagents_code/tui/widgets/model_selector.py +2343 -0
  139. deepagents_code/tui/widgets/notification_center.py +456 -0
  140. deepagents_code/tui/widgets/notification_detail.py +257 -0
  141. deepagents_code/tui/widgets/notification_settings.py +170 -0
  142. deepagents_code/tui/widgets/restart_prompt.py +158 -0
  143. deepagents_code/tui/widgets/skill_trust.py +131 -0
  144. deepagents_code/tui/widgets/startup_tip.py +91 -0
  145. deepagents_code/tui/widgets/status.py +781 -0
  146. deepagents_code/tui/widgets/subagent_panel.py +969 -0
  147. deepagents_code/tui/widgets/theme_selector.py +401 -0
  148. deepagents_code/tui/widgets/thread_selector.py +2564 -0
  149. deepagents_code/tui/widgets/tool_renderers.py +190 -0
  150. deepagents_code/tui/widgets/tool_widgets.py +304 -0
  151. deepagents_code/tui/widgets/update_available.py +311 -0
  152. deepagents_code/tui/widgets/update_confirm.py +184 -0
  153. deepagents_code/tui/widgets/update_progress.py +327 -0
  154. deepagents_code/tui/widgets/welcome.py +508 -0
  155. deepagents_code/turn_end_summary.py +522 -0
  156. deepagents_code/ui.py +858 -0
  157. deepagents_code/unicode_security.py +563 -0
  158. deepagents_code/update_check.py +3124 -0
  159. zjcode-0.0.1.data/data/deepagents_code/default_agent_prompt.md +12 -0
  160. zjcode-0.0.1.dist-info/METADATA +220 -0
  161. zjcode-0.0.1.dist-info/RECORD +163 -0
  162. zjcode-0.0.1.dist-info/WHEEL +4 -0
  163. zjcode-0.0.1.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,366 @@
1
+ #!/usr/bin/env python3
2
+ """Skill Initializer - Creates a new skill from template.
3
+
4
+ Usage:
5
+ init_skill.py <skill-name> --path <path>
6
+
7
+ Examples:
8
+ init_skill.py my-new-skill --path skills/public
9
+ init_skill.py my-api-helper --path skills/private
10
+ init_skill.py custom-skill --path /custom/location
11
+
12
+ For deepagents CLI:
13
+ init_skill.py my-skill --path ~/.deepagents/agent/skills
14
+ """
15
+
16
+ import sys
17
+ from pathlib import Path
18
+
19
+ MAX_SKILL_NAME_LENGTH = 64
20
+
21
+ SKILL_TEMPLATE = """---
22
+ name: {skill_name}
23
+ description: [TODO: Complete and informative explanation of what the skill does and when to use it. Include WHEN to use this skill - specific scenarios, file types, or tasks that trigger it.]
24
+ ---
25
+
26
+ # {skill_title}
27
+
28
+ ## Overview
29
+
30
+ [TODO: 1-2 sentences explaining what this skill enables]
31
+
32
+ ## Structuring This Skill
33
+
34
+ [TODO: Choose the structure that best fits this skill's purpose. Common patterns:
35
+
36
+ **1. Workflow-Based** (best for sequential processes)
37
+ - Works well when there are clear step-by-step procedures
38
+ - Example: DOCX skill with "Workflow Decision Tree" → "Reading" → "Creating" → "Editing"
39
+ - Structure: ## Overview → ## Workflow Decision Tree → ## Step 1 → ## Step 2...
40
+
41
+ **2. Task-Based** (best for tool collections)
42
+ - Works well when the skill offers different operations/capabilities
43
+ - Example: PDF skill with "Quick Start" → "Merge PDFs" → "Split PDFs" → "Extract Text"
44
+ - Structure: ## Overview → ## Quick Start → ## Task Category 1 → ## Task Category 2...
45
+
46
+ **3. Reference/Guidelines** (best for standards or specifications)
47
+ - Works well for brand guidelines, coding standards, or requirements
48
+ - Example: Brand styling with "Brand Guidelines" → "Colors" → "Typography" → "Features"
49
+ - Structure: ## Overview → ## Guidelines → ## Specifications → ## Usage...
50
+
51
+ **4. Capabilities-Based** (best for integrated systems)
52
+ - Works well when the skill provides multiple interrelated features
53
+ - Example: Product Management with "Core Capabilities" → numbered capability list
54
+ - Structure: ## Overview → ## Core Capabilities → ### 1. Feature → ### 2. Feature...
55
+
56
+ Patterns can be mixed and matched as needed. Most skills combine patterns (e.g., start with task-based, add workflow for complex operations).
57
+
58
+ Delete this entire "Structuring This Skill" section when done - it's just guidance.]
59
+
60
+ ## [TODO: Replace with the first main section based on chosen structure]
61
+
62
+ [TODO: Add content here. See examples in existing skills:
63
+ - Code samples for technical skills
64
+ - Decision trees for complex workflows
65
+ - Concrete examples with realistic user requests
66
+ - References to scripts/templates/references as needed]
67
+
68
+ ## Resources
69
+
70
+ This skill includes example resource directories that demonstrate how to organize different types of bundled resources:
71
+
72
+ ### scripts/
73
+ Executable code (Python/Bash/etc.) that can be run directly to perform specific operations.
74
+
75
+ **Examples from other skills:**
76
+ - PDF skill: `fill_fillable_fields.py`, `extract_form_field_info.py` - utilities for PDF manipulation
77
+ - DOCX skill: `document.py`, `utilities.py` - Python modules for document processing
78
+
79
+ **Appropriate for:** Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations.
80
+
81
+ **Note:** Scripts may be executed without loading into context, but can still be read by Claude for patching or environment adjustments.
82
+
83
+ ### references/
84
+ Documentation and reference material intended to be loaded into context to inform Claude's process and thinking.
85
+
86
+ **Examples from other skills:**
87
+ - Product management: `communication.md`, `context_building.md` - detailed workflow guides
88
+ - BigQuery: API reference documentation and query examples
89
+ - Finance: Schema documentation, company policies
90
+
91
+ **Appropriate for:** In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Claude should reference while working.
92
+
93
+ ### assets/
94
+ Files not intended to be loaded into context, but rather used within the output Claude produces.
95
+
96
+ **Examples from other skills:**
97
+ - Brand styling: PowerPoint template files (.pptx), logo files
98
+ - Frontend builder: HTML/React boilerplate project directories
99
+ - Typography: Font files (.ttf, .woff2)
100
+
101
+ **Appropriate for:** Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output.
102
+
103
+ ---
104
+
105
+ **Any unneeded directories can be deleted.** Not every skill requires all three types of resources.
106
+ """ # noqa: E501
107
+
108
+ EXAMPLE_SCRIPT = '''#!/usr/bin/env python3
109
+ """
110
+ Example helper script for {skill_name}
111
+
112
+ This is a placeholder script that can be executed directly.
113
+ Replace with actual implementation or delete if not needed.
114
+
115
+ Example real scripts from other skills:
116
+ - pdf/scripts/fill_fillable_fields.py - Fills PDF form fields
117
+ - pdf/scripts/convert_pdf_to_images.py - Converts PDF pages to images
118
+ """
119
+
120
+ def main():
121
+ print("This is an example script for {skill_name}")
122
+ # TODO: Add actual script logic here
123
+ # This could be data processing, file conversion, API calls, etc.
124
+
125
+ if __name__ == "__main__":
126
+ main()
127
+ '''
128
+
129
+ EXAMPLE_REFERENCE = """# Reference Documentation for {skill_title}
130
+
131
+ This is a placeholder for detailed reference documentation.
132
+ Replace with actual reference content or delete if not needed.
133
+
134
+ Example real reference docs from other skills:
135
+ - product-management/references/communication.md - Comprehensive guide for status updates
136
+ - product-management/references/context_building.md - Deep-dive on gathering context
137
+ - bigquery/references/ - API references and query examples
138
+
139
+ ## When Reference Docs Are Useful
140
+
141
+ Reference docs are ideal for:
142
+ - Comprehensive API documentation
143
+ - Detailed workflow guides
144
+ - Complex multi-step processes
145
+ - Information too lengthy for main SKILL.md
146
+ - Content that's only needed for specific use cases
147
+
148
+ ## Structure Suggestions
149
+
150
+ ### API Reference Example
151
+ - Overview
152
+ - Authentication
153
+ - Endpoints with examples
154
+ - Error codes
155
+ - Rate limits
156
+
157
+ ### Workflow Guide Example
158
+ - Prerequisites
159
+ - Step-by-step instructions
160
+ - Common patterns
161
+ - Troubleshooting
162
+ - Best practices
163
+ """ # noqa: E501
164
+
165
+ EXAMPLE_ASSET = """# Example Asset File
166
+
167
+ This placeholder represents where asset files would be stored.
168
+ Replace with actual asset files (templates, images, fonts, etc.) or delete if not needed.
169
+
170
+ Asset files are NOT intended to be loaded into context, but rather used within
171
+ the output Claude produces.
172
+
173
+ Example asset files from other skills:
174
+ - Brand guidelines: logo.png, slides_template.pptx
175
+ - Frontend builder: hello-world/ directory with HTML/React boilerplate
176
+ - Typography: custom-font.ttf, font-family.woff2
177
+ - Data: sample_data.csv, test_dataset.json
178
+
179
+ ## Common Asset Types
180
+
181
+ - Templates: .pptx, .docx, boilerplate directories
182
+ - Images: .png, .jpg, .svg, .gif
183
+ - Fonts: .ttf, .otf, .woff, .woff2
184
+ - Boilerplate code: Project directories, starter files
185
+ - Icons: .ico, .svg
186
+ - Data files: .csv, .json, .xml, .yaml
187
+
188
+ Note: This is a text placeholder. Actual assets can be any file type.
189
+ """ # noqa: E501
190
+
191
+
192
+ def _validate_name(name: str) -> tuple[bool, str]:
193
+ """Validate skill name per Agent Skills spec.
194
+
195
+ Requirements (https://agentskills.io/specification):
196
+ - 1-64 characters
197
+ - Unicode lowercase alphanumeric and hyphens only
198
+ - Cannot start or end with hyphen
199
+ - No consecutive hyphens
200
+
201
+ Unicode lowercase alphanumeric means any character where
202
+ `c.isalpha() and c.islower()` or `c.isdigit()` returns `True`.
203
+
204
+ Args:
205
+ name: The skill name to validate.
206
+
207
+ Returns:
208
+ Tuple of (is_valid, error_message). If valid, error_message is empty.
209
+ """
210
+ if not name or not name.strip():
211
+ return False, "cannot be empty"
212
+ if len(name) > MAX_SKILL_NAME_LENGTH:
213
+ return False, "cannot exceed 64 characters"
214
+ if name.startswith("-") or name.endswith("-") or "--" in name:
215
+ return False, "must be lowercase alphanumeric with single hyphens only"
216
+ for c in name:
217
+ if c == "-":
218
+ continue
219
+ if (c.isalpha() and c.islower()) or c.isdigit():
220
+ continue
221
+ return False, "must be lowercase alphanumeric with single hyphens only"
222
+ return True, ""
223
+
224
+
225
+ def title_case_skill_name(skill_name):
226
+ """Convert hyphenated skill name to Title Case for display.
227
+
228
+ Returns:
229
+ Skill name with each word capitalized.
230
+ """
231
+ return " ".join(word.capitalize() for word in skill_name.split("-"))
232
+
233
+
234
+ def init_skill(skill_name, path):
235
+ """Initialize a new skill directory with template SKILL.md.
236
+
237
+ Args:
238
+ skill_name: Name of the skill
239
+ path: Path where the skill directory should be created
240
+
241
+ Returns:
242
+ Path to created skill directory, or None if error
243
+ """
244
+ is_valid, error_msg = _validate_name(skill_name)
245
+ if not is_valid:
246
+ print(f"Error: Invalid skill name: {error_msg}")
247
+ print(
248
+ "Skill names must be lowercase alphanumeric with hyphens only.\n"
249
+ "Examples: web-research, code-review, data-analysis"
250
+ )
251
+ return None
252
+
253
+ # Determine skill directory path
254
+ skill_dir = Path(path).resolve() / skill_name
255
+
256
+ # Check if directory already exists
257
+ if skill_dir.exists():
258
+ print(f"Error: Skill directory already exists: {skill_dir}")
259
+ return None
260
+
261
+ # Create skill directory
262
+ try:
263
+ skill_dir.mkdir(parents=True, exist_ok=False)
264
+ print(f"Created skill directory: {skill_dir}")
265
+ except Exception as e:
266
+ print(f"Error creating directory: {e}")
267
+ return None
268
+
269
+ # Create SKILL.md from template
270
+ skill_title = title_case_skill_name(skill_name)
271
+ skill_content = SKILL_TEMPLATE.format(
272
+ skill_name=skill_name, skill_title=skill_title
273
+ )
274
+
275
+ skill_md_path = skill_dir / "SKILL.md"
276
+ try:
277
+ skill_md_path.write_text(skill_content)
278
+ print("Created SKILL.md")
279
+ except Exception as e:
280
+ print(f"Error creating SKILL.md: {e}")
281
+ return None
282
+
283
+ # Create resource directories with example files
284
+ try:
285
+ # Create scripts/ directory with example script
286
+ scripts_dir = skill_dir / "scripts"
287
+ scripts_dir.mkdir(exist_ok=True)
288
+ example_script = scripts_dir / "example.py"
289
+ example_script.write_text(EXAMPLE_SCRIPT.format(skill_name=skill_name))
290
+ example_script.chmod(0o755)
291
+ print("Created scripts/example.py")
292
+
293
+ # Create references/ directory with example reference doc
294
+ references_dir = skill_dir / "references"
295
+ references_dir.mkdir(exist_ok=True)
296
+ example_reference = references_dir / "api_reference.md"
297
+ example_reference.write_text(EXAMPLE_REFERENCE.format(skill_title=skill_title))
298
+ print("Created references/api_reference.md")
299
+
300
+ # Create assets/ directory with example asset placeholder
301
+ assets_dir = skill_dir / "assets"
302
+ assets_dir.mkdir(exist_ok=True)
303
+ example_asset = assets_dir / "example_asset.txt"
304
+ example_asset.write_text(EXAMPLE_ASSET)
305
+ print("Created assets/example_asset.txt")
306
+ except Exception as e:
307
+ print(f"Error creating resource directories: {e}")
308
+ return None
309
+
310
+ # Print next steps
311
+ print(f"\nSkill '{skill_name}' initialized successfully at {skill_dir}")
312
+ print("\nNext steps:")
313
+ print("1. Edit SKILL.md to complete the TODO items and update the description")
314
+ print(
315
+ "2. Customize or delete the example files in scripts/, references/, and assets/"
316
+ )
317
+ print("3. Run the validator when ready to check the skill structure")
318
+
319
+ return skill_dir
320
+
321
+
322
+ def main():
323
+ """Main entry point for the skill initialization script."""
324
+ if len(sys.argv) < 4 or sys.argv[2] != "--path":
325
+ print("Usage: init_skill.py <skill-name> --path <path>")
326
+ print("\nSkill name requirements:")
327
+ print(" - Hyphen-case identifier (e.g., 'data-analyzer')")
328
+ print(" - Lowercase letters, digits, and hyphens only")
329
+ print(" - Max 64 characters")
330
+ print(" - Must match directory name exactly")
331
+ print("\nExamples:")
332
+ print(" init_skill.py my-new-skill --path skills/public")
333
+ print(" init_skill.py my-api-helper --path skills/private")
334
+ print(" init_skill.py custom-skill --path /custom/location")
335
+ print("\nFor deepagents CLI:")
336
+ print(" init_skill.py my-skill --path ~/.deepagents/agent/skills")
337
+ sys.exit(1)
338
+
339
+ skill_name = sys.argv[1]
340
+ path = sys.argv[3]
341
+
342
+ # Early validation for fast feedback
343
+ is_valid, error_msg = _validate_name(skill_name)
344
+ if not is_valid:
345
+ print(f"Error: Invalid skill name '{skill_name}': {error_msg}")
346
+ print("\nSkill name requirements:")
347
+ print(" - Lowercase letters, digits, and hyphens only")
348
+ print(" - Cannot start or end with hyphen")
349
+ print(" - No consecutive hyphens")
350
+ print(" - Max 64 characters")
351
+ sys.exit(1)
352
+
353
+ print(f"Initializing skill: {skill_name}")
354
+ print(f" Location: {path}")
355
+ print()
356
+
357
+ result = init_skill(skill_name, path)
358
+
359
+ if result:
360
+ sys.exit(0)
361
+ else:
362
+ sys.exit(1)
363
+
364
+
365
+ if __name__ == "__main__":
366
+ main()
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env python3
2
+ """Quick validation script for skills - minimal version.
3
+
4
+ For deepagents CLI, skills are located at:
5
+ ~/.deepagents/<agent>/skills/<skill-name>/
6
+
7
+ Example:
8
+ ```python
9
+ python quick_validate.py ~/.deepagents/agent/skills/my-skill
10
+ ```
11
+ """
12
+
13
+ import re
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ import yaml
18
+
19
+
20
+ def validate_skill(skill_path):
21
+ """Basic validation of a skill.
22
+
23
+ Returns:
24
+ Tuple of (is_valid, message) where is_valid is bool and message
25
+ describes result.
26
+ """
27
+ skill_path = Path(skill_path)
28
+
29
+ # Check SKILL.md exists
30
+ skill_md = skill_path / "SKILL.md"
31
+ if not skill_md.exists():
32
+ return False, "SKILL.md not found"
33
+
34
+ # Read and validate frontmatter
35
+ content = skill_md.read_text()
36
+ if not content.startswith("---"):
37
+ return False, "No YAML frontmatter found"
38
+
39
+ # Extract frontmatter
40
+ match = re.match(r"^---\n(.*?)\n---", content, re.DOTALL)
41
+ if not match:
42
+ return False, "Invalid frontmatter format"
43
+
44
+ frontmatter_text = match.group(1)
45
+
46
+ # Parse YAML frontmatter
47
+ try:
48
+ frontmatter = yaml.safe_load(frontmatter_text)
49
+ if not isinstance(frontmatter, dict):
50
+ return False, "Frontmatter must be a YAML dictionary"
51
+ except yaml.YAMLError as e:
52
+ return False, f"Invalid YAML in frontmatter: {e}"
53
+
54
+ # Define allowed properties
55
+ ALLOWED_PROPERTIES = {
56
+ "name",
57
+ "description",
58
+ "license",
59
+ "compatibility",
60
+ "allowed-tools",
61
+ "metadata",
62
+ }
63
+
64
+ # Check for unexpected properties (excluding nested keys under metadata)
65
+ unexpected_keys = set(frontmatter.keys()) - ALLOWED_PROPERTIES
66
+ if unexpected_keys:
67
+ unexpected_str = ", ".join(sorted(unexpected_keys))
68
+ allowed_str = ", ".join(sorted(ALLOWED_PROPERTIES))
69
+ return False, (
70
+ f"Unexpected key(s) in SKILL.md frontmatter: {unexpected_str}. "
71
+ f"Allowed properties are: {allowed_str}"
72
+ )
73
+
74
+ # Check required fields
75
+ if "name" not in frontmatter:
76
+ return False, "Missing 'name' in frontmatter"
77
+ if "description" not in frontmatter:
78
+ return False, "Missing 'description' in frontmatter"
79
+
80
+ # Extract name for validation
81
+ name = frontmatter.get("name", "")
82
+ if not isinstance(name, str):
83
+ return False, f"Name must be a string, got {type(name).__name__}"
84
+ name = name.strip()
85
+ if name:
86
+ # Structural hyphen checks
87
+ if name.startswith("-") or name.endswith("-") or "--" in name:
88
+ return (
89
+ False,
90
+ (
91
+ f"Name '{name}' cannot start/end with hyphen "
92
+ "or contain consecutive hyphens"
93
+ ),
94
+ )
95
+ # Character-by-character check matching SDK's _validate_skill_name:
96
+ # Unicode lowercase alphanumeric and hyphens only
97
+ for c in name:
98
+ if c == "-":
99
+ continue
100
+ if (c.isalpha() and c.islower()) or c.isdigit():
101
+ continue
102
+ return (
103
+ False,
104
+ (
105
+ f"Name '{name}' should be hyphen-case "
106
+ "(lowercase letters, digits, and hyphens only)"
107
+ ),
108
+ )
109
+ # Check name length (max 64 characters per spec)
110
+ if len(name) > 64:
111
+ return (
112
+ False,
113
+ f"Name is too long ({len(name)} characters). Maximum is 64 characters.",
114
+ )
115
+
116
+ # Extract and validate description
117
+ description = frontmatter.get("description", "")
118
+ if not isinstance(description, str):
119
+ return False, f"Description must be a string, got {type(description).__name__}"
120
+ description = description.strip()
121
+ if description:
122
+ # Check for angle brackets
123
+ if "<" in description or ">" in description:
124
+ return False, "Description cannot contain angle brackets (< or >)"
125
+ # Check description length (max 1024 characters per spec)
126
+ if len(description) > 1024:
127
+ return (
128
+ False,
129
+ (
130
+ f"Description is too long ({len(description)} characters). "
131
+ "Maximum is 1024 characters."
132
+ ),
133
+ )
134
+
135
+ # Extract and validate compatibility (max 500 characters per spec)
136
+ compatibility = frontmatter.get("compatibility", "")
137
+ if isinstance(compatibility, str):
138
+ compatibility = compatibility.strip()
139
+ if len(compatibility) > 500:
140
+ return (
141
+ False,
142
+ (
143
+ f"Compatibility is too long ({len(compatibility)} characters). "
144
+ "Maximum is 500 characters."
145
+ ),
146
+ )
147
+
148
+ return True, "Skill is valid!"
149
+
150
+
151
+ if __name__ == "__main__":
152
+ if len(sys.argv) != 2:
153
+ print("Usage: python quick_validate.py <skill_directory>")
154
+ sys.exit(1)
155
+
156
+ valid, message = validate_skill(sys.argv[1])
157
+ print(message)
158
+ sys.exit(0 if valid else 1)
@@ -0,0 +1 @@
1
+ """Client-side transport and headless execution for Deep Agents Code."""
@@ -0,0 +1 @@
1
+ """Client-facing CLI command implementations."""