-
Notifications
You must be signed in to change notification settings - Fork 306
feat: add analyze command #402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
if (supportedFrameworks.length === 0) { | ||
throw new ShortestError(`No supported framework found`); | ||
} | ||
|
||
if (supportedFrameworks.length > 1) { | ||
throw new ShortestError( | ||
`Multiple supported frameworks found: ${supportedFrameworks.map((f) => f.name).join(", ")}`, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basic checks to limit usage to one app per repo, Next.js.
); | ||
|
||
this.log.trace("Paths saved", { | ||
path: path.join(this.frameworkDir, "paths.json"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not currently used in future steps, saved for debugging/reference.
}; | ||
|
||
await fs.writeFile(treeJsonPath, JSON.stringify(treeOutput, null, 2)); | ||
this.log.trace("Tree structure saved", { path: treeJsonPath }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not currently used in future steps, saved for debugging/reference.
ast: null | parser.ParseResult<t.File>; | ||
} | ||
|
||
export class NextJsAnalyzer implements BaseAnalyzer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the core logic (AST parsing, components detection, etc) was AI-generated, with some considerable refactoring to reduce its complexity. It appears to be good enough for an MVP.
ignore: [ | ||
"**/*.test.ts", | ||
"**/*.test.tsx", | ||
"**/*.test.js", | ||
"**/*.test.jsx", | ||
"**/*.spec.ts", | ||
"**/*.spec.tsx", | ||
"**/*.spec.js", | ||
"**/*.spec.jsx", | ||
"packages/**", | ||
"test/**", | ||
"tests/**", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other files to be ignored besides what matches .gitignore
.
> [!NOTE] > Experimental feature Follow-up on #402 New command `npx shortest plan` Generates `.shortest/{framework}/test-plan.json`. Uses AI to generate up to 10 test plans based on the `analysis.json` file Sample [test-plan.json](https://gist.github.com/rmarescu/3457f144757875456d34af417a66468a)
Note
Experimental feature
Follow-up on #401
New command
npx shortest analyze
Generates 3 files in
.shortest/{framework}
folder:paths.json
: list of all app filestree.json
: detailed app file structure hierarchyanalysis.json
: app analysisSample files for https://github.com/antiwork/iffy:
or accessible at https://gist.github.com/rmarescu/d1b452812e7078afd19b301abf916853