@mcpher/gas-fakes 1.2.11 → 1.2.13

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/README.RU.md CHANGED
@@ -358,4 +358,9 @@ const getParentsIterator = ({
358
358
  - [How to allow access to sensitive scopes with Application Default Credentials](https://ramblings.mcpher.com/how-to-allow-access-to-sensitive-scopes-with-application-default-credentials/)
359
359
  - [Supercharge Your Google Apps Script Caching with GasFlexCache](https://ramblings.mcpher.com/supercharge-your-google-apps-script-caching-with-gasflexcache/)
360
360
  - [Fake-Sandbox for Google Apps Script: Granular controls.](https://ramblings.mcpher.com/fake-sandbox-for-google-apps-script-granular-controls/)
361
- - [A Fake-Sandbox for Google Apps Script: Securely Executing Code Generated by Gemini CLI](https://ramblings.mcpher.com/gas-fakes-sandbox/)
361
+ - [A Fake-Sandbox for Google Apps Script: Securely Executing Code Generated by Gemini CLI](https://ramblings.mcpher.com/gas-fakes-sandbox/)
362
+ - [Bridging the Gap: Seamless Integration for Local Google Apps Script Development](https://medium.com/@tanaike/bridging-the-gap-seamless-integration-for-local-google-apps-script-development-9b9b973aeb02)
363
+ - [Next-Level Google Apps Script Development](https://medium.com/google-cloud/next-level-google-apps-script-development-654be5153912)
364
+ - [Secure and Streamlined Google Apps Script Development with gas-fakes CLI and Gemini CLI Extension](https://medium.com/google-cloud/secure-and-streamlined-google-apps-script-development-with-gas-fakes-cli-and-gemini-cli-extension-67bbce80e2c8)
365
+ - [Secure and Conversational Google Workspace Automation: Integrating Gemini CLI with a gas-fakes MCP Server](https://medium.com/google-cloud/secure-and-conversational-google-workspace-automation-integrating-gemini-cli-with-a-gas-fakes-mcp-0a5341559865)
366
+ - [A Fake-Sandbox for Google Apps Script: A Feasibility Study on Securely Executing Code Generated by Gemini CL](https://medium.com/google-cloud/a-fake-sandbox-for-google-apps-script-a-feasibility-study-on-securely-executing-code-generated-by-cc985ce5dae3)
package/README.md CHANGED
@@ -177,4 +177,9 @@ As I mentioned earlier, to take this further, I'm going to need a lot of help to
177
177
  - [How to allow access to sensitive scopes with Application Default Credentials](https://ramblings.mcpher.com/how-to-allow-access-to-sensitive-scopes-with-application-default-credentials/)
178
178
  - [Supercharge Your Google Apps Script Caching with GasFlexCache](https://ramblings.mcpher.com/supercharge-your-google-apps-script-caching-with-gasflexcache/)
179
179
  - [Fake-Sandbox for Google Apps Script: Granular controls.](https://ramblings.mcpher.com/fake-sandbox-for-google-apps-script-granular-controls/)
180
- - [A Fake-Sandbox for Google Apps Script: Securely Executing Code Generated by Gemini CLI](https://ramblings.mcpher.com/gas-fakes-sandbox/)
180
+ - [A Fake-Sandbox for Google Apps Script: Securely Executing Code Generated by Gemini CLI](https://ramblings.mcpher.com/gas-fakes-sandbox/)
181
+ - [Bridging the Gap: Seamless Integration for Local Google Apps Script Development](https://medium.com/@tanaike/bridging-the-gap-seamless-integration-for-local-google-apps-script-development-9b9b973aeb02)
182
+ - [Next-Level Google Apps Script Development](https://medium.com/google-cloud/next-level-google-apps-script-development-654be5153912)
183
+ - [Secure and Streamlined Google Apps Script Development with gas-fakes CLI and Gemini CLI Extension](https://medium.com/google-cloud/secure-and-streamlined-google-apps-script-development-with-gas-fakes-cli-and-gemini-cli-extension-67bbce80e2c8)
184
+ - [Secure and Conversational Google Workspace Automation: Integrating Gemini CLI with a gas-fakes MCP Server](https://medium.com/google-cloud/secure-and-conversational-google-workspace-automation-integrating-gemini-cli-with-a-gas-fakes-mcp-0a5341559865)
185
+ - [A Fake-Sandbox for Google Apps Script: A Feasibility Study on Securely Executing Code Generated by Gemini CL](https://medium.com/google-cloud/a-fake-sandbox-for-google-apps-script-a-feasibility-study-on-securely-executing-code-generated-by-cc985ce5dae3)
package/exgcp.sh CHANGED
@@ -20,7 +20,7 @@ fi
20
20
  GCP_PROJECT_ID_VALUE=$(grep -E '^GCP_PROJECT_ID=' "$ENV_FILE" | cut -d '=' -f2 | tr -d '"\r')
21
21
  GEMINI_API_KEY_VALUE=$(grep -E '^GEMINI_API_KEY=' "$ENV_FILE" | cut -d '=' -f2 | tr -d '"\r')
22
22
  GEMINI_MODEL_VALUE=$(grep -E '^GEMINI_MODEL=' "$ENV_FILE" | cut -d '=' -f2 | tr -d '"\r')
23
-
23
+ OMDB_API_KEY_VALUE=$(grep -E '^OMDB_API_KEY=' "$ENV_FILE" | cut -d '=' -f2 | tr -d '"\r')
24
24
  # Check if a value was extracted
25
25
  if [ -z "$GCP_PROJECT_ID_VALUE" ]; then
26
26
  echo "Error: GCP_PROJECT_ID not found or is empty in $ENV_FILE."
@@ -34,6 +34,13 @@ else
34
34
  export GEMINI_API_KEY="$GEMINI_API_KEY_VALUE"
35
35
  fi
36
36
 
37
+ if [ -z "OMDB_API_KEY_VALUE" ]; then
38
+ echo "OMDB_API_KEY not found or is empty in $ENV_FILE."
39
+ else
40
+ echo "exported: OMDB_API_KEY"
41
+ export OMDB_API_KEY="$OMDB_API_KEY_VALUE"
42
+ fi
43
+
37
44
  if [ -z "GEMINI_MODEL_VALUE" ]; then
38
45
  echo "GEMINI_MODEL not found or is empty in $ENV_FILE."
39
46
  else
package/gas-fakes.js CHANGED
@@ -12,13 +12,19 @@ import { Command } from "commander";
12
12
  import dotenv from "dotenv";
13
13
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
14
14
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
15
- import { z, ZodCatch } from "zod";
15
+ import { z } from "zod";
16
+
17
+ // sync the version with gas fakes code since they share a package.json
18
+ import { createRequire } from "node:module";
19
+ const require = createRequire(import.meta.url);
20
+ const pjson = require("./package.json");
21
+ const VERSION = pjson.version;
16
22
 
17
23
  // -----------------------------------------------------------------------------
18
24
  // CONSTANTS & UTILITIES
19
25
  // -----------------------------------------------------------------------------
20
26
 
21
- const VERSION = "0.0.6";
27
+ const CLI_VERSION = "0.0.8";
22
28
  const MCP_VERSION = "0.0.3";
23
29
  const execAsync = promisify(exec);
24
30
 
@@ -155,7 +161,7 @@ function generateExecutionScript({ scriptText, useSandbox, sandboxConfig }) {
155
161
  ' await import("./main.js"); // This will trigger the fxInit call',
156
162
  gasScript,
157
163
  "}",
158
- "runGas();",
164
+ "return runGas();",
159
165
  ].join("\n");
160
166
 
161
167
  return { mainScript, gasScript };
@@ -180,7 +186,11 @@ async function executeGasScript(options) {
180
186
  args,
181
187
  } = options;
182
188
 
183
- const scriptText = filename ? fs.readFileSync(filename, "utf8") : script;
189
+ let scriptText = filename ? fs.readFileSync(filename, "utf8") : script;
190
+
191
+ if (scriptText) {
192
+ scriptText = scriptText.replace(/\\\s*?\n/g, "\n");
193
+ }
184
194
 
185
195
  const { mainScript, gasScript } = generateExecutionScript({
186
196
  scriptText: normalizeScriptNewlines(scriptText),
@@ -201,12 +211,17 @@ async function executeGasScript(options) {
201
211
  configurable: true,
202
212
  });
203
213
 
214
+ let res;
204
215
  if (args) {
205
216
  const gasFunction = new Function("args", mainScript);
206
- await gasFunction(args);
217
+ res = await gasFunction(args);
207
218
  } else {
208
219
  const gasFunction = new Function(mainScript);
209
- await gasFunction();
220
+ res = await gasFunction();
221
+ }
222
+ if (res) {
223
+ const output = typeof res == "string" ? res : JSON.stringify(res);
224
+ console.log(output); // Returned value from Google Apps Script.
210
225
  }
211
226
  }
212
227
 
@@ -475,7 +490,12 @@ async function main() {
475
490
  let args = null;
476
491
  if (options.args) {
477
492
  try {
478
- args = JSON.parse(options.args);
493
+ args = JSON.parse(
494
+ options.args
495
+ .replace(/\\\s*?\n/g, "\\n")
496
+ .replace(/\n/g, "\\n")
497
+ .replace(/\r/g, "\\r")
498
+ );
479
499
  } catch (err) {
480
500
  console.error("Error: Invalid JSON provided to --args option.");
481
501
  process.exit(1);
package/main.js CHANGED
@@ -1,2 +1,8 @@
1
1
  // testing locally
2
+ // sync the version with gas fakes code since they share a package.json
3
+ import { createRequire } from 'node:module';
4
+ const require = createRequire(import.meta.url);
5
+ const pjson = require('./package.json');
6
+ const VERSION = pjson.version;
7
+ console.log (`...gas-fakes version ${VERSION}`)
2
8
  import './src/index.js'
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "name": "@mcpher/gas-fakes",
39
39
  "author": "bruce mcpherson",
40
- "version": "1.2.11",
40
+ "version": "1.2.13",
41
41
  "license": "MIT",
42
42
  "main": "main.js",
43
43
  "description": "A proof of concept implementation of Apps Script Environment on Node",
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  import './services/scriptapp/app.js'
2
3
 
3
4
  import './services/driveapp/app.js'