Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/PrinceOfCookies/CookieOS/llms.txt

Use this file to discover all available pages before exploring further.

CookieOS ships a set of drop-in replacements for standard CC:Tweaked shell commands. Rather than patching the ROM, these replacements live in /programReplacements/ and are loaded transparently at boot — every time you type a command, the enhanced version runs instead of the default, with no extra configuration required.

How it works

During startup, startup/replacements.lua monkey-patches shell.resolveProgram(). Before falling back to the standard program path, the override checks whether a matching file exists inside /programReplacements/. Both bare names (e.g. list) and .lua-suffixed names (e.g. list.lua) are accepted.
shell.resolveProgram = function(command)
    local sReplacementPath = fs.combine(replacementPath, command)
    if fs.exists(sReplacementPath) and not fs.isDir(sReplacementPath) then
        return sReplacementPath
    else
        local sReplacementPathLua = sReplacementPath .. ".lua"
        if fs.exists(sReplacementPathLua) and not fs.isDir(sReplacementPathLua) then
            return sReplacementPathLua
        end
    end
    return originalResolveProgram(command)
end
If no replacement file is found, the call is forwarded to the original shell.resolveProgram(), so all standard CC:Tweaked commands continue to work normally.

Available replacements

CommandReplacesKey enhancement
listDefault listShows file sizes, -s/-i/-h flags, horizontal layout
lsDefault lsAlias for list using cosUtils helpers
shellN/A (new command)Shows CookieOS version info
screenfetchDefault screenfetchCC:Tweaked system info with ASCII art
aboutDefault aboutShows main OS and CookieOS co-OS version
rebootos.reboot()Wrapped by replacements.lua for goodbye animation
shutdownos.shutdown()Wrapped by replacements.lua for goodbye animation

fs.attributes2()

startup/replacements.lua extends the built-in fs API with fs.attributes2(). It calls the standard fs.attributes() underneath and adds two extra fields: a human-readable file size and relative timestamps for modified and created.
-- fs.attributes2 is available globally after CookieOS boots
local attrs = fs.attributes2("/os")
-- attrs.size     = "4.50 KB"
-- attrs.modified = "2 days, 3 hrs"
-- attrs.created  = "5 weeks, 2 days"
For directories, size is the recursive total of all files inside, and modified reflects the most recently changed file anywhere in the tree. The optional second argument hdOnly switches the timestamp format to a two-unit short form (e.g. "1 day, 4 hrs" instead of the full multi-unit breakdown).

shell.lastDir()

startup/replacements.lua adds a shell.lastDir() function that navigates back to the directory you were in before the most recent cd. The previous directory is persisted to os/data/lastDir.txt by the enhanced shell.setDir(), so it survives between command invocations within the same session.
shell.lastDir()  -- navigates to the previously visited directory

Adding your own replacements

To add a new command replacement, create a .lua file in /programReplacements/ whose name matches the command you want to override (e.g. /programReplacements/mycommand.lua). CookieOS will automatically use it the next time that command is run — no restart or registration required.

Build docs developers (and LLMs) love