Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
docs(cli): add sm projects commands (#8737)
Adrian Kahali45c42522318a
diff --git a/docs/cli/faq.mdx b/docs/cli/faq.mdxindex 7a12759fda..23020d4d01 100644--- a/docs/cli/faq.mdx+++ b/docs/cli/faq.mdx@@ -72,6 +72,10 @@ Yes. This is simply a configuration file and contains no sensitive data.<Accordion title="Where can I find my Project ID?">+ Run [infisical sm projects list](/cli/reference#sm-projects-list) to print the name, slug, and ID of each of your projects.++ You can also find the ID in Infisical.+Visit the Infisical website and navigate to a project of your choice. Once on the project page, access the **Project Settings** from the sidebar. Within the Project name section, select the "Copy Project ID" button for copying the current Project ID to clipboard, or simply obtain it from the URL of the current page.```diff --git a/docs/cli/reference.mdx b/docs/cli/reference.mdxindex 32ddbee391..73f85ce612 100644--- a/docs/cli/reference.mdx+++ b/docs/cli/reference.mdx@@ -309,7 +309,7 @@ Stop and remove a gateway's systemd service. Run the command as root on Linux.command="init"usage="[flags]"flags={[- { name: "--project-id", value: "<string>", type: "string", description: "Project ID to link this directory to. When set, skips the interactive org and project pickers and writes `.infisical.yaml` directly." },+ { name: "--project-id", value: "<string>", type: "string", description: "Project ID to link this directory to. When set, skips the interactive org and project pickers and writes `.infisical.yaml` directly. Find the ID with [infisical sm projects list](/cli/reference#sm-projects-list)." },]}examples={[{ title: "Link the current directory to a project", code: "infisical init" },@@ -1137,7 +1137,7 @@ Without `--token-only`, the command prints the token's name, project, access, sccommand="sm">-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).+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), run the [Agent Proxy](/documentation/platform/agent-proxy/overview), and list and create projects.<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`.@@ -1439,6 +1439,87 @@ Print an environment's secrets in a file format such as `.env` or JSON, for tool</CLICommand>+<CLICommand+ id="sm-projects"+ command="sm projects"+>++List, inspect, and create Secrets Management [projects](/documentation/platform/project). Use these commands to find the project ID that [infisical init](/cli/reference#init) and the `--projectId` flag take, or to create a project without opening Infisical. `project` is an alias, so `infisical sm project list` also works.++<Note>+The commands work only with Secrets Management projects. Projects of other products, such as Certificate Manager or KMS, don't appear in the list.+</Note>++</CLICommand>++<CLICommand+ id="sm-projects-create"+ command="sm projects create"+ usage="[flags]"+ flags={[+ { name: "--description", value: "<string>", type: "string", description: "A description of the project, up to 1024 characters." },+ { name: "--name", value: "<string>", type: "string", required: true, description: "The name of the project, up to 64 characters." },+ { name: "--output", short: "-o", value: "<string>", type: "string", description: "Print the created project as `json` or `yaml` instead of a table." },+ { name: "--slug", value: "<string>", type: "string", description: "The project's slug, from 5 to 64 characters. Without it, Infisical generates a slug from the name." },+ { name: "--token", value: "<string>", type: "string", description: "A machine identity access token to authenticate with, instead of your login. Without it, the CLI reads `INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN`, then `INFISICAL_TOKEN`." },+ ]}+ examples={[+ { title: "Create a project and link this directory to it", code: "infisical sm projects create --name my-app\ninfisical init --project-id <project-id>" },+ { title: "Create a project with a description and slug", code: "infisical sm projects create --name my-app --description \"Backend service\" --slug my-app-backend" },+ ]}+>++Create a Secrets Management project in your organization with the Development, Staging, and Production environments.++The user or machine identity that creates the project becomes the project's admin. The command prints the project and its environments, followed by the `infisical init` command that links the current directory to the project.++<Note>+Service tokens can't create projects. If your environment stores a service token in `INFISICAL_TOKEN`, the command uses your login instead.+</Note>++</CLICommand>++<CLICommand+ id="sm-projects-get"+ command="sm projects get"+ usage="[flags]"+ flags={[+ { name: "--output", short: "-o", value: "<string>", type: "string", description: "Print the project as `json` or `yaml` instead of a table." },+ { name: "--projectId", value: "<string>", type: "string", description: "The ID of the project to show. Defaults to `INFISICAL_PROJECT_ID`, then the project linked in `.infisical.yaml`." },+ { name: "--token", value: "<string>", type: "string", description: "A machine identity access token to authenticate with, instead of your login. Without it, the CLI reads `INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN`, then `INFISICAL_TOKEN`." },+ ]}+ examples={[+ { title: "Show the project linked to this directory", code: "infisical sm projects get" },+ { title: "Show a project by ID", code: "infisical sm projects get --projectId=<project-id>" },+ ]}+>++Show a project's name, slug, and ID, and the name, slug, and ID of each of its environments. Use an environment's slug with the `--env` flag of other `sm` commands.++</CLICommand>++<CLICommand+ id="sm-projects-list"+ command="sm projects list"+ usage="[flags]"+ flags={[+ { name: "--output", short: "-o", value: "<string>", type: "string", description: "Print the projects as `json` or `yaml` instead of a table." },+ { name: "--token", value: "<string>", type: "string", description: "A machine identity access token to authenticate with, instead of your login. Without it, the CLI reads `INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN`, then `INFISICAL_TOKEN`." },+ ]}+ examples={[+ { title: "List your projects", code: "infisical sm projects list" },+ { title: "List a machine identity's projects as JSON", code: "infisical sm projects list --token=<access-token> --output=json" },+ ]}+>++List the name, slug, and ID of each Secrets Management project you're a member of in your organization. With a machine identity, the command lists the projects the identity is a member of.++<Note>+Service tokens can't create projects. If your environment stores a service token in `INFISICAL_TOKEN`, the command uses your login instead.+</Note>++</CLICommand>+<CLICommandid="sm-run"command="sm run"diff --git a/docs/cli/reference/sm/projects.mdx b/docs/cli/reference/sm/projects.mdxnew file mode 100644index 0000000000..534759fae2--- /dev/null+++ b/docs/cli/reference/sm/projects.mdx@@ -0,0 +1,5 @@+---+title: "infisical sm projects"+sidebarTitle: "projects"+url: "/cli/reference#sm-projects"+---diff --git a/docs/docs.json b/docs/docs.jsonindex 19e3acf870..3a2b1fe4a9 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -1342,6 +1342,7 @@"cli/reference/sm/agent-proxy","cli/reference/sm/dynamic-secrets","cli/reference/sm/export",+ "cli/reference/sm/projects","cli/reference/sm/run","cli/reference/sm/secrets"]