MCPcopy
hub / github.com/di-sukharev/opencommit / _instructions

Function _instructions

out/cli.cjs:1977–2009  ·  view source on GitHub ↗
(result, dotenvKey)

Source from the content-addressed store, hash-verified

1975 return "";
1976 }
1977 function _instructions(result, dotenvKey) {
1978 let uri;
1979 try {
1980 uri = new URL(dotenvKey);
1981 } catch (error) {
1982 if (error.code === "ERR_INVALID_URL") {
1983 const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
1984 err.code = "INVALID_DOTENV_KEY";
1985 throw err;
1986 }
1987 throw error;
1988 }
1989 const key = uri.password;
1990 if (!key) {
1991 const err = new Error("INVALID_DOTENV_KEY: Missing key part");
1992 err.code = "INVALID_DOTENV_KEY";
1993 throw err;
1994 }
1995 const environment = uri.searchParams.get("environment");
1996 if (!environment) {
1997 const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
1998 err.code = "INVALID_DOTENV_KEY";
1999 throw err;
2000 }
2001 const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
2002 const ciphertext = result.parsed[environmentKey];
2003 if (!ciphertext) {
2004 const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
2005 err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
2006 throw err;
2007 }
2008 return { ciphertext, key };
2009 }
2010 function _vaultPath(options) {
2011 let possibleVaultPath = null;
2012 if (options && options.path && options.path.length > 0) {

Callers 1

_parseVaultFunction · 0.85

Calls 2

toUpperCaseMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…