ctxdotdev 0.1.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/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/analyzer/index.d.ts +36 -0
- package/dist/analyzer/index.d.ts.map +1 -0
- package/dist/analyzer/index.js +137 -0
- package/dist/analyzer/index.js.map +1 -0
- package/dist/cli/commands/config.d.ts +3 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +16 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/context.d.ts +3 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +42 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +43 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +30 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/template.d.ts +3 -0
- package/dist/cli/commands/template.d.ts.map +1 -0
- package/dist/cli/commands/template.js +19 -0
- package/dist/cli/commands/template.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +3 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +9 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/help.d.ts +2 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +29 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +35 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/defaults.d.ts +25 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +34 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +43 -0
- package/dist/config/index.js.map +1 -0
- package/dist/formatter/index.d.ts +4 -0
- package/dist/formatter/index.d.ts.map +1 -0
- package/dist/formatter/index.js +15 -0
- package/dist/formatter/index.js.map +1 -0
- package/dist/formatter/json.d.ts +3 -0
- package/dist/formatter/json.d.ts.map +1 -0
- package/dist/formatter/json.js +22 -0
- package/dist/formatter/json.js.map +1 -0
- package/dist/formatter/markdown.d.ts +3 -0
- package/dist/formatter/markdown.d.ts.map +1 -0
- package/dist/formatter/markdown.js +43 -0
- package/dist/formatter/markdown.js.map +1 -0
- package/dist/formatter/text.d.ts +3 -0
- package/dist/formatter/text.d.ts.map +1 -0
- package/dist/formatter/text.js +73 -0
- package/dist/formatter/text.js.map +1 -0
- package/dist/scanner/ignore.d.ts +2 -0
- package/dist/scanner/ignore.d.ts.map +1 -0
- package/dist/scanner/ignore.js +17 -0
- package/dist/scanner/ignore.js.map +1 -0
- package/dist/scanner/index.d.ts +19 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +48 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +11 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Luke Westun
|
|
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
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# ctx — Project Context for AI Coding Tools
|
|
2
|
+
|
|
3
|
+
**One command. Perfect context. Every AI tool.**
|
|
4
|
+
|
|
5
|
+
`ctx` is a CLI tool that gives every AI coding tool perfect project context with one command. Works with Cursor, Claude Code, GitHub Copilot, Continue.dev, Codex, and any LLM.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install via npm
|
|
11
|
+
npm install -g ctxdotdev
|
|
12
|
+
|
|
13
|
+
# Then generate context in any project
|
|
14
|
+
cd my-project
|
|
15
|
+
ctx
|
|
16
|
+
|
|
17
|
+
# Context is copied to your clipboard. Paste into any AI tool.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Why ctx?
|
|
21
|
+
|
|
22
|
+
**The problem:** Every time you use an AI coding tool, you have to re-explain your codebase. What framework is this? What's the project structure? What are the dependencies? You waste 15+ minutes per session setting up context.
|
|
23
|
+
|
|
24
|
+
**The solution:** `ctx` scans your project, analyzes its structure, dependencies, and configuration, and produces a compact context summary. One command. One second. Perfect context.
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
| Command | Description |
|
|
29
|
+
|---------|-------------|
|
|
30
|
+
| `ctx` | Generate context and copy to clipboard |
|
|
31
|
+
| `ctx init` | Initialize ctx in this project |
|
|
32
|
+
| `ctx watch` | Watch files and auto-update context (Pro) |
|
|
33
|
+
| `ctx config` | View or edit project configuration |
|
|
34
|
+
| `ctx template` | Manage context templates (Pro) |
|
|
35
|
+
| `ctx doctor` | Check installation and setup |
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
- **Cross-platform** — Works with Cursor, Claude Code, Copilot, Codex, and any LLM
|
|
40
|
+
- **One command** — `ctx` generates context in under a second
|
|
41
|
+
- **Privacy-first** — All processing local. Nothing leaves your machine.
|
|
42
|
+
- **Smart prioritization** — Auto-detects what's most relevant
|
|
43
|
+
- **Project-aware** — Detects framework, dependencies, structure automatically
|
|
44
|
+
|
|
45
|
+
## Output Example
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Project: my-app ── Node / Next.js
|
|
49
|
+
|
|
50
|
+
Dependencies: 1,234 (312 production)
|
|
51
|
+
Git branch: main
|
|
52
|
+
|
|
53
|
+
Structure:
|
|
54
|
+
├── src/
|
|
55
|
+
├── public/
|
|
56
|
+
├── package.json
|
|
57
|
+
├── tsconfig.json
|
|
58
|
+
└── next.config.js
|
|
59
|
+
|
|
60
|
+
Config files:
|
|
61
|
+
→ tsconfig.json (TypeScript config)
|
|
62
|
+
|
|
63
|
+
Key files:
|
|
64
|
+
→ package.json — 2h ago
|
|
65
|
+
→ src/app/layout.tsx — 3h ago
|
|
66
|
+
|
|
67
|
+
✓ Context copied to clipboard. Ready for AI.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
Create a `.ctx/config.json` in your project root:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"scan": {
|
|
77
|
+
"exclude": ["node_modules", ".git", "dist"]
|
|
78
|
+
},
|
|
79
|
+
"output": {
|
|
80
|
+
"format": "text",
|
|
81
|
+
"showDependencies": true
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or use `.ctxignore` for additional file exclusions (same syntax as `.gitignore`).
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT — do whatever you want with it.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ScannedFile } from '../scanner/index.js';
|
|
2
|
+
export interface ProjectInfo {
|
|
3
|
+
name: string;
|
|
4
|
+
type: ProjectType;
|
|
5
|
+
framework: string;
|
|
6
|
+
dependencies: DepInfo;
|
|
7
|
+
configFiles: FoundConfig[];
|
|
8
|
+
structure: TreeNode;
|
|
9
|
+
gitInfo: GitInfo | null;
|
|
10
|
+
keyFiles: ScannedFile[];
|
|
11
|
+
}
|
|
12
|
+
export type ProjectType = 'node' | 'python' | 'go' | 'rust' | 'unknown';
|
|
13
|
+
export type Framework = 'next.js' | 'react' | 'express' | 'fastify' | 'django' | 'flask' | 'unknown';
|
|
14
|
+
export interface DepInfo {
|
|
15
|
+
total: number;
|
|
16
|
+
production: number;
|
|
17
|
+
dev: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FoundConfig {
|
|
20
|
+
path: string;
|
|
21
|
+
type: string;
|
|
22
|
+
keyValues?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
export interface TreeNode {
|
|
25
|
+
name: string;
|
|
26
|
+
type: 'file' | 'directory';
|
|
27
|
+
children?: TreeNode[];
|
|
28
|
+
size?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface GitInfo {
|
|
31
|
+
branch: string;
|
|
32
|
+
lastCommit: string;
|
|
33
|
+
recentChanges: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function analyzeProject(cwd: string, files: ScannedFile[]): ProjectInfo;
|
|
36
|
+
//# sourceMapping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ACvB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,WAAW,CAmB7E"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve, basename } from 'node:path';
|
|
3
|
+
export function analyzeProject(cwd, files) {
|
|
4
|
+
const name = basename(cwd);
|
|
5
|
+
const type = detectProjectType(cwd);
|
|
6
|
+
const framework = detectFramework(cwd, type);
|
|
7
|
+
const dependencies = analyzeDependencies(cwd, type);
|
|
8
|
+
const configFiles = findConfigFiles(cwd, type);
|
|
9
|
+
const gitInfo = getGitInfo(cwd);
|
|
10
|
+
const keyFiles = getKeyFiles(cwd, files);
|
|
11
|
+
return {
|
|
12
|
+
name,
|
|
13
|
+
type,
|
|
14
|
+
framework,
|
|
15
|
+
dependencies,
|
|
16
|
+
configFiles,
|
|
17
|
+
structure: buildTree(files),
|
|
18
|
+
gitInfo,
|
|
19
|
+
keyFiles,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function detectProjectType(cwd) {
|
|
23
|
+
if (existsSync(resolve(cwd, 'package.json')))
|
|
24
|
+
return 'node';
|
|
25
|
+
if (existsSync(resolve(cwd, 'pyproject.toml')) || existsSync(resolve(cwd, 'requirements.txt')))
|
|
26
|
+
return 'python';
|
|
27
|
+
if (existsSync(resolve(cwd, 'go.mod')))
|
|
28
|
+
return 'go';
|
|
29
|
+
if (existsSync(resolve(cwd, 'Cargo.toml')))
|
|
30
|
+
return 'rust';
|
|
31
|
+
return 'unknown';
|
|
32
|
+
}
|
|
33
|
+
function detectFramework(cwd, type) {
|
|
34
|
+
if (type === 'node') {
|
|
35
|
+
try {
|
|
36
|
+
const pkg = JSON.parse(readFileSync(resolve(cwd, 'package.json'), 'utf-8'));
|
|
37
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
38
|
+
if (deps.next)
|
|
39
|
+
return 'next.js';
|
|
40
|
+
if (deps.react)
|
|
41
|
+
return 'react';
|
|
42
|
+
if (deps.express)
|
|
43
|
+
return 'express';
|
|
44
|
+
if (deps.fastify)
|
|
45
|
+
return 'fastify';
|
|
46
|
+
}
|
|
47
|
+
catch { /* ignore */ }
|
|
48
|
+
}
|
|
49
|
+
return 'unknown';
|
|
50
|
+
}
|
|
51
|
+
function analyzeDependencies(cwd, type) {
|
|
52
|
+
if (type === 'node') {
|
|
53
|
+
try {
|
|
54
|
+
const pkg = JSON.parse(readFileSync(resolve(cwd, 'package.json'), 'utf-8'));
|
|
55
|
+
const prod = Object.keys(pkg.dependencies ?? {}).length;
|
|
56
|
+
const dev = Object.keys(pkg.devDependencies ?? {}).length;
|
|
57
|
+
return { total: prod + dev, production: prod, dev };
|
|
58
|
+
}
|
|
59
|
+
catch { /* ignore */ }
|
|
60
|
+
}
|
|
61
|
+
return { total: 0, production: 0, dev: 0 };
|
|
62
|
+
}
|
|
63
|
+
function findConfigFiles(cwd, type) {
|
|
64
|
+
const configs = [];
|
|
65
|
+
if (type === 'node') {
|
|
66
|
+
checkConfig(configs, cwd, 'tsconfig.json', 'TypeScript config');
|
|
67
|
+
checkConfig(configs, cwd, 'next.config.js', 'Next.js config');
|
|
68
|
+
checkConfig(configs, cwd, 'next.config.mjs', 'Next.js config');
|
|
69
|
+
checkConfig(configs, cwd, 'next.config.ts', 'Next.js config');
|
|
70
|
+
checkConfig(configs, cwd, 'tailwind.config.js', 'Tailwind config');
|
|
71
|
+
checkConfig(configs, cwd, 'eslint.config.js', 'ESLint config');
|
|
72
|
+
checkConfig(configs, cwd, '.eslintrc.json', 'ESLint config');
|
|
73
|
+
checkConfig(configs, cwd, 'vitest.config.ts', 'Vitest config');
|
|
74
|
+
checkConfig(configs, cwd, 'jest.config.ts', 'Jest config');
|
|
75
|
+
}
|
|
76
|
+
return configs;
|
|
77
|
+
}
|
|
78
|
+
function checkConfig(configs, cwd, path, type) {
|
|
79
|
+
const fullPath = resolve(cwd, path);
|
|
80
|
+
if (existsSync(fullPath)) {
|
|
81
|
+
configs.push({ path: fullPath, type });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function getGitInfo(cwd) {
|
|
85
|
+
try {
|
|
86
|
+
const headPath = resolve(cwd, '.git', 'HEAD');
|
|
87
|
+
if (!existsSync(headPath))
|
|
88
|
+
return null;
|
|
89
|
+
const head = readFileSync(headPath, 'utf-8').trim();
|
|
90
|
+
const branch = head.startsWith('ref: ')
|
|
91
|
+
? head.replace('ref: refs/heads/', '')
|
|
92
|
+
: 'detached';
|
|
93
|
+
return { branch, lastCommit: '', recentChanges: 0 };
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function getKeyFiles(cwd, files) {
|
|
100
|
+
const priority = ['package.json', 'tsconfig.json', 'README.md', 'Dockerfile'];
|
|
101
|
+
const result = [];
|
|
102
|
+
for (const name of priority) {
|
|
103
|
+
const found = files.find(f => f.path === name || f.path.endsWith('/' + name));
|
|
104
|
+
if (found)
|
|
105
|
+
result.push(found);
|
|
106
|
+
}
|
|
107
|
+
result.push(...files.slice(0, 5));
|
|
108
|
+
return [...new Set(result)];
|
|
109
|
+
}
|
|
110
|
+
function buildTree(files) {
|
|
111
|
+
const root = { name: '', type: 'directory', children: [] };
|
|
112
|
+
const dirMap = new Map();
|
|
113
|
+
for (const file of files) {
|
|
114
|
+
const parts = file.path.split('/');
|
|
115
|
+
const topDir = parts[0];
|
|
116
|
+
if (!dirMap.has(topDir)) {
|
|
117
|
+
dirMap.set(topDir, []);
|
|
118
|
+
}
|
|
119
|
+
dirMap.get(topDir).push(file);
|
|
120
|
+
}
|
|
121
|
+
for (const [dir, dirFiles] of dirMap) {
|
|
122
|
+
if (dirFiles.length === 1 && dirFiles[0].path === dir) {
|
|
123
|
+
const file = dirFiles[0];
|
|
124
|
+
root.children.push({ name: dir, type: 'file', size: file.size });
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
root.children.push({ name: dir + '/', type: 'directory' });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
root.children?.sort((a, b) => {
|
|
131
|
+
if (a.type !== b.type)
|
|
132
|
+
return a.type === 'directory' ? -1 : 1;
|
|
133
|
+
return a.name.localeCompare(b.name);
|
|
134
|
+
});
|
|
135
|
+
return root;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/analyzer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAY,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAW,MAAM,WAAW,CAAC;AAiDvD,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,KAAoB;IAC9D,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,WAAW,GAAG,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEzC,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,SAAS;QACT,YAAY;QACZ,WAAW;QACX,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC;QAC3B,OAAO;QACP,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,c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,IAAI,KAAK,GAAG,EAAE,CAAC;YACtD,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,CAAC,QAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,EAAE,WAAoB,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC3B,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;YAAE,OAAO,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,aAAa,SAWtB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { loadConfig } from '../../config/index.js';
|
|
3
|
+
export const configCommand = new Command('config')
|
|
4
|
+
.description('View or edit project configuration')
|
|
5
|
+
.option('--show', 'Show current configuration')
|
|
6
|
+
.action((options) => {
|
|
7
|
+
if (options.show) {
|
|
8
|
+
const config = loadConfig(process.cwd());
|
|
9
|
+
console.log(JSON.stringify(config, null, 2));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
const config = loadConfig(process.cwd());
|
|
13
|
+
console.log(JSON.stringify(config, null, 2));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,oCAAoC,CAAC;KACjD,MAAM,CAAC,QAAQ,EAAE,4BAA4B,CAAC;KAC9C,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;IAClB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,cAAc,SAoCvB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { scanProject } from '../../scanner/index.js';
|
|
3
|
+
import { analyzeProject } from '../../analyzer/index.js';
|
|
4
|
+
import { formatOutput } from '../../formatter/index.js';
|
|
5
|
+
import { loadConfig } from '../../config/index.js';
|
|
6
|
+
import { copyToClipboard } from '../../utils/clipboard.js';
|
|
7
|
+
export const contextCommand = new Command('context')
|
|
8
|
+
.aliases(['default'])
|
|
9
|
+
.description('Generate project context for AI coding tools')
|
|
10
|
+
.option('--no-clipboard', 'Print to stdout only')
|
|
11
|
+
.option('--format <format>', 'Output format: text, markdown, json', 'text')
|
|
12
|
+
.option('--profile <name>', 'Use a named context profile')
|
|
13
|
+
.option('-v, --verbose', 'Show detailed output')
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
const cwd = process.cwd();
|
|
16
|
+
const config = loadConfig(cwd);
|
|
17
|
+
try {
|
|
18
|
+
const scanResult = await scanProject({
|
|
19
|
+
cwd,
|
|
20
|
+
maxDepth: config.scan.maxDepth,
|
|
21
|
+
maxFiles: config.scan.maxFiles,
|
|
22
|
+
include: config.scan.include,
|
|
23
|
+
exclude: config.scan.exclude,
|
|
24
|
+
});
|
|
25
|
+
const projectInfo = analyzeProject(cwd, scanResult.files);
|
|
26
|
+
const format = options.format || config.output.format;
|
|
27
|
+
const output = formatOutput(projectInfo, format);
|
|
28
|
+
if (options.clipboard !== false) {
|
|
29
|
+
await copyToClipboard(output);
|
|
30
|
+
console.log(output);
|
|
31
|
+
console.log('\n ✓ Context copied to clipboard. Ready for AI.');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(output);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error('Error generating context:', error instanceof Error ? error.message : error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 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CAAC,KAAK,CAAC,CAAC;QAE1D,MAAM,MAAM,GAAI,OAAO,CAAC,MAAuB,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACxE,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAEjD,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;YAChC,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC3F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,aAAa,SAuCtB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
export const doctorCommand = new Command('doctor')
|
|
5
|
+
.description('Check installation and project setup')
|
|
6
|
+
.action(() => {
|
|
7
|
+
const cwd = process.cwd();
|
|
8
|
+
let allGood = true;
|
|
9
|
+
console.log(' ctx doctor — System Check\n');
|
|
10
|
+
const nodeVersion = process.version;
|
|
11
|
+
console.log(` Node.js: ${nodeVersion}${nodeVersion >= 'v18' ? ' ✓' : ' ✗ (need >=18)'}`);
|
|
12
|
+
if (nodeVersion < 'v18')
|
|
13
|
+
allGood = false;
|
|
14
|
+
const pkgPath = resolve(cwd, 'package.json');
|
|
15
|
+
if (existsSync(pkgPath)) {
|
|
16
|
+
console.log(' package.json: ✓');
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.log(' package.json: ✗ (not found)');
|
|
20
|
+
}
|
|
21
|
+
const ctxDir = resolve(cwd, '.ctx');
|
|
22
|
+
if (existsSync(ctxDir)) {
|
|
23
|
+
console.log(' .ctx/config: ✓');
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
console.log(' .ctx/config: — (run ctx init)');
|
|
27
|
+
}
|
|
28
|
+
const gitDir = resolve(cwd, '.git');
|
|
29
|
+
if (existsSync(gitDir)) {
|
|
30
|
+
console.log(' Git repository: ✓');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.log(' Git repository: — (not a git repo)');
|
|
34
|
+
}
|
|
35
|
+
console.log('');
|
|
36
|
+
if (allGood) {
|
|
37
|
+
console.log(' ✓ System looks good. Ready to generate context.');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
console.log(' ⚠ Some checks failed. See details above.');
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,sCAAsC,CAA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OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,WAAW,SAyBpB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { DEFAULT_CONFIG } from '../../config/defaults.js';
|
|
5
|
+
export const initCommand = new Command('init')
|
|
6
|
+
.description('Initialize ctx in this project')
|
|
7
|
+
.argument('[directory]', 'Project directory', '.')
|
|
8
|
+
.action((directory) => {
|
|
9
|
+
const cwd = resolve(process.cwd(), directory);
|
|
10
|
+
const ctxDir = resolve(cwd, '.ctx');
|
|
11
|
+
if (!existsSync(ctxDir)) {
|
|
12
|
+
mkdirSync(ctxDir, { recursive: true });
|
|
13
|
+
}
|
|
14
|
+
const configPath = resolve(ctxDir, 'config.json');
|
|
15
|
+
if (!existsSync(configPath)) {
|
|
16
|
+
const config = {
|
|
17
|
+
...DEFAULT_CONFIG,
|
|
18
|
+
project: {
|
|
19
|
+
...DEFAULT_CONFIG.project,
|
|
20
|
+
name: cwd.split('/').pop() || 'my-project',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
24
|
+
console.log(` ✓ Initialized ctx in ${cwd}`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
console.log(` ✓ ctx already initialized in ${cwd}`);
|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AAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,eAAO,MAAM,eAAe,SAiBxB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export const templateCommand = new Command('template')
|
|
3
|
+
.description('Manage context templates (Pro)')
|
|
4
|
+
.argument('[action]', 'Action: list, create, use')
|
|
5
|
+
.argument('[name]', 'Template name')
|
|
6
|
+
.action((action) => {
|
|
7
|
+
if (!action) {
|
|
8
|
+
console.log(' Usage: ctx template <list|create|use> [name]');
|
|
9
|
+
console.log('\n Available templates:');
|
|
10
|
+
console.log(' standard Default context template');
|
|
11
|
+
console.log('\n Pro templates (coming soon):');
|
|
12
|
+
console.log(' review Code review context');
|
|
13
|
+
console.log(' debug Debugging context');
|
|
14
|
+
console.log(' onboard Onboarding context');
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
console.log(` ✗ Template management is a Pro feature. Coming soon.`);
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/cli/commands/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;KACnD,WAAW,CAAC,gCAAgC,CAAC;KAC7C,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;KACjD,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;KACnC,MAAM,CAAC,CAAC,MAAe,EAAE,EAAE;IAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAClD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,eAAO,MAAM,YAAY,SAMrB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export const watchCommand = new Command('watch')
|
|
3
|
+
.description('Watch files and auto-update context (Pro)')
|
|
4
|
+
.option('--debounce <ms>', 'Debounce time in milliseconds', '1000')
|
|
5
|
+
.action((options) => {
|
|
6
|
+
console.log(' ✗ ctx watch is a Pro feature. Coming soon.');
|
|
7
|
+
console.log(' Get notified: https://ctx.dev');
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,2CAA2C,CAAC;KACxD,MAAM,CAAC,iBAAiB,EAAE,+BAA+B,EAAE,MAAM,CAAC;KAClE,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;IAClB,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,IAAI,MAAM,CA2BpC"}
|
package/dist/cli/help.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function getHelpText() {
|
|
2
|
+
return `
|
|
3
|
+
ctx — Project context for AI coding tools
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
ctx Generate context and copy to clipboard
|
|
7
|
+
ctx init Initialize ctx in this project
|
|
8
|
+
ctx watch Watch files and auto-update context
|
|
9
|
+
ctx config View or edit project configuration
|
|
10
|
+
ctx template Manage context templates (Pro)
|
|
11
|
+
ctx doctor Check installation and setup
|
|
12
|
+
|
|
13
|
+
Options:
|
|
14
|
+
--no-clipboard Print to stdout only
|
|
15
|
+
--format <format> Output format: text (default), markdown, json
|
|
16
|
+
--profile <name> Use a named context profile
|
|
17
|
+
-v, --verbose Show detailed output
|
|
18
|
+
-h, --help Show this help
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
ctx Generate and copy context
|
|
22
|
+
ctx --no-clipboard Print context to terminal
|
|
23
|
+
ctx init Set up ctx in current project
|
|
24
|
+
ctx --format json Get context as JSON
|
|
25
|
+
|
|
26
|
+
Learn more: https://ctx.dev
|
|
27
|
+
`;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW;IACzB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CAyBR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { contextCommand } from './commands/context.js';
|
|
4
|
+
import { initCommand } from './commands/init.js';
|
|
5
|
+
import { watchCommand } from './commands/watch.js';
|
|
6
|
+
import { configCommand } from './commands/config.js';
|
|
7
|
+
import { templateCommand } from './commands/template.js';
|
|
8
|
+
import { doctorCommand } from './commands/doctor.js';
|
|
9
|
+
import { readFileSync } from 'node:fs';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import { dirname, resolve } from 'node:path';
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
function getVersion() {
|
|
15
|
+
try {
|
|
16
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, '../../package.json'), 'utf-8'));
|
|
17
|
+
return pkg.version;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return '0.1.0';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const program = new Command();
|
|
24
|
+
program
|
|
25
|
+
.name('ctx')
|
|
26
|
+
.description('Project context for AI coding tools')
|
|
27
|
+
.version(getVersion());
|
|
28
|
+
program.addCommand(contextCommand, { isDefault: true });
|
|
29
|
+
program.addCommand(initCommand);
|
|
30
|
+
program.addCommand(watchCommand);
|
|
31
|
+
program.addCommand(configCommand);
|
|
32
|
+
program.addCommand(templateCommand);
|
|
33
|
+
program.addCommand(doctorCommand);
|
|
34
|
+
program.parse();
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAChE,CAAC;QACF,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OA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