repoburg 1.3.211 → 1.3.213
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/agent-pane/backend/dist/index.js +88 -9
- package/agent-pane/backend/dist/server.js +88 -9
- package/backend/dist/src/app.module.js +2 -0
- package/backend/dist/src/app.module.js.map +1 -1
- package/backend/dist/src/session-inputs/session-input-context.service.d.ts +3 -1
- package/backend/dist/src/session-inputs/session-input-context.service.js +25 -7
- package/backend/dist/src/session-inputs/session-input-context.service.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.module.js +2 -0
- package/backend/dist/src/session-inputs/session-inputs.module.js.map +1 -1
- package/backend/dist/src/slash-commands/slash-commands.controller.d.ts +10 -0
- package/backend/dist/src/slash-commands/slash-commands.controller.js +37 -0
- package/backend/dist/src/slash-commands/slash-commands.controller.js.map +1 -0
- package/backend/dist/src/slash-commands/slash-commands.module.d.ts +2 -0
- package/backend/dist/src/slash-commands/slash-commands.module.js +23 -0
- package/backend/dist/src/slash-commands/slash-commands.module.js.map +1 -0
- package/backend/dist/src/slash-commands/slash-commands.service.d.ts +23 -0
- package/backend/dist/src/slash-commands/slash-commands.service.js +136 -0
- package/backend/dist/src/slash-commands/slash-commands.service.js.map +1 -0
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/backend/package.json +2 -0
- package/discuss-e2e-open.png +0 -0
- package/hasan-thread-after-fix.png +0 -0
- package/hasan-threads.png +0 -0
- package/package.json +1 -1
- package/visual-editor-proxy/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var SlashCommandsService_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SlashCommandsService = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const yaml = require("js-yaml");
|
|
15
|
+
const NAME_REGEX = /^[a-z0-9][a-z0-9-]*$/;
|
|
16
|
+
let SlashCommandsService = SlashCommandsService_1 = class SlashCommandsService {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.logger = new common_1.Logger(SlashCommandsService_1.name);
|
|
19
|
+
}
|
|
20
|
+
commandsDir() {
|
|
21
|
+
const projectPath = process.env.REPOBURG_PROJECT_PATH || process.cwd();
|
|
22
|
+
return path.join(projectPath, '.repoburg', 'commands');
|
|
23
|
+
}
|
|
24
|
+
async list() {
|
|
25
|
+
const commands = await this.loadAll();
|
|
26
|
+
return commands.map((c) => ({
|
|
27
|
+
name: c.name,
|
|
28
|
+
description: c.description,
|
|
29
|
+
argument_hint: c.argumentHint,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
async tryExpand(prompt) {
|
|
33
|
+
const match = prompt.match(/^\/([a-z0-9][a-z0-9-]*)\s*([\s\S]*)$/);
|
|
34
|
+
if (!match) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const command = await this.findByName(match[1]);
|
|
38
|
+
if (!command) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const args = match[2].trim();
|
|
42
|
+
this.logger.log(`Expanding slash command "/${command.name}"`);
|
|
43
|
+
return this.substitute(command.body, args);
|
|
44
|
+
}
|
|
45
|
+
async findByName(name) {
|
|
46
|
+
const commands = await this.loadAll();
|
|
47
|
+
return commands.find((c) => c.name === name) ?? null;
|
|
48
|
+
}
|
|
49
|
+
substitute(body, args) {
|
|
50
|
+
const hasPlaceholder = /(?<!\\)\$(ARGUMENTS|[1-9])/.test(body);
|
|
51
|
+
const tokens = this.tokenizeArgs(args);
|
|
52
|
+
let result = body.replace(/(?<!\\)\$(ARGUMENTS|[1-9])/g, (_match, token) => token === 'ARGUMENTS' ? args : (tokens[parseInt(token, 10) - 1] ?? ''));
|
|
53
|
+
result = result.replace(/\\\$/g, '$');
|
|
54
|
+
if (args && !hasPlaceholder) {
|
|
55
|
+
result += `\n\nARGUMENTS: ${args}`;
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
tokenizeArgs(args) {
|
|
60
|
+
const tokens = [];
|
|
61
|
+
const regex = /"([^"]*)"|'([^']*)'|(\S+)/g;
|
|
62
|
+
let match;
|
|
63
|
+
while ((match = regex.exec(args)) !== null) {
|
|
64
|
+
tokens.push(match[1] ?? match[2] ?? match[3]);
|
|
65
|
+
}
|
|
66
|
+
return tokens;
|
|
67
|
+
}
|
|
68
|
+
async loadAll() {
|
|
69
|
+
const dir = this.commandsDir();
|
|
70
|
+
let files;
|
|
71
|
+
try {
|
|
72
|
+
files = await fs.promises.readdir(dir);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
const commands = [];
|
|
78
|
+
for (const file of files.sort()) {
|
|
79
|
+
if (!file.endsWith('.md')) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const name = file.slice(0, -3);
|
|
83
|
+
if (!NAME_REGEX.test(name)) {
|
|
84
|
+
this.logger.warn(`Skipping "${file}": command name must be kebab-case (a-z, 0-9, -).`);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
const raw = await fs.promises.readFile(path.join(dir, file), 'utf-8');
|
|
89
|
+
const parsed = this.parseFile(raw);
|
|
90
|
+
commands.push({
|
|
91
|
+
name,
|
|
92
|
+
description: typeof parsed.frontmatter?.description === 'string'
|
|
93
|
+
? parsed.frontmatter.description
|
|
94
|
+
: undefined,
|
|
95
|
+
argumentHint: this.readHint(parsed.frontmatter?.['argument-hint']),
|
|
96
|
+
body: parsed.body,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
this.logger.warn(`Skipping "${file}": could not read or parse (${error.message}).`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return commands;
|
|
104
|
+
}
|
|
105
|
+
readHint(value) {
|
|
106
|
+
if (typeof value === 'string') {
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
if (Array.isArray(value)) {
|
|
110
|
+
return value.map((v) => String(v)).join(' ');
|
|
111
|
+
}
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
parseFile(raw) {
|
|
115
|
+
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
116
|
+
if (!match) {
|
|
117
|
+
return { frontmatter: null, body: raw };
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const frontmatter = yaml.load(match[1]);
|
|
121
|
+
return {
|
|
122
|
+
frontmatter: frontmatter && typeof frontmatter === 'object' ? frontmatter : null,
|
|
123
|
+
body: match[2],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
this.logger.warn(`Invalid frontmatter, treating file as body only.`);
|
|
128
|
+
return { frontmatter: null, body: raw };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
exports.SlashCommandsService = SlashCommandsService;
|
|
133
|
+
exports.SlashCommandsService = SlashCommandsService = SlashCommandsService_1 = __decorate([
|
|
134
|
+
(0, common_1.Injectable)()
|
|
135
|
+
], SlashCommandsService);
|
|
136
|
+
//# sourceMappingURL=slash-commands.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash-commands.service.js","sourceRoot":"","sources":["../../../src/slash-commands/slash-commands.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,yBAAyB;AACzB,6BAA6B;AAC7B,gCAAgC;AA2BhC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAcnC,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAA1B;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC;IAuJlE,CAAC;IApJS,WAAW;QACjB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACvE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IACzD,CAAC;IAGD,KAAK,CAAC,IAAI;QACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACtC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1B,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,aAAa,EAAE,CAAC,CAAC,YAAY;SAC9B,CAAC,CAAC,CAAC;IACN,CAAC;IAOD,KAAK,CAAC,SAAS,CAAC,MAAc;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACnE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,I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