@mcpher/gas-fakes 2.3.13 → 2.3.15

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.
Files changed (54) hide show
  1. package/README.md +11 -5
  2. package/gf_agent/README.md +101 -0
  3. package/gf_agent/SKILL.md +396 -0
  4. package/gf_agent/documentation.md +105 -0
  5. package/gf_agent/gf-agent-contributor/SKILL.md +56 -0
  6. package/gf_agent/index.md +21 -0
  7. package/gf_agent/knowledge/00-execution-context.md +4 -0
  8. package/gf_agent/knowledge/01-drive.md +12 -0
  9. package/gf_agent/knowledge/02-syntax.md +13 -0
  10. package/gf_agent/knowledge/03-auth.md +15 -0
  11. package/gf_agent/knowledge/04-advanced.md +24 -0
  12. package/gf_agent/knowledge/05-sheets-forms.md +25 -0
  13. package/gf_agent/knowledge/06-jdbc-cloudsql.md +21 -0
  14. package/gf_agent/knowledge/07-jdbc-auth-details.md +30 -0
  15. package/gf_agent/knowledge/08-docs-limitations.md +4 -0
  16. package/gf_agent/knowledge/09-orchestrator-pattern.md +54 -0
  17. package/gf_agent/knowledge/10-sandbox-security.md +61 -0
  18. package/gf_agent/knowledge/11-chart-builder-limitations.md +15 -0
  19. package/gf_agent/knowledge/12-gmail-eventual-consistency.md +13 -0
  20. package/gf_agent/knowledge/README.md +16 -0
  21. package/gf_agent/scripts/SKILL.template.md +65 -0
  22. package/gf_agent/scripts/builder.js +78 -47
  23. package/gf_agent/skills/base.md +156 -0
  24. package/gf_agent/skills/cache.md +20 -0
  25. package/gf_agent/skills/calendar.md +780 -0
  26. package/gf_agent/skills/charts.md +127 -0
  27. package/gf_agent/skills/document.md +6626 -0
  28. package/gf_agent/skills/drive.md +423 -0
  29. package/gf_agent/skills/forms.md +4036 -0
  30. package/gf_agent/skills/gmail.md +576 -0
  31. package/gf_agent/skills/jdbc.md +3101 -0
  32. package/gf_agent/skills/lock.md +20 -0
  33. package/gf_agent/skills/properties.md +19 -0
  34. package/gf_agent/skills/script.md +50 -0
  35. package/gf_agent/skills/slides.md +5054 -0
  36. package/gf_agent/skills/spreadsheet.md +56075 -0
  37. package/gf_agent/skills/urlfetch.md +28 -0
  38. package/gf_agent/skills/utilities.md +33 -0
  39. package/gf_agent/skills/xml.md +270 -0
  40. package/package.json +1 -1
  41. package/src/cli/mcp.js +82 -67
  42. package/src/cli/setup.js +87 -9
  43. package/src/services/advgmail/fakeadvgmailmessages.js +85 -3
  44. package/src/services/driveapp/fakedrivemeta.js +1 -1
  45. package/src/services/gmailapp/fakegmailapp.js +217 -1
  46. package/src/services/gmailapp/fakegmailattachment.js +5 -0
  47. package/src/services/gmailapp/fakegmaildraft.js +32 -4
  48. package/src/services/gmailapp/fakegmaillabel.js +45 -0
  49. package/src/services/gmailapp/fakegmailmessage.js +212 -9
  50. package/src/services/gmailapp/fakegmailthread.js +151 -1
  51. package/src/services/spreadsheetapp/fakeembeddedchartbuilder.js +113 -28
  52. package/src/support/sxgmail.js +22 -2
  53. package/docs_discovery.json +0 -4939
  54. package/drive_tools.js +0 -20
@@ -1,67 +1,97 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
+ import { fileURLToPath } from 'url';
3
4
 
