@worca/ui 0.38.0 → 0.41.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/app/main.bundle.js +4600 -3615
- package/app/main.bundle.js.map +4 -4
- package/app/styles.css +2837 -895
- package/package.json +1 -1
- package/scripts/build-frontend.js +15 -2
- package/server/app.js +17 -0
- package/server/project-routes.js +7 -39
- package/server/templates-routes.js +742 -0
- package/server/version-check.js +11 -2
package/package.json
CHANGED
|
@@ -117,7 +117,15 @@ async function run() {
|
|
|
117
117
|
|
|
118
118
|
try {
|
|
119
119
|
const esbuild = await import('esbuild');
|
|
120
|
-
|
|
120
|
+
// Optional build-time override of the docs base URL used by
|
|
121
|
+
// worca-ui/app/utils/help-links.js. Production / npm-published
|
|
122
|
+
// builds leave WORCA_DOCS_BASE unset and fall through to the
|
|
123
|
+
// 'https://docs.worca.dev' default baked into the module.
|
|
124
|
+
// Local + staging previews can retarget the badges:
|
|
125
|
+
// WORCA_DOCS_BASE=http://localhost:4321 npm run build
|
|
126
|
+
// WORCA_DOCS_BASE=http://staging.docs.example npm run build
|
|
127
|
+
const docsBase = process.env.WORCA_DOCS_BASE;
|
|
128
|
+
const buildOpts = {
|
|
121
129
|
entryPoints: [entry],
|
|
122
130
|
bundle: true,
|
|
123
131
|
format: 'esm',
|
|
@@ -127,7 +135,12 @@ async function run() {
|
|
|
127
135
|
sourcemap: true,
|
|
128
136
|
minify: true,
|
|
129
137
|
legalComments: 'none',
|
|
130
|
-
}
|
|
138
|
+
};
|
|
139
|
+
if (docsBase) {
|
|
140
|
+
buildOpts.define = { WORCA_DOCS_BASE: JSON.stringify(docsBase) };
|
|
141
|
+
console.log('help-links DOCS_BASE override:', docsBase);
|
|
142
|
+
}
|
|
143
|
+
await esbuild.build(buildOpts);
|
|
131
144
|
console.log('built', path.relative(repoRoot, outfile));
|
|
132
145
|
} catch (err) {
|
|
133
146
|
console.error('bundle error', err);
|
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 }));
|
package/server/project-routes.js
CHANGED
|
@@ -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
|
|
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 /
|
|
1637
|
-
|
|
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
|