Skip to content

Conversation

@riddhi2910
Copy link

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Member

@purplecabbage purplecabbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits on how json arg objects are formatted, we prefer readability. ex.

RuleCreate.args = {
  name: Args.string({
    required: true,
    description: 'Name of the rule'
  }),
  trigger: Args.string({
    required: true,
    description: 'Name of the trigger'
  }),
  action: Args.string({
    required: true,
    description: 'Name of the action'
  })
}

description: 'The action to call'
}
]
ApiCreate.args = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use newlines in formatting so this can be read easier

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates the @adobe/aio-cli-plugin-runtime from @oclif/core v1 to v2. The migration involves significant changes to the CLI framework API.

Changes:

  • Updated @oclif/core dependency from v1.3.0 to v2.8.12
  • Converted args definitions from array-based to object-based syntax using Args.string()
  • Replaced deprecated CliUx.cli references with ux
  • Replaced jest-plugin-fs with a custom filesystem mock implementation
  • Updated test assertions to work with new args structure
  • Removed leading slashes from test file paths to match the custom mock filesystem
  • Updated error message assertions to match @oclif/core v2 error format

Reviewed changes

Copilot reviewed 86 out of 86 changed files in this pull request and generated 4 comments.

File Description
package.json Updated @oclif/core to v2.8.12, removed jest-plugin-fs dependency
test/jest.setup.js Implemented custom filesystem mock to replace jest-plugin-fs
src/commands/runtime/**/*.js Converted args from array to object syntax, updated imports for Args and ux
test/commands/**/*.test.js Updated test assertions for object-based args, changed test file paths, updated error message expectations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +76 to +83
readdirSync: jest.fn((path) => {
const files = []
for (const filePath in global.__mockFs) {
if (filePath.startsWith(path)) {
files.push(filePath.replace(path + '/', ''))
}
}
return files.length > 0 ? files : actualFs.readdirSync(path)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The custom mock implementation for readdirSync doesn't handle paths without trailing slashes correctly. When a path doesn't end with '/', the replace operation filePath.replace(path + '/', '') may not work as expected. Consider normalizing paths or handling edge cases where filePath equals path exactly.

Copilot uses AI. Check for mistakes.
Comment on lines +85 to +99
mkdirSync: jest.fn((path, options) => {
if (!global.__mockFs[path]) {
global.__mockFs[path] = null
}
if (options && options.recursive) {
const parts = path.split('/').filter(p => p)
let currentPath = ''
for (const part of parts) {
currentPath = currentPath ? `${currentPath}/${part}` : part
if (!global.__mockFs.hasOwnProperty(currentPath)) {
global.__mockFs[currentPath] = null
}
}
}
})
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mkdirSync mock implementation stores null for directory entries but doesn't differentiate between directories and files when checking with statSync. The statSync function always returns isDirectory: false, even for directory paths. This could cause issues if code checks whether a path is a directory.

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +75
statSync: jest.fn((path) => {
if (global.__mockFs.hasOwnProperty(path)) {
return {
isFile: () => true,
isDirectory: () => false,
size: typeof global.__mockFs[path] === 'string' ? Buffer.byteLength(global.__mockFs[path]) : global.__mockFs[path].length
}
}
return actualFs.statSync(path)
}),
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The statSync mock implementation may fail when global.__mockFs[path] is null (as set by mkdirSync for directories). Attempting to access .length property on null will cause a runtime error. Consider handling the case where content is null or undefined.

Copilot uses AI. Check for mistakes.

const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { Args } = require('@oclif/core')
// eslint-disable-next-line no-unused-vars
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The eslint-disable comment for no-unused-vars appears to be unnecessary as all imports are now being used. The Args import is actively used in the args definition. Consider removing this unused eslint-disable comment.

Suggested change
// eslint-disable-next-line no-unused-vars

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants