@agents-dev/cli 0.7.7 → 0.8.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/AGENTS.md +36 -0
- package/CHANGELOG.md +55 -0
- package/README.md +4 -0
- package/dist/cli.js +4 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/connect.js +23 -13
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/disconnect.js +22 -12
- package/dist/commands/disconnect.js.map +1 -1
- package/dist/commands/doctor.js +26 -12
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.js +16 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mcp-add.js +24 -16
- package/dist/commands/mcp-add.js.map +1 -1
- package/dist/commands/mcp-list.js +25 -6
- package/dist/commands/mcp-list.js.map +1 -1
- package/dist/commands/mcp-remove.js +14 -4
- package/dist/commands/mcp-remove.js.map +1 -1
- package/dist/commands/mcp-test.js +57 -28
- package/dist/commands/mcp-test.js.map +1 -1
- package/dist/commands/migrate.d.ts +4 -0
- package/dist/commands/migrate.js +71 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/reset.js +9 -3
- package/dist/commands/reset.js.map +1 -1
- package/dist/commands/start.js +1 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.js +40 -30
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.js +25 -3
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/watch.js +17 -8
- package/dist/commands/watch.js.map +1 -1
- package/dist/core/catalog.d.ts +8 -0
- package/dist/core/catalog.js +141 -0
- package/dist/core/catalog.js.map +1 -0
- package/dist/core/linking.d.ts +8 -0
- package/dist/core/linking.js +41 -0
- package/dist/core/linking.js.map +1 -0
- package/dist/core/project.d.ts +1 -0
- package/dist/core/project.js +5 -2
- package/dist/core/project.js.map +1 -1
- package/dist/core/templates.d.ts +4 -1
- package/dist/core/templates.js +12 -3
- package/dist/core/templates.js.map +1 -1
- package/dist/core/ui.d.ts +155 -0
- package/dist/core/ui.js +350 -0
- package/dist/core/ui.js.map +1 -0
- package/dist/core/windsurfPaths.d.ts +8 -0
- package/dist/core/windsurfPaths.js +43 -0
- package/dist/core/windsurfPaths.js.map +1 -0
- package/dist/integrations/windsurf.d.ts +9 -0
- package/dist/integrations/windsurf.js +17 -0
- package/dist/integrations/windsurf.js.map +1 -0
- package/docs/screenshot.jpg +0 -0
- package/package.json +2 -4
package/dist/core/project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,IAO/C;IACC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,QAAQ,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAA;IAEtG,MAAM,KAAK,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;IAC1C,MAAM,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAChC,MAAM,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IACnC,MAAM,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IAEtC,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,SAAS,EAAE,UA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AK,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;IACpF,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AAC9B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAGxC;IACC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IACpC,MAAM,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,WAAmB;IAC1D,MAAM,KAAK,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;IAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;AACvC,CAAC"}
|
package/dist/core/templates.d.ts
CHANGED
package/dist/core/templates.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { copyFile } from 'node:fs/promises';
|
|
2
|
+
import { copyFile, lstat } from 'node:fs/promises';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { ensureDir, pathExists, writeTextAtomic } from './fs.js';
|
|
5
5
|
import { getProjectPaths } from './paths.js';
|
|
@@ -21,8 +21,17 @@ export async function scaffoldBaseTemplates(projectRoot, force) {
|
|
|
21
21
|
}
|
|
22
22
|
];
|
|
23
23
|
const changed = [];
|
|
24
|
+
const warnings = [];
|
|
24
25
|
for (const pair of pairs) {
|
|
25
|
-
|
|
26
|
+
const exists = await pathExists(pair.to);
|
|
27
|
+
if (pair.to === paths.rootAgentsMd && exists) {
|
|
28
|
+
const info = await lstat(pair.to);
|
|
29
|
+
if (!info.isFile()) {
|
|
30
|
+
warnings.push('AGENTS.md exists and is not a regular file (symlink/directory). Skipped overwrite.');
|
|
31
|
+
}
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (!force && exists) {
|
|
26
35
|
continue;
|
|
27
36
|
}
|
|
28
37
|
await ensureDir(path.dirname(pair.to));
|
|
@@ -33,6 +42,6 @@ export async function scaffoldBaseTemplates(projectRoot, force) {
|
|
|
33
42
|
await writeTextAtomic(paths.agentsLocal, '{\n "mcpServers": {}\n}\n');
|
|
34
43
|
changed.push(path.relative(projectRoot, paths.agentsLocal) || paths.agentsLocal);
|
|
35
44
|
}
|
|
36
|
-
return changed;
|
|
45
|
+
return { changed, warnings };
|
|
37
46
|
}
|
|
38
47
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/core/templates.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/core/templates.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AAC1C,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAA;AAEvE,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,WAAmB,EACnB,KAAc;IAEd,MAAM,KAAK,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;IAC1C,MAAM,SAAS,CAAC,KAAK,CAAC,SAA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V,CAAC;QAED,IAAI,CAAC,KAAK,IAAI,MAAM,EAAE,CAAC;YACrB,SAAQ;QACV,CAAC;QACD,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;QACtC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;QAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAA;IAC9D,CAAC;IAED,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QAC3C,MAAM,eAAe,CAAC,KAAK,CAAC,WAAW,EAAE,4BAA4B,CAAC,CAAA;QACtE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,CAAA;IAClF,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified UI module for @agents-dev/cli
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent formatting, colors, and symbols across all commands.
|
|
5
|
+
* Features:
|
|
6
|
+
* - Unicode symbols with ASCII fallback
|
|
7
|
+
* - Minimalist colors (only for status indicators)
|
|
8
|
+
* - Context-aware output (respects --json, NO_COLOR)
|
|
9
|
+
* - Spinner wrapper for async operations
|
|
10
|
+
*/
|
|
11
|
+
import * as clack from '@clack/prompts';
|
|
12
|
+
import color from 'picocolors';
|
|
13
|
+
export declare const symbols: {
|
|
14
|
+
readonly success: "✓";
|
|
15
|
+
readonly error: "✗";
|
|
16
|
+
readonly warning: "⚠";
|
|
17
|
+
readonly info: "○";
|
|
18
|
+
readonly bullet: "•";
|
|
19
|
+
readonly arrow: "→";
|
|
20
|
+
readonly ellipsis: "…";
|
|
21
|
+
} | {
|
|
22
|
+
readonly success: "[ok]";
|
|
23
|
+
readonly error: "[error]";
|
|
24
|
+
readonly warning: "[warn]";
|
|
25
|
+
readonly info: "[info]";
|
|
26
|
+
readonly bullet: "-";
|
|
27
|
+
readonly arrow: "->";
|
|
28
|
+
readonly ellipsis: "...";
|
|
29
|
+
};
|
|
30
|
+
interface UIContext {
|
|
31
|
+
json: boolean;
|
|
32
|
+
quiet: boolean;
|
|
33
|
+
noColor: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Set UI context flags (call at command start)
|
|
37
|
+
*/
|
|
38
|
+
export declare function setContext(options: Partial<UIContext>): void;
|
|
39
|
+
/**
|
|
40
|
+
* Reset UI context to defaults
|
|
41
|
+
*/
|
|
42
|
+
export declare function resetContext(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Write raw text to stdout
|
|
45
|
+
*/
|
|
46
|
+
export declare function write(text: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Write a line to stdout
|
|
49
|
+
*/
|
|
50
|
+
export declare function writeln(text?: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Output success message: ✓ message (green)
|
|
53
|
+
*/
|
|
54
|
+
export declare function success(message: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Output error message: ✗ message (red)
|
|
57
|
+
*/
|
|
58
|
+
export declare function error(message: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Output warning message: ⚠ message (yellow)
|
|
61
|
+
*/
|
|
62
|
+
export declare function warning(message: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Output info message: ○ message (cyan)
|
|
65
|
+
*/
|
|
66
|
+
export declare function info(message: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Output dim/secondary text
|
|
69
|
+
*/
|
|
70
|
+
export declare function dim(message: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Output a blank line
|
|
73
|
+
*/
|
|
74
|
+
export declare function blank(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Output key-value pair with aligned formatting
|
|
77
|
+
* Example: "Project: /path/to/project"
|
|
78
|
+
*/
|
|
79
|
+
export declare function keyValue(key: string, value: string, keyWidth?: number): void;
|
|
80
|
+
/**
|
|
81
|
+
* Output a bulleted list
|
|
82
|
+
* Example:
|
|
83
|
+
* • item1
|
|
84
|
+
* • item2
|
|
85
|
+
*/
|
|
86
|
+
export declare function list(items: string[], indent?: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* Output a list with status indicators
|
|
89
|
+
* Example:
|
|
90
|
+
* ✓ file1.json
|
|
91
|
+
* ✗ file2.json (missing)
|
|
92
|
+
*/
|
|
93
|
+
export declare function statusList(items: Array<{
|
|
94
|
+
label: string;
|
|
95
|
+
ok: boolean;
|
|
96
|
+
detail?: string;
|
|
97
|
+
}>, indent?: number): void;
|
|
98
|
+
/**
|
|
99
|
+
* Output a section with title
|
|
100
|
+
* Example:
|
|
101
|
+
* Files:
|
|
102
|
+
* ✓ config.json
|
|
103
|
+
* ✗ local.json
|
|
104
|
+
*/
|
|
105
|
+
export declare function section(title: string, content: string[] | (() => void)): void;
|
|
106
|
+
/**
|
|
107
|
+
* Output items with arrow prefix (for "changed" lists)
|
|
108
|
+
* Example:
|
|
109
|
+
* → file1.json
|
|
110
|
+
* → file2.json
|
|
111
|
+
*/
|
|
112
|
+
export declare function arrowList(items: string[], indent?: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Output a hint/help message
|
|
115
|
+
*/
|
|
116
|
+
export declare function hint(message: string): void;
|
|
117
|
+
/**
|
|
118
|
+
* Output next steps
|
|
119
|
+
*/
|
|
120
|
+
export declare function nextSteps(message: string): void;
|
|
121
|
+
export interface Spinner {
|
|
122
|
+
start: (message?: string) => void;
|
|
123
|
+
stop: (message?: string) => void;
|
|
124
|
+
message: (message: string) => void;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Create a spinner for async operations
|
|
128
|
+
* Returns a no-op spinner if in JSON mode or non-TTY
|
|
129
|
+
*/
|
|
130
|
+
export declare function spinner(): Spinner;
|
|
131
|
+
/**
|
|
132
|
+
* Output JSON and exit (for --json flag handling)
|
|
133
|
+
*/
|
|
134
|
+
export declare function json<T>(data: T): void;
|
|
135
|
+
/**
|
|
136
|
+
* Format a count with singular/plural label
|
|
137
|
+
* Example: formatCount(1, 'file', 'files') => '1 file'
|
|
138
|
+
* Example: formatCount(3, 'file', 'files') => '3 files'
|
|
139
|
+
*/
|
|
140
|
+
export declare function formatCount(count: number, singular: string, plural: string): string;
|
|
141
|
+
/**
|
|
142
|
+
* Format a list of items with "none" fallback
|
|
143
|
+
* Example: formatList(['a', 'b']) => 'a, b'
|
|
144
|
+
* Example: formatList([]) => '(none)'
|
|
145
|
+
*/
|
|
146
|
+
export declare function formatList(items: string[], fallback?: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* Format enabled/disabled status
|
|
149
|
+
*/
|
|
150
|
+
export declare function formatEnabled(enabled: boolean): string;
|
|
151
|
+
/**
|
|
152
|
+
* Format ok/missing status for files
|
|
153
|
+
*/
|
|
154
|
+
export declare function formatExists(exists: boolean): string;
|
|
155
|
+
export { color, clack };
|
package/dist/core/ui.js
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified UI module for @agents-dev/cli
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent formatting, colors, and symbols across all commands.
|
|
5
|
+
* Features:
|
|
6
|
+
* - Unicode symbols with ASCII fallback
|
|
7
|
+
* - Minimalist colors (only for status indicators)
|
|
8
|
+
* - Context-aware output (respects --json, NO_COLOR)
|
|
9
|
+
* - Spinner wrapper for async operations
|
|
10
|
+
*/
|
|
11
|
+
import * as clack from '@clack/prompts';
|
|
12
|
+
import color from 'picocolors';
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Terminal Detection
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
/**
|
|
17
|
+
* Detect if terminal supports Unicode characters
|
|
18
|
+
*/
|
|
19
|
+
function detectUnicodeSupport() {
|
|
20
|
+
// Windows Terminal and modern terminals support Unicode
|
|
21
|
+
if (process.env.WT_SESSION)
|
|
22
|
+
return true;
|
|
23
|
+
if (process.env.TERM_PROGRAM === 'vscode')
|
|
24
|
+
return true;
|
|
25
|
+
if (process.env.TERM_PROGRAM === 'iTerm.app')
|
|
26
|
+
return true;
|
|
27
|
+
if (process.env.TERM_PROGRAM === 'Apple_Terminal')
|
|
28
|
+
return true;
|
|
29
|
+
// Check locale settings
|
|
30
|
+
const locale = (process.env.LC_ALL ?? process.env.LC_CTYPE ?? process.env.LANG ?? '').toLowerCase();
|
|
31
|
+
if (locale.includes('utf-8') || locale.includes('utf8'))
|
|
32
|
+
return true;
|
|
33
|
+
// Check TERM
|
|
34
|
+
const term = (process.env.TERM ?? '').toLowerCase();
|
|
35
|
+
if (term.includes('xterm') || term.includes('256color') || term.includes('kitty') || term.includes('alacritty')) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
// CI environments usually support Unicode
|
|
39
|
+
if (process.env.CI)
|
|
40
|
+
return true;
|
|
41
|
+
// Default to ASCII for unknown terminals
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if colors should be disabled
|
|
46
|
+
*/
|
|
47
|
+
function isNoColor() {
|
|
48
|
+
return Boolean(process.env.NO_COLOR) || process.argv.includes('--no-color');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Check if we're in a TTY (interactive terminal)
|
|
52
|
+
*/
|
|
53
|
+
function isTTY() {
|
|
54
|
+
return Boolean(process.stdout.isTTY);
|
|
55
|
+
}
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Symbols
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
const UNICODE_SYMBOLS = {
|
|
60
|
+
success: '\u2713', // ✓
|
|
61
|
+
error: '\u2717', // ✗
|
|
62
|
+
warning: '\u26a0', // ⚠
|
|
63
|
+
info: '\u25cb', // ○
|
|
64
|
+
bullet: '\u2022', // •
|
|
65
|
+
arrow: '\u2192', // →
|
|
66
|
+
ellipsis: '\u2026' // …
|
|
67
|
+
};
|
|
68
|
+
const ASCII_SYMBOLS = {
|
|
69
|
+
success: '[ok]',
|
|
70
|
+
error: '[error]',
|
|
71
|
+
warning: '[warn]',
|
|
72
|
+
info: '[info]',
|
|
73
|
+
bullet: '-',
|
|
74
|
+
arrow: '->',
|
|
75
|
+
ellipsis: '...'
|
|
76
|
+
};
|
|
77
|
+
const supportsUnicode = detectUnicodeSupport();
|
|
78
|
+
export const symbols = supportsUnicode ? UNICODE_SYMBOLS : ASCII_SYMBOLS;
|
|
79
|
+
const context = {
|
|
80
|
+
json: false,
|
|
81
|
+
quiet: false,
|
|
82
|
+
noColor: isNoColor()
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Set UI context flags (call at command start)
|
|
86
|
+
*/
|
|
87
|
+
export function setContext(options) {
|
|
88
|
+
if (options.json !== undefined)
|
|
89
|
+
context.json = options.json;
|
|
90
|
+
if (options.quiet !== undefined)
|
|
91
|
+
context.quiet = options.quiet;
|
|
92
|
+
if (options.noColor !== undefined)
|
|
93
|
+
context.noColor = options.noColor;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Reset UI context to defaults
|
|
97
|
+
*/
|
|
98
|
+
export function resetContext() {
|
|
99
|
+
context.json = false;
|
|
100
|
+
context.quiet = false;
|
|
101
|
+
context.noColor = isNoColor();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check if output should be suppressed
|
|
105
|
+
*/
|
|
106
|
+
function shouldSuppress() {
|
|
107
|
+
return context.json || context.quiet;
|
|
108
|
+
}
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Color Helpers
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
function applyColor(fn, text) {
|
|
113
|
+
if (context.noColor)
|
|
114
|
+
return text;
|
|
115
|
+
return fn(text);
|
|
116
|
+
}
|
|
117
|
+
const colors = {
|
|
118
|
+
success: (s) => applyColor(color.green, s),
|
|
119
|
+
error: (s) => applyColor(color.red, s),
|
|
120
|
+
warning: (s) => applyColor(color.yellow, s),
|
|
121
|
+
info: (s) => applyColor(color.cyan, s),
|
|
122
|
+
dim: (s) => applyColor(color.dim, s),
|
|
123
|
+
bold: (s) => applyColor(color.bold, s)
|
|
124
|
+
};
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Output Functions
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
/**
|
|
129
|
+
* Write raw text to stdout
|
|
130
|
+
*/
|
|
131
|
+
export function write(text) {
|
|
132
|
+
if (shouldSuppress())
|
|
133
|
+
return;
|
|
134
|
+
process.stdout.write(text);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Write a line to stdout
|
|
138
|
+
*/
|
|
139
|
+
export function writeln(text = '') {
|
|
140
|
+
write(`${text}\n`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Output success message: ✓ message (green)
|
|
144
|
+
*/
|
|
145
|
+
export function success(message) {
|
|
146
|
+
if (shouldSuppress())
|
|
147
|
+
return;
|
|
148
|
+
writeln(`${colors.success(symbols.success)} ${message}`);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Output error message: ✗ message (red)
|
|
152
|
+
*/
|
|
153
|
+
export function error(message) {
|
|
154
|
+
if (shouldSuppress())
|
|
155
|
+
return;
|
|
156
|
+
writeln(`${colors.error(symbols.error)} ${message}`);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Output warning message: ⚠ message (yellow)
|
|
160
|
+
*/
|
|
161
|
+
export function warning(message) {
|
|
162
|
+
if (shouldSuppress())
|
|
163
|
+
return;
|
|
164
|
+
writeln(`${colors.warning(symbols.warning)} ${message}`);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Output info message: ○ message (cyan)
|
|
168
|
+
*/
|
|
169
|
+
export function info(message) {
|
|
170
|
+
if (shouldSuppress())
|
|
171
|
+
return;
|
|
172
|
+
writeln(`${colors.info(symbols.info)} ${message}`);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Output dim/secondary text
|
|
176
|
+
*/
|
|
177
|
+
export function dim(message) {
|
|
178
|
+
if (shouldSuppress())
|
|
179
|
+
return;
|
|
180
|
+
writeln(colors.dim(message));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Output a blank line
|
|
184
|
+
*/
|
|
185
|
+
export function blank() {
|
|
186
|
+
if (shouldSuppress())
|
|
187
|
+
return;
|
|
188
|
+
writeln();
|
|
189
|
+
}
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
// Layout Helpers
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
/**
|
|
194
|
+
* Output key-value pair with aligned formatting
|
|
195
|
+
* Example: "Project: /path/to/project"
|
|
196
|
+
*/
|
|
197
|
+
export function keyValue(key, value, keyWidth = 14) {
|
|
198
|
+
if (shouldSuppress())
|
|
199
|
+
return;
|
|
200
|
+
const paddedKey = key.padEnd(keyWidth);
|
|
201
|
+
writeln(`${paddedKey} ${value}`);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Output a bulleted list
|
|
205
|
+
* Example:
|
|
206
|
+
* • item1
|
|
207
|
+
* • item2
|
|
208
|
+
*/
|
|
209
|
+
export function list(items, indent = 2) {
|
|
210
|
+
if (shouldSuppress())
|
|
211
|
+
return;
|
|
212
|
+
const padding = ' '.repeat(indent);
|
|
213
|
+
for (const item of items) {
|
|
214
|
+
writeln(`${padding}${symbols.bullet} ${item}`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Output a list with status indicators
|
|
219
|
+
* Example:
|
|
220
|
+
* ✓ file1.json
|
|
221
|
+
* ✗ file2.json (missing)
|
|
222
|
+
*/
|
|
223
|
+
export function statusList(items, indent = 2) {
|
|
224
|
+
if (shouldSuppress())
|
|
225
|
+
return;
|
|
226
|
+
const padding = ' '.repeat(indent);
|
|
227
|
+
for (const item of items) {
|
|
228
|
+
const symbol = item.ok ? colors.success(symbols.success) : colors.error(symbols.error);
|
|
229
|
+
const detail = item.detail ? colors.dim(` (${item.detail})`) : '';
|
|
230
|
+
writeln(`${padding}${symbol} ${item.label}${detail}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Output a section with title
|
|
235
|
+
* Example:
|
|
236
|
+
* Files:
|
|
237
|
+
* ✓ config.json
|
|
238
|
+
* ✗ local.json
|
|
239
|
+
*/
|
|
240
|
+
export function section(title, content) {
|
|
241
|
+
if (shouldSuppress())
|
|
242
|
+
return;
|
|
243
|
+
writeln(`${title}:`);
|
|
244
|
+
if (typeof content === 'function') {
|
|
245
|
+
content();
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
for (const line of content) {
|
|
249
|
+
writeln(` ${line}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Output items with arrow prefix (for "changed" lists)
|
|
255
|
+
* Example:
|
|
256
|
+
* → file1.json
|
|
257
|
+
* → file2.json
|
|
258
|
+
*/
|
|
259
|
+
export function arrowList(items, indent = 2) {
|
|
260
|
+
if (shouldSuppress())
|
|
261
|
+
return;
|
|
262
|
+
const padding = ' '.repeat(indent);
|
|
263
|
+
for (const item of items) {
|
|
264
|
+
writeln(`${padding}${colors.dim(symbols.arrow)} ${item}`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Output a hint/help message
|
|
269
|
+
*/
|
|
270
|
+
export function hint(message) {
|
|
271
|
+
if (shouldSuppress())
|
|
272
|
+
return;
|
|
273
|
+
writeln(colors.dim(`Hint: ${message}`));
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Output next steps
|
|
277
|
+
*/
|
|
278
|
+
export function nextSteps(message) {
|
|
279
|
+
if (shouldSuppress())
|
|
280
|
+
return;
|
|
281
|
+
writeln(`Next: ${message}`);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Create a spinner for async operations
|
|
285
|
+
* Returns a no-op spinner if in JSON mode or non-TTY
|
|
286
|
+
*/
|
|
287
|
+
export function spinner() {
|
|
288
|
+
// No spinner in JSON mode or non-TTY
|
|
289
|
+
if (context.json || context.quiet || !isTTY()) {
|
|
290
|
+
return {
|
|
291
|
+
start: () => { },
|
|
292
|
+
stop: () => { },
|
|
293
|
+
message: () => { }
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
const spin = clack.spinner();
|
|
297
|
+
return {
|
|
298
|
+
start: (message) => spin.start(message ?? 'Working...'),
|
|
299
|
+
stop: (message) => spin.stop(message ?? 'Done'),
|
|
300
|
+
message: (message) => spin.message(message)
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
// ---------------------------------------------------------------------------
|
|
304
|
+
// JSON Output
|
|
305
|
+
// ---------------------------------------------------------------------------
|
|
306
|
+
/**
|
|
307
|
+
* Output JSON and exit (for --json flag handling)
|
|
308
|
+
*/
|
|
309
|
+
export function json(data) {
|
|
310
|
+
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
|
311
|
+
}
|
|
312
|
+
// ---------------------------------------------------------------------------
|
|
313
|
+
// Formatting Utilities
|
|
314
|
+
// ---------------------------------------------------------------------------
|
|
315
|
+
/**
|
|
316
|
+
* Format a count with singular/plural label
|
|
317
|
+
* Example: formatCount(1, 'file', 'files') => '1 file'
|
|
318
|
+
* Example: formatCount(3, 'file', 'files') => '3 files'
|
|
319
|
+
*/
|
|
320
|
+
export function formatCount(count, singular, plural) {
|
|
321
|
+
return `${count} ${count === 1 ? singular : plural}`;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Format a list of items with "none" fallback
|
|
325
|
+
* Example: formatList(['a', 'b']) => 'a, b'
|
|
326
|
+
* Example: formatList([]) => '(none)'
|
|
327
|
+
*/
|
|
328
|
+
export function formatList(items, fallback = '(none)') {
|
|
329
|
+
return items.length > 0 ? items.join(', ') : fallback;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Format enabled/disabled status
|
|
333
|
+
*/
|
|
334
|
+
export function formatEnabled(enabled) {
|
|
335
|
+
return enabled ? 'enabled' : 'disabled';
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Format ok/missing status for files
|
|
339
|
+
*/
|
|
340
|
+
export function formatExists(exists) {
|
|
341
|
+
if (exists) {
|
|
342
|
+
return colors.success(symbols.success);
|
|
343
|
+
}
|
|
344
|
+
return `${colors.error(symbols.error)} ${colors.dim('(missing)')}`;
|
|
345
|
+
}
|
|
346
|
+
// ---------------------------------------------------------------------------
|
|
347
|
+
// Re-exports for convenience
|
|
348
|
+
// ---------------------------------------------------------------------------
|
|
349
|
+
export { color, clack };
|
|
350
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/core/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;GAEG;AACH,SAAS,oBAAoB;IAC3B,wDAAwD;IACxD,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;QAAE,OAAO,IAAI,CAAA;IACvC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACtD,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IACzD,IAAI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Y,CAAC,MAAe;IAC1C,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACxC,CAAC;IACD,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAA;AACpE,CAAC;AAED,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface WindsurfMcpPathResolution {
|
|
2
|
+
configPath: string;
|
|
3
|
+
source: 'env' | 'existing-modern' | 'existing-legacy' | 'default-modern';
|
|
4
|
+
modernPath: string;
|
|
5
|
+
legacyPath: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveWindsurfMcpConfigPath(): Promise<WindsurfMcpPathResolution>;
|
|
8
|
+
export declare function getWindsurfMcpLockPath(configPath: string): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pathExists } from './fs.js';
|
|
4
|
+
const ENV_OVERRIDE = 'AGENTS_WINDSURF_MCP_CONFIG_PATH';
|
|
5
|
+
export async function resolveWindsurfMcpConfigPath() {
|
|
6
|
+
const modernPath = path.join(os.homedir(), '.codeium', 'windsurf', 'mcp_config.json');
|
|
7
|
+
const legacyPath = path.join(os.homedir(), '.codeium', 'mcp_config.json');
|
|
8
|
+
const override = process.env[ENV_OVERRIDE]?.trim();
|
|
9
|
+
if (override) {
|
|
10
|
+
return {
|
|
11
|
+
configPath: path.resolve(override),
|
|
12
|
+
source: 'env',
|
|
13
|
+
modernPath,
|
|
14
|
+
legacyPath
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (await pathExists(modernPath)) {
|
|
18
|
+
return {
|
|
19
|
+
configPath: modernPath,
|
|
20
|
+
source: 'existing-modern',
|
|
21
|
+
modernPath,
|
|
22
|
+
legacyPath
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (await pathExists(legacyPath)) {
|
|
26
|
+
return {
|
|
27
|
+
configPath: legacyPath,
|
|
28
|
+
source: 'existing-legacy',
|
|
29
|
+
modernPath,
|
|
30
|
+
legacyPath
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
configPath: modernPath,
|
|
35
|
+
source: 'default-modern',
|
|
36
|
+
modernPath,
|
|
37
|
+
legacyPath
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function getWindsurfMcpLockPath(configPath) {
|
|
41
|
+
return path.join(path.dirname(configPath), `${path.basename(configPath)}.agents.lock`);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=windsurfPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windsurfPaths.js","sourceRoot":"","sources":["../../src/core/windsurfPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,MAAM,YAAY,GAAG,iCAAiC,CAAA;AAStD,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAA;IACrF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAA;IACzE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAA;IAElD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;YAClC,MAAM,EAAE,KAAK;YACb,UAAU;YACV,UAAU;SACX,CAAA;IACH,CAAC;IAED,IAAI,MAAM,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACjC,OAAO;YACL,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,iBAAiB;YACzB,UAAU;YACV,UAAU;SACX,CAAA;IACH,CAAC;IAED,IAAI,MAAM,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACjC,OAAO;YACL,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,iBAAiB;YACzB,UAAU;YACV,UAAU;SACX,CAAA;IACH,CAAC;IAED,OAAO;QACL,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,gBAAgB;QACxB,UAAU;QACV,UAAU;KACX,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AACxF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResolvedMcpServer } from '../types.js';
|
|
2
|
+
export declare function buildWindsurfPayload(servers: ResolvedMcpServer[]): {
|
|
3
|
+
payload: {
|
|
4
|
+
mcpServers: Record<string, unknown>;
|
|
5
|
+
};
|
|
6
|
+
warnings: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function toManagedWindsurfName(projectHash: string, serverName: string): string;
|
|
9
|
+
export declare function deriveWindsurfProjectHash(projectRoot: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { renderWindsurfMcp } from '../core/renderers.js';
|
|
4
|
+
export function buildWindsurfPayload(servers) {
|
|
5
|
+
const rendered = renderWindsurfMcp(servers);
|
|
6
|
+
return {
|
|
7
|
+
payload: { mcpServers: rendered.servers },
|
|
8
|
+
warnings: rendered.warnings
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export function toManagedWindsurfName(projectHash, serverName) {
|
|
12
|
+
return `agents__${projectHash}__${serverName}`;
|
|
13
|
+
}
|
|
14
|
+
export function deriveWindsurfProjectHash(projectRoot) {
|
|
15
|
+
return createHash('sha256').update(path.resolve(projectRoot)).digest('hex').slice(0, 12);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=windsurf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windsurf.js","sourceRoot":"","sources":["../../src/integrations/windsurf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAGxD,MAAM,UAAU,oBAAoB,CAAC,OAA4B;IAI/D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAC3C,OAAO;QACL,OAAO,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,OAAO,EAAE;QACzC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;KAC5B,CAAA;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,WAAmB,EAAE,UAAkB;IAC3E,OAAO,WAAW,WAAW,KAAK,UAAU,EAAE,CAAA;AAChD,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,WAAmB;IAC3D,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAC1F,CAAC"}
|
|
Binary file
|