@jotx-labs/cli 2.4.82 → 2.4.131

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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @jotx/cli
1
+ # @jotx-labs/cli
2
2
 
3
3
  Command-line interface for jotx - demonstrates platform independence.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install -g @jotx/cli
8
+ npm install -g @jotx-labs/cli
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -63,9 +63,9 @@ jotx parse notes.jot | jq .
63
63
 
64
64
  The CLI demonstrates jotx's platform independence:
65
65
 
66
- - Uses `@jotx/core` for parsing/validation
67
- - Uses `NodePlatform` from `@jotx/adapters` for file I/O
68
- - Uses `HTMLRenderer` from `@jotx/adapters` for output
66
+ - Uses `@jotx-labs/core` for parsing/validation
67
+ - Uses `NodePlatform` from `@jotx-labs/adapters` for file I/O
68
+ - Uses `HTMLRenderer` from `@jotx-labs/adapters` for output
69
69
  - **Zero** VS Code dependencies
70
70
  - **Zero** browser dependencies
71
71
 
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  /**
4
4
  * jotx CLI - Demonstrates platform independence
5
- * Uses @jotx/core + NodePlatform
5
+ * Uses @jotx-labs/core + NodePlatform
6
6
  */
7
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
8
  if (k2 === undefined) k2 = k;
