@canvatopsd/magiclayers 0.0.0-stage → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -2
- package/bin/magiclayers.mjs +30 -0
- package/contracts/guest-agent-commands.json +95 -0
- package/doc/usage.md +66 -0
- package/package.json +48 -4
- package/release.json +17 -0
- package/runtime/darwin-arm64/magiclayers +0 -0
- package/runtime/linux-x64/magiclayers +0 -0
- package/skills/magiclayers/SKILL.md +35 -0
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MagicLayers CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Convert an image into editable PSD layers or automatic spot-color print separations from your AI agent or terminal. Submit an image, share hosted checkout, inspect progress and download verified delivery.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g @canvatopsd/magiclayers
|
|
7
|
+
magiclayers --version
|
|
8
|
+
magiclayers skill install agents
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Node.js 22 or newer. Native executables are included for macOS Apple Silicon and Linux x64 (glibc 2.31+); no Rust, Photoshop, account registration or API key is required. Other platforms are not included in this npm release.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
magiclayers convert image.png --email buyer@example.com
|
|
15
|
+
magiclayers checkout TASK_ID
|
|
16
|
+
# After payment is verified:
|
|
17
|
+
magiclayers status TASK_ID
|
|
18
|
+
magiclayers download TASK_ID --output delivery.zip
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Add `--print` to `convert` for automatic spot-color separations. Business output is JSON. Use full option names, keep the same task ID when resuming, and back up the private access file. The CLI never automatically polls, retries, creates a replacement payment or overwrites a downloaded file.
|
|
22
|
+
|
|
23
|
+
Install the bundled Skill for `codex`, `claude-code`, `cursor`, `copilot` or generic `agents`. Use `--dir` for a custom parent directory and start a new Agent session after installation.
|
|
24
|
+
|
|
25
|
+
[Usage and recovery](doc/usage.md) · [Agent Skill](skills/magiclayers/SKILL.md) · [Release guide](doc/npm-release.md) · [Website](https://magiclayers.app/ai-agent/)
|
|
26
|
+
|
|
27
|
+
The hosted service defaults to `https://magiclayers.app`. Local development selects `--base-url http://127.0.0.1:3000` explicitly. Buyers complete hosted checkout before processing starts. PayPal confirmation is explicit after buyer approval. Delivery size and SHA-256 are verified.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import metadata from "../package.json" with { type: "json" };
|
|
6
|
+
|
|
7
|
+
function fail(code, message) {
|
|
8
|
+
console.log(JSON.stringify({ ok: false, error: { code, message } }));
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
const target = `${process.platform}-${process.arch}`;
|
|
12
|
+
if (!metadata.magiclayers.targets.includes(target))
|
|
13
|
+
fail(
|
|
14
|
+
"unsupported_platform",
|
|
15
|
+
`Supported platforms: ${metadata.magiclayers.targets.join(", ")}; received ${target}`,
|
|
16
|
+
);
|
|
17
|
+
const executable = fileURLToPath(
|
|
18
|
+
new URL(`../runtime/${target}/magiclayers`, import.meta.url),
|
|
19
|
+
);
|
|
20
|
+
if (!existsSync(executable))
|
|
21
|
+
fail(
|
|
22
|
+
"native_binary_missing",
|
|
23
|
+
`The package is missing its ${target} executable; reinstall the official release`,
|
|
24
|
+
);
|
|
25
|
+
const result = spawnSync(executable, process.argv.slice(2), {
|
|
26
|
+
stdio: "inherit",
|
|
27
|
+
});
|
|
28
|
+
if (result.error) fail("native_launch_failed", result.error.message);
|
|
29
|
+
if (result.signal) process.kill(process.pid, result.signal);
|
|
30
|
+
else process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"authentication": "task-scoped access key; no account",
|
|
4
|
+
"commands": [
|
|
5
|
+
{
|
|
6
|
+
"method": "POST",
|
|
7
|
+
"path": "/api/v2/task/create",
|
|
8
|
+
"contentType": "multipart/form-data",
|
|
9
|
+
"description": "Create a guest task and freeze its one-time image quote"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"method": "POST",
|
|
13
|
+
"path": "/api/v2/task/read",
|
|
14
|
+
"contentType": "application/json",
|
|
15
|
+
"description": "Read a task with its private access key"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"method": "POST",
|
|
19
|
+
"path": "/api/v2/task/access",
|
|
20
|
+
"contentType": "application/json",
|
|
21
|
+
"description": "Restore a browser task access cookie"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"method": "POST",
|
|
25
|
+
"path": "/api/v2/task/config/read",
|
|
26
|
+
"contentType": "application/json",
|
|
27
|
+
"description": "Read one-image pricing and guest service configuration"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"method": "POST",
|
|
31
|
+
"path": "/api/v2/task/checkout/open",
|
|
32
|
+
"contentType": "application/json",
|
|
33
|
+
"description": "Return the one-time Creem checkout link"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"method": "POST",
|
|
37
|
+
"path": "/api/v2/task/paypal/prepare",
|
|
38
|
+
"contentType": "application/json",
|
|
39
|
+
"description": "Prepare the task's hosted PayPal checkout"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"method": "POST",
|
|
43
|
+
"path": "/api/v2/task/paypal/confirm",
|
|
44
|
+
"contentType": "application/json",
|
|
45
|
+
"description": "Confirm a PayPal order and capture only after buyer approval"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"method": "POST",
|
|
49
|
+
"path": "/api/v2/task/payment/read",
|
|
50
|
+
"contentType": "application/json",
|
|
51
|
+
"description": "Read the last verified payment state"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"method": "POST",
|
|
55
|
+
"path": "/api/v2/task/payment/verify",
|
|
56
|
+
"contentType": "application/json",
|
|
57
|
+
"description": "Verify an existing provider checkout; queue only verified paid work"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"method": "POST",
|
|
61
|
+
"path": "/api/v2/task/delivery/read",
|
|
62
|
+
"contentType": "application/json",
|
|
63
|
+
"description": "Verify payment and return short-lived artifact download URLs"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"workflows": [
|
|
67
|
+
{
|
|
68
|
+
"id": "image-layering",
|
|
69
|
+
"processingMethod": "editable-text",
|
|
70
|
+
"settingsRequired": false,
|
|
71
|
+
"delivery": ["PSD", "preview", "fonts"]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "spot-print",
|
|
75
|
+
"processingMethod": "spot-separation",
|
|
76
|
+
"settingsRequired": false,
|
|
77
|
+
"settings": {
|
|
78
|
+
"palette": "auto; extracted from image, up to 12 inks",
|
|
79
|
+
"process": "spot-screen",
|
|
80
|
+
"substrate": "white",
|
|
81
|
+
"dpi": 300
|
|
82
|
+
},
|
|
83
|
+
"delivery": [
|
|
84
|
+
"grayscale TIFF plates",
|
|
85
|
+
"transparent PNG plates",
|
|
86
|
+
"RGB layered PSD",
|
|
87
|
+
"proof",
|
|
88
|
+
"ZIP"
|
|
89
|
+
],
|
|
90
|
+
"halftone": false,
|
|
91
|
+
"nativeSpotChannels": false,
|
|
92
|
+
"CMYK": false
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
package/doc/usage.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# MagicLayers Agent CLI
|
|
2
|
+
|
|
3
|
+
`magiclayers` submits an image, returns hosted checkout, reads task/payment status and downloads verified delivery. It uses private per-task access without registration or an account session. Check the installed version with `magiclayers --version`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Install Node.js 22 or newer, then run `npm install -g @canvatopsd/magiclayers`. The npm package contains native executables and the Agent Skill; it does not compile or download executables during installation. Supported: macOS Apple Silicon and Linux x64 with glibc 2.31 or newer. Rust is not required. macOS Intel, Linux ARM64 and Windows are not currently included.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
magiclayers --version
|
|
11
|
+
magiclayers doctor
|
|
12
|
+
magiclayers skill install agents
|
|
13
|
+
magiclayers skill status agents
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The Skill also supports `codex`, `claude-code`, `cursor` and `copilot`; `--dir` selects a custom parent skills directory. Codex respects `CODEX_HOME`. Installation accepts identical content and refuses to overwrite different instructions or symlinks. Review local edits before removing/replacing an existing Skill. Start a new agent session after installation. `skill show` returns the embedded instructions offline.
|
|
17
|
+
|
|
18
|
+
The default service is `https://magiclayers.app` (prod). Select local explicitly with `--base-url http://127.0.0.1:3000` or `MAGICLAYERS_BASE_URL`. Doctor reads configuration; it does not prove payment or delivery. The npm package is `@canvatopsd/magiclayers`; its command and Skill name are both `magiclayers`. The selected Web release is published at `/agent/release.json`.
|
|
19
|
+
|
|
20
|
+
## Convert, pay, inspect, download
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
magiclayers convert ./image.png --email buyer@example.com --dry-run
|
|
24
|
+
magiclayers convert ./image.png --email buyer@example.com
|
|
25
|
+
# Use the task ID returned by convert:
|
|
26
|
+
magiclayers checkout TASK_ID
|
|
27
|
+
# After the buyer completes checkout:
|
|
28
|
+
magiclayers status TASK_ID
|
|
29
|
+
magiclayers download TASK_ID --output ./delivery.zip
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Input is PNG/JPEG/WebP, up to 30 MiB. Add `--print` to both conversion commands for automatic spot separations; otherwise the result is editable design layers. `--locale` defaults to `en-US`. Downloads default to the delivery package; use `--kind psd` or `--kind preview` for a single file. Business options always use full names such as `--email` and `--output`.
|
|
33
|
+
|
|
34
|
+
Create freezes the server quote and saves private access before sending. It does not charge. Checkout defaults to Creem and returns a hosted link for the buyer. Read verified financial facts with `magiclayers payment TASK_ID`. A redirect or browser success message alone is not proof of payment.
|
|
35
|
+
|
|
36
|
+
For PayPal:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
magiclayers checkout TASK_ID --provider paypal
|
|
40
|
+
# Only after buyer approval:
|
|
41
|
+
magiclayers verify-payment TASK_ID --provider paypal
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
PayPal confirmation can capture the saved order after approval. Creem verification uses `magiclayers verify-payment TASK_ID --checkout-id CHECKOUT_ID` and queues verification (HTTP 202). `--checkout-id` belongs only to Creem. Neither channel provides a refund command. Keep the original provider once checkout exists.
|
|
45
|
+
|
|
46
|
+
## Resume and protect access
|
|
47
|
+
|
|
48
|
+
Keep the returned UUIDv7 (compact or original form). After an uncertain submission, inspect that ID first. If resubmission is necessary, run `convert` with `--task-id TASK_ID` and the **same image, email, locale and workflow**. Never create a replacement task or payment merely because status is delayed. There is no automatic polling or retry.
|
|
49
|
+
|
|
50
|
+
Access files live under the OS local application-data directory in `magiclayers/tasks/<uuid>.json`, overridable by `MAGICLAYERS_ACCESS_DIRECTORY`. On macOS: `~/Library/Application Support/magiclayers/tasks/`. Unix directories/files use 0700/0600. Back them up privately; restore the original file on another machine and use the same service origin. Missing access is an explicit error. Do not share access keys, private task links or signed download URLs.
|
|
51
|
+
|
|
52
|
+
## Print output
|
|
53
|
+
|
|
54
|
+
New `--print` tasks automatically extract up to twelve inks at 300 DPI on white, preserving source pixel dimensions. Transparent input is composited onto white. The ZIP contains continuous-tone TIFF/PNG plates, an RGB layered PSD and proof. Halftoning, trapping, underbase and native Photoshop spot channels remain downstream. No manual palette is needed. Only retries of existing explicitly configured tasks need their saved `--print-settings` file together with `--print`.
|
|
55
|
+
|
|
56
|
+
## Output and discovery
|
|
57
|
+
|
|
58
|
+
Business commands return `{"ok":true,"data":...}` or `{"ok":false,"error":{"code":"...","message":"..."}}`. Argument errors exit 2; command failures exit 1. API failures retain HTTP status and code. Help/version are plain text. JSON is always used for business output; no `--json` flag is required or accepted.
|
|
59
|
+
|
|
60
|
+
`magiclayers discover` returns the offline API-owned [command inventory](../contracts/guest-agent-commands.json). Use the specific CLI commands for business actions; generic `request`, `read` aliases and the earlier `task` command layer are not exposed.
|
|
61
|
+
|
|
62
|
+
Downloads verify byte count and SHA-256 and never overwrite an existing output. The service checks current payment when download links are used; refunds/disputes revoke access. Transport errors do not print signed download URLs. Local payment uses test credentials; prod uses live payment. Local checks do not imply real payment acceptance.
|
|
63
|
+
|
|
64
|
+
## Source installation
|
|
65
|
+
|
|
66
|
+
The optional source installer at `https://magiclayers.app/agent/install.sh` requires Rust/Cargo with edition 2024 support and a native linker. Inspect the downloaded script before running it. It verifies the fixed-version source archive, builds locked dependencies and installs into `~/.local/share/magiclayers/cli/<version>/`. Add `~/.local/bin` to PATH. Source installation and npm installation are alternatives; do not install both into the same command directory.
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canvatopsd/magiclayers",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.6.1",
|
|
4
|
+
"description": "MagicLayers native CLI and Agent Skill for image-to-PSD layers, automatic spot-color separations, hosted checkout and verified downloads.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"magiclayers": "bin/magiclayers.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"runtime",
|
|
12
|
+
"skills",
|
|
13
|
+
"contracts",
|
|
14
|
+
"doc/usage.md",
|
|
15
|
+
"release.json"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=22"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {},
|
|
21
|
+
"homepage": "https://magiclayers.app/ai-agent/",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/canvatopsd/magiclayers-cli.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/canvatopsd/magiclayers-cli/issues"
|
|
28
|
+
},
|
|
29
|
+
"author": "CanvaToPSD",
|
|
30
|
+
"license": "UNLICENSED",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"registry": "https://registry.npmjs.org/"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"magiclayers",
|
|
37
|
+
"psd",
|
|
38
|
+
"image-layers",
|
|
39
|
+
"spot-color",
|
|
40
|
+
"cli",
|
|
41
|
+
"agent-skills"
|
|
42
|
+
],
|
|
43
|
+
"magiclayers": {
|
|
44
|
+
"targets": [
|
|
45
|
+
"darwin-arm64",
|
|
46
|
+
"linux-x64"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "2ca4334728d520f5a0cca03c5b82ef9400118739"
|
|
50
|
+
}
|
package/release.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.6.1",
|
|
3
|
+
"revision": "2ca4334728d520f5a0cca03c5b82ef9400118739",
|
|
4
|
+
"environment": "prod",
|
|
5
|
+
"targets": [
|
|
6
|
+
"darwin-arm64",
|
|
7
|
+
"linux-x64"
|
|
8
|
+
],
|
|
9
|
+
"binaries": {
|
|
10
|
+
"darwin-arm64": {
|
|
11
|
+
"sha256": "13a6923a31c5110f8cb74eb57247d82ba45c9b5af4e31046daebea2bc6cdc5a0"
|
|
12
|
+
},
|
|
13
|
+
"linux-x64": {
|
|
14
|
+
"sha256": "2207ef019e8affbe80c4cfb1f20f18832142cdadb8fd76e1692d34be83615241"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: magiclayers
|
|
3
|
+
description: Convert images into editable PSD layers or automatic spot-color print separations with the MagicLayers CLI; submit tasks, share hosted checkout, inspect progress and download verified delivery.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
Use the installed `magiclayers` command. Check `--version`, `discover` and `doctor`. If missing, install Node.js 22 or newer and run `npm install -g @canvatopsd/magiclayers`. The package includes native executables for macOS Apple Silicon and Linux x64 (glibc 2.31 or newer); Rust is not required. Other platforms are not supported by this npm release. Install this bundled Skill with `magiclayers skill install agents` or a supported agent name; `--dir` selects a parent skills directory. Do not overwrite different local Skill instructions. Start a new agent session after installation.
|
|
9
|
+
|
|
10
|
+
The default service is prod, `https://magiclayers.app`. Select local explicitly with `--base-url http://127.0.0.1:3000`. No account login or API key is required. Business output is always JSON (`ok/data` or `ok/error`); errors exit nonzero. Use full option names. There is no `--json`, generic `request`, `read` alias or `task` command prefix.
|
|
11
|
+
|
|
12
|
+
## Image workflow
|
|
13
|
+
|
|
14
|
+
Get the user's source image, delivery email and choice of editable design layers or print separations. Email is an auxiliary delivery/recovery contact; payment, task status and downloads are available directly through CLI commands without an email confirmation step.
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
magiclayers convert ./image.png --email buyer@example.com --dry-run
|
|
18
|
+
magiclayers convert ./image.png --email buyer@example.com
|
|
19
|
+
magiclayers checkout TASK_ID
|
|
20
|
+
# After buyer payment:
|
|
21
|
+
magiclayers status TASK_ID
|
|
22
|
+
magiclayers download TASK_ID --output ./delivery.zip
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Dry-run validates local arguments only and does not submit. Conversion freezes a quote and saves private access before sending; it does not charge. Share the hosted checkout link with the buyer. `payment TASK_ID` reads verified financial facts. For Creem, `verify-payment TASK_ID --checkout-id CHECKOUT_ID` queues provider verification. For PayPal, use `checkout TASK_ID --provider paypal`; only after buyer approval, run `verify-payment TASK_ID --provider paypal`, which can capture the saved order. Do not treat a redirect or HTTP 200 alone as proof of paid delivery. No refund command exists.
|
|
26
|
+
|
|
27
|
+
Add `--print` to both convert commands for print separations. New tasks automatically extract up to twelve inks at 300 DPI on white, retaining pixel dimensions. They need no palette/settings file. The ZIP includes continuous-tone TIFF/PNG plates, RGB layered PSD and proof; halftoning, trapping, underbase and native spot channels remain downstream. Use `--print-settings` only with an existing task's original explicit setup. Do not route print work through Canva.
|
|
28
|
+
|
|
29
|
+
## Resume and download
|
|
30
|
+
|
|
31
|
+
Preserve the returned task ID. On uncertain submission, inspect that same ID, then retry only if needed with `convert --task-id TASK_ID` and identical image/email/locale/workflow. Never create duplicate tasks or payments for recovery. Status checks are explicit; do not start automatic polling.
|
|
32
|
+
|
|
33
|
+
Private access is saved in the OS local application-data directory under `magiclayers/tasks/`, overridable with `MAGICLAYERS_ACCESS_DIRECTORY`. Missing access requires restoring the original private file, not a new payment. Do not print access keys or share private task/signed download links. Downloads verify size/SHA-256 and never overwrite output. Use `--kind psd` or `--kind preview` when needed.
|
|
34
|
+
|
|
35
|
+
Detailed installation, payment and recovery reference: https://magiclayers.app/agent/doc/usage.md.
|