@waron97/prbot 3.0.2 → 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 +1 -1
- package/src/agrippa/commands/init.js +11 -7
- package/src/agrippa/commands/pull.js +10 -40
- package/src/agrippa/lib/config.js +1 -1
- package/src/index.js +1 -1
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
|
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>')
|