@@ -40,11 +40,14 @@ var __importStar = (this && this.__importStar) || (function () {
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  const commander_1 = require("commander");
42
42
  const fs = __importStar(require("fs/promises"));
43
+ const core_1 = require("@jotx-labs/core");
44
+ const adapters_1 = require("@jotx-labs/adapters");
45
+ const renderer = new adapters_1.HTMLRenderer();
43
46
  const program = new commander_1.Command();
44
47
  program
45
48
  .name('jotx')
46
49
  .description('jotx CLI - Parse, validate, and convert jotx files')
47
- .version('1.0.22');
50
+ .version('2.4.130');
48
51
  // Parse command
49
52
  program
50
53
  .command('parse <file>')
@@ -52,14 +55,14 @@ program
52
55
  .action(async (file) => {
53
56
  try {
54
57
  const text = await fs.readFile(file, 'utf-8');
55
- const result = core.parseAndValidate(text);
58
+ const result = (0, core_1.parseAndValidate)(text);
56
59
  if (result.isValid) {
57
60
  console.log('✅ Parse successful!');
58
61
  console.log(JSON.stringify(result.ast, null, 2));
59
62
  }
60
63
  else {
61
64
  console.error('❌ Parse failed:');
62
- result.validation.errors.forEach(err => {
65
+ result.errors.forEach((err) => {
63
66
  console.error(` - ${err.message}`);
64
67
  });
65
68
  process.exit(1);
@@ -77,16 +80,16 @@ program
77
80
  .action(async (file) => {
78
81
  try {
79
82
  const text = await fs.readFile(file, 'utf-8');
80
- const result = core.parseAndValidate(text);
83
+ const result = (0, core_1.parseAndValidate)(text);
81
84
  if (result.isValid) {
82
85
  console.log(`✅ ${file} is valid!`);
83
86
  console.log(` Document: ${result.ast.document.id}`);
84
- console.log(` Type: ${result.ast.document.documentType}`);
87
+ console.log(` Type: ${result.ast.document.type}`);
85
88
  console.log(` Blocks: ${result.ast.document.blocks.length}`);
86
89
  }
87
90
  else {
88
91
  console.error(`❌ ${file} has errors:`);
89
- result.validation.errors.forEach(err => {
92
+ result.errors.forEach((err) => {
90
93
  console.error(` - ${err.message}`);
91
94
  });
92
95
  process.exit(1);
@@ -105,10 +108,10 @@ program
105
108
  .action(async (file, options) => {
106
109
  try {
107
110
  const text = await fs.readFile(file, 'utf-8');
108
- const result = core.parseAndValidate(text);
111
+ const result = (0, core_1.parseAndValidate)(text);
109
112
  if (!result.isValid) {
110
113
  console.error('❌ File has errors:');
111
- result.validation.errors.forEach(err => {
114
+ result.errors.forEach((err) => {
112
115
  console.error(` - ${err.message}`);
113
116
  });
114
117
  process.exit(1);
@@ -116,17 +119,18 @@ program
116
119
  // Render to HTML
117
120
  const html = renderer.render({
118
121
  id: result.ast.document.id,
119
- type: result.ast.document.documentType,
122
+ type: result.ast.document.type,
120
123
  metadata: result.ast.document.metadata,
121
124
  blocks: result.ast.document.blocks
122
125
  });
123
126
  // Wrap in full HTML document
127
+ const title = result.ast.document.metadata?.title || 'jotx Document';
124
128
  const fullHtml = `<!DOCTYPE html>
125
129
  <html lang="en">
126
130
  <head>
127
131
  <meta charset="UTF-8">
128
132
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
129
- <title>${result.ast.document.metadata.title || 'jotx Document'}</title>
133
+ <title>${title}</title>
130
134
  <style>
131
135
  body { font-family: system-ui, -apple-system, sans-serif; max-width: 800px; margin: 40px auto; padding: 0 20px; }
132
136
  h1 { font-size: 2em; margin-bottom: 0.5em; }
@@ -161,7 +165,7 @@ program
161
165
  .action(async (file) => {
162
166
  try {
163
167
  const text = await fs.readFile(file, 'utf-8');
164
- const result = core.parseAndValidate(text);
168
+ const result = (0, core_1.parseAndValidate)(text);
165
169
  if (!result.isValid) {
166
170
  console.error('❌ File has errors');
167
171
  process.exit(1);
@@ -170,13 +174,13 @@ program
170
174
  console.log('📄 Document Information');
171
175
  console.log('─'.repeat(50));
172
176
  console.log(`ID: ${doc.id}`);
173
- console.log(`Type: ${doc.documentType}`);
174
- console.log(`Title: ${doc.metadata.title || '(none)'}`);
177
+ console.log(`Type: ${doc.type}`);
178
+ console.log(`Title: ${doc.metadata?.title || '(none)'}`);
175
179
  console.log(`Blocks: ${doc.blocks.length}`);
176
180
  console.log();
177
181
  console.log('Block Types:');
178
182
  const blockCounts = {};
179
- doc.blocks.forEach(block => {
183
+ doc.blocks.forEach((block) => {
180
184
  blockCounts[block.type] = (blockCounts[block.type] || 0) + 1;
181
185
  });
182
186
  Object.entries(blockCounts).forEach(([type, count]) => {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAmC;A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C,CAAA;QAC7C,OAAO,CAAC,GAAG,EAAE,CAAA;QACb,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;QAE3B,MAAM,WAAW,GAA2B,EAAE,CAAA;QAC9C,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;YAChC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;QAC9D,CAAC,CAAC,CAAA;QAEF,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;YACpD,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,KAAK,KAAK,EAAE,CAAC,CAAA;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;QAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,OAAO,CAAC,KAAK,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@jotx-labs/cli",
3
- "version": "2.4.82",
3
+ "version": "2.4.131",
4
+ "files": [
5
+ "dist"
6
+ ],
4
7
  "description": "jotx command-line interface",
5
8
  "main": "dist/index.js",
6
9
  "bin": {
@@ -20,8 +23,8 @@
20
23
  "author": "jotx",
21
24
  "license": "Apache-2.0",
22
25
  "dependencies": {
23
- "@jotx-labs/core": "file:../core",
24
- "@jotx-labs/adapters": "file:../adapters",
26
+ "@jotx-labs/core": "^2.4.130",
27
+ "@jotx-labs/adapters": "^2.4.130",
25
28
  "commander": "^11.0.0",
26
29
  "chalk": "^4.1.2"
27
30
  },
@@ -29,4 +32,4 @@
29
32
  "@types/node": "^20.0.0",
30
33
  "typescript": "^5.0.0"
31
34
  }
32
- }
35
+ }
package/src/cli.ts DELETED
@@ -1,171 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * jotx CLI - Demonstrates platform independence
4
- * Uses @jotx-labs/core + NodePlatform
5
- */
6
-
7
- import { Command } from 'commander'
8
- import * as fs from 'fs/promises'
9
- import * as path from 'path'
10
- import { jotToMarkdown, markdownToJot } from '@jotx-labs/core'
11
-
12
- const program = new Command()
13
-
14
- program
15
- .name('jotx')
16
- .description('jotx CLI - Parse, validate, and convert jotx files')
17
- .version('1.0.22')
18
-
19
- // Parse command
20
- program
21
- .command('parse <file>')
22
- .description('Parse a .jot file and show AST')
23
- .action(async (file: string) => {
24
- try {
25
- const text = await fs.readFile(file, 'utf-8')
26
- const result = core.parseAndValidate(text)
27
-
28
- if (result.isValid) {
29
- console.log('✅ Parse successful!')
30
- console.log(JSON.stringify(result.ast, null, 2))
31
- } else {
32
- console.error('❌ Parse failed:')
33
- result.validation.errors.forEach(err => {
34
- console.error(` - ${err.message}`)
35
- })
36
- process.exit(1)
37
- }
38
- } catch (error) {
39
- console.error('❌ Error:', error)
40
- process.exit(1)
41
- }
42
- })
43
-
44
- // Validate command
45
- program
46
- .command('validate <file>')
47
- .description('Validate a .jot file')
48
- .action(async (file: string) => {
49
- try {
50
- const text = await fs.readFile(file, 'utf-8')
51
- const result = core.parseAndValidate(text)
52
-
53
- if (result.isValid) {
54
- console.log(`✅ ${file} is valid!`)
55
- console.log(` Document: ${result.ast.document.id}`)
56
- console.log(` Type: ${result.ast.document.documentType}`)
57
- console.log(` Blocks: ${result.ast.document.blocks.length}`)
58
- } else {
59
- console.error(`❌ ${file} has errors:`)
60
- result.validation.errors.forEach(err => {
61
- console.error(` - ${err.message}`)
62
- })
63
- process.exit(1)
64
- }
65
- } catch (error) {
66
- console.error('❌ Error:', error)
67
- process.exit(1)
68
- }
69
- })
70
-
71
- // Convert command
72
- program
73
- .command('convert <file>')
74
- .description('Convert .jot file to HTML')
75
- .option('-o, --output <file>', 'Output file (default: stdout)')
76
- .action(async (file: string, options: { output?: string }) => {
77
- try {
78
- const text = await fs.readFile(file, 'utf-8')
79
- const result = core.parseAndValidate(text)
80
-
81
- if (!result.isValid) {
82
- console.error('❌ File has errors:')
83
- result.validation.errors.forEach(err => {
84
- console.error(` - ${err.message}`)
85
- })
86
- process.exit(1)
87
- }
88
-
89
- // Render to HTML
90
- const html = renderer.render({
91
- id: result.ast.document.id,
92
- type: result.ast.document.documentType,
93
- metadata: result.ast.document.metadata,
94
- blocks: result.ast.document.blocks as any
95
- } as any)
96
-
97
- // Wrap in full HTML document
98
- const fullHtml = `<!DOCTYPE html>
99
- <html lang="en">
100
- <head>
101
- <meta charset="UTF-8">
102
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
103
- <title>${result.ast.document.metadata.title || 'jotx Document'}</title>
104
- <style>
105
- body { font-family: system-ui, -apple-system, sans-serif; max-width: 800px; margin: 40px auto; padding: 0 20px; }
106
- h1 { font-size: 2em; margin-bottom: 0.5em; }
107
- h2 { font-size: 1.5em; margin-top: 1.5em; }
108
- h3 { font-size: 1.2em; margin-top: 1.2em; }
109
- code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; }
110
- pre { background: #f5f5f5; padding: 16px; border-radius: 6px; overflow-x: auto; }
111
- blockquote { border-left: 4px solid #ddd; padding-left: 16px; margin-left: 0; color: #666; }
112
- </style>
113
- </head>
114
- <body>
115
- ${html}
116
- </body>
117
- </html>`
118
-
119
- if (options.output) {
120
- await fs.writeFile(options.output, fullHtml, 'utf-8')
121
- console.log(`✅ Converted to ${options.output}`)
122
- } else {
123
- console.log(fullHtml)
124
- }
125
- } catch (error) {
126
- console.error('❌ Error:', error)
127
- process.exit(1)
128
- }
129
- })
130
-
131
- // Info command
132
- program
133
- .command('info <file>')
134
- .description('Show document information')
135
- .action(async (file: string) => {
136
- try {
137
- const text = await fs.readFile(file, 'utf-8')
138
- const result = core.parseAndValidate(text)
139
-
140
- if (!result.isValid) {
141
- console.error('❌ File has errors')
142
- process.exit(1)
143
- }
144
-
145
- const doc = result.ast.document
146
-
147
- console.log('📄 Document Information')
148
- console.log('─'.repeat(50))
149
- console.log(`ID: ${doc.id}`)
150
- console.log(`Type: ${doc.documentType}`)
151
- console.log(`Title: ${doc.metadata.title || '(none)'}`)
152
- console.log(`Blocks: ${doc.blocks.length}`)
153
- console.log()
154
- console.log('Block Types:')
155
-
156
- const blockCounts: Record<string, number> = {}
157
- doc.blocks.forEach(block => {
158
- blockCounts[block.type] = (blockCounts[block.type] || 0) + 1
159
- })
160
-
161
- Object.entries(blockCounts).forEach(([type, count]) => {
162
- console.log(` - ${type}: ${count}`)
163
- })
164
- } catch (error) {
165
- console.error('❌ Error:', error)
166
- process.exit(1)
167
- }
168
- })
169
-
170
- program.parse()
171
-
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "lib": ["ES2020"],
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "resolveJsonModule": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "sourceMap": true
15
- },
16
- "include": ["src/**/*.ts"],
17
- "exclude": ["node_modules", "dist"]
18
- }
19
-