@naseej/blox 1.6.2 → 1.6.3
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/run.js +107 -42
- package/package.json +1 -1
- package/readme.md +235 -178
package/dist/run.js
CHANGED
|
@@ -199,7 +199,7 @@ var checkForCliUpdate = async (currentVersion, argv = []) => {
|
|
|
199
199
|
};
|
|
200
200
|
|
|
201
201
|
// package.json
|
|
202
|
-
var version = "1.6.
|
|
202
|
+
var version = "1.6.3";
|
|
203
203
|
|
|
204
204
|
// src/commands/add/index.ts
|
|
205
205
|
var import_fs_extra10 = __toESM(require("fs-extra"));
|
|
@@ -922,6 +922,16 @@ var listCommits = async (limit, skip, cwd = ".") => {
|
|
|
922
922
|
return { hash, subject: subjectRaw.trim() };
|
|
923
923
|
});
|
|
924
924
|
};
|
|
925
|
+
var listCommitsOldestFirst = async (cwd = ".") => {
|
|
926
|
+
let out = "";
|
|
927
|
+
await $("git", ["log", "--reverse", "--pretty=format:%H", "HEAD"], {
|
|
928
|
+
cwd,
|
|
929
|
+
onStdout: (text2) => {
|
|
930
|
+
out += text2;
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
return out.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
934
|
+
};
|
|
925
935
|
var fetchCommit = async (fromRepo, commit2, cwd = ".") => {
|
|
926
936
|
const ref = normalizeCommitRef(commit2);
|
|
927
937
|
await $("git", ["fetch", fromRepo, `+${ref}:FETCH_HEAD`], { cwd });
|
|
@@ -1000,6 +1010,7 @@ var git = {
|
|
|
1000
1010
|
checkoutFile,
|
|
1001
1011
|
revertPathToHead,
|
|
1002
1012
|
listCommits,
|
|
1013
|
+
listCommitsOldestFirst,
|
|
1003
1014
|
fetchCommit,
|
|
1004
1015
|
cherryPick,
|
|
1005
1016
|
reset,
|
|
@@ -1176,6 +1187,13 @@ var upeToDate = false;
|
|
|
1176
1187
|
var cacheDirNameForRegistry = (registry) => {
|
|
1177
1188
|
return encodeURIComponent(registry).replace(/%/g, "_");
|
|
1178
1189
|
};
|
|
1190
|
+
var getConfiguredRegistryDirs = () => {
|
|
1191
|
+
const config = getLocalConfig();
|
|
1192
|
+
return config.registries.map((registry) => ({
|
|
1193
|
+
registry,
|
|
1194
|
+
dir: import_node_path12.default.join(registriesDataPath, cacheDirNameForRegistry(registry))
|
|
1195
|
+
}));
|
|
1196
|
+
};
|
|
1179
1197
|
var syncRegistries = async (branch) => {
|
|
1180
1198
|
if (upeToDate) return;
|
|
1181
1199
|
upeToDate = true;
|
|
@@ -1205,9 +1223,8 @@ var syncRegistries = async (branch) => {
|
|
|
1205
1223
|
var getAvailableTemplates = async () => {
|
|
1206
1224
|
debug("Get available templates");
|
|
1207
1225
|
const templates = {};
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1210
|
-
const indexPath = import_node_path12.default.join(registriesDataPath, registry, "index.json");
|
|
1226
|
+
for (const { dir } of getConfiguredRegistryDirs()) {
|
|
1227
|
+
const indexPath = import_node_path12.default.join(dir, "index.json");
|
|
1211
1228
|
if (import_fs_extra9.default.existsSync(indexPath)) {
|
|
1212
1229
|
const data = import_fs_extra9.default.readJSONSync(indexPath);
|
|
1213
1230
|
Object.entries(data.templates || {}).forEach(([templateName, template]) => {
|
|
@@ -1249,13 +1266,11 @@ var getAvailableBlocks = async (templateInfo) => {
|
|
|
1249
1266
|
return blocks;
|
|
1250
1267
|
};
|
|
1251
1268
|
var getAvailableVersions = async (source) => {
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1254
|
-
const registryPath = import_node_path12.default.join(registriesDataPath, registry);
|
|
1255
|
-
const indexPath = import_node_path12.default.join(registryPath, "index.json");
|
|
1269
|
+
for (const { dir } of getConfiguredRegistryDirs()) {
|
|
1270
|
+
const indexPath = import_node_path12.default.join(dir, "index.json");
|
|
1256
1271
|
if (!import_fs_extra9.default.existsSync(indexPath)) continue;
|
|
1257
1272
|
const registryData = import_fs_extra9.default.readJSONSync(indexPath);
|
|
1258
|
-
const versionDirPath = import_node_path12.default.join(
|
|
1273
|
+
const versionDirPath = import_node_path12.default.join(dir, "versions");
|
|
1259
1274
|
const versionsFilePaths = [
|
|
1260
1275
|
import_node_path12.default.join(versionDirPath, `${source.replace(`${registryData.baseUrl}/`, "")}.json`),
|
|
1261
1276
|
import_node_path12.default.join(versionDirPath, `${encodeURIComponent(source)}.json`)
|
|
@@ -1590,7 +1605,7 @@ var ContributionWorkflow = class {
|
|
|
1590
1605
|
await this.assertAppRepoClean();
|
|
1591
1606
|
const target = await this.targetSelector.selectTargetInteractive();
|
|
1592
1607
|
const mode = flags.existing ? "existing" : "new";
|
|
1593
|
-
const { title, description } = await this.
|
|
1608
|
+
const { title, description } = await this.promptContributionMeta(flags);
|
|
1594
1609
|
const commits = await this.resolveCommitsFromFlags(flags);
|
|
1595
1610
|
const branch = await this.resolveContributionBranch({ mode, target, title });
|
|
1596
1611
|
return this.run({
|
|
@@ -1677,19 +1692,17 @@ var ContributionWorkflow = class {
|
|
|
1677
1692
|
);
|
|
1678
1693
|
}
|
|
1679
1694
|
}
|
|
1680
|
-
async
|
|
1681
|
-
let title = flags.title;
|
|
1682
|
-
let description = flags.description;
|
|
1683
|
-
if (
|
|
1684
|
-
|
|
1685
|
-
title
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
description = await text({ message: "Description (optional)", defaultValue: "" });
|
|
1692
|
-
}
|
|
1695
|
+
async promptContributionMeta(flags) {
|
|
1696
|
+
let title = flags.title?.trim();
|
|
1697
|
+
let description = flags.description?.trim();
|
|
1698
|
+
if (!title) {
|
|
1699
|
+
title = await text({
|
|
1700
|
+
message: "Contribution title (conventional commit style recommended)",
|
|
1701
|
+
validate: (v) => v.trim() ? void 0 : "Title is required"
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
if (description === void 0) {
|
|
1705
|
+
description = await text({ message: "Description (optional)", defaultValue: "" });
|
|
1693
1706
|
}
|
|
1694
1707
|
return { title, description };
|
|
1695
1708
|
}
|
|
@@ -1847,6 +1860,23 @@ function getPathPrefixToStrip(target) {
|
|
|
1847
1860
|
return "";
|
|
1848
1861
|
}
|
|
1849
1862
|
|
|
1863
|
+
// src/services/contribute/utils/orderCommitsOldestToNewest.ts
|
|
1864
|
+
var orderCommitsOldestToNewest = (commits, history) => {
|
|
1865
|
+
const historyIndex = new Map(history.map((commit2, index) => [commit2, index]));
|
|
1866
|
+
const uniqueCommits = [...new Set(commits)];
|
|
1867
|
+
const missingCommits = uniqueCommits.filter((commit2) => !historyIndex.has(commit2));
|
|
1868
|
+
if (missingCommits.length) {
|
|
1869
|
+
throw new Error(
|
|
1870
|
+
`Unable to order commits because these hashes were not found in repo history: ${missingCommits.join(", ")}`
|
|
1871
|
+
);
|
|
1872
|
+
}
|
|
1873
|
+
return uniqueCommits.sort((left, right) => {
|
|
1874
|
+
const leftIndex = historyIndex.get(left);
|
|
1875
|
+
const rightIndex = historyIndex.get(right);
|
|
1876
|
+
return leftIndex - rightIndex;
|
|
1877
|
+
});
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1850
1880
|
// src/services/contribute/utils/shouldExcludeFile.ts
|
|
1851
1881
|
function shouldExcludeFile(file, excludedPrefixes) {
|
|
1852
1882
|
const f = normalizePath(file);
|
|
@@ -1873,7 +1903,8 @@ var CommitApplierService = class {
|
|
|
1873
1903
|
projectIgnore
|
|
1874
1904
|
});
|
|
1875
1905
|
prepareSpinner.stop("Prepared apply commits");
|
|
1876
|
-
const
|
|
1906
|
+
const history = await git.listCommitsOldestFirst(opts.appRepoCwd);
|
|
1907
|
+
const orderedCommits = orderCommitsOldestToNewest(opts.commits, history);
|
|
1877
1908
|
for (const commit2 of orderedCommits) {
|
|
1878
1909
|
await this.applySingleCommit(
|
|
1879
1910
|
opts,
|
|
@@ -3096,6 +3127,12 @@ It has been recreated to apply upstream changes.`
|
|
|
3096
3127
|
}
|
|
3097
3128
|
|
|
3098
3129
|
// src/commands/update/utils.ts
|
|
3130
|
+
async function confirmContinueWhenMissing(itemType, name) {
|
|
3131
|
+
return confirm({
|
|
3132
|
+
message: `${itemType}: ${name} does not exist in registries. Continue updating remaining parts?`,
|
|
3133
|
+
initialValue: true
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3099
3136
|
async function updateApp({
|
|
3100
3137
|
templateDef,
|
|
3101
3138
|
templates,
|
|
@@ -3105,10 +3142,14 @@ async function updateApp({
|
|
|
3105
3142
|
hard = false
|
|
3106
3143
|
}) {
|
|
3107
3144
|
let updated = false;
|
|
3145
|
+
let shouldContinue = true;
|
|
3108
3146
|
await runTask({ start: "Update App", end: "Updated App" }, async () => {
|
|
3109
3147
|
const template = templates[templateDef.name];
|
|
3110
3148
|
if (!template) {
|
|
3111
|
-
|
|
3149
|
+
shouldContinue = await confirmContinueWhenMissing(
|
|
3150
|
+
"template" /* TEMPLATE */,
|
|
3151
|
+
templateDef.name
|
|
3152
|
+
);
|
|
3112
3153
|
return;
|
|
3113
3154
|
}
|
|
3114
3155
|
const toAppCommit = await updateFromRemote({
|
|
@@ -3122,7 +3163,14 @@ async function updateApp({
|
|
|
3122
3163
|
if (!templateDef.bases?.length) return;
|
|
3123
3164
|
for (const block of usedBlocks) {
|
|
3124
3165
|
const blockRegistryData = availableBlocks[block.name];
|
|
3125
|
-
if (!blockRegistryData)
|
|
3166
|
+
if (!blockRegistryData) {
|
|
3167
|
+
shouldContinue = await confirmContinueWhenMissing(
|
|
3168
|
+
"block" /* BLOCK */,
|
|
3169
|
+
block.name
|
|
3170
|
+
);
|
|
3171
|
+
if (!shouldContinue) return;
|
|
3172
|
+
continue;
|
|
3173
|
+
}
|
|
3126
3174
|
await git.updateRemote(block.name, blockRegistryData.source);
|
|
3127
3175
|
const blockPath = import_node_path22.default.join(blocksDir, block.name);
|
|
3128
3176
|
const currentBloxFile = getBloxFile(blockPath);
|
|
@@ -3139,17 +3187,21 @@ async function updateApp({
|
|
|
3139
3187
|
}
|
|
3140
3188
|
}
|
|
3141
3189
|
});
|
|
3142
|
-
return updated;
|
|
3190
|
+
return { updated, shouldContinue };
|
|
3143
3191
|
}
|
|
3144
3192
|
async function updateAppBases(templateDef, templates, ignore3, hard = false) {
|
|
3145
3193
|
let updated = false;
|
|
3194
|
+
let shouldContinue = true;
|
|
3146
3195
|
for (const base of templateDef.bases || []) {
|
|
3147
3196
|
await runTask(
|
|
3148
3197
|
{ start: `Update App base: ${base.name}`, end: `Updated App base: ${base.name}` },
|
|
3149
3198
|
async () => {
|
|
3150
3199
|
const template = templates[base.name];
|
|
3151
3200
|
if (!template) {
|
|
3152
|
-
|
|
3201
|
+
shouldContinue = await confirmContinueWhenMissing(
|
|
3202
|
+
"base" /* BASE */,
|
|
3203
|
+
base.name
|
|
3204
|
+
);
|
|
3153
3205
|
return;
|
|
3154
3206
|
}
|
|
3155
3207
|
const toCommit = await updateFromRemote({
|
|
@@ -3161,16 +3213,18 @@ async function updateAppBases(templateDef, templates, ignore3, hard = false) {
|
|
|
3161
3213
|
if (toCommit) updated = true;
|
|
3162
3214
|
}
|
|
3163
3215
|
);
|
|
3216
|
+
if (!shouldContinue) break;
|
|
3164
3217
|
}
|
|
3165
|
-
return updated;
|
|
3218
|
+
return { updated, shouldContinue };
|
|
3166
3219
|
}
|
|
3167
3220
|
async function updateBlock(block, blocks, ignore3, hard = false) {
|
|
3168
3221
|
const blockRegistryData = blocks[block];
|
|
3169
3222
|
const blockPath = import_node_path22.default.join(blocksDir, block);
|
|
3170
3223
|
let updated = false;
|
|
3224
|
+
let shouldContinue = true;
|
|
3171
3225
|
await runTask({ start: `Update block: ${block}`, end: `Updated block: ${block}` }, async () => {
|
|
3172
3226
|
if (!blockRegistryData) {
|
|
3173
|
-
|
|
3227
|
+
shouldContinue = await confirmContinueWhenMissing("block" /* BLOCK */, block);
|
|
3174
3228
|
return;
|
|
3175
3229
|
}
|
|
3176
3230
|
const toCommit = await updateFromRemote({
|
|
@@ -3185,7 +3239,7 @@ async function updateBlock(block, blocks, ignore3, hard = false) {
|
|
|
3185
3239
|
if (updated) {
|
|
3186
3240
|
await runLifecycleHookWithTask(blockPath, "update", "Run block update");
|
|
3187
3241
|
}
|
|
3188
|
-
return updated;
|
|
3242
|
+
return { updated, shouldContinue };
|
|
3189
3243
|
}
|
|
3190
3244
|
async function getCurrentCheckpoints() {
|
|
3191
3245
|
const bloxFile = getBloxFile();
|
|
@@ -3251,8 +3305,9 @@ var update2 = command("update").description("Update app/block").alias("u").addOp
|
|
|
3251
3305
|
}
|
|
3252
3306
|
try {
|
|
3253
3307
|
let hasUpdate = false;
|
|
3308
|
+
let shouldContinue = true;
|
|
3254
3309
|
if (["app", "all"].includes(args.scope)) {
|
|
3255
|
-
const
|
|
3310
|
+
const appResult = await updateApp({
|
|
3256
3311
|
templateDef,
|
|
3257
3312
|
templates,
|
|
3258
3313
|
usedBlocks,
|
|
@@ -3260,29 +3315,35 @@ var update2 = command("update").description("Update app/block").alias("u").addOp
|
|
|
3260
3315
|
ignore: ignoresByName[templateDef.name],
|
|
3261
3316
|
hard: args.hard
|
|
3262
3317
|
});
|
|
3263
|
-
hasUpdate = hasUpdate ||
|
|
3318
|
+
hasUpdate = hasUpdate || appResult.updated;
|
|
3319
|
+
shouldContinue = appResult.shouldContinue;
|
|
3264
3320
|
}
|
|
3265
|
-
if (["bases", "all"].includes(args.scope)) {
|
|
3266
|
-
const
|
|
3321
|
+
if (shouldContinue && ["bases", "all"].includes(args.scope)) {
|
|
3322
|
+
const basesResult = await updateAppBases(
|
|
3267
3323
|
templateDef,
|
|
3268
3324
|
templates,
|
|
3269
3325
|
ignoresByName[templateDef.name],
|
|
3270
3326
|
args.hard
|
|
3271
3327
|
);
|
|
3272
|
-
hasUpdate = hasUpdate ||
|
|
3328
|
+
hasUpdate = hasUpdate || basesResult.updated;
|
|
3329
|
+
shouldContinue = basesResult.shouldContinue;
|
|
3273
3330
|
}
|
|
3274
|
-
if (args.scope === "all") {
|
|
3331
|
+
if (shouldContinue && args.scope === "all") {
|
|
3275
3332
|
for (const block of usedBlocks) {
|
|
3276
|
-
const
|
|
3333
|
+
const blockResult = await updateBlock(
|
|
3277
3334
|
block.name,
|
|
3278
3335
|
availableBlocks,
|
|
3279
3336
|
ignoresByName[block.name],
|
|
3280
3337
|
args.hard
|
|
3281
3338
|
);
|
|
3282
|
-
hasUpdate = hasUpdate ||
|
|
3339
|
+
hasUpdate = hasUpdate || blockResult.updated;
|
|
3340
|
+
if (!blockResult.shouldContinue) {
|
|
3341
|
+
shouldContinue = false;
|
|
3342
|
+
break;
|
|
3343
|
+
}
|
|
3283
3344
|
}
|
|
3284
3345
|
}
|
|
3285
|
-
if (args.scope === "block") {
|
|
3346
|
+
if (shouldContinue && args.scope === "block") {
|
|
3286
3347
|
if (!args.block) {
|
|
3287
3348
|
args.block = await select({
|
|
3288
3349
|
message: "Select block to be updated",
|
|
@@ -3297,13 +3358,17 @@ var update2 = command("update").description("Update app/block").alias("u").addOp
|
|
|
3297
3358
|
error("Selected block not used in app");
|
|
3298
3359
|
return;
|
|
3299
3360
|
}
|
|
3300
|
-
const
|
|
3361
|
+
const blockResult = await updateBlock(
|
|
3301
3362
|
blockDef.name,
|
|
3302
3363
|
availableBlocks,
|
|
3303
3364
|
ignoresByName[blockDef.name],
|
|
3304
3365
|
args.hard
|
|
3305
3366
|
);
|
|
3306
|
-
hasUpdate = hasUpdate ||
|
|
3367
|
+
hasUpdate = hasUpdate || blockResult.updated;
|
|
3368
|
+
shouldContinue = blockResult.shouldContinue;
|
|
3369
|
+
}
|
|
3370
|
+
if (!shouldContinue) {
|
|
3371
|
+
import_prompts23.log.warn(fmt.yellow("Stopped updating remaining parts by user choice"));
|
|
3307
3372
|
}
|
|
3308
3373
|
if (hasUpdate) {
|
|
3309
3374
|
await runLifecycleHookWithTask(".", "update", "Run template update");
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,284 +1,341 @@
|
|
|
1
1
|
# BLOX CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
BLOX CLI helps you bootstrap, manage, update, and contribute BLOX-based apps and blocks.
|
|
4
|
+
|
|
5
|
+
## Content
|
|
6
|
+
|
|
7
|
+
- [BLOX CLI](#blox-cli)
|
|
8
|
+
- [Content](#content)
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Quick Start](#quick-start)
|
|
11
|
+
- [Commands](#commands)
|
|
12
|
+
- [init](#init)
|
|
13
|
+
- [add](#add)
|
|
14
|
+
- [remove](#remove)
|
|
15
|
+
- [update](#update)
|
|
16
|
+
- [contribute](#contribute)
|
|
17
|
+
- [conf](#conf)
|
|
18
|
+
- [upgrade](#upgrade)
|
|
19
|
+
- [migrate](#migrate)
|
|
20
|
+
- [skills](#skills)
|
|
21
|
+
- [Features](#features)
|
|
22
|
+
- [Ignore Policy](#ignore-policy)
|
|
23
|
+
- [Lifecycle Hooks](#lifecycle-hooks)
|
|
24
|
+
- [Skills](#skills-1)
|
|
25
|
+
- [Installing Skills](#installing-skills)
|
|
26
|
+
- [CLI Compatibility](#cli-compatibility)
|
|
27
|
+
- [Common Commands](#common-commands)
|
|
28
|
+
- [Compatibility](#compatibility)
|
|
29
|
+
- [Create new template](#create-new-template)
|
|
30
|
+
- [1 - Initialize from an existing template](#1---initialize-from-an-existing-template)
|
|
31
|
+
- [2 - Update `.blox` configuration](#2---update-blox-configuration)
|
|
32
|
+
- [3 - Publish and register the template](#3---publish-and-register-the-template)
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
Install globally with npm:
|
|
4
37
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
38
|
+
```sh
|
|
39
|
+
npm install -g patch-package @naseej/blox
|
|
40
|
+
```
|
|
8
41
|
|
|
9
|
-
|
|
42
|
+
Notes:
|
|
10
43
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```
|
|
44
|
+
- Ensure npm is available in your `PATH`.
|
|
45
|
+
- Use minimal mode (`-m`, `--minimal`) if spinners interfere with interactive input.
|
|
14
46
|
|
|
15
|
-
|
|
47
|
+
## Quick Start
|
|
16
48
|
|
|
17
|
-
|
|
49
|
+
Start with the core commands:
|
|
18
50
|
|
|
19
51
|
```sh
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
BLOX CLI
|
|
25
|
-
|
|
26
|
-
Commands:
|
|
27
|
-
blox init Init new app [alias: i]
|
|
28
|
-
blox add Add block to app [alias: a]
|
|
29
|
-
blox remove Remove block from app [alias: rm]
|
|
30
|
-
blox update Update app/block [alias: u]
|
|
31
|
-
blox contribute Contribute changes to template/base/block repos [alias: cb]
|
|
32
|
-
blox conf Set blox global config [alias: c]
|
|
33
|
-
blox upgrade Upgrade blox cli to latest version
|
|
34
|
-
blox migrate Migrate blox schema
|
|
35
|
-
blox detach Detach to base
|
|
36
|
-
blox skills Install and manage BLOX CLI skills (wraps npx skills)
|
|
37
|
-
|
|
38
|
-
Options:
|
|
39
|
-
-V, --version Show version number [boolean]
|
|
40
|
-
-h, --help Show help [boolean]
|
|
41
|
-
-d, --debug Works in debug mode [boolean]
|
|
42
|
-
-m, --minimal Works in minimal mode [boolean]
|
|
52
|
+
blox --help
|
|
53
|
+
blox init
|
|
54
|
+
blox add
|
|
55
|
+
blox update
|
|
43
56
|
```
|
|
44
57
|
|
|
45
|
-
|
|
58
|
+
## Commands
|
|
46
59
|
|
|
47
|
-
|
|
60
|
+
Other available command:
|
|
48
61
|
|
|
49
|
-
-
|
|
50
|
-
- [add](#add)
|
|
51
|
-
- [remove](#remove)
|
|
52
|
-
- [update](#update)
|
|
53
|
-
- [contribute](#contribute)
|
|
54
|
-
- [conf](#conf)
|
|
55
|
-
- [upgrade](#upgrade)
|
|
56
|
-
- [migrate](#migrate)
|
|
57
|
-
- [skills](#installing-blox-cli-skills)
|
|
62
|
+
- `blox detach`: detach to base
|
|
58
63
|
|
|
59
|
-
|
|
64
|
+
### init
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
Initialize a new app.
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
Usage:
|
|
64
69
|
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
"project": {
|
|
68
|
-
"ignore": ["applet-core", "dist/**", "*.generated.ts"]
|
|
69
|
-
}
|
|
70
|
-
}
|
|
70
|
+
```sh
|
|
71
|
+
blox init
|
|
71
72
|
```
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
Important options:
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
- `-n, --name`: app name
|
|
77
|
+
- `-t, --template`: template to use
|
|
78
|
+
- `--branch`: branch name to use
|
|
76
79
|
|
|
77
|
-
|
|
78
|
-
- `project.ignore`: local to your app (you control it).
|
|
80
|
+
### add
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
Add one or more blocks to an app.
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
- local project ignore (`project.ignore` in your local `.blox`)
|
|
84
|
-
- local `.gitignore`
|
|
85
|
-
- command option `--ignore` (when provided)
|
|
84
|
+
Usage:
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
```sh
|
|
87
|
+
blox add [blocks]
|
|
88
|
+
```
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
Example:
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
```sh
|
|
93
|
+
blox add components applet-template
|
|
94
|
+
```
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
- each **block** (`blocks/<name>/.blox`)
|
|
96
|
+
Important options:
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
- `--branch`: branch name (applies to all selected blocks)
|
|
99
|
+
- `--dest`: destination directory (applies to all selected blocks)
|
|
99
100
|
|
|
100
|
-
|
|
101
|
+
Important notes:
|
|
101
102
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
| `init` | Runs after`blox init` finishes creating the app. | Runs after a new block is cloned and initialized, before its dependencies are added. |
|
|
105
|
-
| `add` | Runs once per `blox add` command, but only if at least one new block was added (including dependencies). | Runs when the block is added , right after the `init` hook for that new block, still before dependencies. |
|
|
106
|
-
| `update` | After `blox update` when the **root template** or a **base** or a **block** remote actually advanced (new commit applied). | Only when that block’s remote actually advanced (new commit). Skipped if already up to date. |
|
|
107
|
-
| `remove` | After `blox remove` actually removed a block in that run. | Runs before the block is deleted, while its files still exist. |
|
|
103
|
+
- If `blocks` are omitted, BLOX prompts with a multiselect from available blocks.
|
|
104
|
+
- Blocks are processed sequentially in the order provided.
|
|
108
105
|
|
|
109
|
-
|
|
106
|
+
### remove
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
blox init --help
|
|
113
|
-
```
|
|
108
|
+
Remove one or more installed blocks.
|
|
114
109
|
|
|
115
|
-
|
|
116
|
-
blox init
|
|
110
|
+
Usage:
|
|
117
111
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Options:
|
|
121
|
-
-n, --name App name
|
|
122
|
-
-t, --template Template to use
|
|
123
|
-
--branch, branch name to use
|
|
112
|
+
```sh
|
|
113
|
+
blox remove [blocks]
|
|
124
114
|
```
|
|
125
115
|
|
|
126
|
-
|
|
116
|
+
Example:
|
|
127
117
|
|
|
128
118
|
```sh
|
|
129
|
-
|
|
119
|
+
blox remove components applet-template
|
|
130
120
|
```
|
|
131
121
|
|
|
132
|
-
|
|
133
|
-
blox add [blocks]
|
|
122
|
+
Important options:
|
|
134
123
|
|
|
135
|
-
|
|
124
|
+
- `-f, --force`: remove even when other blocks depend on them
|
|
136
125
|
|
|
137
|
-
|
|
138
|
-
blocks Block names separated by space (optional; if omitted, prompts with multiselect from available blocks)
|
|
126
|
+
Important notes:
|
|
139
127
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
- You can add multiple blocks in one command, for example: `blox add components applet-template`.
|
|
128
|
+
- If `blocks` are omitted, BLOX prompts with a multiselect from installed blocks.
|
|
129
|
+
- You can pass registry keys or installed folder names under `blocks/`.
|
|
130
|
+
- Only directories under `blocks/` containing a valid `.blox` file are treated as removable blocks.
|
|
146
131
|
- Blocks are processed sequentially in the order provided.
|
|
147
132
|
|
|
148
|
-
|
|
133
|
+
### update
|
|
134
|
+
|
|
135
|
+
Update the app, bases, or specific blocks.
|
|
136
|
+
|
|
137
|
+
Usage:
|
|
149
138
|
|
|
150
139
|
```sh
|
|
151
|
-
|
|
140
|
+
blox update
|
|
152
141
|
```
|
|
153
142
|
|
|
154
|
-
|
|
155
|
-
blox remove [blocks]
|
|
143
|
+
Important options:
|
|
156
144
|
|
|
157
|
-
|
|
145
|
+
- `-s, --scope`: `app`, `bases`, `block`, or `all` (default: `all`)
|
|
146
|
+
- `-b, --block`: block to update (valid only when `--scope block`)
|
|
158
147
|
|
|
159
|
-
|
|
160
|
-
blocks Blocks to remove separated by space — registry keys or installed folder names under blocks/ (optional; prompts with multiselect from installed blocks)
|
|
148
|
+
Important notes:
|
|
161
149
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
```
|
|
150
|
+
- You may need to resolve merge conflicts.
|
|
151
|
+
- If a template, base, or block is missing from the registry, BLOX prompts you to continue or stop.
|
|
165
152
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
153
|
+
### contribute
|
|
154
|
+
|
|
155
|
+
Contribute app changes back to template/base/block repositories.
|
|
169
156
|
|
|
170
|
-
|
|
157
|
+
Usage:
|
|
171
158
|
|
|
172
159
|
```sh
|
|
173
|
-
|
|
160
|
+
blox contribute
|
|
174
161
|
```
|
|
175
162
|
|
|
176
|
-
|
|
177
|
-
blox update
|
|
163
|
+
Important options:
|
|
178
164
|
|
|
179
|
-
|
|
165
|
+
- `--existing`: add changes to an existing contribution branch
|
|
166
|
+
- `--title <title>`: contribution title
|
|
167
|
+
- `--description <text>`: contribution description
|
|
168
|
+
- `--commits <commits>`: comma-separated commit hashes from the app repo
|
|
169
|
+
- `--force`: bypass safety pre-flight checks
|
|
170
|
+
- `--type <type>`: target type (`template`, `base`, or `block`)
|
|
171
|
+
- `--name <name>`: target name (used with `--type`)
|
|
180
172
|
|
|
181
|
-
|
|
182
|
-
-s, --scope Scope of update [choices: "app", "bases", "block", "all"] [default: "all"]
|
|
183
|
-
-b, --block Block to update, valid only with scope block
|
|
184
|
-
```
|
|
173
|
+
### conf
|
|
185
174
|
|
|
186
|
-
|
|
175
|
+
Set global BLOX configuration.
|
|
187
176
|
|
|
188
|
-
|
|
177
|
+
Usage:
|
|
189
178
|
|
|
190
179
|
```sh
|
|
191
|
-
|
|
180
|
+
blox conf
|
|
192
181
|
```
|
|
193
182
|
|
|
194
|
-
|
|
195
|
-
blox contribute
|
|
183
|
+
Important options:
|
|
196
184
|
|
|
197
|
-
|
|
185
|
+
- `-r, --registries`: remote registry URLs
|
|
198
186
|
|
|
199
|
-
|
|
200
|
-
--existing Add changes to an existing contribution branch
|
|
201
|
-
--title <title> Contribution title
|
|
202
|
-
--description <text> Contribution description
|
|
203
|
-
--commits <commits> Comma-separated commit hashes from the app repo
|
|
204
|
-
--force Bypass safety pre-flight checks
|
|
205
|
-
--type <type> Target: template | base | block
|
|
206
|
-
--name <name> Target name (with --type)
|
|
207
|
-
```
|
|
187
|
+
### upgrade
|
|
208
188
|
|
|
209
|
-
|
|
189
|
+
Upgrade BLOX CLI to the latest version.
|
|
210
190
|
|
|
211
|
-
|
|
212
|
-
blox sync --help
|
|
213
|
-
```
|
|
191
|
+
Usage:
|
|
214
192
|
|
|
193
|
+
```sh
|
|
194
|
+
blox upgrade
|
|
215
195
|
```
|
|
216
|
-
blox conf
|
|
217
196
|
|
|
218
|
-
|
|
197
|
+
### migrate
|
|
219
198
|
|
|
220
|
-
|
|
221
|
-
-r, --registries Remote registries urls
|
|
222
|
-
```
|
|
199
|
+
Migrate BLOX schema.
|
|
223
200
|
|
|
224
|
-
|
|
201
|
+
Usage:
|
|
225
202
|
|
|
226
203
|
```sh
|
|
227
|
-
|
|
204
|
+
blox migrate
|
|
228
205
|
```
|
|
229
206
|
|
|
230
|
-
|
|
231
|
-
blox upgrade
|
|
207
|
+
### skills
|
|
232
208
|
|
|
233
|
-
|
|
234
|
-
```
|
|
209
|
+
Install and manage BLOX CLI skills (wraps `npx skills`).
|
|
235
210
|
|
|
236
|
-
|
|
211
|
+
Usage:
|
|
237
212
|
|
|
238
213
|
```sh
|
|
239
|
-
|
|
214
|
+
blox skills <command> [options]
|
|
240
215
|
```
|
|
241
216
|
|
|
242
|
-
|
|
243
|
-
blox migrate
|
|
217
|
+
Important notes:
|
|
244
218
|
|
|
245
|
-
|
|
246
|
-
|
|
219
|
+
- BLOX clones the BLOX CLI skills repository, runs `npx skills` with your arguments, then cleans up.
|
|
220
|
+
- No repository URL is required.
|
|
247
221
|
|
|
248
|
-
##
|
|
222
|
+
## Features
|
|
249
223
|
|
|
250
|
-
|
|
224
|
+
### Ignore Policy
|
|
251
225
|
|
|
252
|
-
|
|
226
|
+
Ignore rules tell BLOX which files or paths to skip.
|
|
253
227
|
|
|
254
|
-
|
|
228
|
+
Template-level ignore:
|
|
255
229
|
|
|
256
|
-
|
|
230
|
+
- Defined in `definition.ignore`.
|
|
231
|
+
- Comes from template/block maintainers.
|
|
257
232
|
|
|
258
|
-
|
|
233
|
+
App-level ignore:
|
|
259
234
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
```
|
|
235
|
+
- Defined in `project.ignore`.
|
|
236
|
+
- Local to your app and controlled by you.
|
|
263
237
|
|
|
264
|
-
|
|
238
|
+
Example root `.blox` configuration:
|
|
265
239
|
|
|
266
|
-
```
|
|
267
|
-
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"project": {
|
|
243
|
+
"ignore": ["applet-core", "dist/**", "*.generated.ts"]
|
|
244
|
+
}
|
|
245
|
+
}
|
|
268
246
|
```
|
|
269
247
|
|
|
270
|
-
|
|
248
|
+
How ignore sources are combined:
|
|
249
|
+
|
|
250
|
+
- `blox update` combines patterns from:
|
|
251
|
+
- remote template ignore (`definition.ignore`)
|
|
252
|
+
- local project ignore (`project.ignore` in local `.blox`)
|
|
253
|
+
- local `.gitignore`
|
|
254
|
+
- command option `--ignore` (when provided)
|
|
255
|
+
- `blox contribute` also respects local `project.ignore`.
|
|
256
|
+
- Local `project.ignore` is project-owned and is not replaced by remote template ignore during update.
|
|
257
|
+
|
|
258
|
+
### Lifecycle Hooks
|
|
259
|
+
|
|
260
|
+
Lifecycle hooks are optional shell commands defined in `.blox` files.
|
|
261
|
+
|
|
262
|
+
Where hooks can be defined:
|
|
263
|
+
|
|
264
|
+
- Root template: `.blox` at app root
|
|
265
|
+
- Each block: `blocks/<name>/.blox`
|
|
266
|
+
|
|
267
|
+
Supported hooks:
|
|
268
|
+
|
|
269
|
+
- `init`
|
|
270
|
+
- `add`
|
|
271
|
+
- `update`
|
|
272
|
+
- `remove`
|
|
273
|
+
|
|
274
|
+
When hooks run:
|
|
275
|
+
|
|
276
|
+
| Hook | Template (root `.blox`) | Block (`blocks/.../.blox`) |
|
|
277
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
|
|
278
|
+
| `init` | Runs after `blox init` finishes creating the app. | Runs after a new block is cloned and initialized, before its dependencies are added. |
|
|
279
|
+
| `add` | Runs once per `blox add` command, only if at least one new block was added (including dependencies). | Runs when the block is added, right after that new block's `init` hook, still before dependencies. |
|
|
280
|
+
| `update` | Runs after `blox update` when the root template, a base, or a block remote actually advanced (new commit applied). | Runs only when that block's remote actually advanced (new commit). Skipped if already up to date. |
|
|
281
|
+
| `remove` | Runs after `blox remove` actually removed a block in that run. | Runs before the block is deleted, while its files still exist. |
|
|
282
|
+
|
|
283
|
+
### Skills
|
|
284
|
+
|
|
285
|
+
#### Installing Skills
|
|
286
|
+
|
|
287
|
+
Use `blox skills` to run the Skills CLI against the BLOX CLI skills repository.
|
|
288
|
+
|
|
289
|
+
Behavior:
|
|
290
|
+
|
|
291
|
+
- BLOX executes `npx skills` with all arguments passed after `skills`.
|
|
292
|
+
- BLOX handles cloning and cleanup automatically.
|
|
293
|
+
|
|
294
|
+
#### CLI Compatibility
|
|
295
|
+
|
|
296
|
+
Skills declare a `cliCompatibility` range in `skill.json` (npm semver).
|
|
297
|
+
|
|
298
|
+
For `blox skills add` and `blox skills update`:
|
|
299
|
+
|
|
300
|
+
- BLOX checks whether your installed CLI version satisfies the required range.
|
|
301
|
+
- If not, BLOX shows the required range and your current version.
|
|
302
|
+
- You can choose to continue or exit and run `blox upgrade` first.
|
|
303
|
+
|
|
304
|
+
#### Common Commands
|
|
271
305
|
|
|
272
306
|
```bash
|
|
307
|
+
blox skills add
|
|
308
|
+
blox skills add -a cursor -y
|
|
273
309
|
blox skills add -a cursor -a claude-code -y
|
|
310
|
+
blox skills list
|
|
274
311
|
```
|
|
275
312
|
|
|
276
|
-
|
|
313
|
+
#### Compatibility
|
|
277
314
|
|
|
278
|
-
|
|
279
|
-
|
|
315
|
+
Skills are not tied to a specific editor or product. They work across tools that support skill-style instructions, and metadata marks agents as `generic` for broad use.
|
|
316
|
+
|
|
317
|
+
### Create new template
|
|
318
|
+
|
|
319
|
+
Create a new template by starting from an existing one, updating its metadata, then publishing it.
|
|
320
|
+
|
|
321
|
+
#### 1 - Initialize from an existing template
|
|
322
|
+
|
|
323
|
+
Create a new project using the template you want to build on.
|
|
324
|
+
|
|
325
|
+
Example:
|
|
326
|
+
|
|
327
|
+
```sh
|
|
328
|
+
blox init -n my-template -t existing-template
|
|
280
329
|
```
|
|
281
330
|
|
|
282
|
-
|
|
331
|
+
#### 2 - Update `.blox` configuration
|
|
332
|
+
|
|
333
|
+
Edit your project's `.blox` file to describe the new template.
|
|
334
|
+
|
|
335
|
+
- Set `definition.name` to your new template name.
|
|
336
|
+
- Keep the original template in the `bases` list so you can continue receiving updates from it.
|
|
337
|
+
|
|
338
|
+
#### 3 - Publish and register the template
|
|
283
339
|
|
|
284
|
-
|
|
340
|
+
- Push the template project to a remote repository.
|
|
341
|
+
- Add that repository to a BLOX registry (Or any custom registry) so BLOX CLI can discover and use your template.
|