@insforge/cli 0.1.67 → 0.1.69
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/index.js +53 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1416,8 +1416,8 @@ function registerBranchListCommand(branch) {
|
|
|
1416
1416
|
import { writeFileSync as writeFileSync2 } from "fs";
|
|
1417
1417
|
import * as clack5 from "@clack/prompts";
|
|
1418
1418
|
function registerBranchMergeCommand(branch) {
|
|
1419
|
-
branch.command("merge <name>").description("Merge a branch back to its parent project").option("--dry-run", "Compute the diff and print rendered SQL; do not apply").option("
|
|
1420
|
-
const { json, apiUrl } = getRootOpts(cmd);
|
|
1419
|
+
branch.command("merge <name>").description("Merge a branch back to its parent project").option("--dry-run", "Compute the diff and print rendered SQL; do not apply").option("--save-sql <path>", "Write rendered SQL preview to a file").action(async (name, opts, cmd) => {
|
|
1420
|
+
const { json, apiUrl, yes } = getRootOpts(cmd);
|
|
1421
1421
|
try {
|
|
1422
1422
|
await requireAuth(apiUrl);
|
|
1423
1423
|
const project = getProjectConfig();
|
|
@@ -1469,7 +1469,7 @@ function registerBranchMergeCommand(branch) {
|
|
|
1469
1469
|
}
|
|
1470
1470
|
return;
|
|
1471
1471
|
}
|
|
1472
|
-
if (!
|
|
1472
|
+
if (!yes && !json) {
|
|
1473
1473
|
const parentLabel = project.branched_from?.project_name ?? project.project_name;
|
|
1474
1474
|
const confirmed = await clack5.confirm({
|
|
1475
1475
|
message: `Apply this merge to parent project '${parentLabel}'?`
|
|
@@ -1523,8 +1523,8 @@ import * as clack6 from "@clack/prompts";
|
|
|
1523
1523
|
var POLL_INTERVAL_MS2 = 3e3;
|
|
1524
1524
|
var POLL_TIMEOUT_MS2 = 5 * 60 * 1e3;
|
|
1525
1525
|
function registerBranchResetCommand(branch) {
|
|
1526
|
-
branch.command("reset <name>").description("Reset a branch's database back to T0 (the parent snapshot at branch creation)").
|
|
1527
|
-
const { json, apiUrl } = getRootOpts(cmd);
|
|
1526
|
+
branch.command("reset <name>").description("Reset a branch's database back to T0 (the parent snapshot at branch creation)").action(async (name, _opts, cmd) => {
|
|
1527
|
+
const { json, apiUrl, yes } = getRootOpts(cmd);
|
|
1528
1528
|
try {
|
|
1529
1529
|
await requireAuth(apiUrl);
|
|
1530
1530
|
const project = getProjectConfig();
|
|
@@ -1539,7 +1539,7 @@ function registerBranchResetCommand(branch) {
|
|
|
1539
1539
|
);
|
|
1540
1540
|
}
|
|
1541
1541
|
const entryState = target.branch_state;
|
|
1542
|
-
if (!
|
|
1542
|
+
if (!yes && !json) {
|
|
1543
1543
|
const confirmed = await clack6.confirm({
|
|
1544
1544
|
message: `Reset branch '${name}' back to T0? This wipes all schema/data/policy/function/migration changes made on the branch since creation.` + (entryState === "merged" ? " (Branch is currently merged \u2014 reset will reopen it for further work.)" : "")
|
|
1545
1545
|
});
|
|
@@ -1601,8 +1601,8 @@ async function pollUntilReady2(branchId, apiUrl, showProgress, startingState) {
|
|
|
1601
1601
|
// src/commands/branch/delete.ts
|
|
1602
1602
|
import * as clack7 from "@clack/prompts";
|
|
1603
1603
|
function registerBranchDeleteCommand(branch) {
|
|
1604
|
-
branch.command("delete <name>").description("Delete a branch").
|
|
1605
|
-
const { json, apiUrl } = getRootOpts(cmd);
|
|
1604
|
+
branch.command("delete <name>").description("Delete a branch").action(async (name, _opts, cmd) => {
|
|
1605
|
+
const { json, apiUrl, yes } = getRootOpts(cmd);
|
|
1606
1606
|
try {
|
|
1607
1607
|
await requireAuth(apiUrl);
|
|
1608
1608
|
const project = getProjectConfig();
|
|
@@ -1611,7 +1611,7 @@ function registerBranchDeleteCommand(branch) {
|
|
|
1611
1611
|
const branches = await listBranchesApi(parentId, apiUrl);
|
|
1612
1612
|
const target = branches.find((b) => b.name === name);
|
|
1613
1613
|
if (!target) throw new CLIError(`Branch '${name}' not found.`);
|
|
1614
|
-
if (!
|
|
1614
|
+
if (!yes && !json) {
|
|
1615
1615
|
const confirmed = await clack7.confirm({
|
|
1616
1616
|
message: `Delete branch '${name}'? This terminates its EC2 instance.`
|
|
1617
1617
|
});
|
|
@@ -1901,6 +1901,33 @@ function extractEnvKeys(content) {
|
|
|
1901
1901
|
}
|
|
1902
1902
|
return keys;
|
|
1903
1903
|
}
|
|
1904
|
+
function extractEnvPairs(content) {
|
|
1905
|
+
const out = /* @__PURE__ */ new Map();
|
|
1906
|
+
for (const line of content.split("\n")) {
|
|
1907
|
+
const trimmed = line.replace(/^\s*export\s+/, "").trimStart();
|
|
1908
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
1909
|
+
const m = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)$/);
|
|
1910
|
+
if (m) out.set(m[1], m[2]);
|
|
1911
|
+
}
|
|
1912
|
+
return out;
|
|
1913
|
+
}
|
|
1914
|
+
function refreshStaleEnvDefaults(existing, manifestDefaults, platformValues) {
|
|
1915
|
+
const refreshed = [];
|
|
1916
|
+
const lines = existing.split("\n").map((line) => {
|
|
1917
|
+
const m = line.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)$/);
|
|
1918
|
+
if (!m) return line;
|
|
1919
|
+
const key = m[1];
|
|
1920
|
+
const userValue = m[2];
|
|
1921
|
+
const def = manifestDefaults.get(key);
|
|
1922
|
+
const real = platformValues.get(key);
|
|
1923
|
+
if (def !== void 0 && real !== void 0 && userValue === def && real !== def) {
|
|
1924
|
+
refreshed.push(key);
|
|
1925
|
+
return `${key}=${real}`;
|
|
1926
|
+
}
|
|
1927
|
+
return line;
|
|
1928
|
+
});
|
|
1929
|
+
return { updated: lines.join("\n"), refreshed };
|
|
1930
|
+
}
|
|
1904
1931
|
function filterCollidingEnvLines(append, existingKeys) {
|
|
1905
1932
|
const dropped = [];
|
|
1906
1933
|
const out = [];
|
|
@@ -1995,6 +2022,7 @@ async function applyAuthProvider(provider, cwd, projectConfig, json) {
|
|
|
1995
2022
|
envExampleAppended: false,
|
|
1996
2023
|
envLocalWritten: false,
|
|
1997
2024
|
envKeysSkipped: [],
|
|
2025
|
+
envKeysRefreshed: [],
|
|
1998
2026
|
nextSteps: manifest.nextSteps
|
|
1999
2027
|
};
|
|
2000
2028
|
const allFiles = (await walkFiles(providerDir)).filter((rel) => !PROVIDER_META_FILES.has(rel));
|
|
@@ -2063,13 +2091,20 @@ async function applyAuthProvider(provider, cwd, projectConfig, json) {
|
|
|
2063
2091
|
await fs.writeFile(envLocalPath, filled + "\n");
|
|
2064
2092
|
result.envLocalWritten = true;
|
|
2065
2093
|
} else {
|
|
2066
|
-
const
|
|
2094
|
+
const manifestDefaults = extractEnvPairs(manifest.envExampleAppend);
|
|
2095
|
+
const platformValues = extractEnvPairs(filled);
|
|
2096
|
+
const { updated, refreshed } = refreshStaleEnvDefaults(existingLocal, manifestDefaults, platformValues);
|
|
2097
|
+
const refreshedSet = new Set(refreshed);
|
|
2098
|
+
const keysAfterRefresh = /* @__PURE__ */ new Set([...existingLocalKeys, ...refreshedSet]);
|
|
2099
|
+
const { filtered, dropped } = filterCollidingEnvLines(filled, keysAfterRefresh);
|
|
2067
2100
|
const hasNewKey = filtered.split("\n").some((l) => /^[A-Z][A-Z0-9_]*=/.test(l));
|
|
2068
|
-
if (hasNewKey) {
|
|
2069
|
-
|
|
2101
|
+
if (refreshed.length > 0 || hasNewKey) {
|
|
2102
|
+
const base = hasNewKey ? updated.replace(/\n*$/, "\n\n") + filtered + "\n" : updated;
|
|
2103
|
+
await fs.writeFile(envLocalPath, base);
|
|
2070
2104
|
result.envLocalWritten = true;
|
|
2071
2105
|
}
|
|
2072
2106
|
result.envKeysSkipped = Array.from(/* @__PURE__ */ new Set([...result.envKeysSkipped, ...dropped]));
|
|
2107
|
+
result.envKeysRefreshed = Array.from(/* @__PURE__ */ new Set([...result.envKeysRefreshed, ...refreshed]));
|
|
2073
2108
|
}
|
|
2074
2109
|
if (!jwtSecret && !json) {
|
|
2075
2110
|
clack9.log.warn("Could not auto-fill JWT_SECRET \u2014 run `npx @insforge/cli secrets get JWT_SECRET` and paste it into .env.local.");
|
|
@@ -2079,6 +2114,11 @@ async function applyAuthProvider(provider, cwd, projectConfig, json) {
|
|
|
2079
2114
|
`Kept your existing values for: ${result.envKeysSkipped.join(", ")}. If any of these need the auth-provider's defaults, see .env.example for reference.`
|
|
2080
2115
|
);
|
|
2081
2116
|
}
|
|
2117
|
+
if (result.envKeysRefreshed.length > 0 && !json) {
|
|
2118
|
+
clack9.log.info(
|
|
2119
|
+
`Refreshed stale platform defaults: ${result.envKeysRefreshed.join(", ")}. Your value matched the manifest's default, so we replaced it with the live one.`
|
|
2120
|
+
);
|
|
2121
|
+
}
|
|
2082
2122
|
return result;
|
|
2083
2123
|
} finally {
|
|
2084
2124
|
await cleanup();
|
|
@@ -6789,7 +6829,7 @@ function registerDiagnoseCommands(diagnoseCmd2) {
|
|
|
6789
6829
|
const s = !json ? clack14.spinner() : null;
|
|
6790
6830
|
s?.start("Collecting diagnostic data...");
|
|
6791
6831
|
const data2 = await collectDiagnosticData(projectId, ossMode, apiUrl);
|
|
6792
|
-
const cliVersion = "0.1.
|
|
6832
|
+
const cliVersion = "0.1.69";
|
|
6793
6833
|
s?.stop("Data collected");
|
|
6794
6834
|
if (!json) {
|
|
6795
6835
|
console.log(`
|