4
- const PROGRESS_DIR = './progress';
5
- const SKILLS_DIR = './gf_agent/skills';
6
- const INDEX_FILE = './gf_agent/index.md';
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+
8
+ // The script is at gf_agent/scripts/builder.js, so the root is one level up
9
+ const GF_AGENT_DIR = path.resolve(__dirname, '..');
10
+
11
+ // Standardize paths relative to the gf_agent directory
12
+ const SKILLS_DIR = path.join(GF_AGENT_DIR, 'skills');
13
+ const INDEX_FILE = path.join(GF_AGENT_DIR, 'index.md');
14
+ const TEMPLATE_FILE = path.join(__dirname, 'SKILL.template.md');
15
+ const KNOWLEDGE_DIR = path.join(GF_AGENT_DIR, 'knowledge');
16
+ const SKILL_OUTPUT = path.join(GF_AGENT_DIR, 'SKILL.md');
17
+
18
+ // Use CWD for progress dir to allow user to provide it in a sparse clone/standalone env
19
+ const PROGRESS_DIR = path.resolve(process.cwd(), 'progress');
7
20
 
8
21
  async function build() {
9
- await fs.mkdir(SKILLS_DIR, { recursive: true });
22
+ // Cleanup potential junk from previous runs where paths were relative to CWD
23
+ // (e.g. if run from within gf_agent/scripts, it might have created gf_agent/scripts/gf_agent)
24
+ try {
25
+ const junkDir = path.join(__dirname, 'gf_agent');
26
+ await fs.rm(junkDir, { recursive: true, force: true });
27
+ } catch (err) {
28
+ // Ignore
29
+ }
10
30
 
11
- const files = await fs.readdir(PROGRESS_DIR);
12
- const mdFiles = files.filter(f => f.endsWith('.md') || f.endsWith('.MD'));
31
+ await fs.mkdir(SKILLS_DIR, { recursive: true });
13
32
 
14
33
  let masterIndex = '# gf_agent Skills Index\n\nThis index lists all Google Apps Script services and classes supported by `gf_agent` via `gas-fakes`.\n\n';
15
34
 
16
- for (const file of mdFiles) {
17
- const content = await fs.readFile(path.join(PROGRESS_DIR, file), 'utf-8');
18
- const serviceName = file.replace(/\.md$/i, '');
19
-
20
- // Extract classes
21
- const classMatches = content.matchAll(/## Class: \[(.*?)\]/g);
22
- const classes = [];
23
-
24
- for (const match of classMatches) {
25
- const className = match[1];
26
- // Find the table for this class
27
- const classSection = content.slice(match.index);
28
- const tableEnd = classSection.indexOf('## Class:') > 0 ? classSection.indexOf('## Class:', 10) : classSection.length;
29
- const tableContent = classSection.slice(0, tableEnd);
35
+ try {
36
+ // Check if progress directory exists before attempting to read
37
+ await fs.access(PROGRESS_DIR);
38
+ const files = await fs.readdir(PROGRESS_DIR);
39
+ const mdFiles = files.filter(f => f.endsWith('.md') || f.endsWith('.MD'));
40
+
41
+ for (const file of mdFiles) {
42
+ const content = await fs.readFile(path.join(PROGRESS_DIR, file), 'utf-8');
43
+ const serviceName = file.replace(/\.md$/i, '');
30
44
 
31
- // Extract completed methods
32
- const methodMatches = tableContent.matchAll(/\| \[(.*?)\]\(.*?\) \| .*? \| .*? \| .*? \| (completed) \|/g);
33
- const methods = Array.from(methodMatches).map(m => m[1]);
45
+ // Extract classes
46
+ const classMatches = content.matchAll(/## Class: \[(.*?)\]/g);
47
+ const classes = [];
34
48
 
35
- if (methods.length > 0) {
36
- classes.push({ name: className, methods });
49
+ for (const match of classMatches) {
50
+ const className = match[1];
51
+ // Find the table for this class
52
+ const classSection = content.slice(match.index);
53
+ const tableEnd = classSection.indexOf('## Class:') > 0 ? classSection.indexOf('## Class:', 10) : classSection.length;
54
+ const tableContent = classSection.slice(0, tableEnd);
55
+
56
+ // Extract completed methods
57
+ const methodMatches = tableContent.matchAll(/\| \[(.*?)\]\(.*?\) \| .*? \| .*? \| .*? \| (completed) \|/g);
58
+ const methods = Array.from(methodMatches).map(m => m[1]);
59
+
60
+ if (methods.length > 0) {
61
+ classes.push({ name: className, methods });
62
+ }
37
63
  }
38
- }
39
64
 
40
- if (classes.length > 0) {
41
- const skillFile = `${serviceName.toLowerCase()}.md`;
42
- let skillContent = `# Service: ${serviceName}\n\n`;
43
-
44
- classes.forEach(c => {
45
- skillContent += `## Class: ${c.name}\n\n`;
46
- skillContent += `Supported Methods:\n`;
47
- c.methods.forEach(m => {
48
- skillContent += `- \`${m}\`\n`;
65
+ if (classes.length > 0) {
66
+ const skillFile = `${serviceName.toLowerCase()}.md`;
67
+ let skillContent = `# Service: ${serviceName}\n\n`;
68
+
69
+ classes.forEach(c => {
70
+ skillContent += `## Class: ${c.name}\n\n`;
71
+ skillContent += `Supported Methods:\n`;
72
+ c.methods.forEach(m => {
73
+ skillContent += `- \`${m}\`\n`;
74
+ });
75
+ skillContent += '\n';
49
76
  });
50
- skillContent += '\n';
51
- });
52
77
 
53
- await fs.writeFile(path.join(SKILLS_DIR, skillFile), skillContent);
54
- masterIndex += `- [${serviceName}](skills/${skillFile})\n`;
78
+ await fs.writeFile(path.join(SKILLS_DIR, skillFile), skillContent);
79
+ masterIndex += `- [${serviceName}](skills/${skillFile})\n`;
80
+ }
55
81
  }
56
- }
57
82
 
58
- await fs.writeFile(INDEX_FILE, masterIndex);
83
+ await fs.writeFile(INDEX_FILE, masterIndex);
84
+ console.log(`Skills and Index generated from ${PROGRESS_DIR}`);
85
+ } catch (err) {
86
+ if (err.code === 'ENOENT') {
87
+ console.log(`Skipping skills index generation: ${PROGRESS_DIR} not found.`);
88
+ } else {
89
+ console.log(`Skipping skills index generation: ${err.message}`);
90
+ }
91
+ console.log(`(This is expected in a sparse clone environment).`);
92
+ }
59
93
 
60
94
  // Aggregate knowledge files into SKILL.md
61
- const TEMPLATE_FILE = './gf_agent/scripts/SKILL.template.md';
62
- const KNOWLEDGE_DIR = './gf_agent/knowledge';
63
- const SKILL_OUTPUT = './gf_agent/SKILL.md';
64
-
65
95
  let skillMarkdown = await fs.readFile(TEMPLATE_FILE, 'utf-8');
66
96
 
67
97
  try {
@@ -76,12 +106,13 @@ async function build() {
76
106
  }
77
107
  }
78
108
  } catch (err) {
79
- console.log("No knowledge directory found or error reading it:", err.message);
109
+ console.log(`No knowledge directory found at ${KNOWLEDGE_DIR} or error reading it:`, err.message);
80
110
  }
81
111
 
82
112
  await fs.writeFile(SKILL_OUTPUT, skillMarkdown);
83
113
 
84
- console.log('Build complete! Skills, Index, and monolithic SKILL.md generated.');
114
+ console.log(`Build complete! Skills, Index, and monolithic SKILL.md generated at ${SKILL_OUTPUT}`);
85
115
  }
86
116
 
87
117
  build().catch(console.error);
118
+
@@ -0,0 +1,156 @@
1
+ # Service: base
2
+
3
+ ## Class: Blob
4
+
5
+ Supported Methods:
6
+ - `copyBlob()`
7
+ - `getBytes()`
8
+ - `getContentType()`
9
+ - `getDataAsString()`
10
+ - `getDataAsString(String)`
11
+ - `getName()`
12
+ - `isGoogleType()`
13
+ - `setBytes(Byte)`
14
+ - `setContentType(String)`
15
+ - `setContentTypeFromExtension()`
16
+ - `setDataFromString(String,String)`
17
+ - `setDataFromString(String)`
18
+ - `setName(String)`
19
+ - `clear()`
20
+ - `getLog()`
21
+ - `log(Object)`
22
+ - `log(String,Object...)`
23
+ - `asHexString()`
24
+ - `getBlue()`
25
+ - `getColorType()`
26
+ - `getGreen()`
27
+ - `getRed()`
28
+ - `getActiveUser()`
29
+ - `getActiveUserLocale()`
30
+ - `getEffectiveUser()`
31
+ - `getScriptTimeZone()`
32
+ - `getTemporaryActiveUserKey()`
33
+ - `getEmail()`
34
+
35
+ ## Class: Browser
36
+
37
+ Supported Methods:
38
+ - `clear()`
39
+ - `getLog()`
40
+ - `log(Object)`
41
+ - `log(String,Object...)`
42
+ - `asHexString()`
43
+ - `getBlue()`
44
+ - `getColorType()`
45
+ - `getGreen()`
46
+ - `getRed()`
47
+ - `getActiveUser()`
48
+ - `getActiveUserLocale()`
49
+ - `getEffectiveUser()`
50
+ - `getScriptTimeZone()`
51
+ - `getTemporaryActiveUserKey()`
52
+ - `getEmail()`
53
+
54
+ ## Class: console
55
+
56
+ Supported Methods:
57
+ - `clear()`
58
+ - `getLog()`
59
+ - `log(Object)`
60
+ - `log(String,Object...)`
61
+ - `asHexString()`
62
+ - `getBlue()`
63
+ - `getColorType()`
64
+ - `getGreen()`
65
+ - `getRed()`
66
+ - `getActiveUser()`
67
+ - `getActiveUserLocale()`
68
+ - `getEffectiveUser()`
69
+ - `getScriptTimeZone()`
70
+ - `getTemporaryActiveUserKey()`
71
+ - `getEmail()`
72
+
73
+ ## Class: Logger
74
+
75
+ Supported Methods:
76
+ - `clear()`
77
+ - `getLog()`
78
+ - `log(Object)`
79
+ - `log(String,Object...)`
80
+ - `asHexString()`
81
+ - `getBlue()`
82
+ - `getColorType()`
83
+ - `getGreen()`
84
+ - `getRed()`
85
+ - `getActiveUser()`
86
+ - `getActiveUserLocale()`
87
+ - `getEffectiveUser()`
88
+ - `getScriptTimeZone()`
89
+ - `getTemporaryActiveUserKey()`
90
+ - `getEmail()`
91
+
92
+ ## Class: Menu
93
+
94
+ Supported Methods:
95
+ - `asHexString()`
96
+ - `getBlue()`
97
+ - `getColorType()`
98
+ - `getGreen()`
99
+ - `getRed()`
100
+ - `getActiveUser()`
101
+ - `getActiveUserLocale()`
102
+ - `getEffectiveUser()`
103
+ - `getScriptTimeZone()`
104
+ - `getTemporaryActiveUserKey()`
105
+ - `getEmail()`
106
+
107
+ ## Class: PromptResponse
108
+
109
+ Supported Methods:
110
+ - `asHexString()`
111
+ - `getBlue()`
112
+ - `getColorType()`
113
+ - `getGreen()`
114
+ - `getRed()`
115
+ - `getActiveUser()`
116
+ - `getActiveUserLocale()`
117
+ - `getEffectiveUser()`
118
+ - `getScriptTimeZone()`
119
+ - `getTemporaryActiveUserKey()`
120
+ - `getEmail()`
121
+
122
+ ## Class: RgbColor
123
+
124
+ Supported Methods:
125
+ - `asHexString()`
126
+ - `getBlue()`
127
+ - `getColorType()`
128
+ - `getGreen()`
129
+ - `getRed()`
130
+ - `getActiveUser()`
131
+ - `getActiveUserLocale()`
132
+ - `getEffectiveUser()`
133
+ - `getScriptTimeZone()`
134
+ - `getTemporaryActiveUserKey()`
135
+ - `getEmail()`
136
+
137
+ ## Class: Session
138
+
139
+ Supported Methods:
140
+ - `getActiveUser()`
141
+ - `getActiveUserLocale()`
142
+ - `getEffectiveUser()`
143
+ - `getScriptTimeZone()`
144
+ - `getTemporaryActiveUserKey()`
145
+ - `getEmail()`
146
+
147
+ ## Class: Ui
148
+
149
+ Supported Methods:
150
+ - `getEmail()`
151
+
152
+ ## Class: User
153
+
154
+ Supported Methods:
155
+ - `getEmail()`
156
+
@@ -0,0 +1,20 @@
1
+ # Service: cache
2
+
3
+ ## Class: Cache
4
+
5
+ Supported Methods:
6
+ - `get(String)`
7
+ - `put(String,String,Integer)`
8
+ - `put(String,String)`
9
+ - `remove(String)`
10
+ - `getDocumentCache()`
11
+ - `getScriptCache()`
12
+ - `getUserCache()`
13
+
14
+ ## Class: CacheService
15
+
16
+ Supported Methods:
17
+ - `getDocumentCache()`
18
+ - `getScriptCache()`
19
+ - `getUserCache()`
20
+