@stage5/lumine 0.2.10 → 0.2.12

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/lib/assets.js CHANGED
@@ -81,8 +81,17 @@ export function resolveGenerateModel(options) {
81
81
  }
82
82
 
83
83
  export function formatBatteryPercent(energyUnits, fullBatteryUnits) {
84
- const total = Number(fullBatteryUnits) || 1_000_000;
85
- const percent = ((Number(energyUnits) || 0) / total) * 100;
84
+ const total = Number(fullBatteryUnits);
85
+ const units = Number(energyUnits);
86
+ if (
87
+ !Number.isFinite(total) ||
88
+ total <= 0 ||
89
+ !Number.isFinite(units) ||
90
+ units < 0
91
+ ) {
92
+ return "unavailable";
93
+ }
94
+ const percent = (units / total) * 100;
86
95
  if (percent <= 0) return "~0%";
87
96
  if (percent < 1) return "<1%";
88
97
  return `~${Math.round(percent)}%`;
@@ -201,7 +210,7 @@ export async function assetsGenerate(options) {
201
210
  const remaining = result?.aiUsagePolicy?.energyRemaining;
202
211
  if (Number.isFinite(Number(remaining))) {
203
212
  console.log(
204
- `Battery remaining: ${formatBatteryPercent(Number(remaining), result?.aiUsagePolicy?.fullBatteryUnits)}`,
213
+ `Battery remaining: ${formatBatteryPercent(Number(remaining), result?.aiUsagePolicy?.baseEnergyUnitsPerDay)}`,
205
214
  );
206
215
  }
207
216
  console.log(
package/lib/constants.js CHANGED
@@ -75,7 +75,8 @@ export const ASSET_MIME_BY_EXTENSION = {
75
75
  export const PROJECT_MAX_FILES = 100;
76
76
  export const PROJECT_MAX_EFFECTIVE_FILE_LINES = 500;
77
77
  export const PROJECT_EFFECTIVE_LINE_MAX_COLUMNS = 160;
78
- export const PROJECT_MAX_TOTAL_BYTES_DEFAULT = 300 * 1024;
78
+ export const PROJECT_MAX_TOTAL_BYTES_DEFAULT = 1024 * 1024;
79
+ export const PROJECT_WARN_TOTAL_BYTES = 500 * 1024;
79
80
  // Matches asset references in project files: absolute CloudFront URLs and
80
81
  // relative /attachments/build-runtime|optimized/... paths.
81
82
  export const RUNTIME_ASSET_REFERENCE_PATTERN =
@@ -218,7 +219,8 @@ lumine save --summary "Describe the change"
218
219
 
219
220
  - Max ${PROJECT_MAX_FILES} files per project; each file max ${PROJECT_MAX_EFFECTIVE_FILE_LINES} effective lines
220
221
  (a physical line counts once per ${PROJECT_EFFECTIVE_LINE_MAX_COLUMNS} characters, so minified one-liners
221
- blow the limit). Default total project size ~${Math.floor(PROJECT_MAX_TOTAL_BYTES_DEFAULT / 1024)} KB.
222
+ blow the limit). Default total project size cap ${Math.floor(PROJECT_MAX_TOTAL_BYTES_DEFAULT / 1024)} KB,
223
+ with a soft warning from ${Math.floor(PROJECT_WARN_TOTAL_BYTES / 1024)} KB.
222
224
  - Plan file splits BEFORE writing code; \`lumine check\` validates the local
223
225
  workspace against these limits without saving, and \`lumine save\` fails fast
224
226
  locally listing every violation.
package/lib/thumbnail.js CHANGED
@@ -324,7 +324,7 @@ export async function thumbnailGenerate(options) {
324
324
  const remaining = result?.aiUsagePolicy?.energyRemaining;
325
325
  if (Number.isFinite(Number(remaining))) {
326
326
  console.log(
327
- `Battery remaining: ${formatBatteryPercent(Number(remaining), result?.aiUsagePolicy?.fullBatteryUnits)}`,
327
+ `Battery remaining: ${formatBatteryPercent(Number(remaining), result?.aiUsagePolicy?.baseEnergyUnitsPerDay)}`,
328
328
  );
329
329
  }
330
330
  }
package/lib/workspace.js CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  PROJECT_MAX_EFFECTIVE_FILE_LINES,
16
16
  PROJECT_MAX_FILES,
17
17
  PROJECT_MAX_TOTAL_BYTES_DEFAULT,
18
+ PROJECT_WARN_TOTAL_BYTES,
18
19
  PROJECT_METADATA_DIR,
19
20
  PROJECT_METADATA_FILE,
20
21
  SDK_REFERENCE_FALLBACK,
@@ -304,6 +305,14 @@ export function collectProjectLimitFindings(files) {
304
305
  PROJECT_MAX_TOTAL_BYTES_DEFAULT / 1024,
305
306
  )} KB project limit — the server may reject this save.`,
306
307
  );
308
+ } else if (totalBytes > PROJECT_WARN_TOTAL_BYTES) {
309
+ warnings.push(
310
+ `Project files total ${formatBytes(totalBytes)} — approaching the ${Math.floor(
311
+ PROJECT_MAX_TOTAL_BYTES_DEFAULT / 1024,
312
+ )} KB project cap (soft warning from ${Math.floor(
313
+ PROJECT_WARN_TOTAL_BYTES / 1024,
314
+ )} KB). Keep files lean where structure allows.`,
315
+ );
307
316
  }
308
317
  return { errors, warnings };
309
318
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stage5/lumine",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Command line tools for launching Lumine builds on Twinkle.",
5
5
  "type": "module",
6
6
  "bin": {