@tanagram/cli 0.1.9 → 0.1.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.
- package/bin/tanagram +0 -0
- package/extractor/extractor.go +22 -17
- package/package.json +1 -1
package/bin/tanagram
CHANGED
|
Binary file
|
package/extractor/extractor.go
CHANGED
|
@@ -60,28 +60,33 @@ func ExtractPolicies(ctx context.Context, content string) ([]parser.Policy, erro
|
|
|
60
60
|
|
|
61
61
|
// buildExtractionPrompt creates the prompt for policy extraction
|
|
62
62
|
func buildExtractionPrompt(content string) string {
|
|
63
|
-
return fmt.Sprintf(`You are a code policy extraction system. Extract ONLY
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
- Import/dependency
|
|
75
|
-
|
|
76
|
-
DO NOT extract:
|
|
63
|
+
return fmt.Sprintf(`You are a code policy extraction system. Extract ONLY policies that define anti-patterns or bad practices that can be detected by reading code.
|
|
64
|
+
|
|
65
|
+
IMPORTANT: Extract policies about what the CODE should or shouldn't look like. DO NOT extract policies that require running commands, executing tools, or performing actions.
|
|
66
|
+
|
|
67
|
+
Extract policies that define CODE ANTI-PATTERNS:
|
|
68
|
+
- Code structure and organization anti-patterns (e.g., "Don't use deeply nested functions")
|
|
69
|
+
- Coding standards violations (e.g., "Don't use var, use let/const")
|
|
70
|
+
- Language-specific anti-patterns (e.g., "Don't use 'any' type in TypeScript")
|
|
71
|
+
- Prohibited code patterns (e.g., "Don't hardcode API keys")
|
|
72
|
+
- Security anti-patterns in code (e.g., "Don't use eval()")
|
|
73
|
+
- Error handling anti-patterns (e.g., "Don't swallow exceptions silently")
|
|
74
|
+
- Import/dependency anti-patterns (e.g., "Don't import entire lodash library")
|
|
75
|
+
|
|
76
|
+
DO NOT extract policies that require ACTIONS or COMMANDS:
|
|
77
|
+
- Running tests (e.g., "Run pytest before committing")
|
|
78
|
+
- Running linters or formatters (e.g., "Run black on all Python files")
|
|
79
|
+
- Building or compiling (e.g., "Build the project to verify")
|
|
80
|
+
- Running scripts or commands (e.g., "Execute database migrations")
|
|
81
|
+
- Using specific tools (e.g., "Use ruff format" - this requires running ruff)
|
|
77
82
|
- Agent behavior instructions (how AI agents should operate)
|
|
78
83
|
- Workflow or process instructions
|
|
79
|
-
- Tool usage instructions
|
|
80
84
|
- Communication style guidelines
|
|
81
85
|
- Project management policies
|
|
82
|
-
- Non-code related guidelines
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
CRITICAL: If a policy would require the agent to run a command or tool to fix a violation, DO NOT extract it. Only extract policies about code patterns that can be fixed by editing code directly.
|
|
88
|
+
|
|
89
|
+
For each code anti-pattern policy, provide:
|
|
85
90
|
1. Name: Short descriptive name (2-5 words)
|
|
86
91
|
2. Message: The full policy text or a clear summary
|
|
87
92
|
3. OriginalText: The exact text from the file
|