-
Notifications
You must be signed in to change notification settings - Fork 0
SF-16-weave-and-resource-page-generation #9
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
Changes from all commits
4dea199
7cb1a87
8913809
64b45fd
caf3b79
90ecd5e
b6f5a96
02a46f8
8ba44df
ac211a1
51cdf5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,32 @@ | ||
| { | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "request": "launch", | ||
| "name": "Debug Service (Prod)", | ||
| "type": "node", | ||
| "program": "${workspaceFolder}/semantic-flow/flow-service/main.ts", | ||
| "cwd": "${workspaceFolder}/semantic-flow/flow-service/", | ||
| "env": {}, | ||
| "runtimeExecutable": "C:\\Users\\drich\\.deno\\bin\\deno.EXE", | ||
| "runtimeArgs": [ | ||
| "run", | ||
| "--watch", | ||
| "--env-file" | ||
| ] | ||
| }, | ||
| { | ||
| "name": "Attach Service", | ||
| "type": "node", | ||
| "request": "attach", | ||
| "port": 9229, | ||
| "address": "127.0.0.1", | ||
| "localRoot": "${workspaceFolder}", | ||
| "remoteRoot": "${workspaceFolder}", | ||
| "skipFiles": ["<node_internals>/**"] | ||
| } | ||
| ] | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "request": "launch", | ||
| "name": "Debug Service (Prod)", | ||
| "type": "node", | ||
| "program": "${workspaceFolder}/flow-service/main.ts", | ||
| "cwd": "${workspaceFolder}/flow-service/", | ||
| "env": {}, | ||
| "runtimeExecutable": "deno", | ||
| "runtimeArgs": [ | ||
| "run", | ||
| "--watch", | ||
| "--env-file" | ||
| ] | ||
| }, | ||
| { | ||
| "name": "Attach Service", | ||
| "type": "node", | ||
| "request": "attach", | ||
| "port": 9229, | ||
| "address": "127.0.0.1", | ||
| "localRoot": "${workspaceFolder}", | ||
| "remoteRoot": "${workspaceFolder}", | ||
| "skipFiles": ["<node_internals>/**"] | ||
| } | ||
| ] | ||
| } |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,43 @@ | ||||||||||||||||||||
| // Utility functions for path handling in flow-core | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * Converts a node relative path to a meta relative path by prepending "../../" | ||||||||||||||||||||
| * This is used to navigate from a node's directory to its meta directory. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * @param nodeRelativePath - The relative path of the node | ||||||||||||||||||||
| * @returns The relative path to the meta directory | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| export function convertNodeRelativePathToMetaRelativePath(nodeRelativePath: string): string { | ||||||||||||||||||||
| return `../../${nodeRelativePath}`; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+10
to
+12
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add input validation for robustness. The function lacks input validation and could produce malformed paths with invalid inputs. Consider validating the input parameter. export function convertNodeRelativePathToMetaRelativePath(nodeRelativePath: string): string {
+ if (!nodeRelativePath || typeof nodeRelativePath !== 'string') {
+ throw new Error('nodeRelativePath must be a non-empty string');
+ }
return `../../${nodeRelativePath}`;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * Normalizes a node path to ensure it does not start with a slash or "./" | ||||||||||||||||||||
| * and uses consistent separators. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * @param nodePath - The node path to normalize | ||||||||||||||||||||
| * @returns The normalized node path | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| export function normalizeNodePath(nodePath: string): string { | ||||||||||||||||||||
| if (!nodePath) return ''; | ||||||||||||||||||||
| let normalized = nodePath; | ||||||||||||||||||||
| if (normalized.startsWith('/')) { | ||||||||||||||||||||
| normalized = normalized.slice(1); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| if (normalized.startsWith('./')) { | ||||||||||||||||||||
| normalized = normalized.slice(2); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| // Additional normalization can be added here if needed | ||||||||||||||||||||
| return normalized; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * Extracts the last segment of a node path. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * @param nodePath - The node path string | ||||||||||||||||||||
| * @returns The last segment of the path | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| export function getLastSegment(nodePath: string): string { | ||||||||||||||||||||
| const parts = nodePath.split('/'); | ||||||||||||||||||||
| return parts[parts.length - 1] || ''; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+40
to
+43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add input validation and improve error handling. The function lacks input validation and could throw errors with invalid inputs. Also consider the path separator assumption. export function getLastSegment(nodePath: string): string {
+ if (!nodePath || typeof nodePath !== 'string') {
+ return '';
+ }
const parts = nodePath.split('/');
return parts[parts.length - 1] || '';
}🤖 Prompt for AI Agents |
||||||||||||||||||||
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.
🛠️ Refactor suggestion
Add validation for nodePath extraction.
The
lastIndexOf("/")operation could return -1 if no "/" is found, resulting in the entire path being used as the last segment. Consider adding validation or using a more robust path parsing approach.Consider using a helper function to safely extract the last segment:
Then update all the distribution path functions:
export function getCurrentConfigDistPath(nodePath: string): string { - const lastSegment = nodePath.substring(nodePath.lastIndexOf("/") + 1); + const lastSegment = getLastPathSegment(nodePath); return `${getCurrentConfigSnapshotPath(nodePath)}${lastSegment}_${MESH.CONFIG}_${MESH.CURRENT}.jsonld`; }Also applies to: 82-83, 91-92, 105-106, 114-115, 123-124, 137-138, 146-147, 155-156, 169-170, 178-179, 187-188
🤖 Prompt for AI Agents