@lincyaw/cli 1.0.0-rc.100 → 1.0.0-rc.102

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/bin/presmium.mjs CHANGED
@@ -8,5 +8,5 @@ process.emitWarning = (warning, ...args) => {
8
8
  }
9
9
 
10
10
  const jiti = createJiti(import.meta.url)
11
- const { main } = await jiti.import('../src/cli.ts')
11
+ const { main } = await jiti.import('../src/index.ts')
12
12
  process.exitCode = await main(process.argv.slice(2))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lincyaw/cli",
3
- "version": "1.0.0-rc.100",
3
+ "version": "1.0.0-rc.102",
4
4
  "description": "The presmium command: build, dev, ir, check and serve for Presmium documents",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,10 +42,10 @@
42
42
  "micromark-extension-gfm": "3.0.0",
43
43
  "micromark-extension-math": "3.1.0",
44
44
  "yaml": "^2.9.1",
45
- "@lincyaw/compiler": "1.0.0-rc.100",
46
- "@lincyaw/skills": "1.0.0-rc.100",
47
- "@lincyaw/kernel": "1.0.0-rc.100",
48
- "@lincyaw/server": "1.0.0-rc.100",
49
- "@lincyaw/workspace": "1.0.0-rc.100"
45
+ "@lincyaw/compiler": "1.0.0-rc.102",
46
+ "@lincyaw/kernel": "1.0.0-rc.102",
47
+ "@lincyaw/workspace": "1.0.0-rc.102",
48
+ "@lincyaw/server": "1.0.0-rc.102",
49
+ "@lincyaw/skills": "1.0.0-rc.102"
50
50
  }
51
51
  }
package/src/index.ts CHANGED
@@ -1,2 +1,18 @@
1
- export { main } from './cli.ts'
1
+ import { createRequire } from 'node:module'
2
+ import { join } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+ import { createJiti } from 'jiti'
5
+ import { CLI_MESSAGES, systemLocale } from './messages.ts'
6
+ import type { MainOptions } from './cli.ts'
2
7
  export type { MainOptions } from './cli.ts'
8
+
9
+ /** Starting the editor does not need to import the compiler, exporters or MCP tool tree first. */
10
+ export async function main(argv: string[], options: MainOptions = {}): Promise<number> {
11
+ if (argv[0] !== 'studio') return (await import('./cli.ts')).main(argv, options)
12
+ const bundled = options.bundled ?? fileURLToPath(new URL('..', import.meta.url))
13
+ let entry: string
14
+ try { entry = createRequire(join(bundled, 'package.json')).resolve('@lincyaw/studio') }
15
+ catch { process.stderr.write(`${CLI_MESSAGES[systemLocale()].studioMissing}\n`); return 2 }
16
+ const studio = await createJiti(import.meta.url).import<{ main(argv: string[], options: { presmium: string }): Promise<number> }>(entry)
17
+ return studio.main(argv.slice(1), { presmium: options.bin ?? fileURLToPath(new URL('../bin/presmium.mjs', import.meta.url)) })
18
+ }