@waron97/prbot 2.6.1 → 3.0.0
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/README.md +24 -21
- package/agrippa_typings/__builtins__.pyi +99 -0
- package/agrippa_typings/b2w_entities.pyi +68 -0
- package/agrippa_typings/odoo_environment.pyi +1945 -0
- package/agrippa_typings/odoo_records.pyi +34176 -0
- package/agrippa_typings/recordset.pyi +38 -0
- package/package.json +10 -3
- package/src/agrippa/commands/clone.js +134 -0
- package/src/agrippa/commands/diff.js +96 -0
- package/src/agrippa/commands/init.js +116 -0
- package/src/agrippa/commands/initPhase.js +162 -0
- package/src/agrippa/commands/pull.js +221 -0
- package/src/agrippa/commands/push.js +126 -0
- package/src/agrippa/commands/repair.js +24 -0
- package/src/agrippa/index.js +61 -0
- package/src/agrippa/lib/api.js +106 -0
- package/src/agrippa/lib/checksum.js +7 -0
- package/src/agrippa/lib/config.js +35 -0
- package/src/agrippa/lib/workspace.js +42 -0
- package/src/commands/autopr.js +5 -0
- package/src/commands/export.js +2 -1
- package/src/commands/exportWorkflow.js +49 -0
- package/src/commands/init.js +3 -17
- package/src/commands/pr.js +8 -2
- package/src/config.js +1 -2
- package/src/index.js +11 -66
- package/.claude/settings.local.json +0 -11
- package/.prettierrc.mjs +0 -11
- package/CLAUDE.md +0 -0
- package/eslint.config.mjs +0 -16
- package/example.xml +0 -3903
- package/index.js +0 -376
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import search from '@inquirer/search';
|
|
4
|
+
import { select } from '@inquirer/prompts';
|
|
5
|
+
import { resolveAddonsPath } from '../lib/addons.js';
|
|
6
|
+
import { fuzzyMatch } from '../lib/fuzzy.js';
|
|
7
|
+
import { runPr } from './pr.js';
|
|
8
|
+
import { verbot } from './ver.js';
|
|
9
|
+
|
|
10
|
+
async function getModuleChoices() {
|
|
11
|
+
const ADDONS_PATH = resolveAddonsPath(process.env.ADDONS_PATH);
|
|
12
|
+
const configDir = path.join(ADDONS_PATH, 'config');
|
|
13
|
+
const entries = await fs.readdir(configDir, { withFileTypes: true });
|
|
14
|
+
return entries
|
|
15
|
+
.filter((e) => e.isDirectory())
|
|
16
|
+
.map((e) => ({ name: e.name, value: e.name }));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function exportWorkflow(opts) {
|
|
20
|
+
const moduleChoices = await getModuleChoices();
|
|
21
|
+
const module = await search({
|
|
22
|
+
message: 'Select module:',
|
|
23
|
+
source: async (input) => {
|
|
24
|
+
if (!input) return moduleChoices;
|
|
25
|
+
return moduleChoices.filter((c) => fuzzyMatch(c.name, input));
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
await runPr(module, opts);
|
|
30
|
+
|
|
31
|
+
let bumpLevel = opts.bump;
|
|
32
|
+
if (!bumpLevel) {
|
|
33
|
+
bumpLevel = await select({
|
|
34
|
+
message: 'Bump version?',
|
|
35
|
+
choices: [
|
|
36
|
+
{ name: 'No bump', value: 'none' },
|
|
37
|
+
{ name: 'Patch', value: 'patch' },
|
|
38
|
+
{ name: 'Minor', value: 'minor' },
|
|
39
|
+
{ name: 'Major', value: 'major' },
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (bumpLevel && bumpLevel !== 'none') {
|
|
45
|
+
await verbot(module, bumpLevel);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { exportWorkflow };
|
package/src/commands/init.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import path from 'path';
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
3
2
|
import inquirer from 'inquirer';
|
|
4
|
-
import {
|
|
3
|
+
import { CONFIG_DIR, CONFIG_FILE } from '../config.js';
|
|
5
4
|
|
|
6
|
-
async function init(
|
|
5
|
+
async function init() {
|
|
7
6
|
if (!existsSync(CONFIG_DIR)) {
|
|
8
7
|
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
9
8
|
}
|
|
@@ -137,19 +136,6 @@ async function init(completion) {
|
|
|
137
136
|
.join('\n') + '\n'
|
|
138
137
|
);
|
|
139
138
|
console.log(`Config written to ${CONFIG_FILE}`);
|
|
140
|
-
|
|
141
|
-
writeFileSync(COMPLETION_SCRIPT, completion.generateCompletionCode());
|
|
142
|
-
console.log(`Completion script written to ${COMPLETION_SCRIPT}`);
|
|
143
|
-
|
|
144
|
-
const rcFile = path.join(process.env.HOME || '', '.bashrc');
|
|
145
|
-
const sourceLine = `source ${COMPLETION_SCRIPT}`;
|
|
146
|
-
const rcContent = existsSync(rcFile) ? readFileSync(rcFile, 'utf-8') : '';
|
|
147
|
-
if (!rcContent.includes(sourceLine)) {
|
|
148
|
-
appendFileSync(rcFile, `\n# prbot completion\n${sourceLine}\n`);
|
|
149
|
-
console.log(`Registered completion in ${rcFile} — run: source ~/.bashrc`);
|
|
150
|
-
} else {
|
|
151
|
-
console.log('Completion already registered in ~/.bashrc');
|
|
152
|
-
}
|
|
153
139
|
}
|
|
154
140
|
|
|
155
141
|
export { init };
|
package/src/commands/pr.js
CHANGED
|
@@ -20,7 +20,7 @@ async function getFiles(module_name, token) {
|
|
|
20
20
|
return await response.json();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async function
|
|
23
|
+
async function runPr(module_name, opts = {}) {
|
|
24
24
|
const token = await getToken();
|
|
25
25
|
const files = await getFiles(module_name, token);
|
|
26
26
|
|
|
@@ -69,6 +69,8 @@ async function main(module_name) {
|
|
|
69
69
|
console.log(`Processed: ${file.name} -> ${destPath}`);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
if (opts.commit === false) return;
|
|
73
|
+
|
|
72
74
|
const workflowDir = path.join(ADDONS_PATH, 'config', module_name, 'data');
|
|
73
75
|
const filesToAdd = [
|
|
74
76
|
path.join(workflowDir, 'workflow_missing_relations.xml'),
|
|
@@ -95,4 +97,8 @@ async function main(module_name) {
|
|
|
95
97
|
console.log(`Committed with message: ${commitMessage}`);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
|
|
100
|
+
async function main(module_name) {
|
|
101
|
+
return runPr(module_name);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { main, runPr };
|
package/src/config.js
CHANGED
|
@@ -2,6 +2,5 @@ import path from 'path';
|
|
|
2
2
|
|
|
3
3
|
const CONFIG_DIR = path.join(process.env.HOME || '', '.config', 'prbot');
|
|
4
4
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'config');
|
|
5
|
-
const COMPLETION_SCRIPT = path.join(CONFIG_DIR, 'completion.sh');
|
|
6
5
|
|
|
7
|
-
export { CONFIG_DIR, CONFIG_FILE
|
|
6
|
+
export { CONFIG_DIR, CONFIG_FILE };
|
package/src/index.js
CHANGED
|
@@ -1,67 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readdirSync, readFileSync } from 'fs';
|
|
3
2
|
import { execFile } from 'child_process';
|
|
4
|
-
import path from 'path';
|
|
5
3
|
import { program } from 'commander';
|
|
6
4
|
import { configDotenv } from 'dotenv';
|
|
7
|
-
import omelette from 'omelette';
|
|
8
5
|
import { autopr } from './commands/autopr.js';
|
|
9
6
|
import { changelog } from './commands/changelog.js';
|
|
10
7
|
import { commit } from './commands/commit.js';
|
|
11
|
-
import { exportPb, exportRip, exportImperex, exportEmailTemplates } from './commands/export.js';
|
|
8
|
+
import { exportPb, exportRip, exportImperex, exportEmailTemplates, exportWorkflow } from './commands/export.js';
|
|
12
9
|
import { init } from './commands/init.js';
|
|
13
10
|
import { main as prMain } from './commands/pr.js';
|
|
14
11
|
import { verbot } from './commands/ver.js';
|
|
15
12
|
import { CONFIG_FILE } from './config.js';
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function replyModules(reply) {
|
|
20
|
-
try {
|
|
21
|
-
const raw = readFileSync(CONFIG_FILE, 'utf-8');
|
|
22
|
-
const match = raw.match(/^ADDONS_PATH=(.+)$/m);
|
|
23
|
-
if (!match) { reply([]); return; }
|
|
24
|
-
const addonsPath = match[1].trim().replace(/^~/, process.env.HOME || '');
|
|
25
|
-
reply(readdirSync(path.join(addonsPath, 'config')));
|
|
26
|
-
} catch {
|
|
27
|
-
reply([]);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const completion = omelette('prbot <command> <subOrModule> <module>');
|
|
32
|
-
completion.on('command', ({ reply }) => {
|
|
33
|
-
reply(['pr', 'ver', 'init', 'changelog', 'autopr', 'commit', 'export']);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 2nd token: export subcommands or module (for non-export commands)
|
|
37
|
-
completion.on('subOrModule', ({ before, reply }) => {
|
|
38
|
-
if (before === 'export') {
|
|
39
|
-
reply(EXPORT_SUBCOMMANDS);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (['init', 'changelog', 'autopr'].includes(before)) {
|
|
43
|
-
reply([]);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
replyModules(reply);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// 3rd token: module (only relevant for export subcommands that take one)
|
|
50
|
-
completion.on('module', ({ before, reply }) => {
|
|
51
|
-
if (['workflow'].includes(before)) {
|
|
52
|
-
replyModules(reply);
|
|
53
|
-
} else {
|
|
54
|
-
reply([]);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
completion.init();
|
|
59
|
-
|
|
60
|
-
const isCompletionMode = process.argv.includes('--compbash') || process.argv.includes('--compzsh');
|
|
61
|
-
|
|
62
|
-
if (!isCompletionMode) {
|
|
63
|
-
configDotenv({ path: CONFIG_FILE });
|
|
64
|
-
}
|
|
14
|
+
configDotenv({ path: CONFIG_FILE });
|
|
65
15
|
|
|
66
16
|
program
|
|
67
17
|
.command('pr <module>')
|
|
@@ -90,9 +40,9 @@ program
|
|
|
90
40
|
|
|
91
41
|
program
|
|
92
42
|
.command('init')
|
|
93
|
-
.description('Create config file
|
|
43
|
+
.description('Create config file')
|
|
94
44
|
.action(() => {
|
|
95
|
-
init(
|
|
45
|
+
init();
|
|
96
46
|
});
|
|
97
47
|
|
|
98
48
|
const collect = (val, prev) => [...(prev ?? []), val];
|
|
@@ -130,18 +80,13 @@ program.command('commit').action((opts) => {
|
|
|
130
80
|
const exportCmd = program.command('export');
|
|
131
81
|
|
|
132
82
|
exportCmd
|
|
133
|
-
.command('workflow
|
|
134
|
-
.option('-
|
|
135
|
-
.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
.catch((err) => {
|
|
143
|
-
throw err;
|
|
144
|
-
});
|
|
83
|
+
.command('workflow')
|
|
84
|
+
.option('--no-commit')
|
|
85
|
+
.option('-b, --bump <level>', 'Version bump level (patch, minor, major)')
|
|
86
|
+
.action((opts) => {
|
|
87
|
+
exportWorkflow(opts).catch((err) => {
|
|
88
|
+
throw err;
|
|
89
|
+
});
|
|
145
90
|
});
|
|
146
91
|
|
|
147
92
|
exportCmd.command('rip').action(() => exportRip());
|
package/.prettierrc.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */
|
|
2
|
-
const config = {
|
|
3
|
-
tabWidth: 4,
|
|
4
|
-
printWidth: 100,
|
|
5
|
-
singleQuote: true,
|
|
6
|
-
trailingComma: 'es5',
|
|
7
|
-
plugins: ['@ianvs/prettier-plugin-sort-imports'],
|
|
8
|
-
importOrder: ['<BUILTIN_MODULES>', '<THIRD_PARTY_MODULES>', '^../.*$', '^./.*$'],
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default config;
|
package/CLAUDE.md
DELETED
|
File without changes
|
package/eslint.config.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import { defineConfig } from 'eslint/config';
|
|
3
|
-
import globals from 'globals';
|
|
4
|
-
|
|
5
|
-
export default defineConfig(
|
|
6
|
-
js.configs.recommended,
|
|
7
|
-
{ ignores: ['node_modules'] },
|
|
8
|
-
{
|
|
9
|
-
languageOptions: {
|
|
10
|
-
globals: globals.node,
|
|
11
|
-
},
|
|
12
|
-
rules: {
|
|
13
|
-
'no-console': 'warn',
|
|
14
|
-
},
|
|
15
|
-
}
|
|
16
|
-
);
|