@waron97/prbot 3.0.1 → 3.0.3
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/package.json
CHANGED
|
@@ -74,16 +74,20 @@ async function init() {
|
|
|
74
74
|
},
|
|
75
75
|
]);
|
|
76
76
|
if (!overwrite) {
|
|
77
|
-
console.log('
|
|
78
|
-
|
|
77
|
+
console.log('Skipped workspace file.');
|
|
78
|
+
} else {
|
|
79
|
+
writeFileSync(WORKSPACE_FILE, TEMPLATE, 'utf-8');
|
|
80
|
+
console.log(`Created ${WORKSPACE_FILE}`);
|
|
81
|
+
console.log(`Run 'agrippa clone' to add resources to this workspace.`);
|
|
82
|
+
console.log(`Add ${WORKSPACE_FILE} to .gitignore if it contains credentials.`);
|
|
79
83
|
}
|
|
84
|
+
} else {
|
|
85
|
+
writeFileSync(WORKSPACE_FILE, TEMPLATE, 'utf-8');
|
|
86
|
+
console.log(`Created ${WORKSPACE_FILE}`);
|
|
87
|
+
console.log(`Run 'agrippa clone' to add resources to this workspace.`);
|
|
88
|
+
console.log(`Add ${WORKSPACE_FILE} to .gitignore if it contains credentials.`);
|
|
80
89
|
}
|
|
81
90
|
|
|
82
|
-
writeFileSync(WORKSPACE_FILE, TEMPLATE, 'utf-8');
|
|
83
|
-
console.log(`Created ${WORKSPACE_FILE}`);
|
|
84
|
-
console.log(`Run 'agrippa clone' to add resources to this workspace.`);
|
|
85
|
-
console.log(`Add ${WORKSPACE_FILE} to .gitignore if it contains credentials.`);
|
|
86
|
-
|
|
87
91
|
if (!existsSync('pyproject.toml')) {
|
|
88
92
|
writeFileSync('pyproject.toml', PYPROJECT_TOML, 'utf-8');
|
|
89
93
|
console.log('Created pyproject.toml (ruff builtins)');
|
|
@@ -162,55 +162,25 @@ async function fetchRemoteCode(token, ripUrl, workspace) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
async function selectEntries(changed, verb, mode = 'pull') {
|
|
165
|
-
// Group by parent folder for folder-level pre-selection
|
|
166
|
-
const folderMap = new Map();
|
|
167
|
-
for (const entry of changed) {
|
|
168
|
-
const folder = dirname(entry.path) || '.';
|
|
169
|
-
if (!folderMap.has(folder)) folderMap.set(folder, []);
|
|
170
|
-
folderMap.get(folder).push(entry);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const folders = [...folderMap.keys()];
|
|
174
|
-
|
|
175
|
-
// Folder-level pre-selection (only shown when there are multiple folders)
|
|
176
|
-
let includedFolders = new Set(folders);
|
|
177
|
-
if (folders.length > 1) {
|
|
178
|
-
const { selectedFolders } = await inquirer.prompt([
|
|
179
|
-
{
|
|
180
|
-
type: 'checkbox',
|
|
181
|
-
name: 'selectedFolders',
|
|
182
|
-
message: `Select workflows/folders to ${verb}:`,
|
|
183
|
-
choices: folders.map((f) => ({
|
|
184
|
-
name: `${f}/ (${folderMap.get(f).length} changed)`,
|
|
185
|
-
value: f,
|
|
186
|
-
checked: true,
|
|
187
|
-
})),
|
|
188
|
-
},
|
|
189
|
-
]);
|
|
190
|
-
includedFolders = new Set(selectedFolders);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const candidates = changed.filter((e) => includedFolders.has(dirname(e.path) || '.'));
|
|
194
|
-
|
|
195
|
-
if (!candidates.length) return [];
|
|
196
|
-
|
|
197
165
|
const badgeFor = (status) => {
|
|
198
166
|
if (mode === 'push') {
|
|
199
|
-
return status === 'fast-forward' ? '↑
|
|
167
|
+
return status === 'fast-forward' ? '↑ safe' : '⚠ conflict';
|
|
200
168
|
}
|
|
201
|
-
return status === 'fast-forward' ? '↑
|
|
169
|
+
return status === 'fast-forward' ? '↑ safe' : '⚠ conflict';
|
|
202
170
|
};
|
|
203
171
|
|
|
172
|
+
const choices = changed.map((e) => ({
|
|
173
|
+
name: `${e.name} [${badgeFor(e.status)}]`,
|
|
174
|
+
value: e,
|
|
175
|
+
checked: true,
|
|
176
|
+
}));
|
|
177
|
+
|
|
204
178
|
const { selected } = await inquirer.prompt([
|
|
205
179
|
{
|
|
206
180
|
type: 'checkbox',
|
|
207
181
|
name: 'selected',
|
|
208
|
-
message: `
|
|
209
|
-
choices
|
|
210
|
-
name: `[${dirname(e.path) || '.'}] ${e.name} [${badgeFor(e.status)}]`,
|
|
211
|
-
value: e,
|
|
212
|
-
checked: true,
|
|
213
|
-
})),
|
|
182
|
+
message: `Select records to ${verb}:`,
|
|
183
|
+
choices,
|
|
214
184
|
pageSize: 20,
|
|
215
185
|
},
|
|
216
186
|
]);
|
|
@@ -19,7 +19,7 @@ function writeConfig(config) {
|
|
|
19
19
|
function loadEffectiveEnv(localConfig) {
|
|
20
20
|
// Load global prbot config as the base (KC_URL, KC_USER, RIP_URL, etc. live here)
|
|
21
21
|
if (existsSync(CONFIG_FILE)) {
|
|
22
|
-
configDotenv({ path: CONFIG_FILE });
|
|
22
|
+
configDotenv({ path: CONFIG_FILE, quiet: true });
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// Overlay workspace-level overrides from agrippa.yaml's agrippa: section
|
|
@@ -55,7 +55,7 @@ function escapeXml(str) {
|
|
|
55
55
|
function generateXml(templates) {
|
|
56
56
|
const records = templates
|
|
57
57
|
.map((t) => {
|
|
58
|
-
const id = toXmlId(t.
|
|
58
|
+
const id = `mail_template_${toXmlId(t.template_code)}`;
|
|
59
59
|
const modelRef = Object.values(t.model_id)[0];
|
|
60
60
|
return ` <record id="${id}" model="mail.template">
|
|
61
61
|
<field name="name">${escapeXml(t.name)}</field>
|
|
@@ -93,28 +93,41 @@ async function exportEmailTemplates(opts) {
|
|
|
93
93
|
const token = await getToken();
|
|
94
94
|
|
|
95
95
|
const moduleChoices = await getModuleChoices();
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
const moduleMatch = opts.module ? moduleChoices.find((c) => c.name === opts.module) : null;
|
|
97
|
+
const module = moduleMatch
|
|
98
|
+
? moduleMatch.value
|
|
99
|
+
: await search({
|
|
100
|
+
message: 'Select module:',
|
|
101
|
+
source: async (input) => {
|
|
102
|
+
if (!input) return moduleChoices;
|
|
103
|
+
return moduleChoices.filter((c) => fuzzyMatch(c.name, input));
|
|
104
|
+
},
|
|
105
|
+
});
|
|
103
106
|
|
|
104
107
|
console.log('Fetching workflows...');
|
|
105
108
|
const workflows = await getWorkflows(token);
|
|
106
109
|
const choices = workflows.map((w) => ({ name: w.name, value: w.id }));
|
|
107
110
|
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
const workflowMatch = opts.workflow
|
|
112
|
+
? workflows.find((w) => w.name === opts.workflow || String(w.id) === opts.workflow)
|
|
113
|
+
: null;
|
|
114
|
+
const workflowId = workflowMatch
|
|
115
|
+
? workflowMatch.id
|
|
116
|
+
: await search({
|
|
117
|
+
message: 'Select workflow:',
|
|
118
|
+
source: async (input) => {
|
|
119
|
+
if (!input) return choices;
|
|
120
|
+
return choices.filter((c) => fuzzyMatch(c.name, input));
|
|
121
|
+
},
|
|
122
|
+
});
|
|
115
123
|
|
|
116
124
|
console.log(`Fetching email templates for workflow ${workflowId}...`);
|
|
117
|
-
const
|
|
125
|
+
const excludes = opts.exclude ?? [];
|
|
126
|
+
const templates = (await getEmailTemplates(workflowId, token))
|
|
127
|
+
.filter((t) => t.template_code)
|
|
128
|
+
.filter((t) => {
|
|
129
|
+
return !excludes.some((ex) => ex === String(t.id) || ex === t.name || ex === t.template_code);
|
|
130
|
+
});
|
|
118
131
|
|
|
119
132
|
if (!templates.length) {
|
|
120
133
|
console.log('No email templates found for this workflow.');
|
package/src/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { main as prMain } from './commands/pr.js';
|
|
|
11
11
|
import { verbot } from './commands/ver.js';
|
|
12
12
|
import { CONFIG_FILE } from './config.js';
|
|
13
13
|
|
|
14
|
-
configDotenv({ path: CONFIG_FILE });
|
|
14
|
+
configDotenv({ path: CONFIG_FILE, quiet: true });
|
|
15
15
|
|
|
16
16
|
program
|
|
17
17
|
.command('pr <module>')
|
|
@@ -112,6 +112,9 @@ exportCmd
|
|
|
112
112
|
exportCmd
|
|
113
113
|
.command('email-templates')
|
|
114
114
|
.option('--no-commit')
|
|
115
|
+
.option('-e, --exclude <value...>', 'exclude templates matching id, name, or template_code')
|
|
116
|
+
.option('-m, --module <name>', 'module directory name (skip prompt)')
|
|
117
|
+
.option('-w, --workflow <value>', 'workflow name or id (skip prompt)')
|
|
115
118
|
.action((opts) => {
|
|
116
119
|
exportEmailTemplates(opts).catch((err) => {
|
|
117
120
|
throw err;
|