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

oa-cli-tool

v1.0.2

Published

OA 系统工作流自动化处理 CLI 工具

Downloads

273

Readme

OA CLI Tool

OA 系统工作流自动化处理 CLI 工具。

功能

  • 自动登录 OA 系统
  • 获取待办列表并按关键词筛选
  • 自动填写工时
  • 智能分配工作流给团队成员
  • 支持配置文件和命令行参数
  • 支持调试模式,保存截图排查问题

安装

从 npm 安装

npm install -g oa-cli-tool

从源码安装

git clone <repo-url>
cd oa-cli-tool
npm install
npx playwright install chromium
npm run build
npm link

快速开始

1. 初始化配置

oa-process --init

这将创建 ~/.oa-cli/ 目录并生成配置文件模板:

~/.oa-cli/
├── config.json           # 配置文件(请编辑填入账号密码)
├── .env                  # 环境变量(可选)
├── transfer-log.log      # 操作日志
└── round-robins.json     # 轮询记录

2. 编辑配置文件

# 编辑 ~/.oa-cli/config.json,填入账号密码
# 或编辑 ~/.oa-cli/.env

3. 运行

oa-process

配置

配置文件查找顺序(优先级从高到低):

  1. 命令行指定 (-c 参数)
  2. 当前目录 (./config.json)
  3. 全局配置 (~/.oa-cli/config.json)
  4. 环境变量 (配置文件所在目录的 .env)
  5. 默认配置

命令行参数

# 初始化配置文件
oa-process --init

# 使用默认配置(自动查找配置文件)
oa-process

# 指定配置文件
oa-process -c custom.json

# 指定关键词
oa-process -k "集成配置,交易yaml编制"

# 指定候选人
oa-process --candidates "张三,李四,王五"

# 仅查看待办,不实际处理
oa-process --dry-run

# 详细输出
oa-process -v

# 调试模式(保存截图到 ~/.oa-cli/)
oa-process --debug

# 无头模式(不显示浏览器,适合服务器)
oa-process --headless

# 组合使用
oa-process --headless -v --debug

调试

使用调试模式

当遇到问题时,使用 --debug 模式运行:

oa-process --headless -v --debug

截图会保存到 ~/.oa-cli/ 目录:

  • debug-0-initial.png - 初始页面
  • debug-1-after-login.png - 登录后页面
  • error-screenshot.png - 出错时的页面状态

常见问题排查

| 问题 | 可能原因 | 解决方法 | |------|---------|---------| | 找不到命令 | 未正确安装 | 运行 npm list -g oa-cli-tool 检查 | | 配置错误 | 配置文件不存在或格式错误 | 运行 oa-process --init 重新初始化 | | 找不到待办 | 登录失败或确实没有待办 | 使用 --debug 查看截图 | | 登录页面显示 | epoint 对象不存在 | 检查 OA 系统是否可访问 |

从服务器获取截图

# 下载截图到本地
scp user@server:~/.oa-cli/debug-*.png .

配置文件说明

config.json

{
  "oa": {
    "baseUrl": "https://oa.epoint.com.cn",
    "username": "your-username",
    "password": "your-password",
    "targetUrl": "https://oa.epoint.com.cn/epointoa9/frame/pages/basic/communication/waithandle/waithandlelist"
  },
  "workflow": {
    "keywords": ["交易yaml编制", "集成配置"],
    "candidates": ["郭嘉铭", "李柏宏", "邓陈坤"],
    "workTime": "0.3",
    "workContent": "评审"
  },
  "logging": {
    "enabled": true,
    "logFile": "transfer-log.log"
  }
}

.env(可选)

OA_USERNAME=your-username
OA_PASSWORD=your-password
OA_BASE_URL=https://oa.epoint.com.cn

开发

# 开发模式运行
npm run dev

# 编译
npm run build

# 运行
npm start

# 本地测试 link
npm link

# 打包测试
npm pack
npm install -g oa-cli-tool-*.tgz

项目结构

oa-cli-tool/
├── src/
│   ├── Clouddev.ts           # 工作流操作类
│   ├── MiniDriver.ts         # MiniUI 驱动
│   ├── ByT.ts                # 定位器工具
│   ├── config.ts             # 配置管理
│   ├── WorkflowProcessor.ts  # 工作流处理
│   ├── cli.ts                # CLI 入口
│   └── index.ts              # 模块导出
├── dist/                     # 编译输出
├── config.example.json       # 配置示例
├── .env.example              # 环境变量示例
├── .gitignore                # Git 忽略文件
├── tsconfig.json             # TypeScript 配置
└── package.json              # 项目配置

许可证

ISC