@flydocs/cli 0.5.0-beta.1 → 0.5.0-beta.10

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,89 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- PreToolUse Hook: Guide AI to prefer scripts over MCP
4
-
5
- Triggers before mcp__linear tool calls and provides guidance
6
- to use the bundled Python scripts instead.
7
-
8
- Soft guidance — doesn't block the MCP call, but reminds the AI
9
- that scripts exist and are preferred.
10
-
11
- Exit codes:
12
- - 0 with JSON: Continue with guidance message
13
- - 0 with no output: No opinion, continue normally
14
- - 2: Block (not used)
15
- """
16
-
17
- import sys
18
- import json
19
-
20
-
21
- # Mapping of MCP operations to equivalent mechanism scripts
22
- SCRIPT_ALTERNATIVES = {
23
- "create_issue": "create_issue.py --title '...' --type feature",
24
- "update_issue": "transition.py ISSUE_ID STATUS 'comment'",
25
- "get_issue": "get_issue.py ISSUE_ID",
26
- "list_issues": "list_issues.py --status STATUS",
27
- "create_comment": "comment.py ISSUE_ID 'message'",
28
- "update_issue_state": "transition.py ISSUE_ID STATUS 'comment'",
29
- "list_projects": "list_projects.py --active",
30
- "create_project": "create_project.py --name '...'",
31
- "list_workflow_states": "list_states.py",
32
- "list_labels": "list_labels.py",
33
- "assign_issue": "assign.py ISSUE_ID 'email'",
34
- "set_issue_priority": "priority.py ISSUE_ID LEVEL",
35
- "set_issue_estimate": "estimate.py ISSUE_ID POINTS",
36
- }
37
-
38
-
39
- def get_script_suggestion(tool_name: str) -> str | None:
40
- """Get the equivalent script for an MCP operation."""
41
- operation = tool_name.replace("mcp__linear__", "").replace("mcp__linear.", "")
42
- return SCRIPT_ALTERNATIVES.get(operation)
43
-
44
-
45
- def main():
46
- try:
47
- input_data = json.load(sys.stdin)
48
- except (json.JSONDecodeError, EOFError):
49
- sys.exit(0)
50
-
51
- tool_name = input_data.get('tool_name', '')
52
-
53
- if not tool_name.startswith('mcp__linear'):
54
- # No opinion — exit 0 with no output to avoid hook error
55
- sys.exit(0)
56
-
57
- script_suggestion = get_script_suggestion(tool_name)
58
-
59
- if script_suggestion:
60
- guidance = {
61
- "decision": "continue",
62
- "message": f"""**Reminder:** FlyDocs prefers Python scripts over MCP for issue operations.
63
-
64
- Equivalent script (in the active mechanism skill):
65
- ```bash
66
- python3 .claude/skills/flydocs-cloud/scripts/{script_suggestion}
67
- ```
68
-
69
- Scripts are:
70
- - Auto-approved (no permission prompt)
71
- - Config-aware (reads team ID, status mappings)
72
- - Pattern-enforced (mandatory comments on transitions)
73
-
74
- You may continue with MCP if the script doesn't cover your use case."""
75
- }
76
- else:
77
- guidance = {
78
- "decision": "continue",
79
- "message": """**Reminder:** Check if the active mechanism skill has a script for this operation.
80
- Read the mechanism skill's SKILL.md for the full script catalog.
81
- Scripts are preferred over MCP for performance and auto-approval."""
82
- }
83
-
84
- print(json.dumps(guidance))
85
- sys.exit(0)
86
-
87
-
88
- if __name__ == "__main__":
89
- main()