{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package scripts\n\nPackage scripts is the repo-local store of reusable multi-step command sequences — a proven recipe (\"rebuild the cli\", \"commit, push, deploy\") saved once and replayed by name instead of re-derived every time. Each script is a real shell file at .memcode/scripts/\\\u003cslug\u003e.sh: a shebang line followed by a hand-parsed \\`#\\`-comment metadata header (description/created/last-run/run-count — no YAML dependency, matching the internal/skills package's existing convention) and then the command body.\n\n.memcode is gitignored, so scripts are per-machine and a hard delete isn't git-recoverable — Delete therefore moves a script to a .trash/ subdirectory rather than removing it outright.\n\n## Functions\n\n```go\nfunc Delete(root, slug string) error\n```\nDelete soft-deletes a script: moves it to .memcode/scripts/.trash/\\\u003cslug\u003e-\\\u003cunixnano\u003e.sh rather than removing it outright, since .memcode is gitignored (a hard delete wouldn't be git-recoverable).\n\n```go\nfunc Dir(root string) string\n```\nDir returns the repo-local scripts directory (.memcode/scripts). It may not exist yet.\n\n```go\nfunc RecordRun(root, slug string)\n```\nRecordRun best-effort bumps the run counter and last-run timestamp after a successful run. Errors are swallowed — a lost stat bump is never worth failing the command that just ran.\n\n```go\nfunc ValidSlug(slug string) bool\n```\nValidSlug reports whether slug is the required lowercase-letters/digits/hyphens charset.\n\n## Types\n\n```go\ntype Script struct {\n\tSlug        string\n\tDescription string\n\tBody        string\n\tCreatedAt   time.Time\n\tLastRunAt   time.Time // zero value: never run\n\tRunCount    int\n\tPath        string\n}\n```\nScript is one saved command sequence.\n\n```go\nfunc Get(root, slug string) (Script, bool)\n```\nGet returns one saved script by exact slug.\n\n```go\nfunc List(root string) ([]Script, error)\n```\nList returns every saved (non-trashed) script, sorted by slug. An absent directory is not an error — it just means nothing has been saved yet.\n\n```go\nfunc Save(root, slug, description, body string) (Script, error)\n```\nSave writes (or upserts) a script under .memcode/scripts/\\\u003cslug\u003e.sh. Validates the slug and requires a description and a non-empty body; updating an existing slug preserves its CreatedAt/RunCount/LastRunAt history rather than resetting it.\n\n","path":"github.com/memcode-ai/memcode/internal/scripts","name":"scripts","synopsis":"Package scripts is the repo-local store of reusable multi-step command sequences — a proven recipe (\"rebuild the cli\", \"commit, push, deploy\") saved once and replayed by name instead of re-derived every time.","isRedistributable":true}
