Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

docs(cli): add note for CLI version compatibility with 'sm' commands

Victor Hugo dos Santos45a9b31f6a0a
diff --git a/docs/cli/reference.mdx b/docs/cli/reference.mdx
index b639a8e146..f265b7dfd3 100644
--- a/docs/cli/reference.mdx
+++ b/docs/cli/reference.mdx
@@ -1135,6 +1135,10 @@ Without `--token-only`, the command prints the token's name, project, access, sc
Manage secrets from the command line. The `sm` commands inject secrets into a process, export them to a file, read and write them, lease credentials from [dynamic secrets](/documentation/platform/dynamic-secrets/overview), and run the [Agent Proxy](/documentation/platform/agent-proxy/overview).
+<Note>
+If `infisical --version` prints 0.43.145 or earlier, your CLI doesn't have `sm`. [Upgrade the CLI](/cli/upgrade), or run the commands without `sm`, such as `infisical run` instead of `infisical sm run`. For the Agent Proxy, use `infisical secrets agent-proxy` instead of `infisical sm agent-proxy`.
+</Note>
+
</CLICommand>
<CLICommand
diff --git a/docs/snippets/CLIPage.jsx b/docs/snippets/CLIPage.jsx
index 19c21088d9..1d01c2ed86 100644
--- a/docs/snippets/CLIPage.jsx
+++ b/docs/snippets/CLIPage.jsx
@@ -15,15 +15,20 @@ export const CLIPage = ({ title, description, movedAnchors = {}, children }) =>
// fonts and sticky headings settle), which pushes the target down. Keep realigning while the
// page resizes, until the reader scrolls on their own or the layout has had time to settle.
let stopAligning = () => {};
- let hash = decodeURIComponent(window.location.hash.slice(1));
// Links to a command's old anchor are already published, so when a command moves under
// another one, `movedAnchors` maps the old id prefix to the new one. The longest prefix wins,
// so a subcommand that moved somewhere other than its parent can have its own entry.
- const movedFrom = Object.keys(movedAnchors)
- .filter((old) => hash === old || hash.startsWith(`${old}-`))
- .sort((a, b) => b.length - a.length)[0];
- if (movedFrom && !document.getElementById(hash)) {
- hash = movedAnchors[movedFrom] + hash.slice(movedFrom.length);
+ const movedHash = (hash) => {
+ if (!hash || document.getElementById(hash)) return null;
+ const movedFrom = Object.keys(movedAnchors)
+ .filter((old) => hash === old || hash.startsWith(`${old}-`))
+ .sort((a, b) => b.length - a.length)[0];
+ return movedFrom ? movedAnchors[movedFrom] + hash.slice(movedFrom.length) : null;
+ };
+ let hash = decodeURIComponent(window.location.hash.slice(1));
+ const movedOnLoad = movedHash(hash);
+ if (movedOnLoad) {
+ hash = movedOnLoad;
window.history.replaceState(window.history.state, "", `#${hash}`);
}
const target = hash ? document.getElementById(hash) : null;
@@ -105,12 +110,28 @@ export const CLIPage = ({ title, description, movedAnchors = {}, children }) =>
};
onScroll();
window.addEventListener("scroll", onScroll, { passive: true });
+
+ // Pasting a link into the address bar while the page is open changes only the hash, so the
+ // page doesn't mount again: an old anchor has to be rewritten here too, and the command the
+ // page was opened on would otherwise stay pinned over the new one.
+ const onHashChange = () => {
+ const hashNow = decodeURIComponent(window.location.hash.slice(1));
+ const moved = movedHash(hashNow);
+ const el = hashNow ? document.getElementById(moved || hashNow) : null;
+ if (!el) return;
+ if (moved) window.history.replaceState(window.history.state, "", `#${moved}`);
+ pinned = el.closest("[data-cli-command]");
+ unpinEvents.forEach((type) => window.addEventListener(type, unpin, { passive: true }));
+ el.scrollIntoView({ block: el.classList.contains("cli-row") ? "center" : "start" });
+ };
+ window.addEventListener("hashchange", onHashChange);
return () => {
stopAligning();
unpin();
cancelAnimationFrame(frame);
clearTimeout(settle);
window.removeEventListener("scroll", onScroll);
+ window.removeEventListener("hashchange", onHashChange);
window.dispatchEvent(new CustomEvent("cli-reference:active", { detail: { id: null } }));
};
}, []);