Skip to content

Telos UpdateTelos.ts: crashes on first run — backups/ directory is not auto-created #1086

@mc0l85

Description

@mc0l85

Summary

Packs/Telos/src/Tools/UpdateTelos.ts writes backups via copyFileSync(targetFile, backupPath) where backupPath lives under BACKUPS_DIR (the backups/ directory inside the TELOS folder), but the script never creates that directory and the installer doesn't ship it. On a fresh install, the very first invocation crashes with ENOENT: no such file or directory at the copyFileSync line.

Reproduction

# Fresh PAI install — backups/ does not exist yet
bun ~/.claude/skills/Telos/Tools/UpdateTelos.ts "BOOKS.md" "- test" "test"
# ❌ Failed to create backup: Error: ENOENT: no such file or directory, ...
#    .../PAI/USER/TELOS/backups/BOOKS-<timestamp>.md

Suggested fix

One-line addition before the copyFileSync call, or eager creation at startup:

 import { readFileSync, writeFileSync, copyFileSync, existsSync } from 'fs';
+import { mkdirSync } from 'fs';
 ...
+  // Ensure backups directory exists (idempotent)
+  mkdirSync(BACKUPS_DIR, { recursive: true });
   copyFileSync(targetFile, backupPath);

Alternative: ship Packs/Telos/src/backups/.gitkeep (or similar) so the directory exists at install time. The programmatic fix is preferable because it also recovers if someone deletes the directory later.

Environment

  • Discovered: 2026-04-17
  • PAI install path: ~/.claude/skills/Telos/ (via PAI installer, 2026-04)
  • OS: Linux (ext4, case-sensitive)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions