-
Notifications
You must be signed in to change notification settings - Fork 1
feat!: metatype integration polish #91
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
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 WalkthroughThis update introduces numerous changes to dependencies, configurations, and logic throughout the project. Key changes include dependency version adjustments, new dependencies, revisions in environment and task handling, refined control flows, and enhancements to CLI commands. Significant modifications to environment activation processes and task definitions are present, leading to a more flexible and robust system. 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 (
|
a6c373d
to
f9342fa
Compare
c410d01
to
225a971
Compare
@coderabbitai review |
Actions performedReview triggered.
|
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: 20
Outside diff range and nitpick comments (11)
modules/ports/inter.ts (1)
Line range hint
24-39
: Consider verifying the existence ofid
ingraph.all
before accessing it to avoid potential runtime errors.- const inst = graph.all[id]!; + const inst = graph.all[id]; + if (!inst) throw new Error(`Install ID ${id} not found in graph.`);tests/envHooks.ts (1)
56-56
: The addition of new test cases inenvHooks.ts
is crucial for ensuring the robustness of environment handling in different shell contexts. Consider adding more detailed comments explaining each test case scenario for better maintainability.tests/reloadHooks.ts (1)
10-35
: Ensure consistent error handling and messaging across tests for clarity and maintainability.Consider using a centralized mechanism or constants for error codes and messages to avoid magic numbers and improve maintainability.
mod.ts (1)
Line range hint
132-173
: Refactor the environment setup logic to improve clarity and maintainability.- const mainEnv = builder.addEnv(DEFAULT_BASE_ENV_NAME, { - name: DEFAULT_BASE_ENV_NAME, - inherit: args.defaultBaseEnv && args.defaultBaseEnv != DEFAULT_BASE_ENV_NAME - ? args.defaultBaseEnv - : false, - installs: args.installs, - desc: "the default default environment.", - }); - - const replaceDefaultBuildDeps = (args: SecureConfigArgs) => { - defaultBuildDepsSet.length = 0; - defaultBuildDepsSet.push( - ...reduceAllowedDeps(args.allowedBuildDeps ?? []), - ); - const seenPorts = new Set( - defaultBuildDepsSet.map((dep) => dep.manifest.name), - ); - for ( - const dep of args.stdDeps !== false - ? stdDeps({ enableRuntimes: args.enableRuntimes ?? false }) - : [] - ) { - if (seenPorts.has(dep.manifest.name)) { - continue; - } - defaultBuildDepsSet.push(dep); - } - if (args.defaultBaseEnv) { - builder.addEnv(args.defaultBaseEnv, { - allowedBuildDeps: defaultBuildDepsSet, - }); - } else { - mainEnv.allowedBuildDeps(...defaultBuildDepsSet); - } - }; + function setupMainEnv() { + return builder.addEnv(DEFAULT_BASE_ENV_NAME, { + name: DEFAULT_BASE_ENV_NAME, + inherit: args.defaultBaseEnv && args.defaultBaseEnv != DEFAULT_BASE_ENV_NAME + ? args.defaultBaseEnv + : false, + installs: args.installs, + desc: "the default default environment.", + }); + } + + function replaceDefaultBuildDeps(args: SecureConfigArgs) { + defaultBuildDepsSet.length = 0; + defaultBuildDepsSet.push( + ...reduceAllowedDeps(args.allowedBuildDeps ?? []), + ); + const seenPorts = new Set( + defaultBuildDepsSet.map((dep) => dep.manifest.name), + ); + for ( + const dep of args.stdDeps !== false + ? stdDeps({ enableRuntimes: args.enableRuntimes ?? false }) + : [] + ) { + if (seenPorts.has(dep.manifest.name)) { + continue; + } + defaultBuildDepsSet.push(dep); + } + if (args.defaultBaseEnv) { + builder.addEnv(args.defaultBaseEnv, { + allowedBuildDeps: defaultBuildDepsSet, + }); + } else { + mainEnv.allowedBuildDeps(...defaultBuildDepsSet); + } + } + + const mainEnv = setupMainEnv(); + replaceDefaultBuildDeps(args);modules/ports/mod.ts (1)
Line range hint
132-140
: Convert function expressions to arrow functions where appropriate to improve readability and reduce verbosity.- function (args) { + (args) => {Also applies to: 266-268
modules/envs/posix.ts (1)
Line range hint
324-374
: The array contains an empty slot, which can lead to unexpected behavior or errors in runtime.- ...onEnterHooksEscaped.map((line) => ` ${line}`), + ...onEnterHooksEscaped.map((line) => ` ${line}`), // Ensure no empty slotsEnsure that no empty slots are present in the array.
host/mod.ts (3)
22-23
: Add documentation for the new flagsreFlagSet
andlockedFlagSet
.It would be beneficial for maintainability to add comments explaining the purpose of these flags both in the
CliArgs
andHostCtx
structures.Also applies to: 29-30
310-314
: Add logging for hash file changes.It would be useful to add debug logging here to trace when hash files are being written, which can help in understanding the flow of data and debugging.
Line range hint
328-352
: Ensure proper handling of lockfile updates.Consider adding more robust checks or a transaction mechanism to ensure that the lockfile updates are atomic and consistent, especially in environments where multiple instances might be accessing the file simultaneously.
modules/ports/sync.ts (2)
51-51
: Clarify the purpose ofSyncCtx
with additional documentation.Adding a brief comment describing the
SyncCtx
type's role would enhance code readability and maintainability.
275-275
: Document the structure ofInstallGraph
.It would be helpful to document the
InstallGraph
type, explaining its components and their interactions, especially since it seems central to the installation logic.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
deno.lock
is excluded by!**/*.lock
Files selected for processing (43)
- .ghjk/deno.lock (1 hunks)
- .ghjk/lock.json (7 hunks)
- .github/workflows/tests.yml (1 hunks)
- deps/cli.ts (1 hunks)
- deps/common.ts (1 hunks)
- examples/kitchen/ghjk.ts (3 hunks)
- files/deno/worker.ts (2 hunks)
- files/mod.ts (26 hunks)
- ghjk.ts (2 hunks)
- host/mod.ts (10 hunks)
- host/types.ts (1 hunks)
- install/hook.fish (3 hunks)
- install/hook.sh (1 hunks)
- main.ts (1 hunks)
- mod.ts (7 hunks)
- modules/envs/inter.ts (1 hunks)
- modules/envs/mod.ts (13 hunks)
- modules/envs/posix.ts (7 hunks)
- modules/envs/types.ts (3 hunks)
- modules/ports/inter.ts (1 hunks)
- modules/ports/mod.ts (9 hunks)
- modules/ports/sync.ts (7 hunks)
- modules/ports/types.ts (3 hunks)
- modules/tasks/deno.ts (2 hunks)
- modules/tasks/exec.ts (5 hunks)
- modules/tasks/inter.ts (1 hunks)
- modules/tasks/mod.ts (2 hunks)
- modules/tasks/types.ts (2 hunks)
- modules/types.ts (2 hunks)
- ports/act.ts (2 hunks)
- ports/cargo-binstall.ts (1 hunks)
- ports/deno_ghrel.ts (1 hunks)
- ports/mod.ts (1 hunks)
- ports/temporal_cli.ts (2 hunks)
- tests/envHooks.ts (1 hunks)
- tests/envs.ts (2 hunks)
- tests/ports.ts (2 hunks)
- tests/portsOutdated.ts (2 hunks)
- tests/reloadHooks.ts (2 hunks)
- tests/tasks.ts (1 hunks)
- tests/utils.ts (1 hunks)
- utils/mod.ts (6 hunks)
- utils/worker.ts (1 hunks)
Files not summarized due to errors (1)
- .ghjk/deno.lock: Error: Message exceeds token limit
Files skipped from review due to trivial changes (3)
- deps/cli.ts
- host/types.ts
- ports/mod.ts
Additional context used
Biome
tests/utils.ts
[error] 79-80: The call chain .map().flat() can be replaced with a single .flatMap() call. (lint/complexity/useFlatMap)
Safe fix: Replace the chain with .flatMap().
modules/ports/mod.ts
[error] 132-140: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 266-268: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.modules/envs/mod.ts
[error] 136-142: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 156-162: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 178-189: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 203-215: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.modules/envs/posix.ts
[error] 324-374: This array contains an empty slot. (lint/suspicious/noSparseArray)
Unsafe fix: Replace hole with undefined
host/mod.ts
[error] 121-125: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 138-144: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 150-156: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 162-168: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 180-190: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 416-417: This case is falling through to the next case. (lint/suspicious/noFallthroughSwitchClause)
Add a
break
orreturn
statement to the end of this case to prevent fallthrough.
[error] 497-499: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
modules/ports/sync.ts
[error] 813-823: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 817-823: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
files/mod.ts
[error] 255-255: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
Gitleaks
.ghjk/deno.lock
130-130: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)
Additional comments not posted (45)
ghjk.ts (1)
2-2
: Integration ofports.deno_ghrel()
appears correct and aligns with the new dependency addition mentioned in the PR.Also applies to: 18-18
modules/envs/inter.ts (1)
4-26
: The implementation ofgetEnvsCtx
function is robust and follows good practices in managing shared state using a blackboard pattern.modules/tasks/inter.ts (1)
4-25
: ThegetTasksCtx
function is well-implemented, utilizing a consistent pattern with other context management functions in the system.modules/types.ts (1)
7-7
: The addition ofenvVarName
is a thoughtful extension to the type definitions, supporting the enhanced environment and task management features introduced in this PR.Also applies to: 26-26
modules/ports/inter.ts (1)
5-16
: Well implemented context retrieval pattern using the blackboard.tests/portsOutdated.ts (1)
13-13
: Please clarify or resolve the FIXME note here.files/deno/worker.ts (1)
10-10
: Proper handling of Deno namespace modification before other operations.deps/common.ts (2)
13-13
: Revised export ofzod_val_err
aligns with the new architectural decisions as mentioned in the AI-generated summary. Ensure this change is consistently reflected in all files that usezod_val_err
.
5-13
: Ensure that all dependencies are appropriately used in the project to prevent any potential issues due to unused imports.ports/deno_ghrel.ts (1)
1-76
: The implementation indeno_ghrel.ts
for handling Deno-specific GitHub releases is well-structured. The use ofosXarch
and error handling in thedownloadUrls
method are particularly noteworthy. Ensure that the error messages are descriptive enough to aid in debugging..github/workflows/tests.yml (1)
47-47
: Ensure the new ARM environment is fully supported and integrated.The addition of a custom ARM environment (line 47) is a significant change. It's important to verify that all dependencies, scripts, and tools used in the tests are compatible with ARM architecture. This verification might include checking compatibility of software installed during the test, ensuring that all scripts run correctly, and that performance metrics are within expected ranges.
Verification successful
The
custom-arm
environment has been added to the matrix strategy in thetest-e2e
job. However, there are no architecture-specific configurations or dependencies that would impact the ARM environment's integration.
- The
platform
is set appropriately for ARM (linux/aarch64
).- The
e2eType
is set todocker
, which should work across different architectures as long as the Docker setup is compatible.- The steps in the
test-e2e
job do not contain any architecture-specific commands or dependencies that would fail on ARM.Thus, it appears that the addition of the
custom-arm
environment is properly integrated and should work as expected.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify ARM compatibility for all tools and scripts used in tests. # Check for any scripts or dependencies specific to architecture in the test setup rg --type yaml "script|dependency" --files-with-matches .github/workflows/tests.yml | xargs catLength of output: 97
Script:
#!/bin/bash # Description: Verify ARM compatibility by searching for architecture-specific references and commands in the CI workflow. # Display the entire content of the workflow file to manually inspect for architecture-specific configurations cat .github/workflows/tests.yml # Search for any usage of the 'custom-arm' environment in the workflow file rg 'custom-arm' .github/workflows/tests.ymlLength of output: 2502
modules/tasks/types.ts (1)
16-16
: Validate the implications of making theenv
field optional and introducingenvKey
.The changes to the task definition types (lines 16 and 20) could have significant implications on how tasks are configured and validated. It's crucial to ensure that these changes do not introduce any inconsistencies or unexpected behaviors in task configurations. Consider verifying the integration and behavior of these new fields with existing task setups.
Also applies to: 20-20
Verification successful
The results show that the
env
field has been made optional and theenvKey
field has been introduced and integrated into the task definitions and execution flow. The integration appears to be consistent, as theenvKey
is used in the task execution process to fetch and cook the environment configurations.
- The
env
field being optional is handled appropriately in thetaskDefFullBase
schema.- The
envKey
field is correctly used in the task execution flow to reference environment configurations.No inconsistencies or missing implementations related to these fields were found in the task creation and execution process.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of `env` and `envKey` fields in task configurations. # Check for any task configurations that might be impacted by the changes in validation. rg --type ts "taskDef" --files-with-matches modules/tasks/*.ts | xargs catLength of output: 8454
Script:
#!/bin/bash # Description: Verify task creation and modification instances for handling `env` and `envKey` fields. # Search for task creation and modification instances in the codebase. rg --type ts "taskDef" --files-with-matches | xargs cat # Check for usages of `envKey` in the codebase to ensure it is correctly integrated. rg --type ts "envKey" --files-with-matches | xargs catLength of output: 85007
modules/tasks/deno.ts (2)
11-11
: Import ofshimDenoNamespace
correctly added for environment adjustments in Deno namespace.
64-64
: Proper use ofshimDenoNamespace
to ensure the Deno namespace is correctly configured before module execution.modules/tasks/mod.ts (2)
13-13
: Import and usage ofgetTasksCtx
correctly implemented for initializing the task context.
57-82
: Enhancements to command generation provide dynamic and flexible handling of tasks based on configuration.modules/envs/types.ts (1)
38-38
: Addition ofmoduleValidators.envVarName
enhances the validation of environment variable names, ensuring configuration integrity.tests/tasks.ts (1)
154-156
: Transformation of tasks from an array to an object enhances lookup efficiency and organization in test setups.examples/kitchen/ghjk.ts (3)
99-108
: Significant changes to thepython
environment to ensure true isolation by not inheriting fromdefaultBaseEnv
. Ensure all dependencies and configurations are correctly isolated as intended.
36-47
: Refined the mechanism for specifying allowed build dependencies. Verify that the new configuration does not introduce any unexpected behaviors in build processes.Verification successful
The new configuration for specifying allowed build dependencies in
examples/kitchen/ghjk.ts
aligns with the intended behavior and does not introduce unexpected dependencies.
env("main")
configuration includesports.node({})
,ports.rust({ version: "stable" })
, andstdDeps({ enableRuntimes: true })
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new allowed build dependencies configuration is correctly used in build processes. rg --type ts "allowedBuildDeps" --files-with-matches | xargs rg --type ts "ports\..*\(\)"Length of output: 464
Script:
#!/bin/bash # Detailed inspection of the allowedBuildDeps configuration in the specific file and lines rg --type ts "allowedBuildDeps" examples/kitchen/ghjk.ts -A 5 -B 5Length of output: 1701
111-116
: Introduced the ability for environments to inherit from multiple other environments. Confirm that there are no conflicts or overrides that could affect the expected behavior.Verification successful
The extracted definitions show that the
main
environment sets a variable (RUST_LOG
), installs a program (jq_ghrel
), and allows certain build dependencies (node
). Thepython
environment installs a specific version of Python and allows it as a build dependency. There are no direct conflicts between these definitions.
main
environment:
- Sets
RUST_LOG
variable.- Installs
jq_ghrel
.- Allows
node
as a build dependency.
python
environment:
- Installs Python 3.8.18.
- Allows Python 3.8.18 as a build dependency.
No conflicts or overrides were found that could affect the expected behavior of the
dev
environment.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the multiple inheritance in the `dev` environment is handled correctly without conflicts. rg --type ts "env\(\"dev\"\)" --files-with-matches | xargs rg --type ts "\.inherit"Length of output: 132
Script:
#!/bin/bash # Description: Search for variable and build dependency definitions in the `main` and `python` environments to check for conflicts. rg --type ts 'env\("main"\)' --files-with-matches | xargs rg --type ts 'set\(|build\(' rg --type ts 'env\("python"\)' --files-with-matches | xargs rg --type ts 'set\(|build\('Length of output: 179
Script:
#!/bin/bash # Description: Search for all environment configurations and their properties in the `main` and `python` environments to check for conflicts. rg --type ts 'env\("main"\)' --files-with-matches | xargs rg --type ts 'env\(' rg --type ts 'env\("python"\)' --files-with-matches | xargs rg --type ts 'env\('Length of output: 515
Script:
#!/bin/bash # Description: Extract the complete definitions of the `main` and `python` environments to check for conflicts. rg --type ts 'env\("main"\)' --files-with-matches | xargs rg -A 10 'env\("main"' rg --type ts 'env\("python"\)' --files-with-matches | xargs rg -A 10 'env\("python"'Length of output: 1849
install/hook.sh (1)
99-103
: Improved handling of environment variables when switching directories. Ensure that this change does not interfere with environment persistence across sessions.Verification successful
The change to unset
GHJK_ENV
when switching directories does not interfere with environment persistence across sessions, as there is no mechanism for persistingGHJK_ENV
in the script.
install/hook.sh
: The unset command forGHJK_ENV
and its usage.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the environment variable handling does not interfere with persistence. rg --type sh "GHJK_ENV" --files-with-matches | xargs rg --type sh "unset"Length of output: 173
Script:
#!/bin/bash # Find where GHJK_ENV is set rg --type sh "GHJK_ENV=" # Check the usage of GHJK_ENV throughout the script rg --type sh "GHJK_ENV" # Look for any persistence mechanisms for GHJK_ENV rg --type sh "save" | xargs rg --type sh "GHJK_ENV"Length of output: 580
install/hook.fish (1)
16-18
: Enhanced handling ofGHJK_ENV
when switching directories in Fish shell. Confirm that this logic aligns with the behavior in other shell environments to maintain consistency.Verification successful
To ensure consistency in handling
GHJK_ENV
across different shell scripts, let's gather detailed information on howGHJK_ENV
is managed in the Fish script (install/hook.fish
) and the corresponding logic in other shell scripts.
The review comment's concern about the consistency of
GHJK_ENV
handling across different shell environments is valid. The gathered information shows:
- In
install/hook.fish
,GHJK_ENV
is set conditionally and ignored when switching directories.- In
install/hook.sh
,GHJK_ENV
is also conditionally set, and it is explicitly unset when switching directories.Both scripts handle
GHJK_ENV
similarly, ensuring that it is ignored or unset when switching directories, maintaining consistency across shell environments.
install/hook.fish
test -z $next_env; and set next_env "$GHJK_ENV" # we ignore previously loaded GHJK_ENV when switching
install/hook.sh
next_env="${1:-${GHJK_ENV:-default}}"; # we ignore previously loaded GHJK_ENV when switching unset GHJK_ENVHence, the logic aligns well across the scripts.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Compare the handling of `GHJK_ENV` in different shell scripts to ensure consistency. rg --type sh "GHJK_ENV" --files-with-matches | xargs rg --type sh "unset"Length of output: 173
Script:
#!/bin/bash # Description: Gather detailed information on handling `GHJK_ENV` in Fish and other shell scripts. # Search for the handling of `GHJK_ENV` in the Fish script rg --type fish "GHJK_ENV" install/hook.fish # Search for the handling of `GHJK_ENV` in other shell scripts rg --type sh "GHJK_ENV" install/hook.shLength of output: 418
tests/reloadHooks.ts (1)
Line range hint
43-77
: Review the use of environment variable checks and dummy commands in test scripts.Verification successful
The search results indicate that the
DUMMY_ENV
anddummy
commands are used extensively throughout the test scripts, including the filetests/reloadHooks.ts
. The checks for environment variables and the usage of thedummy
command appear to be correctly implemented as per the review comment.
- The environment variable
DUMMY_ENV
is checked multiple times using different methods (e.g.,[ "\${DUMMY_ENV:-}" = "dummy" ]
).- The
dummy
command is invoked and checked to ensure it behaves as expected.These findings align with the review comment's focus on verifying the correct usage of environment variable checks and dummy commands.
However, the extensive usage across multiple files suggests a thorough review might be necessary to ensure all instances are correctly implemented. Since the verification script results align with the review comment, no immediate issues are found in the provided snippet.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the environment variable and dummy command checks are correctly implemented in the test scripts. # Test: Search for usage of `DUMMY_ENV` and `dummy` in test scripts. Expect: Correct checks and command usage. rg --type bash $'DUMMY_ENV|dummy'Length of output: 63
Script:
#!/bin/bash # Description: Verify that the environment variable and dummy command checks are correctly implemented in the test scripts. # Test: Search for usage of `DUMMY_ENV` and `dummy` in all files. Expect: Correct checks and command usage. rg 'DUMMY_ENV|dummy'Length of output: 2695
tests/ports.ts (1)
113-117
: Added test case for Deno port appears correctly implemented.Ensure that the
deno --version
command is available and functions as expected in the testing environment.modules/tasks/exec.ts (1)
Line range hint
119-163
: Review the task execution logic for handling Deno file tasks.Verification successful
The implementation of
execTaskDeno
has been successfully retrieved. Here is the relevant function:export async function execTaskDeno( moduleUri: string, args: ExecTaskArgs, ) { const resp = await rpc(moduleUri, { ty: "exec", uri: moduleUri, args, }); if (resp.ty != "exec") { throw new Error(`invalid response type: ${resp.ty}`); } }This function sends an RPC request to execute a task and checks the response type to ensure it matches the expected "exec" type. If the response type is incorrect, it throws an error.
execTaskDeno
is correctly handling the execution of tasks by making an RPC call and validating the response.- Error handling is in place to catch and report invalid response types.
No issues were found with the task execution logic for handling Deno file tasks.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the task execution logic, especially for Deno file tasks. # Test: Search for usage of `execTaskDeno` and related logic. Expect: Correct implementation and error handling. rg --type typescript $'execTaskDeno'Length of output: 70
Script:
#!/bin/bash # Description: Verify the task execution logic, especially for Deno file tasks. # Test: Search for usage of `execTaskDeno` and related logic. Expect: Correct implementation and error handling. rg --type ts 'execTaskDeno'Length of output: 197
Script:
#!/bin/bash # Description: Retrieve the implementation of `execTaskDeno` to verify its logic. # Extract the implementation of `execTaskDeno` from modules/tasks/deno.ts ast-grep --lang typescript --pattern $'export async function execTaskDeno($_) { $$$ }'Length of output: 89
Script:
#!/bin/bash # Description: Retrieve the implementation of `execTaskDeno` to verify its logic. # Extract the implementation of `execTaskDeno` from modules/tasks/deno.ts ast-grep --lang typescript --pattern $'export async function execTaskDeno($_) { $$$ }' modules/tasks/deno.tsLength of output: 111
Script:
#!/bin/bash # Description: Retrieve the implementation of `execTaskDeno` to verify its logic. # Directly search for the function implementation in modules/tasks/deno.ts rg 'export async function execTaskDeno' modules/tasks/deno.ts -A 20Length of output: 333
mod.ts (1)
92-92
: Ensure tasks are properly typed and documented, especially since they now use aRecord
structure.Verification successful
The search results show multiple references to
tasks
across various files. To ensure that the newRecord
structure is properly implemented and used, we need to verify a few key points:
- Definition Consistency: Ensure that
tasks
is consistently defined asRecord<string, DenoTaskDefArgs>
where applicable.- Usage Alignment: Verify that the usage of
tasks
aligns with the new structure, especially in object manipulations and function arguments.Let's generate a script to check the definitions and usages in detail.
The search results confirm that the
tasks
property is defined usingRecord<string, DenoTaskDefArgs>
and its usage in object manipulations aligns with the new structure. Specifically:
- Definition Consistency: The
tasks
property is defined asRecord<string, DenoTaskDefArgs>
inmod.ts
.- Usage Alignment: The usage of
tasks
in object manipulations (e.g.,Object.entries(args.tasks ?? {})
) is consistent with the new structure.No further issues were found based on the provided context and the verification scripts.
mod.ts
:tasks
is defined and used correctly.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `tasks` throughout the application to ensure they align with the new `Record` structure. # Test: Search for task usage. Expect: Proper handling of the new structure. rg --type ts $'tasks'Length of output: 5386
Script:
#!/bin/bash # Description: Verify the consistency of `tasks` definition and its usage alignment with the new `Record` structure. # Check for definitions of `tasks` to ensure they use `Record<string, DenoTaskDefArgs>` rg --type ts 'tasks\?: Record<string, DenoTaskDefArgs>' # Check for object manipulations and function arguments involving `tasks` rg --type ts 'Object\.entries\(\s*args\.tasks' -A 3 rg --type ts 'Object\.entries\(\s*moduleConfig\.tasks' -A 3 rg --type ts 'Object\.fromEntries\(\s*this\.\#tasks' -A 3Length of output: 685
tests/envs.ts (1)
244-260
: Ensure task inheritance is thoroughly tested, especially where tasks inherit environment variables.Verification successful
To proceed, we need to extract and analyze the specific test cases in
tests/envs.ts
that involve task inheritance. This will help us determine if the inheritance of environment variables and other properties is thoroughly tested.
The extracted test cases from
tests/envs.ts
confirm that task inheritance, including the inheritance of environment variables, is thoroughly tested. Here are the relevant sections:
- env_inherit_from_envs: Tests inheritance of environment variables from one environment to another.
- task_inherit_from_envs: Tests inheritance of environment variables from an environment to a task.
- env_inherit_from_tasks: Tests inheritance of environment variables from a task to an environment.
- task_inherit_from_task: Tests inheritance of environment variables from one task to another.
- inheritance_diamond: Tests complex inheritance scenarios involving multiple environments.
These test cases cover various scenarios, ensuring that task inheritance is correctly implemented and verified.
env_inherit_from_envs
:{ name: "env_inherit_from_envs", ePoint: "fish", envs: [], secureConfig: { defaultEnv: "e1", envs: [ { name: "e1", inherit: "e2" }, { name: "e2", vars: { HEY: "hello" }, }, ], }, stdin: ` test "$GHJK_ENV" = "e1"; or exit 101 test "$HEY" = "hello"; or exit 102 `, }
task_inherit_from_envs
:{ name: "task_inherit_from_envs", ePoint: "fish", envs: [], secureConfig: { envs: [{ name: "e1", vars: { HEY: "hello" } }], tasks: { t1: { inherit: "e1", fn: ($) => $`echo $HEY` } }, }, stdin: ` set fish_trace 1 test (ghjk x t1) = "hello"; or exit 102 `, }
env_inherit_from_tasks
:{ name: "env_inherit_from_tasks", ePoint: "fish", envs: [], secureConfig: { defaultEnv: "e1", envs: [{ name: "e1", inherit: "t1" }], tasks: { t1: { vars: { HEY: "hello" } } }, }, stdin: ` set fish_trace 1 test "$GHJK_ENV" = "e1"; or exit 101 test "$HEY" = "hello"; or exit 102 `, }
task_inherit_from_task
:{ name: "task_inherit_from_task", ePoint: "fish", envs: [], secureConfig: { tasks: { t1: { vars: { HEY: "hello" }, fn: ($) => $`echo fake` }, t2: { inherit: "t1", fn: ($) => $`echo $HEY`, }, }, }, stdin: ` set fish_trace 1 test (ghjk x t2) = "hello"; or exit 102 `, }
inheritance_diamond
:{ name: "inheritance_diamond", ePoint: "fish", envs: [ { name: "e1", vars: { E1: "1" }, installs: [dummy({ output: "e1" })] }, { name: "e2", inherit: "e1", vars: { E2: "2" }, }, { name: "e3", inherit: "e1", vars: { E3: "3" }, }, { name: "e4", inherit: ["e2", "e3"], vars: { E4: "4" }, }, ], stdin: ` set fish_trace 1 test "$E1" = "1"; or exit 101 test "$E2" = "2"; or exit 102 test "$E3" = "3"; or exit 103 test "$E4" = "4"; or exit 104 test (dummy) = "e1"; or exit 105 `, }These test cases demonstrate that the task inheritance feature is well-covered and verified.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that task inheritance is correctly implemented and covered by tests. # Test: Search for task inheritance implementation and test coverage. rg --type ts $'inherit'Length of output: 3568
Script:
#!/bin/bash # Extract and display the relevant test cases from tests/envs.ts that involve task inheritance. rg --context 5 'inherit' tests/envs.tsLength of output: 3618
modules/envs/mod.ts (3)
15-23
: Refactored imports and function usage from../ports/inter.ts
improve modularity by separating concerns.
21-22
: Integration ofgetTasksCtx
from../tasks/inter.ts
allows task context to be fetched, enhancing the functionality of environment commands.
112-119
: The filtering and mapping logic to exclude environments starting with underscores is clear and effective. This is a good use of chaining array methods for concise data processing.modules/envs/posix.ts (2)
16-19
: The functioncookPosixEnv
now explicitly requiresenvKey
andenvDir
parameters, which enhances clarity and ensures that the environment is correctly specified for cooking.
42-42
: Explicitly settingGHJK_ENV
in the environment variables map is a good practice to ensure that the environment is correctly recognized across different parts of the application.utils/mod.ts (2)
12-12
: Addingzod_val_err
to the imports in this file extends the error handling capabilities by utilizing validation error formatting from Zod.
183-183
: The use oflogger().debug
indefaultCommandBuilder
provides detailed logging for command execution, which is useful for debugging and ensuring command processes are clear..ghjk/lock.json (3)
73-76
: Addition ofdeno_ghrel
dependency.The addition of the
deno_ghrel
dependency is noted. Please ensure that all necessary documentation and usage examples are updated accordingly to reflect this change.
21-21
: Version downgrades fortar_aa
andzstd_aa
need justification.Please provide a rationale for downgrading these dependencies. This is crucial to ensure that there are no regressions or loss of features that might affect the stability or security of the system.
Also applies to: 27-27, 45-45, 51-51, 61-61, 67-67
97-98
: Configuration changes in theconfig
section.Configuration changes have been made in the
config
section, including updates to installation sets and environment provisions. Please verify that these changes align with the intended system architecture and do not introduce configuration drift.Also applies to: 100-101, 103-104, 120-126, 128-141
host/mod.ts (2)
36-39
: Ensure that both flagsGHJK_LOCKED
andGHJK_RE
cannot be set simultaneously.The logic to prevent both
GHJK_LOCKED
andGHJK_RE
from being set at the same time is correctly implemented.
Line range hint
222-243
: Validate module entries during lockfile processing.
[REFACTOR_SUGGESTion]
Consider adding validation for the structure and contents offoundLockObj.config.modules
before processing to ensure data integrity.files/mod.ts (5)
7-7
: The addition of imports fordeep_eql
,multibase32
,multibase64
, andzod
supports the enhanced validation and encoding functionalities introduced in this update.
Line range hint
54-106
: The updated type definitions forEnvParent
,EnvDefArgs
,TaskFnArgs
,TaskFn
, andTaskDefArgs
effectively support the new functionalities around environment inheritance and task configurations.
Line range hint
136-501
: The modifications in theGhjkfile
class methods such asaddInstall
,setAllowedPortDeps
,addTask
, andaddEnv
enhance the management of installations, dependencies, tasks, and environments, aligning well with the PR's objectives.
387-501
: The implementation of new functionalities for handling environment variable conflicts (#mergeEnvs
) and task execution (execTask
) is robust and aligns with the enhanced capabilities described in the PR.Also applies to: 295-306
Line range hint
5-1093
: Overall, the changes infiles/mod.ts
are well-integrated and enhance the project's functionality regarding environment and task management. The code is well-structured and follows best practices in software development.
* 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]>
Describe your change
ghjk envs ls
deno_ghrel
port$GHJK_RE
env var will force ghjk recreate lockfile$GHJK_LOCKED
env var will force ghjk to avoid re-serialization/use lockfileMotivation and context
MET-347
Migration notes
task
field on the object argument to thefile
function now takes an object instead of an array.allowedBuildDeps
builder function for envs now takes varargs instead of an array..ghjk/lock.json
Checklist
Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Chores
Enhancements