Core Concepts
🧠 Core ConceptsLink
Understanding these fundamental concepts will make everything else click into place.
🎯 The Big PictureLink
graph LR
A[Your Idea] -->|Write| B[Invoker Script]
B -->|Compile| C[Standalone Tool]
C -->|Execute| D[Results]
D -->|Visualize| E[Tables/Charts/Trees]
F[Community] -->|Share| G[Package]
G -->|Install| B
style A fill:#bc13fe20
style E fill:#00f3ff20
style G fill:#0aff0020
Sierra Dev has three main workflows:
- Create - Build your own investigation tools
- Use - Install and run community tools
- Share - Package and distribute your tools
Let's understand each component!
📦 What is an Invoker?Link
Simple Definition
An invoker is a specialized Python script that performs a specific task and returns formatted results.
Think of It Like ThisLink
- Regular Python Script: Prints text to console, hard to reuse
- Sierra Invoker: Structured tool with inputs, validation, and formatted output
Anatomy of an InvokerLink
Breaking it down:
- Define - Give your tool a name and description
- Dependencies - Optional helper functions marked with
@invoker.dependancy - Entry Point - Main function marked with
@invoker.entry_point - Loader - Hook to register your invoker
The Power of Structure
This structure allows Sierra to:
- ✅ Validate your inputs automatically
- ✅ Generate command-line interfaces
- ✅ Create standalone scripts
- ✅ Ensure type safety
🏗️ EnvironmentsLink
An environment is a workspace where you develop and organize your invokers.
Directory StructureLink
Why Environments?Link
- Organization - Keep different projects separate
- Isolation - Each environment has its own dependencies
- Portability - Share the entire environment
Creating an environment:
| Bash | |
|---|---|
⚙️ The Compilation ProcessLink
What is Compilation?
Converting your source invoker into a standalone script that can run independently.
Why Compile?Link
Your source invoker imports sierra and uses its features. But the compiled script:
- ✅ Runs without Sierra Dev installed
- ✅ Has all dependencies bundled
- ✅ Includes command-line argument parsing
- ✅ Can be shared as a single file
What Happens During Compilation?Link
graph TD
A[scripts/tool.py] -->|Read| B[Analyze Imports]
B --> C[Extract Dependencies]
C --> D[Generate CLI Parser]
D --> E[Bundle Everything]
E --> F[invokers/tool.py]
F --> G[config.yaml entry]
style A fill:#bc13fe20
style F fill:#00f3ff20
style G fill:#0aff0020
Step by step:
- Read - Sierra reads your source script
- Analyze - Identifies imports and dependencies
- Transform - Removes Sierra-specific code
- Generate - Creates standalone version with CLI
- Bundle - Packages everything needed
- Output - Writes compiled script and YAML config
Running CompilationLink
| Bash | |
|---|---|
📊 Result TypesLink
Sierra provides structured result types for beautiful data visualization.
Available TypesLink
| Type | Use Case | Example |
|---|---|---|
| Table | Tabular data | Scan results, lists |
| Tree | Hierarchical data | Directory structures, categories |
| Timeline | Time-based events | Historical data, logs |
| Chart | Statistical data | Distributions, comparisons |
| Network | Relationships | Social graphs, connections |
Example: Table ResultLink
| Python | |
|---|---|
Output (JSON):
Why Structured Results?
- Consistency - Same format every time
- Integration - Easy to parse and use
- Visualization - Sierra platform renders beautifully
- Machine-Readable - Perfect for automation
📦 PackagesLink
A package is a published invoker that others can install and use.
Package EcosystemLink
graph LR
A[Developer] -->|Creates| B[Invoker]
B -->|Publishes to| C[GitHub Repo]
C -->|Discovered by| D[Package Registry]
D -->|Searched by| E[User]
E -->|Installs| F[Local Environment]
style A fill:#bc13fe20
style D fill:#00f3ff20
style E fill:#0aff0020
Package Manager CommandsLink
| Bash | |
|---|---|
How It WorksLink
- Repositories - GitHub repos hosting invokers
- Registry - Index of available packages
- Installation - Downloads to your environment
- Compilation - Builds into usable tools
🔐 Type Safety & ValidationLink
Sierra uses Python's type hints for automatic validation.
Without Type SafetyLink
With Type SafetyLink
| Python | |
|---|---|
Benefits:
- ✅ Catch errors early - Before script runs
- ✅ Auto-generate help - CLI knows parameter types
- ✅ Better IDE support - Autocomplete works
- ✅ Self-documenting - Code explains itself
🎭 Parameters vs OptionsLink
Understanding the difference:
ParameterLink
What your invoker needs as input:
| Python | |
|---|---|
OptionLink
Rules and metadata about that parameter:
| Python | |
|---|---|
Think of it as: - Parameter = The data - Option = How to validate/describe that data
🔄 The Development WorkflowLink
Typical workflow when creating an invoker:
graph TD
A[1. Write Invoker] --> B[2. Test Locally]
B --> C[3. Compile]
C --> D{4. Does it work?}
D -->|No| E[5. Debug]
E --> A
D -->|Yes| F[6. Share/Deploy]
style A fill:#bc13fe20
style C fill:#00f3ff20
style F fill:#0aff0020
Detailed StepsLink
1. Write Invoker (scripts/my_tool.py)
2. Test Locally
| Bash | |
|---|---|
3. Compile
| Bash | |
|---|---|
4. Test Compiled Version
| Bash | |
|---|---|
5. Debug if Needed
- Check validation errors
- Use --verbose flag
- Review logs
6. Share - Push to GitHub - Add to package registry - Others can install!
🎓 Key TakeawaysLink
Concepts You Now Understand
- ✅ Invoker - A structured investigation tool
- ✅ Environment - A workspace for your invokers
- ✅ Compilation - Making standalone scripts
- ✅ Result Types - Formatted, structured output
- ✅ Packages - Shareable, installable tools
- ✅ Type Safety - Automatic validation
- ✅ Workflow - Write → Compile → Test → Share
🚀 Ready to Build?Link
Now that you understand the concepts, let's create your first invoker!
→ Your First Invoker Tutorial → CLI Command Reference
🤔 Still Have Questions?Link
Common questions beginners ask:
Do I need to know Python well?
Basic Python knowledge helps, but you can learn as you go! Our tutorials start with simple examples and gradually introduce more concepts.
Can I use external libraries (requests, beautifulsoup, etc.)?
Yes! Use invoker.requirement([\"requests\"]) to specify dependencies. Sierra handles installation during compilation.
What's the difference between source and compiled?
- Source (
scripts/) - Your editable code with Sierra imports - Compiled (
invokers/) - Standalone version that runs anywhere
How do I debug my invoker?
Use sierra-dev build --env myenv --verbose for detailed logs. Check validation errors before compilation.
Can compiled invokers run on other machines?
Yes, but they need Python and the dependencies installed. The environment's venv/ contains everything needed.