@deftai/directive 0.126.0-beta.1 → 0.126.0-beta.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/bin.js +60 -51
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -785,6 +785,12 @@ function lockfileRecordsExactPin(projectRoot, exactVersion, pm) {
|
|
|
785
785
|
function ensurePackageJson(projectRoot) {
|
|
786
786
|
const path = join3(projectRoot, "package.json");
|
|
787
787
|
if (existsSync5(path)) {
|
|
788
|
+
const existing = readJsonObject2(path);
|
|
789
|
+
if (existing !== null && Object.keys(existing).length === 0) {
|
|
790
|
+
writeFileSync(path, `${JSON.stringify({ private: true }, null, 2)}
|
|
791
|
+
`);
|
|
792
|
+
return { created: true, path };
|
|
793
|
+
}
|
|
788
794
|
return { created: false, path };
|
|
789
795
|
}
|
|
790
796
|
writeFileSync(path, `${JSON.stringify({ private: true }, null, 2)}
|
|
@@ -1063,8 +1069,8 @@ function runPmRemove(options) {
|
|
|
1063
1069
|
var WRAP_FLOOR = 40;
|
|
1064
1070
|
var WRAP_CEILING = 100;
|
|
1065
1071
|
var WRAP_FALLBACK = 80;
|
|
1066
|
-
var HUMAN_INSTALL_SCRIPT_SETTINGS_LINE = "
|
|
1067
|
-
var
|
|
1072
|
+
var HUMAN_INSTALL_SCRIPT_SETTINGS_LINE = "Directive skips lifecycle scripts on that add. Other project install settings still apply.";
|
|
1073
|
+
var PM_WILL_RUN_LABEL = "Package manager will run:";
|
|
1068
1074
|
var HUMAN_GIT_HOOKS_INACTIVE_LINE = "Incomplete install: this folder is not a git repository yet, so git hooks will not be installed. After you run git init, run directive install --repair so hooks get installed.";
|
|
1069
1075
|
function lockfileNameFor(pm) {
|
|
1070
1076
|
return pm === "pnpm" ? "pnpm-lock.yaml" : "package-lock.json";
|
|
@@ -1175,10 +1181,10 @@ function writeKeyedBlock(io, lines) {
|
|
|
1175
1181
|
`);
|
|
1176
1182
|
}
|
|
1177
1183
|
}
|
|
1178
|
-
function
|
|
1179
|
-
if (!command) return;
|
|
1184
|
+
function writePmCommandAndScriptVerbose(io, command, verbosity) {
|
|
1185
|
+
if (verbosity < 1 || !command) return;
|
|
1180
1186
|
writeBlank(io);
|
|
1181
|
-
io.writeOut(`${
|
|
1187
|
+
io.writeOut(`${PM_WILL_RUN_LABEL}
|
|
1182
1188
|
`);
|
|
1183
1189
|
io.writeOut(` ${command}
|
|
1184
1190
|
`);
|
|
@@ -1211,10 +1217,12 @@ function presentFirstInstallPlan(io, fields) {
|
|
|
1211
1217
|
`add Directive ${fields.version} to this project's development tools with ${fields.pm}`
|
|
1212
1218
|
);
|
|
1213
1219
|
writeBullet(io, `update ${lock}`);
|
|
1214
|
-
writeBullet(io, "
|
|
1220
|
+
writeBullet(io, "create Directive's project files for this folder");
|
|
1221
|
+
writeBlank(io);
|
|
1222
|
+
writeHumanParagraph(io, "Your other project files stay as they are.");
|
|
1215
1223
|
writeBlank(io);
|
|
1216
1224
|
writeDisclosures(io, fields);
|
|
1217
|
-
|
|
1225
|
+
writePmCommandAndScriptVerbose(io, fields.pmCommand, fields.verbosity);
|
|
1218
1226
|
if (fields.verbosity >= 1) {
|
|
1219
1227
|
writeBlank(io);
|
|
1220
1228
|
const keyed = [
|
|
@@ -1246,28 +1254,27 @@ function presentRepairPlan(io, fields) {
|
|
|
1246
1254
|
writeLabeled(io, "Directive version:", `${fields.version} (unchanged)`);
|
|
1247
1255
|
writeBlank(io);
|
|
1248
1256
|
if (!fields.needsPmRestore) {
|
|
1249
|
-
writeHumanParagraph(io, "The installed package
|
|
1257
|
+
writeHumanParagraph(io, "The installed package looks fine. No reinstall is needed.");
|
|
1250
1258
|
writeBlank(io);
|
|
1251
|
-
io.
|
|
1252
|
-
writeBullet(io, `
|
|
1253
|
-
writeBullet(io, "
|
|
1254
|
-
|
|
1255
|
-
writeHumanParagraph(io, "Your existing settings and other files will be preserved.");
|
|
1259
|
+
writeHumanParagraph(io, "You may still refresh the setup. If you approve, Directive will:");
|
|
1260
|
+
writeBullet(io, `check this project's Directive-managed files for ${fields.version}`);
|
|
1261
|
+
writeBullet(io, "write only what is missing or out of date");
|
|
1262
|
+
writeBullet(io, "leave matching files and your other project files alone");
|
|
1256
1263
|
} else {
|
|
1257
1264
|
writeHumanParagraph(
|
|
1258
1265
|
io,
|
|
1259
|
-
|
|
1266
|
+
"The installed package needs to be restored (missing or wrong version on disk)."
|
|
1260
1267
|
);
|
|
1261
1268
|
writeBlank(io);
|
|
1262
1269
|
io.writeOut("If you approve, Directive will:\n");
|
|
1263
|
-
writeBullet(io, `
|
|
1270
|
+
writeBullet(io, `reinstall Directive ${fields.version} with ${fields.pm}`);
|
|
1264
1271
|
writeBullet(io, "rerun project setup");
|
|
1265
1272
|
writeBlank(io);
|
|
1266
|
-
writeHumanParagraph(io, "Your existing settings and other files
|
|
1273
|
+
writeHumanParagraph(io, "Your existing settings and other files stay as they are.");
|
|
1267
1274
|
}
|
|
1268
1275
|
writeBlank(io);
|
|
1269
1276
|
writeDisclosures(io, fields);
|
|
1270
|
-
|
|
1277
|
+
writePmCommandAndScriptVerbose(io, fields.pmCommand, fields.verbosity);
|
|
1271
1278
|
if (fields.verbosity >= 1) {
|
|
1272
1279
|
writeBlank(io);
|
|
1273
1280
|
const keyed = [
|
|
@@ -1299,47 +1306,51 @@ function presentUpgradePlan(io, fields) {
|
|
|
1299
1306
|
writeLabeled(io, "Current version:", fields.currentVersion);
|
|
1300
1307
|
writeLabeled(io, "Target version:", fields.targetVersion);
|
|
1301
1308
|
writeBlank(io);
|
|
1302
|
-
if (fields.oldStyle) {
|
|
1303
|
-
writeHumanParagraph(io, "This project uses an older Directive layout
|
|
1304
|
-
} else if (fields.convertShapeId) {
|
|
1309
|
+
if (fields.oldStyle || fields.convertShapeId) {
|
|
1310
|
+
writeHumanParagraph(io, "This project still uses an older Directive layout.");
|
|
1305
1311
|
writeHumanParagraph(
|
|
1306
1312
|
io,
|
|
1307
|
-
|
|
1313
|
+
"A copied tree of Directive files may sit under .deft/core."
|
|
1308
1314
|
);
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1315
|
+
writeHumanParagraph(
|
|
1316
|
+
io,
|
|
1317
|
+
"The project version is still recorded as the old @deftai/directive package."
|
|
1318
|
+
);
|
|
1319
|
+
writeBlank(io);
|
|
1320
|
+
io.writeOut("If you approve, Directive will:\n");
|
|
1313
1321
|
writeBullet(
|
|
1314
1322
|
io,
|
|
1315
|
-
|
|
1323
|
+
"remove the copied .deft/core tree (including any local edits there)"
|
|
1316
1324
|
);
|
|
1317
|
-
writeBullet(io, `update ${lock}`);
|
|
1318
|
-
writeBullet(io, "run setup and any required project-data migrations");
|
|
1319
|
-
} else if (fields.convertShapeId) {
|
|
1320
1325
|
writeBullet(
|
|
1321
1326
|
io,
|
|
1322
|
-
|
|
1327
|
+
`switch the project to Directive ${fields.targetVersion} as a normal project dependency`
|
|
1323
1328
|
);
|
|
1324
|
-
writeBullet(io, `add Directive ${fields.targetVersion} with ${fields.pm}`);
|
|
1325
1329
|
writeBullet(io, `update ${lock}`);
|
|
1326
|
-
writeBullet(io, "run setup and any
|
|
1330
|
+
writeBullet(io, "run setup and any needed data updates for that version");
|
|
1331
|
+
writeBlank(io);
|
|
1332
|
+
writeHumanParagraph(io, "Your existing project settings stay as they are.");
|
|
1333
|
+
writeHumanParagraph(io, "Your notes and briefs under xbrief/ stay as they are.");
|
|
1327
1334
|
} else if (fields.versionChange) {
|
|
1328
|
-
|
|
1335
|
+
io.writeOut("If you approve, Directive will:\n");
|
|
1336
|
+
writeBullet(io, `change this project's Directive version to ${fields.targetVersion}`);
|
|
1329
1337
|
writeBullet(io, `update ${lock}`);
|
|
1330
|
-
writeBullet(io, "run project setup and any
|
|
1338
|
+
writeBullet(io, "run project setup and any needed data updates for that version");
|
|
1339
|
+
writeBlank(io);
|
|
1340
|
+
writeHumanParagraph(io, "Your existing project settings stay as they are.");
|
|
1331
1341
|
} else {
|
|
1342
|
+
io.writeOut("If you approve, Directive will:\n");
|
|
1332
1343
|
writeBullet(
|
|
1333
1344
|
io,
|
|
1334
1345
|
`finish equal-version work for Directive ${fields.targetVersion}` + (fields.needSetup ? " (setup, then migration as needed)" : " (migration as needed)")
|
|
1335
1346
|
);
|
|
1347
|
+
writeBlank(io);
|
|
1348
|
+
writeHumanParagraph(io, "Your existing project settings stay as they are.");
|
|
1336
1349
|
}
|
|
1337
1350
|
writeBlank(io);
|
|
1338
|
-
writeHumanParagraph(io, "Your existing project settings will be preserved.");
|
|
1339
|
-
writeBlank(io);
|
|
1340
1351
|
writeDisclosures(io, fields);
|
|
1341
1352
|
if (fields.versionChange) {
|
|
1342
|
-
|
|
1353
|
+
writePmCommandAndScriptVerbose(io, fields.pmCommand, fields.verbosity);
|
|
1343
1354
|
}
|
|
1344
1355
|
if (fields.verbosity >= 1) {
|
|
1345
1356
|
writeBlank(io);
|
|
@@ -1347,7 +1358,7 @@ function presentUpgradePlan(io, fields) {
|
|
|
1347
1358
|
`operation: upgrade`,
|
|
1348
1359
|
`root: ${fields.projectRoot}`,
|
|
1349
1360
|
`package manager: ${fields.pm} (${fields.pmEvidence})`,
|
|
1350
|
-
`current: @deftai/directive-runtime@${fields.currentVersion}${fields.oldStyle ? " (
|
|
1361
|
+
`current: @deftai/directive-runtime@${fields.currentVersion}${fields.oldStyle ? " (older layout)" : ""}`,
|
|
1351
1362
|
`target: @deftai/directive-runtime@${fields.targetVersion}`,
|
|
1352
1363
|
fields.versionChange ? `PM: exact add target (pin + lockfile change)` : `PM: none (equal version; package already matches pin)`,
|
|
1353
1364
|
fields.versionChange && fields.pmCommand ? `PM command: ${fields.pmCommand}` : `PM command: (none)`,
|
|
@@ -1357,11 +1368,11 @@ function presentUpgradePlan(io, fields) {
|
|
|
1357
1368
|
`global launcher: unchanged`,
|
|
1358
1369
|
INSTALL_SCRIPT_POLICY_PLAN_LINE
|
|
1359
1370
|
];
|
|
1360
|
-
if (fields.oldStyle) {
|
|
1371
|
+
if (fields.oldStyle || fields.convertShapeId) {
|
|
1361
1372
|
keyed.splice(
|
|
1362
1373
|
5,
|
|
1363
1374
|
0,
|
|
1364
|
-
`remove: .deft/core (
|
|
1375
|
+
`remove: .deft/core (copied content tree, even if edited)`,
|
|
1365
1376
|
`replace: @deftai/directive pin \u2192 @deftai/directive-runtime@${fields.targetVersion}`
|
|
1366
1377
|
);
|
|
1367
1378
|
}
|
|
@@ -1455,7 +1466,7 @@ function writeUninstallActionBullets(io, removal, pm) {
|
|
|
1455
1466
|
if (removal.willRemovePin) {
|
|
1456
1467
|
writeBullet(
|
|
1457
1468
|
io,
|
|
1458
|
-
pm ? `remove the Directive
|
|
1469
|
+
pm ? `remove the Directive version from this project's development tools with ${pm}` : "remove the Directive version from this project's package.json"
|
|
1459
1470
|
);
|
|
1460
1471
|
}
|
|
1461
1472
|
if (removal.skillPointers === 0 && removal.hostHooks === 0 && wiringBits.length === 0 && !removal.willRemovePin && removal.other === 0) {
|
|
@@ -1485,12 +1496,7 @@ function presentUninstallPlan(io, fields) {
|
|
|
1485
1496
|
);
|
|
1486
1497
|
}
|
|
1487
1498
|
writeBlank(io);
|
|
1488
|
-
writePmCommandVerbose(
|
|
1489
|
-
io,
|
|
1490
|
-
"Package manager command (Directive runs this):",
|
|
1491
|
-
fields.pmCommand,
|
|
1492
|
-
fields.verbosity
|
|
1493
|
-
);
|
|
1499
|
+
writePmCommandVerbose(io, PM_WILL_RUN_LABEL, fields.pmCommand, fields.verbosity);
|
|
1494
1500
|
if (fields.verbosity >= 1) {
|
|
1495
1501
|
writeBlank(io);
|
|
1496
1502
|
if (fields.removal && fields.removal.pathInventory.length > 0) {
|
|
@@ -1699,7 +1705,7 @@ function presentUninstallSuccess(io, opts) {
|
|
|
1699
1705
|
if (opts.removal.hostHooks > 0) parts.push("host hooks");
|
|
1700
1706
|
if (opts.removal.gitHooks > 0 || opts.removal.projectWiring > 0) parts.push("project wiring");
|
|
1701
1707
|
if (opts.removal.legacyCore) parts.push("legacy core");
|
|
1702
|
-
if (opts.removal.willRemovePin) parts.push("the
|
|
1708
|
+
if (opts.removal.willRemovePin) parts.push("the Directive version from development tools");
|
|
1703
1709
|
}
|
|
1704
1710
|
if (parts.length > 0) {
|
|
1705
1711
|
writeHumanParagraph(io, `Removed ${parts.join(", ")}.`);
|
|
@@ -1774,18 +1780,18 @@ function presentSetupFailedAfterInstall(io, opts) {
|
|
|
1774
1780
|
}
|
|
1775
1781
|
if (opts.operation === "install" || opts.operation === "upgrade") {
|
|
1776
1782
|
io.writeErr(
|
|
1777
|
-
`The project
|
|
1783
|
+
`The project version and lockfile already reference Directive ${opts.version}.
|
|
1778
1784
|
`
|
|
1779
1785
|
);
|
|
1780
1786
|
writeBlankErr(io);
|
|
1781
1787
|
}
|
|
1782
|
-
io.writeErr("
|
|
1788
|
+
io.writeErr("Fix the cause, then run:\n");
|
|
1783
1789
|
io.writeErr(" directive install --repair\n");
|
|
1784
1790
|
if (opts.operation === "upgrade") {
|
|
1785
1791
|
io.writeErr(" (or directive upgrade again for data migration)\n");
|
|
1786
1792
|
}
|
|
1787
1793
|
writeBlankErr(io);
|
|
1788
|
-
io.writeErr("Review the existing changes before
|
|
1794
|
+
io.writeErr("Review the existing changes before you commit.\n");
|
|
1789
1795
|
}
|
|
1790
1796
|
function presentMigrateFailedAfterUpgrade(io, opts) {
|
|
1791
1797
|
if (opts.versionChange) {
|
|
@@ -3653,6 +3659,9 @@ function runUpgrade(projectRoot, state, argv, launcherVersion, io = defaultIo(),
|
|
|
3653
3659
|
if (stale !== null) return stale;
|
|
3654
3660
|
if (versionChange) {
|
|
3655
3661
|
if (state.oldStyle || convertViaRemovals) {
|
|
3662
|
+
if (convertViaRemovals && !existsSync7(join6(projectRoot, "package.json"))) {
|
|
3663
|
+
ensurePackageJson(projectRoot);
|
|
3664
|
+
}
|
|
3656
3665
|
for (const packageName of RETIRED_DIRECTIVE_PACKAGE_NAMES) {
|
|
3657
3666
|
const rm = deps.runPmRemove?.({ projectRoot, pm: pmDetect.pm, packageName }) ?? runPmRemove({ projectRoot, pm: pmDetect.pm, packageName, env });
|
|
3658
3667
|
if (!rm.ok && rm.interrupted) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive",
|
|
3
|
-
"version": "0.126.0-beta.
|
|
3
|
+
"version": "0.126.0-beta.3",
|
|
4
4
|
"description": "Directive launcher — finds the project pin and hands off to @deftai/directive-runtime.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://deftai.github.io/directive/",
|