@worca/ui 0.37.0 → 0.40.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worca/ui",
3
- "version": "0.37.0",
3
+ "version": "0.40.0",
4
4
  "description": "Pipeline monitoring UI for worca-cc",
5
5
  "license": "MIT",
6
6
  "author": "Sinisha Djukic",
package/server/app.js CHANGED
@@ -670,6 +670,23 @@ export function createApp(options = {}) {
670
670
  }
671
671
  });
672
672
 
673
+ // GET /api/worca-cli — focused worca-cc compatibility probe.
674
+ //
675
+ // Returns the cached `checkWorcaVersion()` result populated at server
676
+ // boot (see index.js). The UI uses this to gate destructive Pipelines
677
+ // actions: when `ok` is false, the editor surfaces a banner and hides
678
+ // the Edit / Duplicate / Set Default / Delete / Create / Import
679
+ // buttons. Read paths (list, view, export) keep working.
680
+ //
681
+ // `?force=1` re-runs the probe. Without `force`, the response is
682
+ // served from the cache and costs essentially nothing.
683
+ app.get('/api/worca-cli', async (req, res) => {
684
+ if (req.query.force === '1' || !app.locals.worcaVersion) {
685
+ app.locals.worcaVersion = await checkWorcaVersion();
686
+ }
687
+ res.json(app.locals.worcaVersion);
688
+ });
689
+
673
690
  // ─── Multi-project routes ──────────────────────────────────────────────
674
691
  if (prefsDir) {
675
692
  app.use('/api/preferences', createPreferencesRouter({ prefsDir }));
@@ -29,7 +29,7 @@ import { getDefaultBranch } from './git-helpers.js';
29
29
  import { extractAndStripGlobalKeys } from './global-keys.js';
30
30
  import { LaunchLock } from './launch-lock.js';
31
31
  import { createModelEnvRouter } from './model-env-routes.js';
32
- import { preferencesPath, templatesDir } from './paths.js';
32
+ import { preferencesPath } from './paths.js';
33
33
  import { readPreferences } from './preferences.js';
34
34
  import { ProcessManager } from './process-manager.js';
35
35
  import { countRunningPipelinesAcrossProjects } from './process-registry.js';
@@ -50,6 +50,7 @@ import {
50
50
  } from './settings-merge.js';
51
51
  import { readGlobalSettings, writeGlobalSettings } from './settings-reader.js';
52
52
  import { validateSettingsPayload } from './settings-validator.js';
53
+ import { createTemplatesRoutes } from './templates-routes.js';
53
54
  import { isVersionBehind } from './version-check.js';
54
55
  import { getVersionInfo } from './versions.js';
55
56
  import { discoverRuns } from './watcher.js';
@@ -458,6 +459,9 @@ export function createProjectScopedRoutes({
458
459
  // --- Model env endpoints (writes wholesale to settings.local.json) ---
459
460
  router.use('/settings/model-env', createModelEnvRouter());
460
461
 
462
+ // --- Template CRUD endpoints (templates-routes.js) ---
463
+ router.use(createTemplatesRoutes());
464
+
461
465
  // --- Project-scoped settings endpoints ---
462
466
 
463
467
  // GET /api/projects/:projectId/settings
@@ -1633,44 +1637,8 @@ export function createProjectScopedRoutes({
1633
1637
  // overlays worktree pipelines via pipelines.d/, so the same /runs/:id/*
1634
1638
  // family handles both local and worktree-hosted runs.
1635
1639
 
1636
- // GET /api/projects/:projectId/templates list available pipeline templates
1637
- router.get('/templates', (req, res) => {
1638
- const root = req.project.projectRoot;
1639
- const tiers = [
1640
- { tier: 'user', dir: templatesDir() },
1641
- { tier: 'project', dir: join(root, '.claude', 'templates') },
1642
- { tier: 'worca', dir: join(root, '.claude', 'worca', 'templates') },
1643
- ];
1644
-
1645
- const templates = [];
1646
- for (const { tier, dir } of tiers) {
1647
- if (!existsSync(dir)) continue;
1648
- let entries;
1649
- try {
1650
- entries = readdirSync(dir, { withFileTypes: true });
1651
- } catch {
1652
- continue;
1653
- }
1654
- for (const entry of entries) {
1655
- if (!entry.isDirectory()) continue;
1656
- const manifestPath = join(dir, entry.name, 'template.json');
1657
- if (!existsSync(manifestPath)) continue;
1658
- try {
1659
- const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
1660
- templates.push({
1661
- id: manifest.id || entry.name,
1662
- name: manifest.name || entry.name,
1663
- description: manifest.description || '',
1664
- tier,
1665
- });
1666
- } catch {
1667
- /* skip malformed manifests */
1668
- }
1669
- }
1670
- }
1671
-
1672
- res.json({ ok: true, templates });
1673
- });
1640
+ // NOTE: GET /templates and all template CRUD routes moved to
1641
+ // templates-routes.js (now mounted at /).
1674
1642
 
1675
1643
  // GET /api/projects/:projectId/worca-status — check worca installation state.
1676
1644
  // `outdated` is true when the project's installed worca-cc version is