-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(modules): ports outdated command #62
Conversation
@coderabbitai review |
Actions PerformedReview triggered.
|
Important Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent changes introduce new dependencies and modules to the project, update platform specifications, and enhance functionality across various files. Key updates include adding new TypeScript files, refining error messages, modifying type imports, and implementing new functions for context retrieval and dependency management. These alterations collectively aim to improve the project's robustness, compatibility, and maintainability. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 9
Outside diff range and nitpick comments (23)
modules/envs/reducer.ts (2)
Line range hint
59-59
: Consider specifying a more explicit type instead ofany
to improve type safety.- if (wellKnownProvisionTypes.includes(ty as any)) { + if (wellKnownProvisionTypes.includes(ty as WellKnownProvision)) {
Line range hint
77-77
: Avoid using template literals when not necessary for string construction.- throw new Error(`no provider reducer found for ty: ${ty}`, { + throw new Error("no provider reducer found for ty: " + ty, {modules/tasks/mod.ts (1)
Line range hint
100-100
: Use strict equality check (!==
) instead of loose equality (!=
) to avoid potential type coercion issues.- if (entry.version != "0") { + if (entry.version !== "0") {modules/ports/reducers.ts (1)
Line range hint
74-77
: The non-null assertion operator!
is used, which can lead to runtime errors ifinstallArts.get(instId)
returns undefined. Consider adding error handling or checks before using!
.- const { binPaths, libPaths, includePaths, installPath, env } = installArts.get(instId)!; + const installArt = installArts.get(instId); + if (!installArt) { + throw new Error(`Install artifacts not found for ID: ${instId}`); + } + const { binPaths, libPaths, includePaths, installPath, env } = installArt;modules/envs/posix.ts (1)
Line range hint
209-209
: Replace==
with===
for strict equality checks to avoid potential bugs due to type coercion.- if (cmd == "ghjk") { + if (cmd === "ghjk") { - if (cmd == "ghjk") { + if (cmd === "ghjk") {Also applies to: 214-214
modules/ports/mod.ts (4)
Line range hint
134-142
: This function expression can be turned into an arrow function for consistency and to potentially improve readability.- .action(async function () { + .action(async () => {
Line range hint
218-220
: Consider converting this function expression into an arrow function for consistency and potential readability improvements.- .action(function () { + .action(() => {
Line range hint
230-230
: Use strict equality check (!==
) instead of loose equality (!=
) to avoid unexpected type coercion.- if (entry.version != "0") { + if (entry.version !== "0") {
Line range hint
231-231
: Avoid using template literals when not necessary. It can lead to less clean code and slight performance overhead.- throw new Error(`unexepected version tag deserializing lockEntry`); + throw new Error("unexepected version tag deserializing lockEntry");files/mod.ts (6)
Line range hint
79-79
: Specify a more appropriate type instead ofany
.- ) => Promise<any> | any; + ) => Promise<YourSpecificType> | YourSpecificType;Using
any
can lead to potential type safety issues. ReplaceYourSpecificType
with the actual expected type.
Line range hint
155-155
: Avoid using template literals where not necessary.Consider using regular string literals or other string handling mechanisms if template literals are not required for dynamic expressions.
Also applies to: 294-294, 473-473
Line range hint
178-178
: Use strict equality checks.- if (typeof args.base == "string") { + if (typeof args.base === "string") {Replace
==
with===
to avoid coercion and ensure strict type comparison.Also applies to: 426-426, 555-555, 559-559
Line range hint
218-218
: Avoid non-null assertions.Non-null assertions may lead to runtime errors if not handled properly. Consider adding null checks or handling potential null values gracefully.
Also applies to: 359-359, 378-380, 521-521, 522-522, 560-560, 624-624
Line range hint
252-252
: Use strict inequality checks.- if (task.ty != "denoFile@v1") { + if (task.ty !== "denoFile@v1") {Replace
!=
with!==
to ensure strict type comparison and avoid coercion.Also applies to: 336-336
Line range hint
605-605
: Use strict equality for consistency.- if (revDepDeps.length == 0) { + if (revDepDeps.length === 0) {It's best practice to use
===
for equality checks to avoid unexpected type coercion.modules/ports/sync.ts (8)
Line range hint
172-172
: Use strict equality comparison.- const idx = parentDeps.findIndex(([instId, _]) => instId == installId); + const idx = parentDeps.findIndex(([instId, _]) => instId === installId);
Line range hint
178-178
: Use strict equality comparison.- if (parentDeps.length == 0) { + if (parentDeps.length === 0) {
Line range hint
196-196
: Use strict equality comparison.- if (cached && cached.progress == "installed") { + if (cached && cached.progress === "installed") {
Line range hint
383-383
: Use strict equality comparison.- if (!manifest.buildDeps || manifest.buildDeps.length == 0) { + if (!manifest.buildDeps || manifest.buildDeps.length === 0) {
Line range hint
431-431
: Use strict equality comparison.- if (depDeps.some(([depInstId, _]) => depInstId == instId)) { + if (depDeps.some(([depInstId, _]) => depInstId === instId)) {
Line range hint
444-444
: Avoid unnecessary template literals.- throw new Error(`cyclic dependency detected`, { + throw new Error("cyclic dependency detected", {
Line range hint
194-194
: Variables implicitly have the 'any' type.Consider specifying explicit types for these variables to enhance type safety and code maintainability.
Also applies to: 227-227, 509-509
Line range hint
93-93
: Forbidden non-null assertions are used.Non-null assertions may lead to runtime errors if not handled properly. Consider adding null checks or handling potential null values gracefully.
Also applies to: 110-110, 169-169, 173-173, 191-191, 198-198, 200-200, 202-202, 362-362, 401-401, 440-440
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (18)
- .ghjk/deno.lock (1 hunks)
- .ghjk/lock.json (4 hunks)
- deps/cli.ts (1 hunks)
- examples/cmake/ghjk.ts (1 hunks)
- files/mod.ts (1 hunks)
- modules/envs/mod.ts (5 hunks)
- modules/envs/posix.ts (2 hunks)
- modules/envs/reducer.ts (1 hunks)
- modules/envs/types.ts (4 hunks)
- modules/ports/db.ts (1 hunks)
- modules/ports/mod.ts (5 hunks)
- modules/ports/reducers.ts (4 hunks)
- modules/ports/sync.ts (14 hunks)
- modules/ports/types.ts (4 hunks)
- modules/ports/utils.ts (1 hunks)
- modules/tasks/mod.ts (2 hunks)
- modules/types.ts (1 hunks)
- modules/utils.ts (1 hunks)
Files skipped from review due to trivial changes (2)
- deps/cli.ts
- modules/types.ts
Additional Context Used
Biome (89)
files/mod.ts (20)
79-79: Unexpected any. Specify a different type.
79-79: Unexpected any. Specify a different type.
155-155: Do not use template literals if interpolation and special-character handling are not needed.
178-178: Use === instead of ==.
== is only allowed when comparing againstnull
218-218: The assignment should not be in an expression.
219-219: Forbidden non-null assertion.
252-252: Use !== instead of !=.
!= is only allowed when comparing againstnull
294-294: Do not use template literals if interpolation and special-character handling are not needed.
336-336: Use !== instead of !=.
!= is only allowed when comparing againstnull
359-359: Forbidden non-null assertion.
378-380: Forbidden non-null assertion.
426-426: Use === instead of ==.
== is only allowed when comparing againstnull
473-473: Do not use template literals if interpolation and special-character handling are not needed.
521-521: Forbidden non-null assertion.
522-522: Forbidden non-null assertion.
555-555: Use === instead of ==.
== is only allowed when comparing againstnull
559-559: Use === instead of ==.
== is only allowed when comparing againstnull
560-560: Forbidden non-null assertion.
605-605: Use === instead of ==.
== is only allowed when comparing againstnull
624-624: Forbidden non-null assertion.
modules/envs/mod.ts (13)
52-52: Use !== instead of !=.
!= is only allowed when comparing againstnull
83-83: Template literals are preferred over string concatenation.
100-113: This function expression can be turned into an arrow function.
122-125: This function expression can be turned into an arrow function.
136-144: This function expression can be turned into an arrow function.
166-166: Use !== instead of !=.
!= is only allowed when comparing againstnull
157-169: This function expression can be turned into an arrow function.
179-179: Use !== instead of !=.
!= is only allowed when comparing againstnull
180-180: Do not use template literals if interpolation and special-character handling are not needed.
245-245: Use === instead of ==.
== is only allowed when comparing againstnull
257-257: Unexpected any. Specify a different type.
3-4: Some named imports are only used as types.
10-11: All these imports are only used as types.
modules/envs/posix.ts (8)
87-87: Unexpected any. Specify a different type.
157-157: Forbidden non-null assertion.
209-209: Use === instead of ==.
== is only allowed when comparing againstnull
214-214: Use === instead of ==.
== is only allowed when comparing againstnull
281-281: Do not use template literals if interpolation and special-character handling are not needed.
282-282: Do not use template literals if interpolation and special-character handling are not needed.
1-6: Some named imports are only used as types.
6-7: Some named imports are only used as types.
modules/envs/reducer.ts (2)
59-59: Unexpected any. Specify a different type.
77-77: Do not use template literals if interpolation and special-character handling are not needed.
modules/ports/mod.ts (7)
134-142: This function expression can be turned into an arrow function.
192-192: Forbidden non-null assertion.
218-220: This function expression can be turned into an arrow function.
230-230: Use !== instead of !=.
!= is only allowed when comparing againstnull
231-231: Do not use template literals if interpolation and special-character handling are not needed.
3-4: Some named imports are only used as types.
18-19: All these imports are only used as types.
modules/ports/reducers.ts (3)
74-77: Forbidden non-null assertion.
3-4: All these imports are only used as types.
4-5: All these imports are only used as types.
modules/ports/sync.ts (20)
93-93: Forbidden non-null assertion.
110-110: Forbidden non-null assertion.
169-169: Forbidden non-null assertion.
172-172: Use === instead of ==.
== is only allowed when comparing againstnull
173-173: Forbidden non-null assertion.
178-178: Use === instead of ==.
== is only allowed when comparing againstnull
191-191: Forbidden non-null assertion.
194-194: This variable implicitly has the any type.
196-196: Use === instead of ==.
== is only allowed when comparing againstnull
198-198: Forbidden non-null assertion.
200-200: Forbidden non-null assertion.
202-202: Forbidden non-null assertion.
227-227: This variable implicitly has the any type.
362-362: Forbidden non-null assertion.
383-383: Use === instead of ==.
== is only allowed when comparing againstnull
401-401: Forbidden non-null assertion.
431-431: Use === instead of ==.
== is only allowed when comparing againstnull
440-440: Forbidden non-null assertion.
444-444: Do not use template literals if interpolation and special-character handling are not needed.
509-509: This variable implicitly has the any type.
modules/ports/utils.ts (6)
107-107: This variable implicitly has the any type.
122-122: This variable implicitly has the any type.
3-4: All these imports are only used as types.
4-5: All these imports are only used as types.
5-14: Some named imports are only used as types.
14-15: All these imports are only used as types.
modules/tasks/mod.ts (5)
100-100: Use !== instead of !=.
!= is only allowed when comparing againstnull
101-101: Do not use template literals if interpolation and special-character handling are not needed.
3-4: Some named imports are only used as types.
7-8: All these imports are only used as types.
11-12: All these imports are only used as types.
modules/utils.ts (5)
1-1: All these imports are only used as types.
1-2: All these imports are only used as types.
2-6: Some named imports are only used as types.
6-7: All these imports are only used as types.
7-13: Some named imports are only used as types.
Additional comments not posted (17)
examples/cmake/ghjk.ts (3)
1-1
: Export statement looks good.
2-3
: Import statements are correctly formatted and appropriate for the usage in this file.
5-11
: The function call toinstall
is correctly implemented with appropriate parameters.modules/envs/reducer.ts (1)
13-16
: The updated type declaration forProvisionReducerStore
correctly includes a second generic parameter, enhancing its flexibility.modules/utils.ts (2)
36-53
: The functiongetPortsCtx
is implemented correctly, ensuring proper management of ports context.
55-79
: The functiongetTasksCtx
effectively manages the tasks context, ensuring it is retrieved or initialized as needed.modules/envs/types.ts (1)
Line range hint
19-58
: The type definitions in this file are comprehensive and correctly structured to support the functionality described in the PR.modules/ports/db.ts (1)
16-16
: TheInstallsDb
class is correctly implemented to manage installation records efficiently.modules/ports/reducers.ts (2)
19-19
: Ensure that the import from./types.ts
is necessary as it seems to be importing validators which might not be used directly here.Verification successful
The
validators
import from./types.ts
is indeed used inmodules/ports/reducers.ts
.
modules/ports/reducers.ts
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if validators from `./types.ts` are used in `modules/ports/reducers.ts`. # Test: Search for `validators` usage. Expect: At least one occurrence. rg --type typescript --files-with-matches 'validators' modules/ports/reducers.tsLength of output: 115
Script:
#!/bin/bash # Description: Verify if validators from `./types.ts` are used in `modules/ports/reducers.ts`. # Test: Search for `validators` usage. Expect: At least one occurrence. rg --type ts --files-with-matches 'validators' modules/ports/reducers.tsLength of output: 98
67-67
: The use ofas Provision[]
is a type assertion that could potentially hide type mismatches. Ensure that this is the best approach or consider a more robust type handling mechanism.Verification successful
The type
Provision
is defined aszod.input<typeof validators.provision>
, which means it is derived from a Zod schema. The type assertionas Provision[]
is used to initialize an empty array with this type. Given thatProvision
is a complex type derived from a Zod schema, the type assertion is necessary to ensure the array is correctly typed from the start.
modules/envs/types.ts:90
:export type Provision = zod.input<typeof validators.provision>;
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if the type assertion for `Provision[]` is necessary. # Test: Check for type mismatches that could be hidden by this assertion. ast-grep --lang typescript --pattern $'const out = [] as Provision[]; $$$'Length of output: 532
Script:
#!/bin/bash # Description: Verify if the type assertion for `Provision[]` is necessary. # Test: Check for type mismatches that could be hidden by this assertion. ast-grep --lang typescript --pattern 'const out: Provision[] = [];'Length of output: 69
Script:
#!/bin/bash # Description: Search for the definition and usage of `Provision` in the codebase. # Find the definition of `Provision`. ast-grep --lang typescript --pattern 'type Provision = $_;' --pattern 'interface Provision { $$$ }' # Find all usages of `Provision`. rg 'Provision'Length of output: 7969
Script:
#!/bin/bash # Description: Search for the definition of `Provision` and related types in the codebase. # Find the definition of `Provision`. ast-grep --lang typescript --pattern 'type Provision = $_;' || ast-grep --lang typescript --pattern 'interface Provision { $$$ }' # Find the definition of related types. ast-grep --lang typescript --pattern 'type WellKnownProvision = $_;' || ast-grep --lang typescript --pattern 'interface WellKnownProvision { $$$ }' ast-grep --lang typescript --pattern 'type InstallSetProvision = $_;' || ast-grep --lang typescript --pattern 'interface InstallSetProvision { $$$ }' ast-grep --lang typescript --pattern 'type InstallSetRefProvision = $_;' || ast-grep --lang typescript --pattern 'interface InstallSetRefProvision { $$$ }'Length of output: 893
modules/ports/utils.ts (1)
1-1
: Ensure that the import from../../deps/cli.ts
is necessary as it seems to be importingstd_path
which might not be used directly here.Verification successful
The
std_path
import from../../deps/cli.ts
is indeed used inmodules/ports/utils.ts
.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if `std_path` from `../../deps/cli.ts` is used in `modules/ports/utils.ts`. # Test: Search for `std_path` usage. Expect: At least one occurrence. rg --type typescript --files-with-matches 'std_path' modules/ports/utils.tsLength of output: 110
Script:
#!/bin/bash # Description: Verify if `std_path` from `../../deps/cli.ts` is used in `modules/ports/utils.ts`. # Test: Search for `std_path` usage. Expect: At least one occurrence. rg --type ts --files-with-matches 'std_path' modules/ports/utils.tsLength of output: 90
modules/envs/posix.ts (1)
50-88
: The switch statement handles different types of provisions. Ensure that all cases are covered and that the default case throws an informative error for unsupported types.Verification successful
The switch statement handling the provision types in
modules/envs/posix.ts
appears to cover all specified cases, including a default case that throws an error for unsupported types. This ensures that any unrecognized provision type will be flagged appropriately.
- The switch statement at line 55 handles various provision types such as "posix.exec", "posix.sharedLib", "posix.headerFile", "posix.envVar", "hook.onEnter.posixExec", "hook.onExit.posixExec", and "ghjk.ports.Install".
- The default case at line 85 throws an error for unsupported provision types, ensuring that any unrecognized type is caught.
Based on the provided context and the results from the shell scripts, it appears that all provision types are adequately handled.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if all provision types are handled in the switch statement. # Test: Check for unhandled provision types. ast-grep --lang typescript --pattern $'switch ($$$) { case "posix.exec": $$$; case "posix.sharedLib": $$$; case "posix.headerFile": $$$; case "posix.envVar": $$$; case "hook.onEnter.posixExec": $$$; case "hook.onExit.posixExec": $$$; case "ghjk.ports.Install": $$$; default: throw Error($$$); }'Length of output: 296
Script:
#!/bin/bash # Description: Find all switch statements in the file to manually verify the cases. # Locate the file file_path=$(fd posix.ts) # Extract all switch statements from the file ast-grep --lang typescript --pattern 'switch ($$$) { $$$ }' $file_pathLength of output: 2723
modules/envs/mod.ts (2)
161-161
: Typographical error in the error message. Correct "detct" to "detect".- "unable to detct shell in use. Use `--shell` flag to explicitly pass shell program.", + "unable to detect shell in use. Use `--shell` flag to explicitly pass shell program.",Likely invalid or redundant comment.
21-21
: The functiongetEnvsCtx
is imported here. Verify that it is used appropriately and that its effects are well-understood in the context of this module.Verification successful
The function
getEnvsCtx
is used appropriately inmodules/envs/mod.ts
. It is called to initialize theenvsCtx
object, which is then populated withactiveEnv
andconfig
properties. This usage aligns with the expected behavior of setting up the environment context.
getEnvsCtx
is imported from../utils.ts
.- It is used to create the
envsCtx
object.- The
envsCtx
object is then populated withactiveEnv
andconfig
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `getEnvsCtx` in `modules/envs/mod.ts`. # Test: Search for `getEnvsCtx` usage. Expect: At least one occurrence. rg --type typescript --files-with-matches 'getEnvsCtx' modules/envs/mod.tsLength of output: 109
Script:
#!/bin/bash # Description: Verify the usage of `getEnvsCtx` in `modules/envs/mod.ts`. # Test: Search for `getEnvsCtx` usage. Expect: At least one occurrence. rg --type ts --files-with-matches 'getEnvsCtx' modules/envs/mod.tsLength of output: 86
Script:
#!/bin/bash # Description: Display the usage of `getEnvsCtx` in `modules/envs/mod.ts` with surrounding lines for context. # Test: Search for `getEnvsCtx` usage and display 5 lines before and after each occurrence. rg 'getEnvsCtx' -C 5 modules/envs/mod.tsLength of output: 659
modules/ports/types.ts (1)
182-186
: New typesinstallProvisionTy
andinstallProvision
are defined. Ensure that these types are integrated correctly across the module and that they adhere to the expected structure and usage patterns.Verification successful
The types
installProvisionTy
andinstallProvision
are correctly integrated and used across the module in the following files:
modules/ports/types.ts
modules/ports/reducers.ts
modules/ports/mod.ts
These usages indicate that the new types are properly referenced and utilized within the module.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and integration of `installProvisionTy` and `installProvision`. # Test: Search for usages of these types across the module. rg --type typescript --files-with-matches 'installProvisionTy|installProvision' modules/portsLength of output: 130
Script:
#!/bin/bash # Description: Verify the usage and integration of `installProvisionTy` and `installProvision`. # Test: Search for usages of these types across the module. rg --type ts --files-with-matches 'installProvisionTy|installProvision' modules/portsLength of output: 157
Script:
#!/bin/bash # Description: Extract and review the relevant lines from the identified files to ensure proper integration and usage of `installProvisionTy` and `installProvision`. # Extract lines from modules/ports/types.ts echo "modules/ports/types.ts:" rg 'installProvisionTy|installProvision' modules/ports/types.ts # Extract lines from modules/ports/reducers.ts echo "modules/ports/reducers.ts:" rg 'installProvisionTy|installProvision' modules/ports/reducers.ts # Extract lines from modules/ports/mod.ts echo "modules/ports/mod.ts:" rg 'installProvisionTy|installProvision' modules/ports/mod.tsLength of output: 882
.ghjk/lock.json (2)
3-3
: Platform updated toaarch64-darwin
.This change aligns with the PR's objective to support the
aarch64-darwin
platform.
20-20
: Version updated to3.5
fortar_aa
.Ensure that all dependencies and configurations that rely on
tar_aa
are compatible with this new version.Also applies to: 40-40, 53-53
.ghjk/deno.lock
Outdated
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/deps/cli.ts": "4eacc555cf80686b487e7502db63a4cfbc2060a7b847d15b14cf1cc008a3b65c", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/deps/common.ts": "46d30782086ccc79e4a2633fe859723e7686ebc5adb4101e76c4bf2d6d2e94ff", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/host/deno.ts": "330c62197c7af0a01d3ec96705367b789d538f3c820b730c63bb2820fabda7d7", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/host/mod.ts": "2bc9f273262e1c4fb434b1a0389f24464f8b986816ce9480e8e2d63d910e8253", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/host/types.ts": "22c06b190172d08092717ad788ed04b050af58af0cf3f8c78b1511984101e9e4", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/main.ts": "8d6985e59db0b5baf67c9dc330bf8b25ad556341b9ef6088038e8ebb37ed75e5", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/mod.ts": "6aa0b765ce5684842ea531e026926836ffde7d2513e62457bffe9cb4ec7eb0df", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/ports/ambient.ts": "25623410c535e2bfaf51fca1e582e7325a00a7690d5b5e763a12be9407f619cf", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/ports/base.ts": "8ef8a8de372420bddcd63a1b363937f43d898059e99478a58621e8432bcd5891", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/ports/db.ts": "3f4541d6874c434f2f869774a17fd41c3d86914ed190d412e2f63f564b58ce95", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/ports/mod.ts": "e38ad2d3599b6a5522da436b52e5945bb85cabba2aca27f633eae43e465b5794", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/ports/sync.ts": "46447c2c51c085193f567ddcd2451b14bb33ee2d761edeb91a6153e2ba642f42", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/ports/types.ts": "b3967d9d75def187b3b55f2b0b1357c9cb69a70e475a9280fc66717193b8b43c", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/ports/types/platform.ts": "0ecffeda71919293f9ffdb6c564ddea4f23bc85c4e640b08ea78225d34387fdc", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/ports/worker.ts": "25c01e3afddd97d48af89d9c97a9a5188e7db09fceb26a69eac4dabacd8ac4fc", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/std.ts": "ddb2c134c080bb0e762a78f2f2edd69536991cc4257bd29a6fc95944b2f105a9", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/tasks/deno.ts": "f988a4d1062364b99272087fa0c7d54e699944ead3790c5b83140577bda089de", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/tasks/exec.ts": "7a07f2cce79fe16e86f0b74df6d57f0160bac75a8c6d58a03f2883a5ecccddf0", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/tasks/mod.ts": "0edbe1ce953a44b6b0fd45aa9c9dd52c11b12053eef21307eac3b24b6db4745e", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/tasks/types.ts": "536495a17c7a917bdd1c316ecc98ce2947b4959a713f92a175d372196dcaafc0", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/modules/types.ts": "b44609942d7ad66c925c24485057c5b4b2ffcad20c0a94e14dc6af34cf9e8241", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/setup_logger.ts": "f8a206bda0595497d6f4718032d4a959000b32ef3346d4b507777eec6a169458", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/utils/logger.ts": "86fdf651123d00ea1081bf8001ed9039cd41a79940e6ebadb8484952ab390e73", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/utils/mod.ts": "1ee68d9390259c065144c10663f6e360d29aec36db2af38d02647e304eeeaedc", | ||
"https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/utils/url.ts": "e1ada6fd30fc796b8918c88456ea1b5bbd87a07d0a0538b092b91fd2bb9b7623", |
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.
Tip
Codebase Verification
The updates to the .ghjk/deno.lock
file have introduced potential issues:
-
Multiple versions of
@david/which
(0.3.0
and0.4.1
) andzod-validation-error
(3.1.0
and3.2.0
) are present, which could lead to version conflicts. -
The integrity check returned
null
, indicating that no integrity hashes were found, which means the integrity of the dependencies cannot be verified. -
Ensure that the versions of
@david/which
andzod-validation-error
are compatible and do not cause conflicts. -
Add integrity hashes for all dependencies to verify their integrity.
Analysis chain
The updates to the dependencies in the .ghjk/deno.lock
file include several new entries and updates to existing ones. Ensure that these changes are compatible with the rest of the project and that there are no version conflicts.
The output indicates potential version conflicts with the following packages:
@david/which
has versions0.3.0
and0.4.1
.zod-validation-error
has versions3.1.0
and3.2.0
.
We need to verify if these versions are compatible and do not cause issues. Additionally, we should check the integrity of the dependencies by comparing the hash values.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any version conflicts or integrity mismatches in the updated dependencies.
# Test: List all dependencies and their versions. Expect: No conflicts or mismatches.
cat .ghjk/deno.lock | jq '.packages.specifiers'
Length of output: 1020
Script:
#!/bin/bash
# Description: Check for multiple versions of the same package and verify their compatibility.
# List all dependencies and their versions
cat .ghjk/deno.lock | jq '.packages.specifiers' > dependencies.json
# Check for multiple versions of the same package
jq 'to_entries | group_by(.key | split("@")[0]) | map(select(length > 1))' dependencies.json
# Verify the integrity of the dependencies by comparing the hash values
cat .ghjk/deno.lock | jq '.packages.integrity'
Length of output: 1641
} from "./types.ts"; | ||
import { type GhjkCtx, type ModuleManifest } from "../types.ts"; |
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.
All these imports are only used as types. Consider using type-only imports to clarify their usage and potentially optimize bundling.
- import { type GhjkCtx, type ModuleManifest } from "../types.ts";
+ import type { GhjkCtx, ModuleManifest } from "../types.ts";
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
} from "./types.ts"; | |
import { type GhjkCtx, type ModuleManifest } from "../types.ts"; | |
} from "./types.ts"; | |
import type { GhjkCtx, ModuleManifest } from "../types.ts"; |
modules/ports/mod.ts
Outdated
const _installName = _opts.updateInstall; | ||
// TODO: convert from install name to install id, after port module refactor | ||
let installId!: string; | ||
const newVersion = latest.get(installId)!; |
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.
Avoid using non-null assertions. It's safer to handle potential null or undefined values explicitly.
- const newVersion = latest.get(installId)!;
+ const newVersion = latest.get(installId);
+ if (!newVersion) {
+ throw new Error(`No version found for install ID: ${installId}`);
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const newVersion = latest.get(installId)!; | |
const newVersion = latest.get(installId); | |
if (!newVersion) { | |
throw new Error(`No version found for install ID: ${installId}`); | |
} |
export function getEnvsCtx( | ||
gcx: GhjkCtx, | ||
): EnvsCtx { | ||
let envsCtx = gcx.blackboard.get(envsCtxBlackboardKey) as | ||
| EnvsCtx | ||
| undefined; | ||
|
||
if (!envsCtx) { | ||
envsCtx = { | ||
activeEnv: "", | ||
config: { | ||
defaultEnv: "", | ||
envs: {}, | ||
}, | ||
}; | ||
gcx.blackboard.set(envsCtxBlackboardKey, envsCtx); | ||
} | ||
|
||
return envsCtx; | ||
} |
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.
The function getEnvsCtx
correctly handles the retrieval or initialization of the environment context.
Consider using import type
for imports that are only used for type annotations to clarify their usage and potentially optimize bundling.
- import { EnvsCtx } from "./envs/mod.ts";
+ import type { EnvsCtx } from "./envs/mod.ts";
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
export function getEnvsCtx( | |
gcx: GhjkCtx, | |
): EnvsCtx { | |
let envsCtx = gcx.blackboard.get(envsCtxBlackboardKey) as | |
| EnvsCtx | |
| undefined; | |
if (!envsCtx) { | |
envsCtx = { | |
activeEnv: "", | |
config: { | |
defaultEnv: "", | |
envs: {}, | |
}, | |
}; | |
gcx.blackboard.set(envsCtxBlackboardKey, envsCtx); | |
} | |
return envsCtx; | |
} | |
import type { EnvsCtx } from "./envs/mod.ts"; | |
export function getEnvsCtx( | |
gcx: GhjkCtx, | |
): EnvsCtx { | |
let envsCtx = gcx.blackboard.get(envsCtxBlackboardKey) as | |
| EnvsCtx | |
| undefined; | |
if (!envsCtx) { | |
envsCtx = { | |
activeEnv: "", | |
config: { | |
defaultEnv: "", | |
envs: {}, | |
}, | |
}; | |
gcx.blackboard.set(envsCtxBlackboardKey, envsCtx); | |
} | |
return envsCtx; | |
} |
@@ -1,7 +1,7 @@ | |||
//! Integration between Ports and Envs module | |||
|
|||
import { expandGlobsAndAbsolutize, unwrapParseRes } from "../../utils/mod.ts"; | |||
import type { WellKnownProvision } from "../envs/types.ts"; | |||
import { Provision } from "../envs/types.ts"; |
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.
Consider using import type
for Provision
as it is only used as a type.
- import { Provision } from "../envs/types.ts";
+ import type { Provision } from "../envs/types.ts";
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
import { Provision } from "../envs/types.ts"; | |
import type { Provision } from "../envs/types.ts"; |
conf: config, | ||
manifest, | ||
}; | ||
let downloadArts; |
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.
Variables downloadArts
and installArtifacts
are implicitly typed as any
. Consider specifying explicit types for better type safety and maintainability.
- let downloadArts;
+ let downloadArts: DownloadArtifacts;
- let installArtifacts;
+ let installArtifacts: InstallArtifacts;
Also applies to: 122-122
Committable suggestion was skipped due low confidence.
export async function updateInstall( | ||
gcx: GhjkCtx, | ||
installId: string, | ||
newVersion: string, | ||
allowedDeps: Record<string, AllowedPortDep>, | ||
) { | ||
await using scx = await syncCtxFromGhjk(gcx); | ||
|
||
const db = scx.db.val; | ||
|
||
const install = await db.get(installId); | ||
|
||
if (!install) { | ||
throw new Error("InstallSetId not found in InstallsDb", { | ||
cause: { | ||
installId, | ||
}, | ||
}); | ||
} | ||
|
||
const config = install.conf; | ||
|
||
if (config.version === newVersion) { | ||
logger().info("Skipping update. Install is already uptodate"); | ||
return; | ||
} | ||
|
||
// it's a user specified install, so skip | ||
if (config.specifiedVersion) { | ||
logger().info(`Skipping Version Specified Install: ${installId}`); | ||
return; | ||
} | ||
|
||
config.version = newVersion; | ||
logger().info(`Updating installId ${installId} to version ${newVersion}...`); | ||
await doInstall(installId, scx, install.manifest, allowedDeps, config); | ||
logger().info( | ||
`Successfully updated installId ${installId} to version ${newVersion}`, | ||
); | ||
} |
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.
Tip
Codebase Verification
The verification scripts did not find any explicit error handling around the asynchronous operations in the updateInstall
function. This indicates that the function might lack proper error handling for these operations.
- Ensure that all asynchronous operations, such as
await syncCtxFromGhjk(gcx)
andawait db.get(installId)
, are wrapped in try-catch blocks to handle potential errors. - Add appropriate logging within the catch blocks to aid in debugging.
Analysis chain
This function updateInstall
handles various aspects of updating an installation. Ensure that all error paths are adequately handled and that logging is sufficient for debugging purposes.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the error handling paths in `updateInstall`.
# Test: Check for error handling in the function.
ast-grep --lang typescript --pattern $'export async function updateInstall($$$) { $$$ }'
Length of output: 2216
Script:
#!/bin/bash
# Description: Verify comprehensive error handling in the `updateInstall` function.
# Test: Check for error handling in all asynchronous operations within the function.
ast-grep --lang typescript --pattern $'await $_' --json | jq '.[] | select(.path == "modules/ports/utils.ts" and .lines[0] >= 17 and .lines[0] <= 56)'
Length of output: 151
Script:
#!/bin/bash
# Description: Verify error handling around specific asynchronous operations in the `updateInstall` function.
# Test: Check for error handling around `await syncCtxFromGhjk(gcx)` and `await db.get(installId)` within the function.
ast-grep --lang typescript --pattern $'try { await syncCtxFromGhjk($_); } catch ($_error) { $$$ }' --json | jq '.[] | select(.path == "modules/ports/utils.ts" and .lines[0] >= 17 and .lines[0] <= 56)'
ast-grep --lang typescript --pattern $'try { await db.get($_); } catch ($_error) { $$$ }' --json | jq '.[] | select(.path == "modules/ports/utils.ts" and .lines[0] >= 17 and .lines[0] <= 56)'
Length of output: 394
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.
Good stuff. Go ahead a merge it on top of the envs PR.
* feat(envs): Envs module * feat: rework `ghjk.ts` interface and integrate with other modules * wip: minor fixup * fix: improve uninited dir experience * wip: `$ ghjk envs sync` * refactor(envs,cli)!: envs first cli (#48) * refactor(envs): envs first CLI * wip: missing file * wip: wip * wip: wip 2 * feat(tests): basic tests * docs: some snippets for `README.md` * doc: typo * fix: `Deno.Command` troubles * fix: cross platform shell fn for getting ctime * fix: `!` as instId separator * fix(tests): missing flag * wip: wip * feat: `ghjk p resolve` * refactor: polish CLI code * wip: clearEnv fix * fix: vendor dax patch * fix: forgotten change * fix: use `@ghjk/dax` fork * fix: remove vendor dir from Dockerfile * feat: env hooks (#59) * feat(envs,tasks): env `onEnter`/`onExit` hooks * wip: anon tasks * feat: anonymous tasks * tests: anon tasks * wip: wip * feat: env onEnter/onExit hooks * tests: env hook tests * fix: bug in path outputs * fix: use latest setup-ghjk * fix: bug on check task * chore: bump deno to 1.43.1 * fix: miss field in test harness * fix: use `no-prune` on docker tests * fix: don't rmi at all * fix: timeout * docs: metatype ecosystem banner in README.md (#49) * docs: metatype ecosystem banner in README.md * fix: utm --------- Co-authored-by: Teo Stocco <[email protected]> * fix(port): `cpy_bs` doesn't work on arm (#60) * wip: linux/arm in docker on mac-14 * wip: try `custom-macos` * wip: try inline docker * wip: try `custom-macos` * fix: remove unnecessary action * fix: move platform flags into tests * refactor: merge new job into matrix * fix: broken aarch64 ports * wip: log * fix: diambiguate platforms in harness * fix: silly ci bug * fix: env depending on itself case * fix: lint issue * fix: use 5m timeout for everything * refactor(envs): `GHJK_NEXTFILE` based env reloading (#83) * wip: nextfile * tests: nextfile * refactor: pid based nextfile * refactor: replace with ghjkdir vars instead of $HOME * fix: env hook tests * fix: bashisms * feat(modules): ports outdated command (#62) * wip(modules): add installSetIds to * wip(modules-ports): read recipe.json and get cooked installSetIds * wip(ports): wip for version getter func * feat(modules): restrcutre ctx tree and recipe.json content * feat(ports): add table to show version diff * fix: fix unhandled prov type in envs/posix cook * wip: wip update outdated installs * wip: add ghjk file with multiple installs * chore(test): wip add test * refactor: refactor table structure and update cargo_binstall * refactor(ghjk.ts): replace `secureConfig` with `hack.ts` (#87) * refactor(ghjk.ts): replace secureConfig with hack.ts * docs: improve README * fix(ci): update action job * fix: address llm feedback * fix: cargo-binstall bug * fix: ports outdated test fix * feat!: metatype integration polish (#91) * feat: multipl env inheritance * refactor: handle GHJK_CLEANUP_POSIX edgecases * feat: task on task inheritance * fix: bugs! * feat(port): `deno_ghrel` * fix: `portsOutdated` tests * fix: diamond inheritance bug * small stuff * fix: apply llm feedback * fix: minor fixes * fix: path var merging * feat: `std.ts` and `sedLock` * fix: task path combinations * fix: task path combinations 2 * chore: set version 0.2.0 * fix: more target sed pattern * fix(ci): pre-commit issue * fix: 10m timeout * fix: explicit GITHUB_TOKEN --------- Co-authored-by: Teo Stocco <[email protected]> Co-authored-by: Estifanos Bireda <[email protected]>
add
ports outdated
command which shows the outdated installs in the env, with options to update specific installs or all at once.Describe your change
reducedRecipe
schema to holdinstallSetId
s.recipe.json
and get current ports versions.PortBase
and log outdated ports table.--update-no-confirm
and--update-all
flags.Motivation and context
MET-485
Migration notes
No Migrations Needed
Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Improvements
PortsModule
class with new utility functions.Documentation