magicpath-ai 1.3.0-beta.8 → 1.3.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/README.md +24 -26
- package/dist/cli.js +15 -8
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.d.ts +0 -3
- package/dist/commands/add.js +347 -246
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/auth.js +14 -2
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/info.js +9 -5
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/inspect.d.ts +53 -0
- package/dist/commands/inspect.js +122 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/list-installed.d.ts +2 -0
- package/dist/commands/list-installed.js +112 -0
- package/dist/commands/list-installed.js.map +1 -0
- package/dist/commands/list.js +6 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/schema.js +11 -24
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/search.js +2 -1
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/setup-skills.d.ts +2 -0
- package/dist/commands/setup-skills.js +13 -0
- package/dist/commands/setup-skills.js.map +1 -0
- package/dist/commands/whoami.js +5 -13
- package/dist/commands/whoami.js.map +1 -1
- package/dist/util/auth.d.ts +19 -6
- package/dist/util/auth.js +70 -10
- package/dist/util/auth.js.map +1 -1
- package/dist/util/banner.d.ts +1 -0
- package/dist/util/banner.js +79 -0
- package/dist/util/banner.js.map +1 -0
- package/package.json +3 -5
- package/dist/commands/init.d.ts +0 -2
- package/dist/commands/init.js +0 -113
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/integrate.d.ts +0 -2
- package/dist/commands/integrate.js +0 -202
- package/dist/commands/integrate.js.map +0 -1
- package/dist/commands/retheme.d.ts +0 -2
- package/dist/commands/retheme.js +0 -327
- package/dist/commands/retheme.js.map +0 -1
- package/dist/commands/skills.d.ts +0 -2
- package/dist/commands/skills.js +0 -55
- package/dist/commands/skills.js.map +0 -1
- package/dist/util/diff.d.ts +0 -13
- package/dist/util/diff.js +0 -63
- package/dist/util/diff.js.map +0 -1
- package/dist/util/integrate.d.ts +0 -84
- package/dist/util/integrate.js +0 -762
- package/dist/util/integrate.js.map +0 -1
- package/skills/cli-reference.md +0 -146
- package/skills/guide.md +0 -63
package/dist/util/diff.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import prompts from 'prompts';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
import { generateDiff, colorDiff } from './integrate.js';
|
|
5
|
-
/**
|
|
6
|
-
* Write modified files to disk without any prompts or review.
|
|
7
|
-
*/
|
|
8
|
-
export function applyChanges(modifiedFiles, cwd) {
|
|
9
|
-
for (const modifiedFile of modifiedFiles) {
|
|
10
|
-
const absFilePath = path.resolve(cwd, modifiedFile.path);
|
|
11
|
-
fs.ensureDirSync(path.dirname(absFilePath));
|
|
12
|
-
fs.writeFileSync(absFilePath, modifiedFile.content, 'utf8');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Show a list of modified files, optionally display colored diffs,
|
|
17
|
-
* then prompt the user to apply changes. Returns true if changes were applied.
|
|
18
|
-
*/
|
|
19
|
-
export async function reviewAndApplyChanges(modifiedFiles, cwd, label) {
|
|
20
|
-
// Show file list
|
|
21
|
-
console.log(`\n Files to modify:`);
|
|
22
|
-
for (const modifiedFile of modifiedFiles) {
|
|
23
|
-
console.log(` • ${modifiedFile.path}`);
|
|
24
|
-
}
|
|
25
|
-
// Review changes (optional)
|
|
26
|
-
const { shouldReview } = await prompts({
|
|
27
|
-
type: 'confirm',
|
|
28
|
-
name: 'shouldReview',
|
|
29
|
-
message: 'Review changes before applying?',
|
|
30
|
-
initial: true,
|
|
31
|
-
});
|
|
32
|
-
if (shouldReview) {
|
|
33
|
-
for (const modifiedFile of modifiedFiles) {
|
|
34
|
-
const originalPath = path.resolve(cwd, modifiedFile.path);
|
|
35
|
-
const originalContent = fs.existsSync(originalPath)
|
|
36
|
-
? fs.readFileSync(originalPath, 'utf8')
|
|
37
|
-
: '';
|
|
38
|
-
const diff = generateDiff(modifiedFile.path, originalContent, modifiedFile.content);
|
|
39
|
-
console.log(`\n Proposed changes to ${modifiedFile.path}:\n`);
|
|
40
|
-
console.log(colorDiff(diff));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Apply changes
|
|
44
|
-
const { shouldApply } = await prompts({
|
|
45
|
-
type: 'confirm',
|
|
46
|
-
name: 'shouldApply',
|
|
47
|
-
message: 'Apply these changes?',
|
|
48
|
-
initial: true,
|
|
49
|
-
});
|
|
50
|
-
if (shouldApply) {
|
|
51
|
-
applyChanges(modifiedFiles, cwd);
|
|
52
|
-
for (const modifiedFile of modifiedFiles) {
|
|
53
|
-
console.log(`✔ Updated ${modifiedFile.path}`);
|
|
54
|
-
}
|
|
55
|
-
console.log(`\n✅ ${label} complete!`);
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
console.log(`${label} skipped.`);
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=diff.js.map
|
package/dist/util/diff.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/util/diff.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOzD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,aAA6B,EAAE,GAAW;IACrE,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QACzC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,CAA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AC/B,CAAC;IACH,CAAC;IAED,gBAAgB;IAChB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,OAAO,CAAC;QACpC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,sBAAsB;QAC/B,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,IAAI,WAAW,EAAE,CAAC;QAChB,YAAY,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QACjC,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,aAAa,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,YAAY,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,WAAW,CAAC,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/util/integrate.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/** Thrown when the user presses 's' to skip the current file during retheme. */
|
|
2
|
-
export declare class SkipFileError extends Error {
|
|
3
|
-
constructor();
|
|
4
|
-
}
|
|
5
|
-
export type Framework = 'nextjs-app' | 'nextjs-pages' | 'vite' | 'cra' | 'unknown';
|
|
6
|
-
export declare function detectFramework(cwd: string): Framework;
|
|
7
|
-
export type TargetLanguage = 'js' | string;
|
|
8
|
-
export declare function detectLanguageFromExtension(filePath: string): TargetLanguage;
|
|
9
|
-
export declare function detectProjectLanguage(cwd: string): TargetLanguage;
|
|
10
|
-
export declare function getLanguageDisplayName(language: TargetLanguage): string;
|
|
11
|
-
export interface CandidateFile {
|
|
12
|
-
relativePath: string;
|
|
13
|
-
label: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function findIntegrationCandidates(cwd: string, framework: Framework): CandidateFile[];
|
|
16
|
-
/**
|
|
17
|
-
* Find integration candidate files for any language.
|
|
18
|
-
* For JS/TS, delegates to the framework-aware findIntegrationCandidates.
|
|
19
|
-
* For other languages, scans using LANGUAGE_CONFIGS.
|
|
20
|
-
*/
|
|
21
|
-
export declare function findCandidates(cwd: string, language: TargetLanguage, framework: Framework): CandidateFile[];
|
|
22
|
-
export interface FileContent {
|
|
23
|
-
path: string;
|
|
24
|
-
content: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Find files under src/ that import the target file (reverse dependencies / "parents").
|
|
28
|
-
*/
|
|
29
|
-
export declare function findReverseDependencies(targetPath: string, cwd: string, sizeBudget: {
|
|
30
|
-
remaining: number;
|
|
31
|
-
}): FileContent[];
|
|
32
|
-
/**
|
|
33
|
-
* Read the target file, its imports (children), and files that import it (parents).
|
|
34
|
-
* Also follows imports from componentFiles so their dependencies are included.
|
|
35
|
-
*/
|
|
36
|
-
export declare function readTargetWithContext(targetPath: string, cwd: string, componentFiles?: FileContent[], language?: TargetLanguage): {
|
|
37
|
-
targetFile: FileContent;
|
|
38
|
-
importedFiles: FileContent[];
|
|
39
|
-
referencingFiles: FileContent[];
|
|
40
|
-
};
|
|
41
|
-
export declare function generateDiff(originalPath: string, originalContent: string, newContent: string): string;
|
|
42
|
-
export declare function colorDiff(diff: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Collect all UI source files from the project for retheme.
|
|
45
|
-
* For JS: filters to files containing visual content (JSX/className/Tailwind).
|
|
46
|
-
* Prioritizes pages/layouts first, then components, then other files.
|
|
47
|
-
* Respects a 1MB total size budget.
|
|
48
|
-
*/
|
|
49
|
-
export declare function gatherProjectFiles(cwd: string, language: TargetLanguage, framework: Framework): {
|
|
50
|
-
files: FileContent[];
|
|
51
|
-
truncated: boolean;
|
|
52
|
-
skippedFiles: string[];
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Search for a CSS theme file (globals.css, index.css, etc.) in common framework locations.
|
|
56
|
-
* Only applies to JS/TS projects — CSS themes don't apply to Swift/Kotlin/Dart.
|
|
57
|
-
* Returns the first match as a FileContent, or null if none found.
|
|
58
|
-
*/
|
|
59
|
-
export declare function findThemeFile(cwd: string, language: TargetLanguage, _framework: Framework): FileContent | null;
|
|
60
|
-
export interface IntegrateApiRequest {
|
|
61
|
-
targetFile: FileContent;
|
|
62
|
-
importedFiles: FileContent[];
|
|
63
|
-
referencingFiles: FileContent[];
|
|
64
|
-
componentGeneratedName: string;
|
|
65
|
-
framework: Framework;
|
|
66
|
-
userInstruction?: string;
|
|
67
|
-
targetLanguage?: string;
|
|
68
|
-
}
|
|
69
|
-
export interface RethemeApiRequest {
|
|
70
|
-
mode: 'retheme';
|
|
71
|
-
projectFiles: FileContent[];
|
|
72
|
-
componentGeneratedName: string;
|
|
73
|
-
framework: Framework;
|
|
74
|
-
userInstruction?: string;
|
|
75
|
-
targetLanguage?: string;
|
|
76
|
-
themeFile?: FileContent;
|
|
77
|
-
}
|
|
78
|
-
export interface IntegrateApiResponse {
|
|
79
|
-
data: {
|
|
80
|
-
modifiedFiles: FileContent[];
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
export declare function requestIntegration(request: IntegrateApiRequest, signal?: AbortSignal): Promise<IntegrateApiResponse['data']>;
|
|
84
|
-
export declare function requestRetheme(request: RethemeApiRequest, signal?: AbortSignal): Promise<IntegrateApiResponse['data']>;
|