Jesús Pérez 9cef9b8d57 refactor: consolidate configuration directories
Merge _configs/ into config/ for single configuration directory.
Update all path references.

Changes:
- Move _configs/* to config/
- Update .gitignore for new patterns
- No code references to _configs/ found

Impact: -1 root directory (layout_conventions.md compliance)
2025-12-26 18:36:23 +00:00

99 lines
2.2 KiB
Plaintext

#! {{TOOL_NAME}} - NuShell Implementation
#!
#! A simple, single-file NuShell tool following the Tools ecosystem patterns.
use std/log
# Configuration for {{tool_name_kebab}}
export def config [] {
# Load configuration from standard locations
# 1. .project/{{tool_name_kebab}}.toml
# 2. .vapora/{{tool_name_kebab}}.toml
# 3. .coder/{{tool_name_kebab}}.toml
# 4. ./{{tool_name_kebab}}.toml
let search_paths = [
".project/{{tool_name_kebab}}.toml"
".vapora/{{tool_name_kebab}}.toml"
".coder/{{tool_name_kebab}}.toml"
"./{{tool_name_kebab}}.toml"
]
let found = $search_paths
| find { |path| ($path | path exists) }
| first
if ($found | is-empty) {
log error $"No config found in standard locations"
return null
}
open $found
}
# List items [filter: optional filter pattern]
export def list [filter?: string] {
let items = [
{ id: "1", name: "Item 1", status: "active" }
{ id: "2", name: "Item 2", status: "inactive" }
]
if ($filter | is-empty) {
return $items
}
$items | where name =~ $filter
}
# Create a new item [name: item name, description: optional description]
export def create [name: string, --description: string = ""] {
{
id: (random uuid)
name: $name
description: $description
created_at: (now)
}
}
# Show summary statistics
export def summary [] {
let items = list
{
total_items: ($items | length)
active_items: ($items | where status == "active" | length)
last_updated: (now)
}
}
# Validate configuration
export def "validate config" [] {
let cfg = config
if ($cfg | is-empty) {
return { valid: false, errors: ["No configuration found"] }
}
{
valid: true
config: $cfg
}
}
# Main entry point
export def main [] {
print "{{TOOL_NAME}} v0.1.0"
print ""
print "Available commands:"
print " list - List all items"
print " create <name> - Create a new item"
print " summary - Show statistics"
print " validate config - Check configuration"
print " help - Show this message"
}
# Help command
export def help [] {
main
}