npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fui-org/mlis-cli

v0.8.4

Published

CLI thiết kế trang ascx (ViewPage) cho website MLIS qua API có sẵn, kèm render cục bộ và skill cho Claude Code

Readme

mlis — CLI thiết kế trang ascx cho website MLIS

mlis giúp designer (và Claude Code) làm việc với giao diện website MLIS qua các API có sẵn của site (/api/viewpage/*): xem cây thư mục ViewPage, tải mã về máy, sửa bằng editor, so sánh và đẩy lên an toàn (phát hiện xung đột, tự sao lưu), upload hình/tài liệu qua CKFinder. Kèm skill mlis cho Claude Code mô tả các control <MLIS:…>.

Cài đặt

Cần Node ≥ 22 (hoặc Bun):

npm install -g @fui-org/mlis-cli     # hoặc: bun add -g @fui-org/mlis-cli
mlis --version

mlis render (chạy trang trên máy để xem trước) cần thêm Windows có .NET Framework 4, mã nguồn site MLIS (mlis config set site-src <thư mục>) và Playwright (npm i -g playwright && playwright install chromium).

Phát triển từ mã nguồn (cần Bun):

git clone https://github.com/fui-org/mlis-cli && cd mlis-cli
bun install
bun run build          # dist/mlis.js
bun link               # lệnh "mlis" dùng toàn máy

Phát hành: mỗi lần push lên main có đổi src/, skills/, render/ hoặc package.json, GitHub Actions tự tăng version (patch; ghi #minor/#major trong commit để tăng nhiều hơn), gắn tag và npm publish (npm Trusted Publishing, không cần token).

Muốn một file chạy độc lập (không cần Bun/Node): bun run build:exe → dist/mlis.exe (chép thư mục skills/ cạnh file exe).

Lần chạy đầu, bản đã build tự cài skill vào ~/.claude/skills/mlis (tắt bằng MLIS_AUTO_SKILLS=off; cài tay: mlis skill install).

Cấu hình

mlis token set                       # dán mã ghép một lần lấy ở /admin → Thiết bị → "Tạo mã ghép cho mlis"
mlis config set url https://lhu.edu.vn
mlis config set cdn-cat 123          # CatID chứa hình/tài liệu cho CKFinder
mlis config set site-src C:\APP\MLIS_2025   # mã nền tảng cho mlis render (mặc định nếu thư mục này có)
mlis config set render-port 5080      # cổng http://localhost của mlis render
mlis config                          # xem cấu hình (token chỉ hiện "(set)")

Cấu hình nằm ở ~/.config/mlis/config.json. Biến môi trường MLIS_URL, MLIS_TOKEN, MLIS_WORKDIR, MLIS_CDN_CAT, MLIS_CDN_MODE, MLIS_SITE_SRC, MLIS_RENDER_PORT ghi đè file. Đăng nhập là phiên gắn với máy: mã ghép chỉ dùng một lần; máy tạo khoá riêng device-key.pem (trong thư mục cấu hình, chỉ người dùng đọc được) và tự gia hạn token ngắn hạn bằng chữ ký, nên token bị chép sang máy khác không dùng được. Thu hồi một máy ở /admin → Thiết bị. Thiết kế ViewPage cần tài khoản có SystemRight ≥ 3; không truyền mã/token làm tham số dòng lệnh.

Dùng hằng ngày

mlis tree LHUENB4 --files            # cây thư mục + file
mlis pull LHUENB4/@HomePage          # tải về C:\APP\mlis-workspaces\LHUENB4\@HomePage
# ... sửa file ...
mlis status LHUENB4                  # file new / changed / missing; warns when the last pull is over 48h old
mlis diff LHUENB4/@HomePage          # so với bản trên server
mlis push LHUENB4/@HomePage --dry-run
mlis push LHUENB4/@HomePage

| Lệnh | Việc làm | |---|---| | tree [folder] [--files], ls [folder], cat <file> | xem trên server | | pull [folder\|file] [--force] | tải về workspace; không ghi đè file local đang sửa (trừ --force, bản local được lưu _history) | | status [scope] [--remote] | so với lần đồng bộ cuối; --remote kiểm cả thay đổi trên server | | diff [scope] [--stat] | diff dòng local ↔ server (hình/font: chỉ báo khác hay giống) | | push <file\|folder>... [--dry-run] [--force] | đẩy lên; dừng (exit 3) nếu server đã đổi từ lần pull cuối; bản server được lưu _history trước khi ghi | | new <file> [--kind page\|control\|css\|js] [--push] | tạo file từ mẫu sạch trong workspace (render, xem rồi push); --push tạo luôn trên server | | rm <file> --confirm-delete, mkdir <folder>, rmdir <folder> --confirm-delete [--recursive] | xoá/tạo trên server; mkdir <SITE> tạo cả thư mục site mới ở gốc ViewPage (server cần WebApiViewPageController.vb bản 2026-10-28); rmdir --recursive xoá cả file và thư mục con (chép mọi file vào _history trước, báo thư mục bài viết đang dùng nó làm trang; không áp dụng cho thư mục site ở gốc; server cần bản build 10/11/2026) | | rename <folder\|file> <new-name> [--confirm] | đổi tên thư mục hoặc file (cùng thư mục cha; file đổi được đuôi trong cùng loại: .ascx/.css/.js, hoặc hình/font/media/pdf) trên server và workspace; không --confirm thì chỉ liệt kê thư mục bài viết và file đang trỏ tới tên cũ (thư mục cần controller có RenameDirectory, file cần RenameFile — bản build 02/11/2026) | | history <file>, restore <file> [--at stamp] | xem/khôi phục bản sao lưu | | check [thư mục\|file] [--offline] | kiểm tra trước khi đẩy: đường dẫn ViewPage hỏng, thẻ MLIS thiếu runat, {/} lạc trong format, CodeFile, alt, <h1>, thẻ SEO trùng | | page <url> [--pull] | URL của một trang (tên miền bất kỳ của máy chủ) → template trong ViewPage, các file LoadPage, HeaderOfSite, số thư mục dùng chung template; --pull tải chúng về | | category sync\|tree\|ls\|show\|find\|pages | cây thư mục (category) của site: CatID, kiểu, PageStyle/PageRead, Location1-3, tên miền chủ; thư mục nào dùng trang nào | | category pull\|diff\|push <CatID>, category new <ParentID> | sửa mọi trường của form Thư mục (kiểu, tên, mô tả, hình, liên kết/tên miền, PageStyle/PageRead, vị trí, thứ tự, tuỳ chọn, thư mục cha) và Tài liệu HTML; file _categories/<CatID>.html | | category rm <CatID> --confirm-delete, category share-style <CatID> [--confirm] | menu chuột phải của /admin → Thư mục: xoá thư mục cùng bài viết bên trong (chép bài vào _history trước; không xoá thư mục còn thư mục con hay trang chủ tên miền), áp đặt kiểu trang (PageStyle/PageRead) cho cả cây con | | category perm <CatID> [--candidates], category perm set <CatID> <user>=<user\|manager\|admin>... [--child] [--subtree --confirm], category perm rm <CatID> <user>... --confirm, category perm inherit <CatID> --confirm | phân quyền thư mục như trang Phân quyền (cần SystemRight ≥ 4 và server bản build 10/11/2026 23:23 trở về sau) | | news ls <CatID>, news show\|pull\|diff\|push <NewsID>, news new <CatID> | đọc/sửa bài viết (nội dung động của trang) qua API của trang quản trị Bài viết; file _news/<NewsID>.html; push dừng (exit 3) nếu bài đã bị sửa trên web | | news move <NewsID>... <CatID>, news sort <NewsID> --after <NewsID>\|--first, news rm <NewsID>... --confirm-delete, news restore <NewsID>... | chuyển bài sang thư mục khác (chỉ thư mục bật "Cho thêm bài viết"), đổi thứ tự bài (thư mục bật "Cho sắp xếp bài viết"), bỏ bài vào thùng rác và lấy lại — như kéo thả trong /admin → Bài viết | | render shot <thư mục\|file.ascx> [--as home\|category\|read] [--device desktop\|mobile\|both] [--full] [-o dir], render start <…>, render stop | chạy trang trên máy (mã nền tảng từ site-src + dữ liệu mẫu, không ghi lên server) và chụp ảnh desktop/mobile vào _mlis/shots/ | | cdn info\|list\|upload\|mkdir\|rename\|url\|download\|rm\|rmdir | tài liệu/hình ngoài ViewPage qua CKFinder | | skill, skill ref [name], skill install | hướng dẫn cho AI |

Workspace: <workdir>/… giữ nguyên đường dẫn bên trong ViewPage, kèm _mlis/state.json (hash lần đồng bộ cuối) và _history/ (bản sao lưu có dấu thời gian). Mỗi workspace dành cho một máy chủ MLIS: mọi tên miền của nó (lhu.edu.vn, tuyensinh.lhu.edu.vn…) dùng chung ViewPage nên dùng chung workspace; CLI tự nhận ra địa chỉ khác của cùng máy chủ. Đầu ra: bảng khi ở terminal, TSV khi pipe, --json cho máy; ghi chú/lỗi ra stderr. Exit code: 0 ok · 1 lỗi · 2 sai cú pháp · 3 bị chặn an toàn.

Loại file và giới hạn của API server

  • .ascx, .css, .js: sửa như văn bản (ReadFile/SaveFile), có diff.
  • Hình, font, media, pdf (png jpg jpeg gif webp svg ico bmp avif woff woff2 ttf otf eot mp4 webm mp3 pdf, ≤ 10 MB): đồng bộ dạng byte qua UploadFile/DownloadFile — cần WebApiViewPageController.vb bản mới. Server cũ vẫn dùng được với file code; khi đẩy hình CLI báo cần deploy.
  • Đuôi khác (đặc biệt .aspx, .ashx, .config, .dll, .html) không được lưu vào ViewPage. Tài liệu bài viết (doc, xls, zip…) dùng mlis cdn (lưu ở /Data/Folders/<CatID>/…).
  • Đổi tên file cần RenameFile (bản build 02/11/2026; server cũ báo cần deploy); xoá thư mục kèm nội dung cần DeleteDirectory bản build 10/11/2026 (server cũ chỉ xoá thư mục rỗng). Server báo "không có quyền xoá" là do quyền NTFS: thông báo ghi tên tài khoản chạy site và lệnh icacls cần chạy trên server.
  • mlis news dùng API của trang quản trị Bài viết: GetNewsList (trả dữ liệu), GetNews, SaveNews, NewsChangeFolder, NewsUpdateStatus — cùng quy tắc kiểm tra với trang sửa bài (App_Code\NewsEditor.vb); cần WebApiController.vb và NewsEditor.vb bản mới.
  • mlis category pull/push/new dùng GetFolder, SaveFolder, GetFolderDoc, SaveFolderDoc (cùng quy tắc với form Thư mục và trang Tài liệu HTML, App_Code\FolderEditor.vb) và MoveFolder có sẵn; category rm/share-style dùng DeleteFolder, ShareStyle có sẵn; category perm dùng GetPermission, SavePermission, InheritPermission (thêm trong WebApiController.vb bản build 10/11/2026 23:23, làm đúng việc của trang Phân quyền).
  • mlis category dùng API của trang quản trị thư mục (/api/admin/GetAllFolder, GetFolderList) — cần WebApiController.vb bản trả JSON (server cũ trả HTML, CLI báo cần deploy).
  • Server không có lịch sử phiên bản; mọi sao lưu nằm ở _history/ trên máy chạy mlis.
  • Khách chưa đăng nhập có thể thấy trang cũ tới 60 giây (cache HTML của site).

Phát triển

bun test           # unit + integration với server giả lập (test/fake-server.ts)
bun run typecheck
bun src/bin.ts --help