Skip to content

Commit 09924de

Browse files
committed
command update
1 parent 9cd9af2 commit 09924de

5 files changed

Lines changed: 42 additions & 10 deletions

File tree

extensions/copilot/package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,16 @@
15381538
"description": "%copilot.chronicle.description%",
15391539
"when": "github.copilot.sessionSearch.enabled"
15401540
},
1541+
{
1542+
"name": "chronicle:standup",
1543+
"description": "%copilot.chronicle.standup.description%",
1544+
"when": "github.copilot.sessionSearch.enabled"
1545+
},
1546+
{
1547+
"name": "chronicle:tips",
1548+
"description": "%copilot.chronicle.tips.description%",
1549+
"when": "github.copilot.sessionSearch.enabled"
1550+
},
15411551
{
15421552
"name": "explain",
15431553
"description": "%copilot.workspace.explain.description%"
@@ -4789,14 +4799,12 @@
47894799
"enum": [
47904800
"none",
47914801
"local",
4792-
"user",
4793-
"repo_and_user"
4802+
"user"
47944803
],
47954804
"enumDescriptions": [
47964805
"%github.copilot.config.sessionSearch.storageLevel.none%",
47974806
"%github.copilot.config.sessionSearch.storageLevel.local%",
4798-
"%github.copilot.config.sessionSearch.storageLevel.user%",
4799-
"%github.copilot.config.sessionSearch.storageLevel.repo_and_user%"
4807+
"%github.copilot.config.sessionSearch.storageLevel.user%"
48004808
],
48014809
"default": "none",
48024810
"scope": "resource",

extensions/copilot/package.nls.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@
169169
"copilot.agent.description": "Edit files in your workspace in agent mode",
170170
"copilot.agent.compact.description": "Free up context by compacting the conversation history. Optionally include extra instructions for compaction.",
171171
"copilot.chronicle.description": "Session history tools and insights",
172+
"copilot.chronicle.standup.description": "Generate a standup report from recent coding sessions",
173+
"copilot.chronicle.tips.description": "Get personalized tips based on your Copilot usage patterns",
174+
"copilot.chronicle.improve.description": "Get suggestions to improve your coding workflow",
172175
"github.copilot.command.resetSessionSearchConsent": "Reset Session Search Consent",
173176
"github.copilot.config.sessionSearch.storageLevel": "How Copilot stores your session history. Controls whether sessions are kept locally or synced to the cloud for features like `/chronicle`.",
174177
"github.copilot.config.sessionSearch.storageLevel.none": "No session storage (default)",

extensions/copilot/src/extension/chronicle/common/standupPrompt.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ export interface AnnotatedRef extends RefRow {
1616
source: 'vscode' | 'cli' | 'cloud';
1717
}
1818

19-
/** Sessions query — SQLite dialect, no time filter (demo) */
19+
/** Sessions query — SQLite dialect, last 24 hours */
2020
export const SESSIONS_QUERY_SQLITE = `SELECT id, summary, branch, repository, cwd, host_type, created_at, updated_at
2121
FROM sessions
22+
WHERE updated_at >= datetime('now', '-1 day')
2223
ORDER BY updated_at DESC`;
2324

2425
/** Build refs query for a list of session IDs */
@@ -77,7 +78,7 @@ export function buildStandupPrompt(
7778

7879
let prompt = `The user ran /chronicle standup. Generate a concise standup update from the pre-fetched data below.
7980
80-
## Pre-fetched Session Data (last 7 days)
81+
## Pre-fetched Session Data (last 24 hours)
8182
8283
### Sessions (${sessions.length})
8384
${sessionLines.join('\n')}

extensions/copilot/src/extension/common/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export const agentsToCommands: Partial<Record<Intent, Record<string, Intent>>> =
4848
'setupTests': Intent.SetupTests,
4949
'compact': Intent.Agent,
5050
'chronicle': Intent.Chronicle,
51+
'chronicle:standup': Intent.Chronicle,
52+
'chronicle:tips': Intent.Chronicle,
5153
},
5254
[Intent.VSCode]: {
5355
'search': Intent.Search,

extensions/copilot/src/extension/intents/node/chronicleIntent.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { ChroniclePrompt } from '../../prompts/node/panel/chroniclePrompt';
3535
/** DuckDB-dialect sessions query (cloud uses DuckDB, not SQLite). */
3636
const SESSIONS_QUERY_DUCKDB = `SELECT id, summary, branch, repository, cwd, created_at, updated_at
3737
FROM sessions
38+
WHERE updated_at >= now() - INTERVAL '1 day'
3839
ORDER BY updated_at DESC
3940
LIMIT 50`;
4041

@@ -88,23 +89,40 @@ export class ChronicleIntent implements IIntent {
8889
return {};
8990
}
9091

91-
const { subcommand, rest } = this._parseSubcommand(request.prompt);
92+
// Route by command name (e.g. 'chronicle:standup') or fall back to parsing the prompt
93+
const { subcommand, rest } = this._resolveSubcommand(request);
9294

9395
switch (subcommand) {
9496
case 'standup':
9597
return this._handleStandup(rest, stream, request, token);
9698
case 'tips':
9799
return this._handleTips(rest, stream, request, token, conversation, documentContext, location, chatTelemetry);
98100
case 'improve':
99-
stream.markdown(l10n.t('`/chronicle {0}` is not yet implemented. Try `/chronicle standup` or `/chronicle tips`.', subcommand));
101+
stream.markdown(l10n.t('`/chronicle {0}` is not yet implemented. Try `/chronicle:standup` or `/chronicle:tips`.', subcommand));
100102
return {};
101103
default:
102104
return this._handleFreeForm(request.prompt ?? '', stream, request, token, conversation, documentContext, location, chatTelemetry);
103105
}
104106
}
105107

106-
private _parseSubcommand(prompt: string | undefined): { subcommand: ChronicleSubcommand | string; rest: string | undefined } {
107-
const trimmed = prompt?.trim() ?? '';
108+
/**
109+
* Resolve the subcommand from the request command (e.g. 'chronicle:standup')
110+
* or fall back to parsing the prompt text for backwards compatibility.
111+
*/
112+
private _resolveSubcommand(request: vscode.ChatRequest): { subcommand: ChronicleSubcommand | string; rest: string | undefined } {
113+
// Prefer explicit command routing (e.g. /chronicle:standup)
114+
if (request.command) {
115+
const colonIdx = request.command.indexOf(':');
116+
if (colonIdx !== -1) {
117+
return {
118+
subcommand: request.command.slice(colonIdx + 1).toLowerCase(),
119+
rest: request.prompt?.trim() || undefined,
120+
};
121+
}
122+
}
123+
124+
// Fall back to parsing the prompt (for bare /chronicle or /chronicle standup)
125+
const trimmed = request.prompt?.trim() ?? '';
108126
if (!trimmed) {
109127
return { subcommand: 'standup', rest: undefined };
110128
}

0 commit comments

Comments
 (0)