Skip to content

Commit 2f88694

Browse files
fix: harden foundation release gates (#56)
* fix: harden foundation release gates * fix: align prompt activity example
1 parent de5df61 commit 2f88694

4 files changed

Lines changed: 49 additions & 3 deletions

File tree

src/__tests__/package-scripts.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,25 @@ describe('package scripts', () => {
5151
}
5252
});
5353

54+
it('lets Docker live testing use process environment credentials without a .env file', () => {
55+
const result = spawnSync('node', [
56+
'-e',
57+
[
58+
'process.env.HELPSCOUT_APP_ID="env-app";',
59+
'process.env.HELPSCOUT_APP_SECRET="env-secret";',
60+
'const { loadEnvFile } = require("./tests/test-docker.cjs");',
61+
'const env = loadEnvFile();',
62+
'process.stdout.write(`${env.HELPSCOUT_APP_ID}:${env.HELPSCOUT_APP_SECRET}`);',
63+
].join(''),
64+
], {
65+
cwd: process.cwd(),
66+
encoding: 'utf8',
67+
});
68+
69+
expect(result.status).toBe(0);
70+
expect(result.stdout).toBe('env-app:env-secret');
71+
});
72+
5473
it('guards sync:plugin when the target checkout has local files', () => {
5574
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'helpscout-sync-plugin-'));
5675
const pluginDir = path.join(tempRoot, 'helpscout-navigator');

src/__tests__/prompts.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,25 @@ describe('PromptHandler', () => {
427427
expect(searchParams.extra).toBeUndefined();
428428
});
429429

430+
it('should keep the activity timestamp example internally consistent', async () => {
431+
const request = {
432+
method: 'prompts/get',
433+
params: {
434+
name: 'list-inbox-activity',
435+
arguments: {
436+
inboxId: 'inbox-123',
437+
hours: 12,
438+
}
439+
}
440+
};
441+
442+
const result = await promptHandler.getPrompt(request);
443+
const promptText = result.messages[0].content.text;
444+
445+
expect(promptText).toContain('If current time is "2025-06-11T15:04:00Z" and hours is 12');
446+
expect(promptText).toContain('then 12 hours ago would be "2025-06-11T03:04:00Z"');
447+
});
448+
430449
it('should include thread details when includeThreads is true', async () => {
431450
const request = {
432451
method: 'prompts/get',

src/prompts/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ export class PromptHandler {
99
.join('\n');
1010
}
1111

12+
private exampleHoursAgo(hours: number): string {
13+
const exampleNow = new Date('2025-06-11T15:04:00Z');
14+
return new Date(exampleNow.getTime() - hours * 60 * 60 * 1000)
15+
.toISOString()
16+
.replace(/\.\d{3}Z$/, 'Z');
17+
}
18+
1219
private parsePositiveHours(value: unknown): number | null {
1320
if (typeof value !== 'number' && typeof value !== 'string') {
1421
return null;
@@ -436,8 +443,8 @@ Note: The exact tag names may vary by organization. Common urgent tag variations
436443
437444
2. Calculate the timestamp ${hours} hours ago from the current time.
438445
- Subtract ${hours} hours from the current timestamp
439-
- Example: If current time is "2025-06-11T15:04:00Z" and hours is 24,
440-
then ${hours} hours ago would be "${new Date(new Date().getTime() - hours * 60 * 60 * 1000).toISOString().replace(/\.\d{3}Z$/, 'Z')}"
446+
- Example: If current time is "2025-06-11T15:04:00Z" and hours is ${hours},
447+
then ${hours} hours ago would be "${this.exampleHoursAgo(hours)}"
441448
442449
3. Search for conversations in the specified inbox using the "searchConversations" tool:
443450
\`\`\`json

tests/test-docker.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const MCP_RESPONSE_TIMEOUT_MS = 30_000;
1111
function loadEnvFile() {
1212
const envPath = path.join(__dirname, '..', '.env');
1313
if (!fs.existsSync(envPath)) {
14-
throw new Error('Missing .env file. Copy .env.example to .env and add Help Scout OAuth credentials.');
14+
return process.env;
1515
}
1616

1717
const env = {};
@@ -288,3 +288,4 @@ if (require.main === module) {
288288
}
289289

290290
module.exports = DockerLiveTester;
291+
module.exports.loadEnvFile = loadEnvFile;

0 commit comments

Comments
 (0)