{"id":21420,"library":"gws-with-audit-log","title":"gws-with-audit-log","description":"A CLI tool for interacting with Google Workspace APIs (Gmail, Drive, Calendar, etc.) with built-in audit logging. Current stable version is v0.22.5. Released as part of the googleworkspace/cli project with regular releases every 1-2 weeks. Key differentiators: dynamic command surface generated from Google Discovery Service, audit log support for tracking commands, prebuilt binaries with native OS keychain integration. ESM-only via npm package or direct binary download.","status":"active","version":"0.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/googleworkspace/cli","tags":["javascript","command-line-utilities","web-programming","cli","google-workspace","google","drive","gmail"],"install":[{"cmd":"npm install gws-with-audit-log","lang":"bash","label":"npm"},{"cmd":"yarn add gws-with-audit-log","lang":"bash","label":"yarn"},{"cmd":"pnpm add gws-with-audit-log","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required runtime for npm installation (>=14)","package":"node","optional":false}],"imports":[{"note":"ESM-only since v0.22.4. CJS require() will fail.","wrong":"const gws = require('gws-with-audit-log')","symbol":"gws","correct":"import gws from 'gws-with-audit-log'"},{"note":"Named export for programmatic use.","wrong":"import GwsClient from 'gws-with-audit-log'","symbol":"GwsClient","correct":"import { GwsClient } from 'gws-with-audit-log'"},{"note":"Audit logging module for tracking CLI commands.","wrong":"const AuditLog = require('gws-with-audit-log').AuditLog","symbol":"AuditLog","correct":"import { AuditLog } from 'gws-with-audit-log'"}],"quickstart":{"code":"import gws from 'gws-with-audit-log';\n\n// Authenticate with Google Workspace\nawait gws.auth.login({\n  clientId: process.env.GOOGLE_CLIENT_ID ?? '',\n  clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? '',\n  scopes: ['https://www.googleapis.com/auth/gmail.send']\n});\n\n// Send an email with audit log\nconst result = await gws.gmail.send({\n  to: 'user@example.com',\n  subject: 'Hello',\n  body: 'Test email',\n  auditLog: true\n});\n\nconsole.log('Sent message ID:', result.id);","lang":"typescript","description":"Shows authentication, sending an email via Gmail API, and enabling audit logging."},"warnings":[{"fix":"Use import syntax and Node >=14.","message":"Requires Node >=14 and ESM imports. Do not use require().","severity":"gotcha","affected_versions":">=0.22.4"},{"fix":"Add --draft flag explicitly if saving drafts is intended.","message":"v0.22.0 changed the --draft flag behavior for Gmail helpers. Existing scripts may send emails immediately if not updated.","severity":"breaking","affected_versions":">=0.22.0"},{"fix":"Use --from with explicit display name to override.","message":"v0.18.0 introduced auto-population of From header with display name. May change sender display unexpectedly.","severity":"breaking","affected_versions":">=0.18.0"},{"fix":"Ensure native OS keychain is available and not corrupted.","message":"v0.22.3 removed fallback .encryption_key file on macOS/Windows. Credentials cannot be decrypted if keychain fails.","severity":"breaking","affected_versions":">=0.22.3"},{"fix":"Watch release notes for stabilization.","message":"Audit logging flags may change in future versions. Currently experimental.","severity":"deprecated","affected_versions":">=0.0.5"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: import gws from 'gws-with-audit-log' (ESM only)","cause":"Using require() instead of import, or wrong import path.","error":"TypeError: gws.auth.login is not a function"},{"fix":"Run: gws auth login with required scopes","cause":"Missing OAuth tokens; --audit-log requires prior authentication.","error":"Error: [gws] No credentials found. Run 'gws auth login' first."},{"fix":"Add \"type\": \"module\" to package.json or use .mjs extension.","cause":"Node.js project not configured for ESM.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Install globally: npm install -g gws-with-audit-log","cause":"Binary not installed or not in PATH after npm install.","error":"gws: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}