@pixelvibing/cli 0.12.0 → 0.13.0
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/dist/pixel-vibing-cli.js +25 -26
- package/package.json +1 -1
- package/skills/pixelvibing/SKILL.md +2 -2
package/dist/pixel-vibing-cli.js
CHANGED
|
@@ -520,12 +520,17 @@ class TooFewCredits extends Error {
|
|
|
520
520
|
this.credits = credits;
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
function costIn(prices, kind
|
|
523
|
+
function costIn(prices, kind) {
|
|
524
524
|
const price = prices.kinds[kind];
|
|
525
525
|
if (price === void 0) return null;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
526
|
+
return "credits" in price ? price.credits : price.upTo;
|
|
527
|
+
}
|
|
528
|
+
function costWords(prices, kind) {
|
|
529
|
+
const price = prices.kinds[kind];
|
|
530
|
+
if (price === void 0) return null;
|
|
531
|
+
const most = "credits" in price ? price.credits : price.upTo;
|
|
532
|
+
const credits = `${most} credit${most === 1 ? "" : "s"}`;
|
|
533
|
+
return "credits" in price ? credits : `up to ${credits}, what it does not use given back`;
|
|
529
534
|
}
|
|
530
535
|
const id = (value) => encodeURIComponent(value);
|
|
531
536
|
function createWebApi(fetcher = (input, init2) => fetch(input, init2), base = API_BASE) {
|
|
@@ -3691,9 +3696,7 @@ function jobWords(job) {
|
|
|
3691
3696
|
}
|
|
3692
3697
|
}
|
|
3693
3698
|
function costOf(prices, request) {
|
|
3694
|
-
|
|
3695
|
-
const frames = request.body.frameCount;
|
|
3696
|
-
return costIn(prices, request.kind, typeof quality === "string" ? quality : void 0, typeof frames === "number" ? frames : void 0);
|
|
3699
|
+
return costIn(prices, request.kind);
|
|
3697
3700
|
}
|
|
3698
3701
|
async function startGeneration(api, project, request) {
|
|
3699
3702
|
const ids = {};
|
|
@@ -3833,8 +3836,8 @@ function sentSketch(sketch, description) {
|
|
|
3833
3836
|
function sketchSendProblem(sketch, description) {
|
|
3834
3837
|
return sketchProblem(sentSketch(sketch, description));
|
|
3835
3838
|
}
|
|
3836
|
-
function sketchBody(sketch, description
|
|
3837
|
-
return { ...sentSketch(sketch, description)
|
|
3839
|
+
function sketchBody(sketch, description) {
|
|
3840
|
+
return { ...sentSketch(sketch, description) };
|
|
3838
3841
|
}
|
|
3839
3842
|
const LARGEST_FOOTPRINT = {
|
|
3840
3843
|
cols: Math.min(Math.floor(WINDOW_PX.width / SCALES.at(-1)), Math.floor(MAX_ASSEMBLED_PX / TILE_SIZE)),
|
|
@@ -3861,7 +3864,6 @@ const MAX_CELL = 16;
|
|
|
3861
3864
|
const MIN_CELL = 8;
|
|
3862
3865
|
const ROUTE_MAX_EDGE = 3840;
|
|
3863
3866
|
const ROUTE_MAX_PIXELS = 8294400;
|
|
3864
|
-
const DEFAULT_QUALITY = "medium";
|
|
3865
3867
|
const ROUTE_MIN_PIXELS = 655360;
|
|
3866
3868
|
const ROUTE_STEP = 16;
|
|
3867
3869
|
function gridForCells(cols, rows, cellsPerTile = CELLS_PER_TILE) {
|
|
@@ -3892,10 +3894,6 @@ function designCanvas(tiles) {
|
|
|
3892
3894
|
if (scale === null) return null;
|
|
3893
3895
|
return { cols: tiles.cols, rows: tiles.rows, scale, width: tiles.cols * scale, height: tiles.rows * scale };
|
|
3894
3896
|
}
|
|
3895
|
-
const EDIT_QUALITIES = ["low", "medium", "high", "xhigh", "max"];
|
|
3896
|
-
function isEditQuality(value) {
|
|
3897
|
-
return typeof value === "string" && EDIT_QUALITIES.includes(value);
|
|
3898
|
-
}
|
|
3899
3897
|
const GENERATED = {
|
|
3900
3898
|
object: { references: 8, words: "an object" },
|
|
3901
3899
|
creature: { references: 3, words: "a creature" },
|
|
@@ -4004,8 +4002,8 @@ async function requestOf(context, kind, args) {
|
|
|
4004
4002
|
const instruction = stringOf(args, "instruction")?.trim() ?? "";
|
|
4005
4003
|
const set = kind === "hud" || kind === "icons";
|
|
4006
4004
|
if (instruction === "" && !set) throw new CliError("say what to make with --instruction");
|
|
4007
|
-
|
|
4008
|
-
|
|
4005
|
+
if (stringOf(args, "quality") !== void 0)
|
|
4006
|
+
context.io.warn("--quality is the platform's to choose now: it draws each asset at the quality it needs, and nothing was sent for it.\n");
|
|
4009
4007
|
const paths = stringsOf(args, "reference");
|
|
4010
4008
|
if (paths.length > known.references)
|
|
4011
4009
|
throw new CliError(known.references === 0 ? `${known.words} takes no reference` : `${known.words} takes at most ${known.references} references`);
|
|
@@ -4017,7 +4015,7 @@ async function requestOf(context, kind, args) {
|
|
|
4017
4015
|
for (const path of paths) styles.push(await referenceOf(context, path));
|
|
4018
4016
|
return {
|
|
4019
4017
|
kind,
|
|
4020
|
-
body: sketchBody(sketch, instruction
|
|
4018
|
+
body: sketchBody(sketch, instruction),
|
|
4021
4019
|
...styles.length > 0 ? { images: { references: styles } } : {},
|
|
4022
4020
|
words: `${words2}${styles.length > 0 ? `, in the style of ${styles.length} reference${styles.length === 1 ? "" : "s"}` : ""}: ${instruction}`
|
|
4023
4021
|
};
|
|
@@ -4026,14 +4024,14 @@ async function requestOf(context, kind, args) {
|
|
|
4026
4024
|
if (set) {
|
|
4027
4025
|
const { fields, words: words2 } = interfaceFields(kind, args);
|
|
4028
4026
|
if (stringOf(args, "tiles") !== void 0) throw new CliError("--tiles is a level design's");
|
|
4029
|
-
const body2 = { ...fields, ...instruction === "" ? {} : { instruction }
|
|
4027
|
+
const body2 = { ...fields, ...instruction === "" ? {} : { instruction } };
|
|
4030
4028
|
return { kind, body: body2, words: instruction === "" ? words2 : `${words2}; ${instruction}` };
|
|
4031
4029
|
}
|
|
4032
4030
|
for (const flag of ["pieces", "names", "purpose"])
|
|
4033
4031
|
if (stringOf(args, flag) !== void 0) throw new CliError(`--${flag} is ${flag === "pieces" ? "a HUD set's" : "an icon set's"}`);
|
|
4034
4032
|
const references = [];
|
|
4035
4033
|
for (const path of paths) references.push(await referenceOf(context, path));
|
|
4036
|
-
const body = { instruction
|
|
4034
|
+
const body = { instruction };
|
|
4037
4035
|
let words = `${known.words}: ${instruction}`;
|
|
4038
4036
|
if (kind === "object") {
|
|
4039
4037
|
const footprint = sizeOf(stringOf(args, "size") ?? "1x1", "--size");
|
|
@@ -4054,7 +4052,7 @@ async function requestOf(context, kind, args) {
|
|
|
4054
4052
|
}
|
|
4055
4053
|
async function confirmed(context, platform, what, cost, yes) {
|
|
4056
4054
|
const credits = (await platform.web.billing()).credits;
|
|
4057
|
-
const priced = cost === null ? "at a cost the platform will say" : `for ${cost}
|
|
4055
|
+
const priced = cost === null ? "at a cost the platform will say" : `for ${cost}`;
|
|
4058
4056
|
context.io.warn(`Making ${what}, ${priced}; the account has ${credits}.
|
|
4059
4057
|
`);
|
|
4060
4058
|
if (yes) return;
|
|
@@ -4078,7 +4076,7 @@ async function followed(context, platform, jobId) {
|
|
|
4078
4076
|
const generate = {
|
|
4079
4077
|
name: "generate",
|
|
4080
4078
|
summary: "Generate an object, a creature, a level design, a HUD set, icons, a HUD mockup or a UI sketch on the platform, then pull it",
|
|
4081
|
-
usage: "<object|creature|level-design|hud|icons|hud-mockup|ui-sketch> [--instruction <text>] [--size <c>x<r>|<px>] [--tiles <c>x<r>] [--pieces <list>] [--names <list>] [--purpose skill|item] [--sketch <json>] [--reference <png>]… [--
|
|
4079
|
+
usage: "<object|creature|level-design|hud|icons|hud-mockup|ui-sketch> [--instruction <text>] [--size <c>x<r>|<px>] [--tiles <c>x<r>] [--pieces <list>] [--names <list>] [--purpose skill|item] [--sketch <json>] [--reference <png>]… [--yes]",
|
|
4082
4080
|
options: {
|
|
4083
4081
|
instruction: {
|
|
4084
4082
|
type: "string",
|
|
@@ -4100,7 +4098,7 @@ const generate = {
|
|
|
4100
4098
|
description: "a UI sketch's file: { canvas: { width, height }, shapes: [{ label, kind, x, y, width, height, radius?, sides?, caption?, note?, border?, hollow? }] }"
|
|
4101
4099
|
},
|
|
4102
4100
|
reference: { type: "string", multiple: true, value: "<png>", description: "an image to draw from" },
|
|
4103
|
-
quality: { type: "string", value: "<quality>", description:
|
|
4101
|
+
quality: { type: "string", value: "<quality>", description: "the platform's to choose now; ignored, and said so" },
|
|
4104
4102
|
yes: { type: "boolean", short: "y", description: "start it without asking, once the cost is said" },
|
|
4105
4103
|
as: { type: "string", value: "<name>", description: "land it under this name instead of the platform's" },
|
|
4106
4104
|
aside: { type: "boolean", description: "keep a folder's own map and art under pixelvibing/before-platform/, and write it from the platform" }
|
|
@@ -4113,8 +4111,9 @@ const generate = {
|
|
|
4113
4111
|
const request = await requestOf(context, kind, args);
|
|
4114
4112
|
await checkFolder(local, flagOf(args, "aside"));
|
|
4115
4113
|
const platform = await signedIn(context);
|
|
4116
|
-
const
|
|
4117
|
-
|
|
4114
|
+
const prices = await platform.web.prices();
|
|
4115
|
+
const cost = costOf(prices, request);
|
|
4116
|
+
await confirmed(context, platform, request.words, costWords(prices, request.kind), flagOf(args, "yes"));
|
|
4118
4117
|
const jobId = await paying(platform, () => startGeneration(platform.web, project, request));
|
|
4119
4118
|
context.io.warn(`Started the job ${jobId}.
|
|
4120
4119
|
`);
|
|
@@ -4284,7 +4283,7 @@ const guideRevise = {
|
|
|
4284
4283
|
if (instruction === "") throw new CliError("say what to change in the style guide");
|
|
4285
4284
|
if (!flagOf(args, "force") && await unpushed(local)) throw new CliError(CHANGED);
|
|
4286
4285
|
const platform = await signedIn(context);
|
|
4287
|
-
const cost =
|
|
4286
|
+
const cost = costWords(await platform.web.prices(), GUIDE_KIND);
|
|
4288
4287
|
await confirmed(context, platform, `a revision of the style guide: ${instruction}`, cost, flagOf(args, "yes"));
|
|
4289
4288
|
const jobId = await paying(platform, () => platform.web.reviseGuide(project, instruction));
|
|
4290
4289
|
context.io.warn(`Started the job ${jobId}.
|
|
@@ -4577,7 +4576,7 @@ const move = {
|
|
|
4577
4576
|
);
|
|
4578
4577
|
}
|
|
4579
4578
|
};
|
|
4580
|
-
const version = "0.
|
|
4579
|
+
const version = "0.13.0";
|
|
4581
4580
|
const manifest = {
|
|
4582
4581
|
version
|
|
4583
4582
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixelvibing/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "PixelVibing: pixel art game assets from the command line, and the Skills that teach coding assistants to make them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://pixelvibing.com",
|
|
@@ -47,8 +47,8 @@ Each generation spends the account's credits.
|
|
|
47
47
|
- **The options.**
|
|
48
48
|
- `--size` is an object's footprint in whole tiles, `1x1` unless given.
|
|
49
49
|
- `--tiles` is how many tiles a level design is across, `6x4` unless given.
|
|
50
|
-
-
|
|
51
|
-
the
|
|
50
|
+
- No quality is given: the platform draws each asset at the quality it needs. The cost
|
|
51
|
+
printed is the most it may take, and what it does not use is given back.
|
|
52
52
|
- `--reference` is a PNG to draw from, repeated for several: at most 8 for an object,
|
|
53
53
|
3 for a creature, a level design, a HUD mockup or a UI sketch, none for a HUD set or icons. A UI
|
|
54
54
|
sketch's references are a style to follow (frames, materials, a way of drawing), never what to draw.
|