@bamptee/aia-code 2.0.12 → 2.0.14

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.
@@ -245,6 +245,98 @@ function ProjectSettings({ onSaved }) {
245
245
  );
246
246
  }
247
247
 
248
+ function ProjectScope({ onSaved }) {
249
+ const [apps, setApps] = React.useState([]);
250
+ const [loading, setLoading] = React.useState(true);
251
+ const [scanning, setScanning] = React.useState(false);
252
+ const [dirty, setDirty] = React.useState(false);
253
+ const [msg, setMsg] = React.useState(null);
254
+
255
+ React.useEffect(() => {
256
+ api.get('/apps').then(setApps).catch(() => {}).finally(() => setLoading(false));
257
+ }, []);
258
+
259
+ const handleToggle = async (appName, enabled) => {
260
+ setDirty(true);
261
+ setMsg(null);
262
+ try {
263
+ await api.patch(`/apps/${appName}`, { enabled });
264
+ setApps(prev => prev.map(a => a.name === appName ? { ...a, enabled } : a));
265
+ setDirty(false);
266
+ setMsg({ type: 'ok', text: 'Saved.' });
267
+ if (onSaved) onSaved();
268
+ } catch (e) {
269
+ setMsg({ type: 'err', text: e.message });
270
+ }
271
+ };
272
+
273
+ const handleScan = async () => {
274
+ setScanning(true);
275
+ setMsg(null);
276
+ try {
277
+ const scanned = await api.post('/apps/scan');
278
+ setApps(scanned);
279
+ setMsg({ type: 'ok', text: `Found ${scanned.length} app(s).` });
280
+ if (onSaved) onSaved();
281
+ } catch (e) {
282
+ setMsg({ type: 'err', text: e.message });
283
+ }
284
+ setScanning(false);
285
+ };
286
+
287
+ if (loading) return React.createElement('p', { className: 'text-slate-500 text-sm' }, 'Loading...');
288
+
289
+ return React.createElement('div', { className: 'bg-aia-card border border-aia-border rounded p-4 space-y-4' },
290
+ React.createElement('div', { className: 'flex items-center justify-between' },
291
+ React.createElement('h3', { className: 'text-sm font-semibold text-amber-400' }, 'Project Scope'),
292
+ React.createElement('div', { className: 'flex gap-2 items-center' },
293
+ msg && React.createElement('span', { className: `text-xs ${msg.type === 'ok' ? 'text-emerald-400' : 'text-red-400'}` }, msg.text),
294
+ React.createElement('button', {
295
+ onClick: handleScan,
296
+ disabled: scanning,
297
+ className: 'bg-aia-accent/20 text-aia-accent border border-aia-accent/30 rounded px-3 py-1 text-xs hover:bg-aia-accent/30 disabled:opacity-40',
298
+ }, scanning ? 'Scanning...' : 'Re-scan Project'),
299
+ ),
300
+ ),
301
+
302
+ apps.length === 0
303
+ ? React.createElement('p', { className: 'text-slate-500 text-sm' },
304
+ 'No apps detected. Click "Re-scan Project" to detect apps and submodules.'
305
+ )
306
+ : React.createElement('div', { className: 'space-y-2' },
307
+ ...apps.map(app =>
308
+ React.createElement('div', {
309
+ key: app.name,
310
+ className: 'flex items-center justify-between py-2 border-b border-slate-700 last:border-0',
311
+ },
312
+ React.createElement('div', { className: 'flex items-center gap-2' },
313
+ React.createElement('span', { className: 'text-lg' }, app.icon || '\uD83D\uDCC1'),
314
+ React.createElement('div', null,
315
+ React.createElement('span', { className: 'text-sm text-slate-200' }, app.name),
316
+ React.createElement('p', { className: 'text-xs text-slate-500' }, app.path),
317
+ ),
318
+ ),
319
+ React.createElement('label', { className: 'relative inline-flex items-center cursor-pointer' },
320
+ React.createElement('input', {
321
+ type: 'checkbox',
322
+ checked: app.enabled !== false,
323
+ onChange: (e) => handleToggle(app.name, e.target.checked),
324
+ className: 'sr-only peer',
325
+ }),
326
+ React.createElement('div', {
327
+ className: 'w-9 h-5 bg-slate-700 rounded-full peer peer-checked:bg-aia-accent peer-checked:after:translate-x-full after:content-[\'\'] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all',
328
+ }),
329
+ ),
330
+ )
331
+ )
332
+ ),
333
+
334
+ React.createElement('p', { className: 'text-xs text-slate-500' },
335
+ 'Enable/disable apps to control feature scope options. Disabled apps won\'t appear in feature scope selection.'
336
+ ),
337
+ );
338
+ }
339
+
248
340
  export function ConfigView() {
249
341
  const [contextFiles, setContextFiles] = React.useState([]);
250
342
  const [knowledgeCategories, setKnowledgeCategories] = React.useState([]);
@@ -293,6 +385,9 @@ export function ConfigView() {
293
385
  React.createElement(ProjectSettings, { onSaved: handlePreferencesSaved }),
294
386
  ),
295
387
 
388
+ // Project Scope
389
+ React.createElement(ProjectScope, { onSaved: handlePreferencesSaved }),
390
+
296
391
  // config.yaml (advanced)
297
392
  React.createElement(YamlEditor, {
298
393
  key: `config-${configVersion}`,