kaimon-cli 0.1.2 → 0.1.3
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/LICENSE +21 -0
- package/README.md +71 -32
- package/bin/index.js +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +13 -4
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/pull.d.ts +4 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +20 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/push.d.ts +4 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +19 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +3 -14
- package/dist/commands/sync.js.map +1 -1
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +7 -3
- package/dist/config/constants.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/markdown.d.ts +21 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/markdown.js +180 -0
- package/dist/utils/markdown.js.map +1 -0
- package/dist/utils/projectConfig.d.ts +25 -0
- package/dist/utils/projectConfig.d.ts.map +1 -0
- package/dist/utils/projectConfig.js +160 -0
- package/dist/utils/projectConfig.js.map +1 -0
- package/dist/utils/supabaseClient.d.ts +11 -0
- package/dist/utils/supabaseClient.d.ts.map +1 -0
- package/dist/utils/supabaseClient.js +43 -0
- package/dist/utils/supabaseClient.js.map +1 -0
- package/dist/utils/syncOperations.d.ts +16 -0
- package/dist/utils/syncOperations.d.ts.map +1 -0
- package/dist/utils/syncOperations.js +168 -0
- package/dist/utils/syncOperations.js.map +1 -0
- package/package.json +15 -8
- package/src/commands/auth.ts +0 -170
- package/src/commands/config.ts +0 -72
- package/src/commands/sync.ts +0 -30
- package/src/config/constants.ts +0 -27
- package/src/index.ts +0 -20
- package/src/utils/config.ts +0 -81
- package/src/utils/requireAuth.ts +0 -65
- package/tsconfig.json +0 -21
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kaimon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -8,65 +8,104 @@
|
|
|
8
8
|
npm install -g kaimon-cli
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Quick Start
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
```bash
|
|
14
|
+
# 1. Authenticate with Kaimon
|
|
15
|
+
kaimon auth login
|
|
16
|
+
|
|
17
|
+
# 2. Navigate to your project directory
|
|
18
|
+
cd my-project
|
|
19
|
+
|
|
20
|
+
# 3. Initialize Kaimon sync
|
|
21
|
+
kaimon config init
|
|
22
|
+
|
|
23
|
+
# 4. Pull your documents as markdown files
|
|
24
|
+
kaimon pull
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Your documents will be downloaded to `./KaimonDocs/` as markdown files with metadata frontmatter.
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### Authentication
|
|
14
32
|
|
|
15
33
|
```bash
|
|
16
|
-
# Login to your Kaimon account
|
|
34
|
+
# Login to your Kaimon account (opens browser)
|
|
17
35
|
kaimon auth login
|
|
18
36
|
|
|
19
|
-
# Check
|
|
37
|
+
# Check authentication status
|
|
20
38
|
kaimon auth status
|
|
21
39
|
|
|
40
|
+
# Show full token (security risk!)
|
|
41
|
+
kaimon auth status --show-token
|
|
42
|
+
|
|
22
43
|
# Logout
|
|
23
44
|
kaimon auth logout
|
|
24
45
|
```
|
|
25
46
|
|
|
26
|
-
|
|
47
|
+
**How login works:**
|
|
48
|
+
1. Opens browser to Kaimon auth page
|
|
49
|
+
2. You log in and copy the access token
|
|
50
|
+
3. Paste token into CLI (hidden input)
|
|
51
|
+
4. Token saved to `~/.kaimon/config.json`
|
|
27
52
|
|
|
28
|
-
|
|
29
|
-
# Pull documentation from Kaimon
|
|
30
|
-
kaimon sync --pull
|
|
53
|
+
### Project Setup
|
|
31
54
|
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
```bash
|
|
56
|
+
# Initialize current directory for syncing
|
|
57
|
+
kaimon config init
|
|
34
58
|
|
|
35
|
-
#
|
|
36
|
-
kaimon
|
|
59
|
+
# View project configuration
|
|
60
|
+
kaimon config show
|
|
37
61
|
```
|
|
38
62
|
|
|
39
|
-
###
|
|
63
|
+
### Syncing Documents
|
|
40
64
|
|
|
41
65
|
```bash
|
|
42
|
-
#
|
|
43
|
-
kaimon
|
|
66
|
+
# Download all documents from Kaimon as markdown
|
|
67
|
+
kaimon pull
|
|
44
68
|
|
|
45
|
-
#
|
|
46
|
-
kaimon
|
|
69
|
+
# Download documents to current folder (flat structure)
|
|
70
|
+
kaimon pull --flat
|
|
71
|
+
|
|
72
|
+
# Upload local markdown files to Kaimon (coming soon)
|
|
73
|
+
kaimon push
|
|
47
74
|
|
|
48
|
-
#
|
|
49
|
-
kaimon
|
|
75
|
+
# Bidirectional sync (coming soon)
|
|
76
|
+
kaimon sync
|
|
50
77
|
```
|
|
51
78
|
|
|
52
|
-
|
|
79
|
+
**Pull options:**
|
|
80
|
+
- `--flat` - Save documents to current directory instead of `./KaimonDocs/` subfolder
|
|
53
81
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
82
|
+
## Document Format
|
|
83
|
+
|
|
84
|
+
Downloaded markdown files include frontmatter:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
---
|
|
88
|
+
title: "My Document"
|
|
89
|
+
kaimon_id: "abc-123-def-456"
|
|
90
|
+
created_at: "2024-01-15T10:00:00Z"
|
|
91
|
+
updated_at: "2024-02-21T15:00:00Z"
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
# My Document
|
|
95
|
+
|
|
96
|
+
Content here...
|
|
97
|
+
```
|
|
59
98
|
|
|
60
|
-
##
|
|
99
|
+
## Troubleshooting
|
|
61
100
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
3. Initialize your project: `kaimon config init`
|
|
65
|
-
4. Sync docs: `kaimon sync --pull` or `kaimon sync --push`
|
|
101
|
+
### "Not authenticated"
|
|
102
|
+
Run `kaimon auth login` to authenticate first.
|
|
66
103
|
|
|
67
|
-
|
|
104
|
+
### "Not in a Kaimon project"
|
|
105
|
+
Run `kaimon config init` in your project directory first.
|
|
68
106
|
|
|
69
|
-
|
|
107
|
+
### "Authentication expired"
|
|
108
|
+
Run `kaimon auth login` again to refresh your token.
|
|
70
109
|
|
|
71
110
|
## License
|
|
72
111
|
|
package/bin/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,QAAA,MAAM,MAAM,SACqC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,QAAA,MAAM,MAAM,SACqC,CAAC;AA8ElD,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/commands/config.js
CHANGED
|
@@ -7,10 +7,19 @@ config
|
|
|
7
7
|
.command('init')
|
|
8
8
|
.description('Initialize .kaimon config in current directory')
|
|
9
9
|
.action(async () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
try {
|
|
11
|
+
const { requireAuth } = await import('../utils/requireAuth.js');
|
|
12
|
+
const { initProjectConfig } = await import('../utils/projectConfig.js');
|
|
13
|
+
// Require authentication first
|
|
14
|
+
await requireAuth();
|
|
15
|
+
console.log(chalk.blue('⚙️ Initializing Kaimon sync in current directory...\n'));
|
|
16
|
+
// Initialize project config (will prompt for workspace selection)
|
|
17
|
+
await initProjectConfig();
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error(chalk.red('❌ Initialization failed:'), error.message);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
14
23
|
});
|
|
15
24
|
config
|
|
16
25
|
.command('show')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,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
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { requireAuth } from '../utils/requireAuth.js';
|
|
4
|
+
const pull = new Command('pull')
|
|
5
|
+
.description('Pull all documents from Kaimon as markdown files')
|
|
6
|
+
.option('--flat', 'Save documents directly to current folder instead of KaimonDocs/ subfolder')
|
|
7
|
+
.action(async (options) => {
|
|
8
|
+
try {
|
|
9
|
+
// Validate authentication first
|
|
10
|
+
await requireAuth();
|
|
11
|
+
const { pullDocuments } = await import('../utils/syncOperations.js');
|
|
12
|
+
await pullDocuments(options.flat);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error(chalk.red('❌ Pull failed:'), error.message);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export { pull };
|
|
20
|
+
//# sourceMappingURL=pull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC7B,WAAW,CAAC,kDAAkD,CAAC;KAC/D,MAAM,CAAC,QAAQ,EAAE,4EAA4E,CAAC;KAC9F,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,IAAI,CAAC;QACH,gCAAgC;QAChC,MAAM,WAAW,EAAE,CAAC;QAEpB,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;QACrE,MAAM,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,QAAA,MAAM,IAAI,SAcN,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { requireAuth } from '../utils/requireAuth.js';
|
|
4
|
+
const push = new Command('push')
|
|
5
|
+
.description('Push local markdown files to Kaimon (coming soon)')
|
|
6
|
+
.action(async () => {
|
|
7
|
+
try {
|
|
8
|
+
// Validate authentication first
|
|
9
|
+
await requireAuth();
|
|
10
|
+
console.log(chalk.yellow('\n⚠️ Push functionality not yet implemented'));
|
|
11
|
+
console.log(chalk.dim('Coming soon! You can use "kaimon pull" to download docs for now.\n'));
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
console.error(chalk.red('❌ Push failed:'), error.message);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export { push };
|
|
19
|
+
//# sourceMappingURL=push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC7B,WAAW,CAAC,mDAAmD,CAAC;KAChE,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,gCAAgC;QAChC,MAAM,WAAW,EAAE,CAAC;QAEpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC,CAAC;IAE/F,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,QAAA,MAAM,IAAI,SAUN,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/commands/sync.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import { requireAuth } from '../utils/requireAuth.js';
|
|
4
3
|
const sync = new Command('sync')
|
|
5
|
-
.description('
|
|
6
|
-
.
|
|
7
|
-
.option('--push', 'Push local docs to Kaimon')
|
|
8
|
-
.option('--diff', 'Show differences without syncing')
|
|
9
|
-
.option('--config <path>', 'Path to sync config file')
|
|
10
|
-
.action(async (options) => {
|
|
4
|
+
.description('Bidirectional sync - compare and sync latest changes (coming soon)')
|
|
5
|
+
.action(async () => {
|
|
11
6
|
try {
|
|
12
|
-
// Validate authentication first
|
|
13
|
-
const token = await requireAuth();
|
|
14
|
-
console.log(chalk.blue('📁 Sync command - coming soon!'));
|
|
15
|
-
console.log(chalk.gray(`Authenticated with token: ${token.substring(0, 10)}...`));
|
|
16
|
-
console.log(chalk.gray('Options:'), options);
|
|
17
|
-
// TODO: Implement sync logic
|
|
18
7
|
console.log(chalk.yellow('\n⚠️ Sync functionality not yet implemented'));
|
|
19
|
-
console.log(chalk.dim('
|
|
8
|
+
console.log(chalk.dim('Coming soon! Use "kaimon pull" and "kaimon push" for now.\n'));
|
|
20
9
|
}
|
|
21
10
|
catch (error) {
|
|
22
11
|
console.error(chalk.red('❌ Sync failed:'), error.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC7B,WAAW,CAAC,oEAAoE,CAAC;KACjF,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC,CAAC;IACxF,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -5,5 +5,5 @@ export declare const CLI_AUTH_PATH = "/cli-auth";
|
|
|
5
5
|
export declare const CONFIG_DIR = ".kaimon";
|
|
6
6
|
export declare const CONFIG_FILE = "config.json";
|
|
7
7
|
export declare const SUPABASE_URL: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const SUPABASE_PUBLISHABLE_KEY: string;
|
|
9
9
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,QAAoD,CAAC;AAG1E,eAAO,MAAM,OAAO,0BAA0B,CAAC;AAG/C,eAAO,MAAM,UAAU,QAAO,MAI7B,CAAC;AAGF,eAAO,MAAM,aAAa,cAAc,CAAC;AAGzC,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,WAAW,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,QAAoD,CAAC;AAG1E,eAAO,MAAM,OAAO,0BAA0B,CAAC;AAG/C,eAAO,MAAM,UAAU,QAAO,MAI7B,CAAC;AAGF,eAAO,MAAM,aAAa,cAAc,CAAC;AAGzC,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAKzC,eAAO,MAAM,YAAY,QAC4C,CAAC;AAEtE,eAAO,MAAM,wBAAwB,QACkD,CAAC"}
|
package/dist/config/constants.js
CHANGED
|
@@ -16,7 +16,11 @@ export const CLI_AUTH_PATH = '/cli-auth';
|
|
|
16
16
|
// Config file location
|
|
17
17
|
export const CONFIG_DIR = '.kaimon';
|
|
18
18
|
export const CONFIG_FILE = 'config.json';
|
|
19
|
-
// Supabase config (
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
// Supabase config (same as web app - PUBLIC and safe to expose)
|
|
20
|
+
// These are the SAME credentials your web app uses in VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY
|
|
21
|
+
// Users can override with environment variables if self-hosting
|
|
22
|
+
export const SUPABASE_URL = process.env.VITE_SUPABASE_URL ||
|
|
23
|
+
'https://lzcvtmboqtzeblhqvmxk.supabase.co'; // ← Replace with your actual Supabase URL
|
|
24
|
+
export const SUPABASE_PUBLISHABLE_KEY = process.env.VITE_SUPABASE_PUBLISHABLE_KEY ||
|
|
25
|
+
'sb_publishable_Uo40YIsQX-juZuC7DV9oHw_suiVu2Kv'; // ← Replace with your actual publishable key
|
|
22
26
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,8CAA8C;AAC9C,gCAAgC;AAChC,uCAAuC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,mBAAmB,CAAC;AAE1E,gCAAgC;AAChC,MAAM,CAAC,MAAM,OAAO,GAAG,uBAAuB,CAAC;AAE/C,6BAA6B;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAW,EAAE;IACrC,qCAAqC;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,CAAC;IAC1F,OAAO,KAAK,C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B;IAC1C,gDAAgD,CAAC,CAAC,6CAA6C"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqBA,wBAAsB,IAAI,kBAEzB"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { auth } from './commands/auth.js';
|
|
3
|
+
import { pull } from './commands/pull.js';
|
|
4
|
+
import { push } from './commands/push.js';
|
|
3
5
|
import { sync } from './commands/sync.js';
|
|
4
6
|
import { config } from './commands/config.js';
|
|
5
7
|
const program = new Command();
|
|
@@ -9,6 +11,8 @@ program
|
|
|
9
11
|
.version('0.1.0');
|
|
10
12
|
// Register commands
|
|
11
13
|
program.addCommand(auth);
|
|
14
|
+
program.addCommand(pull);
|
|
15
|
+
program.addCommand(push);
|
|
12
16
|
program.addCommand(sync);
|
|
13
17
|
program.addCommand(config);
|
|
14
18
|
export async function main() {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,8CAA8C,CAAC;KAC3D,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,oBAAoB;AACpB,OAAO,CAA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own
|
|
3
|
+
* This is a simplified version that handles common block types
|
|
4
|
+
*/
|
|
5
|
+
interface BlockNoteBlock {
|
|
6
|
+
type: string;
|
|
7
|
+
content?: any[];
|
|
8
|
+
props?: Record<string, any>;
|
|
9
|
+
children?: BlockNoteBlock[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convert BlockNote document to Markdown
|
|
13
|
+
*/
|
|
14
|
+
export declare function blocknoteToMarkdown(blocks: BlockNoteBlock[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Convert Markdown to simplified BlockNote JSON
|
|
17
|
+
* This is a basic implementation for --push support
|
|
18
|
+
*/
|
|
19
|
+
export declare function markdownToBlocknote(markdown: string): BlockNoteBlock[];
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/utils/markdown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAgFD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAoBpE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,EAAE,CA8FtE"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert BlockNote JSON format to Markdown
|
|
3
|
+
* This is a simplified version that handles common block types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Extract text from inline content with formatting
|
|
7
|
+
*/
|
|
8
|
+
function extractInlineText(content) {
|
|
9
|
+
if (!Array.isArray(content))
|
|
10
|
+
return '';
|
|
11
|
+
return content.map((item) => {
|
|
12
|
+
if (typeof item === 'string')
|
|
13
|
+
return item;
|
|
14
|
+
if (!item.text)
|
|
15
|
+
return '';
|
|
16
|
+
let text = item.text;
|
|
17
|
+
// Apply styles
|
|
18
|
+
if (item.styles) {
|
|
19
|
+
if (item.styles.bold)
|
|
20
|
+
text = `**${text}**`;
|
|
21
|
+
if (item.styles.italic)
|
|
22
|
+
text = `*${text}*`;
|
|
23
|
+
if (item.styles.code)
|
|
24
|
+
text = `\`${text}\``;
|
|
25
|
+
if (item.styles.strike)
|
|
26
|
+
text = `~~${text}~~`;
|
|
27
|
+
}
|
|
28
|
+
return text;
|
|
29
|
+
}).join('');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Convert a single BlockNote block to Markdown
|
|
33
|
+
*/
|
|
34
|
+
function blockToMarkdown(block, listIndex) {
|
|
35
|
+
const { type, content = [], props = {}, children = [] } = block;
|
|
36
|
+
const text = extractInlineText(content);
|
|
37
|
+
switch (type) {
|
|
38
|
+
case 'heading':
|
|
39
|
+
const level = props.level || 1;
|
|
40
|
+
return `${'#'.repeat(level)} ${text}\n\n`;
|
|
41
|
+
case 'paragraph':
|
|
42
|
+
return text ? `${text}\n\n` : '\n';
|
|
43
|
+
case 'bulletListItem':
|
|
44
|
+
const bulletChildren = children.map(child => blockToMarkdown(child)).join('');
|
|
45
|
+
return `- ${text}\n${bulletChildren}`;
|
|
46
|
+
case 'numberedListItem':
|
|
47
|
+
const start = props.start || listIndex || 1;
|
|
48
|
+
const numberedChildren = children.map(child => blockToMarkdown(child)).join('');
|
|
49
|
+
return `${start}. ${text}\n${numberedChildren}`;
|
|
50
|
+
case 'checkListItem':
|
|
51
|
+
const checked = props.checked ? 'x' : ' ';
|
|
52
|
+
return `- [${checked}] ${text}\n`;
|
|
53
|
+
case 'codeBlock':
|
|
54
|
+
const language = props.language || '';
|
|
55
|
+
return `\`\`\`${language}\n${text}\n\`\`\`\n\n`;
|
|
56
|
+
case 'table':
|
|
57
|
+
// Simplified table handling
|
|
58
|
+
return `| Table |\n|-------|\n| ${text} |\n\n`;
|
|
59
|
+
case 'image':
|
|
60
|
+
const url = props.url || '';
|
|
61
|
+
const caption = props.caption || text || '';
|
|
62
|
+
return `\n\n`;
|
|
63
|
+
default:
|
|
64
|
+
// Unknown block type - treat as paragraph
|
|
65
|
+
return text ? `${text}\n\n` : '';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Convert BlockNote document to Markdown
|
|
70
|
+
*/
|
|
71
|
+
export function blocknoteToMarkdown(blocks) {
|
|
72
|
+
if (!Array.isArray(blocks))
|
|
73
|
+
return '';
|
|
74
|
+
let markdown = '';
|
|
75
|
+
let listIndex = 1;
|
|
76
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
77
|
+
const block = blocks[i];
|
|
78
|
+
// Track list numbering
|
|
79
|
+
if (block.type === 'numberedListItem') {
|
|
80
|
+
markdown += blockToMarkdown(block, listIndex);
|
|
81
|
+
listIndex++;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
markdown += blockToMarkdown(block);
|
|
85
|
+
listIndex = 1; // Reset list counter
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return markdown.trim();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Convert Markdown to simplified BlockNote JSON
|
|
92
|
+
* This is a basic implementation for --push support
|
|
93
|
+
*/
|
|
94
|
+
export function markdownToBlocknote(markdown) {
|
|
95
|
+
const lines = markdown.split('\n');
|
|
96
|
+
const blocks = [];
|
|
97
|
+
let currentBlock = [];
|
|
98
|
+
let inCodeBlock = false;
|
|
99
|
+
let codeLanguage = '';
|
|
100
|
+
let codeLines = [];
|
|
101
|
+
for (let i = 0; i < lines.length; i++) {
|
|
102
|
+
const line = lines[i];
|
|
103
|
+
// Handle code blocks
|
|
104
|
+
if (line.startsWith('```')) {
|
|
105
|
+
if (!inCodeBlock) {
|
|
106
|
+
// Start code block
|
|
107
|
+
inCodeBlock = true;
|
|
108
|
+
codeLanguage = line.slice(3).trim();
|
|
109
|
+
codeLines = [];
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// End code block
|
|
113
|
+
blocks.push({
|
|
114
|
+
type: 'codeBlock',
|
|
115
|
+
props: { language: codeLanguage },
|
|
116
|
+
content: [{ type: 'text', text: codeLines.join('\n') }]
|
|
117
|
+
});
|
|
118
|
+
inCodeBlock = false;
|
|
119
|
+
codeLanguage = '';
|
|
120
|
+
codeLines = [];
|
|
121
|
+
}
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (inCodeBlock) {
|
|
125
|
+
codeLines.push(line);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
// Handle headings
|
|
129
|
+
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
130
|
+
if (headingMatch) {
|
|
131
|
+
blocks.push({
|
|
132
|
+
type: 'heading',
|
|
133
|
+
props: { level: headingMatch[1].length },
|
|
134
|
+
content: [{ type: 'text', text: headingMatch[2] }]
|
|
135
|
+
});
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
// Handle bullet lists
|
|
139
|
+
if (line.match(/^-\s+(.+)$/)) {
|
|
140
|
+
const text = line.replace(/^-\s+/, '');
|
|
141
|
+
blocks.push({
|
|
142
|
+
type: 'bulletListItem',
|
|
143
|
+
content: [{ type: 'text', text }]
|
|
144
|
+
});
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
// Handle numbered lists
|
|
148
|
+
const numberedMatch = line.match(/^(\d+)\.\s+(.+)$/);
|
|
149
|
+
if (numberedMatch) {
|
|
150
|
+
blocks.push({
|
|
151
|
+
type: 'numberedListItem',
|
|
152
|
+
props: { start: parseInt(numberedMatch[1]) },
|
|
153
|
+
content: [{ type: 'text', text: numberedMatch[2] }]
|
|
154
|
+
});
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
// Handle empty lines (paragraph breaks)
|
|
158
|
+
if (line.trim() === '') {
|
|
159
|
+
if (currentBlock.length > 0) {
|
|
160
|
+
blocks.push({
|
|
161
|
+
type: 'paragraph',
|
|
162
|
+
content: [{ type: 'text', text: currentBlock.join('\n') }]
|
|
163
|
+
});
|
|
164
|
+
currentBlock = [];
|
|
165
|
+
}
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
// Accumulate paragraph text
|
|
169
|
+
currentBlock.push(line);
|
|
170
|
+
}
|
|
171
|
+
// Flush remaining paragraph
|
|
172
|
+
if (currentBlock.length > 0) {
|
|
173
|
+
blocks.push({
|
|
174
|
+
type: 'paragraph',
|
|
175
|
+
content: [{ type: 'text', text: currentBlock.join('\n') }]
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return blocks;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/utils/markdown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH;;GAEG;AACH,SAAS,iBAAiB,CAAC,OAAc;IACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAAiB,EAAE,EAAE;QACvC,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QAE1B,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAErB,eAAe;QACf,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI;gBAAE,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC;YAC3C,IAAI,IAAI,CAAC,MAAM,CAAC,MA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CAAC,CAAC,CAAC,CAAC,EAAE;gBAC5C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;aACpD,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,wCAAwC;QACxC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACvB,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC3D,CAAC,CAAC;gBACH,YAAY,GAAG,EAAE,CAAC;YACpB,CAAC;YACD,SAAS;QACX,CAAC;QAED,4BAA4B;QAC5B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,4BAA4B;IAC5B,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;SAC3D,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ProjectConfig {
|
|
2
|
+
version: string;
|
|
3
|
+
user_id?: string;
|
|
4
|
+
sync_patterns?: {
|
|
5
|
+
include: string[];
|
|
6
|
+
exclude: string[];
|
|
7
|
+
};
|
|
8
|
+
last_sync?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function getProjectConfigDir(baseDir?: string): string;
|
|
11
|
+
export declare function getProjectConfigPath(baseDir?: string): string;
|
|
12
|
+
export declare function isProjectInitialized(baseDir?: string): boolean;
|
|
13
|
+
export declare function loadProjectConfig(baseDir?: string): ProjectConfig | null;
|
|
14
|
+
export declare function saveProjectConfig(config: ProjectConfig, baseDir?: string): void;
|
|
15
|
+
export declare function validateProjectConfig(config: ProjectConfig): {
|
|
16
|
+
valid: boolean;
|
|
17
|
+
errors: string[];
|
|
18
|
+
};
|
|
19
|
+
export declare function findProjectConfig(startDir?: string): {
|
|
20
|
+
path: string;
|
|
21
|
+
config: ProjectConfig;
|
|
22
|
+
} | null;
|
|
23
|
+
export declare function initProjectConfig(baseDir?: string): Promise<void>;
|
|
24
|
+
export declare function requireProjectConfig(baseDir?: string): Promise<ProjectConfig>;
|
|
25
|
+
//# sourceMappingURL=projectConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectConfig.d.ts","sourceRoot":"","sources":["../../src/utils/projectConfig.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE;QACd,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,MAAsB,GAAG,MAAM,CAE3E;AAGD,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,MAAsB,GAAG,MAAM,CAE5E;AAGD,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAE7E;AAGD,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,MAAsB,GAAG,aAAa,GAAG,IAAI,CAavF;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,GAAE,MAAsB,GAAG,IAAI,CAgB9F;AAGD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAejG;AAGD,wBAAgB,iBAAiB,CAAC,QAAQ,GAAE,MAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG,IAAI,CAqBlH;AAGD,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+DtF;AAGD,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,aAAa,CAAC,CAqBlG"}
|