@cliangdev/conductor 0.48.0 → 0.48.1

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": "@cliangdev/conductor",
3
- "version": "0.48.0",
3
+ "version": "0.48.1",
4
4
  "description": "Agentic software development platform — AI-driven PRD, implementation, and beyond",
5
5
  "license": "SEE LICENSE IN ../LICENSE",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "scripts/"
24
24
  ],
25
25
  "scripts": {
26
- "build": "tsc && node scripts/build-creative.mjs",
26
+ "build": "tsc && node scripts/build-creative.mjs && node scripts/sync-slideshow-core.mjs",
27
27
  "typecheck:fast": "tsgo --noEmit",
28
28
  "dev": "ts-node src/index.ts",
29
29
  "test": "vitest run",
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ /* sync-slideshow-core.mjs — emits the pure slideshow modules of src/lib/slideshow/ as plain ESM (+ .d.ts)
3
+ * into the sibling `conductor-creative/slideshow/`, and copies the bundled fonts to
4
+ * `conductor-creative/slideshow/fonts/`. Run by `npm run build`; the output is committed, and
5
+ * src/__tests__/sync-slideshow-core.test.ts fails when the committed copy differs from a fresh generation.
6
+ *
7
+ * Why: the web editor's live preview must build the very same slide HTML (and run the same in-page CHECK_SCRIPT)
8
+ * the composer and the render job do, but the web app cannot import conductor-tools (a published npm package with
9
+ * Node dependencies). These five modules have no Node imports, so they are compiled on their own. compose.ts and
10
+ * spec-transport.ts import node:fs / playwright and are deliberately not emitted.
11
+ *
12
+ * The web app imports them as `@cliangdev/creative-render/slideshow/html.js` etc. through its `file:` dependency
13
+ * and copies the fonts into `public/slideshow-fonts/` (conductor-frontend/scripts/copy-slideshow-fonts.mjs).
14
+ */
15
+ import { mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
16
+ import { dirname, join } from 'node:path'
17
+ import { fileURLToPath } from 'node:url'
18
+ import ts from 'typescript'
19
+
20
+ const __dirname = dirname(fileURLToPath(import.meta.url))
21
+ const TOOLS_ROOT = join(__dirname, '..')
22
+ const REPO_ROOT = join(TOOLS_ROOT, '..')
23
+ export const SRC_DIR = join(TOOLS_ROOT, 'src', 'lib', 'slideshow')
24
+ export const OUT_DIR = join(REPO_ROOT, 'conductor-creative', 'slideshow')
25
+ export const FONTS_SRC = join(TOOLS_ROOT, 'assets', 'fonts')
26
+
27
+ /** The modules that are safe to run in a browser (no Node imports), without the extension. */
28
+ export const CORE_MODULES = ['spec', 'style', 'css', 'html', 'text-fields']
29
+
30
+ const HEADER =
31
+ '// GENERATED from conductor-tools/src/lib/slideshow/%NAME%.ts by conductor-tools/scripts/sync-slideshow-core.mjs.\n' +
32
+ '// Do not edit: change the TypeScript source and run `npm run build` in conductor-tools.\n'
33
+
34
+ /** Returns { [relative path]: content } for the .js and .d.ts of every core module. Throws on a type error or a Node import. */
35
+ export function generateSlideshowCore(srcDir = SRC_DIR) {
36
+ const rootNames = CORE_MODULES.map((m) => join(srcDir, `${m}.ts`))
37
+ const options = {
38
+ target: ts.ScriptTarget.ES2020,
39
+ module: ts.ModuleKind.ES2020,
40
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
41
+ lib: ['lib.es2022.d.ts', 'lib.dom.d.ts'],
42
+ types: [],
43
+ strict: true,
44
+ skipLibCheck: true,
45
+ declaration: true,
46
+ rootDir: srcDir,
47
+ newLine: ts.NewLineKind.LineFeed,
48
+ removeComments: false,
49
+ }
50
+ const program = ts.createProgram(rootNames, options)
51
+ const problems = ts.getPreEmitDiagnostics(program).filter((d) => d.category === ts.DiagnosticCategory.Error)
52
+ if (problems.length > 0) {
53
+ throw new Error(
54
+ 'sync-slideshow-core: the core modules do not compile on their own (a Node import?):\n' +
55
+ problems.map((d) => ts.flattenDiagnosticMessageText(d.messageText, '\n')).join('\n')
56
+ )
57
+ }
58
+ const out = {}
59
+ const emit = program.emit(undefined, (fileName, text) => {
60
+ const rel = fileName.slice(srcDir.length + 1)
61
+ const name = rel.replace(/\.d\.ts$|\.js$/, '')
62
+ out[rel] = HEADER.replace('%NAME%', name) + text
63
+ })
64
+ if (emit.emitSkipped) throw new Error('sync-slideshow-core: emit was skipped')
65
+ for (const [rel, text] of Object.entries(out)) {
66
+ if (/(from|import)\s*\(?\s*['"]node:/.test(text)) throw new Error(`sync-slideshow-core: ${rel} imports a Node module`)
67
+ }
68
+ return out
69
+ }
70
+
71
+ /** Every file sync writes under OUT_DIR, as { relative path: Buffer | string }. */
72
+ export function expectedOutput(srcDir = SRC_DIR, fontsSrc = FONTS_SRC) {
73
+ const files = generateSlideshowCore(srcDir)
74
+ const all = { ...files }
75
+ for (const f of readdirSync(fontsSrc).sort()) all[`fonts/${f}`] = readFileSync(join(fontsSrc, f))
76
+ return all
77
+ }
78
+
79
+ export function syncSlideshowCore(outDir = OUT_DIR) {
80
+ const files = expectedOutput()
81
+ rmSync(outDir, { recursive: true, force: true })
82
+ mkdirSync(join(outDir, 'fonts'), { recursive: true })
83
+ for (const [rel, content] of Object.entries(files)) writeFileSync(join(outDir, rel), content)
84
+ return Object.keys(files).map((rel) => join(outDir, rel))
85
+ }
86
+
87
+ function isMain() {
88
+ return process.argv[1] && import.meta.url === `file://${process.argv[1]}`
89
+ }
90
+
91
+ if (isMain()) {
92
+ const written = syncSlideshowCore()
93
+ console.log(`sync-slideshow-core: wrote ${written.length} file(s) into ${OUT_DIR}`)
94
+ }