# cpta

> TA Kit for Computer Programming.

Latest version **0.1.3** (published 2024-01-03) · AGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install cpta
pnpm add cpta
yarn add cpta
bun add cpta
```

Provides the command `cpta`.

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2024-01-03 |
| First published | 2023-10-31 |
| Weekly downloads | 0 |
| License | AGPL-3.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 9 |
| Unpacked size | 89.5 KB |
| Known vulnerabilities | 0 (+16 in 4 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 0 |
| Author | JacobLinCool |
| Maintainers | jacoblincool |

## Links

- npm: https://www.npmjs.com/package/cpta
- Repository: https://github.com/JacobLinCool/cpta
- Homepage: https://jacoblincool.github.io/cpta
- Issues: https://github.com/JacobLinCool/cpta/issues
- npm.io page: https://npm.io/package/cpta

## Dependencies (9)

- [zx](https://npm.io/package/zx.md) ^7.2.3
- [tar](https://npm.io/package/tar.md) ^6.2.0
- [xlsx](https://npm.io/package/xlsx.md) ^0.18.5
- [chalk](https://npm.io/package/chalk.md) ^5.3.0
- [debug](https://npm.io/package/debug.md) ^4.3.4
- [commander](https://npm.io/package/commander.md) ^11.1.0
- [dockerode](https://npm.io/package/dockerode.md) ^4.0.0
- [file-type](https://npm.io/package/file-type.md) ^18.5.0
- [memory-streams](https://npm.io/package/memory-streams.md) ^0.1.3

## Recent versions

- 0.1.3 (latest) — 2024-01-03
- 0.1.2 — 2023-12-06
- 0.1.1 — 2023-12-06
- 0.1.0 — 2023-11-13
- 0.0.1 — 2023-11-01
- 0.0.0 — 2023-10-31

## README

# CPTA

TA Kit for Computer Programming.

## Features

- [x] Compile and Run code in sandbox
  - [x] Network isolation (no internet access)
  - [x] Limit CPU usage (1 core)
  - [x] Limit memory usage (1GB)
  - [x] Limit disk usage (`/tmp` and `/workspace`)
  - [x] Read-only root filesystem, write to `/tmp` and `/workspace` only
- [x] Mount files into workspace
  - [x] Mount files before build
  - [x] Mount files before execution
- [x] Flexible file-based case system
  - [x] Config `exec.js` to execute target
  - [x] Define `spec.js` to evaluate result
- [x] Generate report from results
  - [x] Generate spreadsheet report with `students.csv`

## File Structure

```sh
.
├── .works
|   └── <student-id>
|       ├── 0-raw
|       ├── 1-build
|       ├── 2-output
|       └── 3-result
├-- .build
|   └── mount
|       └ ... (files to be mounted before build)
└── .cases
    └── <case-name>
        ├── mount
        |   └ ... (files to be mounted before execution)
        ├── exec.js
        └── spec.js
```

## Usage

### Create workspace from Moodle archive

```sh
cpta from-moodle <moodle-archive> --output [output-dir]
```

`output-dir` defaults to `./.works`.

### Build all workspaces

```sh
cpta make --workspace [workspaces-dir]
```

`workspaces-dir` defaults to `./.works`.

### Execute all targets in workspaces

```sh
cpta exec --workspace [workspaces-dir] --case [cases-dir]
```

`workspaces-dir` defaults to `./.works`.
`cases-dir` defaults to `./.cases`.

### Evaluate all targets in workspaces

```sh
cpta eval --workspace [workspaces-dir] --case [cases-dir]
```

`workspaces-dir` defaults to `./.works`.
`cases-dir` defaults to `./.cases`.

### Make report from workspaces

```sh
cpta report
```

### Dive into workspaces in container

```sh
cpta dive
```

---
_Source: https://npm.io/package/cpta · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
