Skip to content

Fix linting and add docstrings#7

Merged
Fcmam5 merged 2 commits intomasterfrom
fix/fix-linting-and-add-docstrings
Apr 5, 2026
Merged

Fix linting and add docstrings#7
Fcmam5 merged 2 commits intomasterfrom
fix/fix-linting-and-add-docstrings

Conversation

@Fcmam5
Copy link
Copy Markdown
Owner

@Fcmam5 Fcmam5 commented Apr 5, 2026

Summary by CodeRabbit

  • New Features

    • Added programmatic API entry points and package exports
    • Added TypeDoc config for generated API docs
    • Published new npm script: lint:fix
  • Documentation

    • Clarified README install/update semantics and added programmatic usage section
    • Expanded code and command docs (JSDoc) and added API documentation config
    • Improved GitHub issue/PR templates and minor docs/SECURITY/Code of Conduct tweaks
  • Chores

    • Reformatted config/IDE files, .gitignore, and workflow YAMLs
    • Tightened TypeScript test typings and minor formatting fixes

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 5, 2026

📝 Walkthrough

Walkthrough

The PR adds a public library entry point (src/index.ts), updates packaging (package.json exports/main/types), adds TypeDoc config, introduces lockfile reconciliation types/behavior, tweaks cache-key computation and parameter naming, and adds extensive JSDoc and minor formatting fixes across config, workflows, docs, and tests.

Changes

Cohort / File(s) Summary
GitHub templates & workflows
.github/FUNDING.yml, .github/ISSUE_TEMPLATE/bug_report.md, .github/ISSUE_TEMPLATE/feature_request.md, .github/PULL_REQUEST_TEMPLATE.md, .github/workflows/codeql.yaml, .github/workflows/release.yml
Whitespace, quoting, and YAML/markdown spacing normalizations; CI step/indentation reformat in CodeQL workflow.
Packaging & docs tooling
package.json, typedoc.json, tsconfig.json, .gitignore, .vscode/settings.json
Added package main/types/exports, typedoc config (docs/api), lint/docs scripts, minor formatting/newline and ignore-rule updates.
Public API entry
src/index.ts
New library entry exporting environment factory, commands, core modules, repo/config helpers, errors, and domain types.
Lockfile & config logic
src/core/lock.ts, src/core/config.ts
Introduced ReconcileLockfileResult and related helpers (pruneLockfile, reconcileLockfile); schemaUrl() now uses main for prerelease versions. Review lock reconciliation semantics and returned metadata.
Adapters & cache
src/adapters/git.ts
Cache path computation changed to path.join(this.cacheRoot, repoCacheKey(repo)) (import adjusted). Verify cache-root usage.
Resolver rename & refs
src/core/resolve.ts, src/core/git-ref-resolver.ts
Renamed injected ref-resolver field to refResolver and added JSDoc for ref resolution. Ensure references updated accordingly.
Type signature tidying
src/core/types.ts, src/commands/types.ts
Interface parameter names changed to underscore-prefixed identifiers; JSDoc added for command types. (No runtime signature changes.)
Commands & core JSDoc
src/commands/..., src/core/... (many files)
Extensive JSDoc additions across commands (add, install, update, list, audit) and core modules (filesystem, errors, logger, manifest, install, parse, repos, validate). Mostly documentation-only changes.
ESLint config
eslint.config.cjs
Switched to typescript-eslint recommended config spread, adjusted parser/globals, replaced core no-unused-vars with @typescript-eslint/no-unused-vars, and added a config-file override.
Tests — stricter typing
tests/... (tests/commands.*.test.ts, tests/describe.test.ts, tests/flow.test.ts, tests/git-ref-resolver.test.ts)
Tightened mock typing from as any to as unknown as SkilletonEnvironment[...] / constructor-parameter-based casts; no runtime behavior changes.
Docs & minor formatting
README.md, CODE_OF_CONDUCT.md, SECURITY.md
README clarifies install/update semantics and programmatic usage; minor markdown spacing and table separator changes; contact spacing adjusted.
Tooling — TypeDoc & eslint scripts
typedoc.json, package.json, eslint.config.cjs
Added typedoc config and scripts, pinned typedoc devDependency, and updated lint config and scripts for fixability.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hopping through exports, docs, and more,

I packaged the functions behind the door.
With lockfiles tidy and schemas in sight,
I stitched the API neat and bright.
✨ — Happy coding from a little rabbit!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 65.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Fix linting and add docstrings' accurately reflects the primary changes across the entire changeset, which include formatting fixes, trailing newlines, quote style adjustments, and comprehensive documentation additions throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fix-linting-and-add-docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@Fcmam5 Fcmam5 force-pushed the fix/fix-linting-and-add-docstrings branch from 361c3bb to cbb3ab5 Compare April 5, 2026 05:29
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (7)
src/core/git-ref-resolver.ts (1)

14-24: Constructor parameter docs on class JSDoc.

The @param tags for gitBinary and run are placed on the class-level JSDoc rather than on the constructor. While TypeDoc handles this, the conventional placement is on the constructor itself:

 /**
  * Resolves Git refs (branches, tags, SHAs) to full commit SHAs using `git ls-remote`.
  * Supports both full and short SHA prefixes.
- * `@param` gitBinary The git binary to use (default: 'git')
- * `@param` run The execa runner to use (default: defaultRunner)
  */
 export class GitRefResolver {
+  /**
+   * `@param` _gitBinary The git binary to use (default: 'git')
+   * `@param` _run The execa runner to use (default: defaultRunner)
+   */
   constructor(

This is a minor style nit; current placement works fine with TypeDoc.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/core/git-ref-resolver.ts` around lines 14 - 24, Move the `@param` JSDoc
tags from the class-level comment to the constructor JSDoc for GitRefResolver:
add a brief JSDoc block immediately above the constructor describing parameters
_gitBinary (string, default 'git') and _run (ExecaRunner, defaultRunner) so the
constructor—not the class—documents its parameters; reference the constructor
signature (private readonly _gitBinary: string = 'git', private readonly _run:
ExecaRunner = defaultRunner) and keep the class-level JSDoc for the general
description only.
tests/git-ref-resolver.test.ts (1)

22-24: Redundant cast on conforming object literal.

The object { stdout: '...' } already matches the { stdout: string } type, making the as unknown as { stdout: string } cast unnecessary. This applies to lines 24, 40, and 48.

That said, if this is intentional for consistency with other test files in this PR, it's a minor style choice.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/git-ref-resolver.test.ts` around lines 22 - 24, Remove the unnecessary
double-cast on the mock resolved values: the object literal passed to
mockRunner.mockResolvedValue already matches the { stdout: string } shape, so
delete the "as unknown as { stdout: string }" wrappers for the calls to
mockRunner.mockResolvedValue (the instances creating { stdout: '...'} in
tests/git-ref-resolver.test.ts) — leave the plain object literal (e.g., {
stdout: 'abc123...' }) to keep the test types correct and cleaner.
src/commands/types.ts (1)

16-16: Underscore prefix unusual for interface method signatures.

The _env and _args naming convention is typically used for unused parameters in implementations to suppress linter warnings. In interface definitions, all parameters are inherently "unused" (they're just type signatures), so this convention doesn't serve the same purpose and may confuse implementers.

Consider using plain parameter names in the interface:

-  run(_env: SkilletonEnvironment, _args: CommandArgs): Promise<void>;
+  run(env: SkilletonEnvironment, args: CommandArgs): Promise<void>;

If your linter requires this, it may need configuration adjustment for interface definitions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/commands/types.ts` at line 16, In the Command interface method signature,
remove the leading underscores from the parameter names so the declaration reads
run(env: SkilletonEnvironment, args: CommandArgs): Promise<void>; — update the
signature for function run and types SkilletonEnvironment / CommandArgs in
src/commands/types.ts (the interface declaration) to use plain parameter names
(env, args) rather than _env and _args to avoid misleading unused-parameter
convention.
src/core/config.ts (1)

48-51: Schema URL ties manifests to the exact package version.

The schemaUrl() function embeds packageJson.version into the schema URL. Per the relevant snippet in src/core/manifest.ts, this URL is written to user manifests when $schema is missing. During development or pre-release versions (e.g., 0.2.0-beta.1), this could produce URLs pointing to non-existent tags.

Consider whether this behavior is intentional, or if you want to pin to a stable schema URL or validate that the version tag exists.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/core/config.ts` around lines 48 - 51, The schemaUrl() function currently
embeds packageJson.version into the GitHub raw URL which can point to
non-existent tags for pre-releases; update schemaUrl (and the manifest-writing
path in manifest.ts) to avoid emitting non-existent-version URLs by either: 1)
returning a stable URL (e.g., pin to "main" or a "latest" non-versioned path)
for prerelease versions, or 2) validating that the tag v{packageJson.version}
exists (via a lightweight HEAD request to the raw URL or GitHub tags API) and
falling back to a stable URL when it does not; implement the check inside
schemaUrl() (or call a helper like isVersionTagged()) so manifest.ts uses the
safe URL.
src/core/resolve.ts (1)

13-13: Underscore prefix on used parameter is misleading.

The _refResolver underscore prefix typically indicates an intentionally unused parameter (common in TypeScript for interface compliance). However, this parameter is actively used on line 39. Consider removing the underscore prefix to follow conventional naming.

Suggested fix
-  constructor(private readonly _refResolver: GitRefResolver) {}
+  constructor(private readonly refResolver: GitRefResolver) {}

And update line 39:

-      const commit = await this._refResolver.resolve(descriptor.repo, descriptor.ref);
+      const commit = await this.refResolver.resolve(descriptor.repo, descriptor.ref);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/core/resolve.ts` at line 13, The constructor parameter _refResolver is
misleadingly underscored despite being used; rename the parameter to refResolver
and update all references inside the class (e.g., change this._refResolver to
this.refResolver, including the usage in resolveBranch/resolveCommit or the
method at the former line 39) so naming follows conventions and avoids implying
the parameter is unused.
src/index.ts (1)

23-29: Export ReconcileLockfileResult from the root API.

Since reconcileLockfile is public, exporting its result type from the same root entrypoint improves consumer ergonomics and keeps the API surface complete.

♻️ Proposed export addition
 export {
   serializeLockfile,
   getChangedSkills,
   pruneLockfile,
   reconcileLockfile,
 } from './core/lock';
+export type { ReconcileLockfileResult } from './core/lock';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/index.ts` around lines 23 - 29, Add and re-export the public result type
from the root API so consumers can import it alongside reconcileLockfile;
specifically, export ReconcileLockfileResult from the same module that currently
exports reconcileLockfile (the index exports for serializeLockfile,
getChangedSkills, pruneLockfile, reconcileLockfile) — update the export list to
include ReconcileLockfileResult (ensuring the type is imported/available from
the ./core/lock module) so the root entrypoint re-exports it.
eslint.config.cjs (1)

10-17: Change sourceType: 'commonjs' to sourceType: 'module' for TypeScript files.

The codebase uses ES module syntax (import/export) throughout, but the ESLint configuration parses TypeScript files as CommonJS. This mismatch can cause parser behavior issues and incorrect lint results.

Configuration fix
   parserOptions: {
     ecmaVersion: 'latest',
-    sourceType: 'commonjs',
+    sourceType: 'module',
   },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@eslint.config.cjs` around lines 10 - 17, The ESLint config parses TypeScript
files as CommonJS; change languageOptions.parserOptions.sourceType from
'commonjs' to 'module' for the TypeScript file pattern (files: ['**/*.ts']) so
the parser (tseslint.parser) correctly handles import/export syntax; update the
sourceType value in the languageOptions block accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.gitignore:
- Around line 8-9: Remove the redundant .skilleton entry from the .gitignore so
it only appears once; locate the duplicate ".skilleton" line in the file and
delete that second occurrence, leaving the original ignore entry intact (ensure
other entries like "docs/api" remain unchanged).

---

Nitpick comments:
In `@eslint.config.cjs`:
- Around line 10-17: The ESLint config parses TypeScript files as CommonJS;
change languageOptions.parserOptions.sourceType from 'commonjs' to 'module' for
the TypeScript file pattern (files: ['**/*.ts']) so the parser (tseslint.parser)
correctly handles import/export syntax; update the sourceType value in the
languageOptions block accordingly.

In `@src/commands/types.ts`:
- Line 16: In the Command interface method signature, remove the leading
underscores from the parameter names so the declaration reads run(env:
SkilletonEnvironment, args: CommandArgs): Promise<void>; — update the signature
for function run and types SkilletonEnvironment / CommandArgs in
src/commands/types.ts (the interface declaration) to use plain parameter names
(env, args) rather than _env and _args to avoid misleading unused-parameter
convention.

In `@src/core/config.ts`:
- Around line 48-51: The schemaUrl() function currently embeds
packageJson.version into the GitHub raw URL which can point to non-existent tags
for pre-releases; update schemaUrl (and the manifest-writing path in
manifest.ts) to avoid emitting non-existent-version URLs by either: 1) returning
a stable URL (e.g., pin to "main" or a "latest" non-versioned path) for
prerelease versions, or 2) validating that the tag v{packageJson.version} exists
(via a lightweight HEAD request to the raw URL or GitHub tags API) and falling
back to a stable URL when it does not; implement the check inside schemaUrl()
(or call a helper like isVersionTagged()) so manifest.ts uses the safe URL.

In `@src/core/git-ref-resolver.ts`:
- Around line 14-24: Move the `@param` JSDoc tags from the class-level comment to
the constructor JSDoc for GitRefResolver: add a brief JSDoc block immediately
above the constructor describing parameters _gitBinary (string, default 'git')
and _run (ExecaRunner, defaultRunner) so the constructor—not the class—documents
its parameters; reference the constructor signature (private readonly
_gitBinary: string = 'git', private readonly _run: ExecaRunner = defaultRunner)
and keep the class-level JSDoc for the general description only.

In `@src/core/resolve.ts`:
- Line 13: The constructor parameter _refResolver is misleadingly underscored
despite being used; rename the parameter to refResolver and update all
references inside the class (e.g., change this._refResolver to this.refResolver,
including the usage in resolveBranch/resolveCommit or the method at the former
line 39) so naming follows conventions and avoids implying the parameter is
unused.

In `@src/index.ts`:
- Around line 23-29: Add and re-export the public result type from the root API
so consumers can import it alongside reconcileLockfile; specifically, export
ReconcileLockfileResult from the same module that currently exports
reconcileLockfile (the index exports for serializeLockfile, getChangedSkills,
pruneLockfile, reconcileLockfile) — update the export list to include
ReconcileLockfileResult (ensuring the type is imported/available from the
./core/lock module) so the root entrypoint re-exports it.

In `@tests/git-ref-resolver.test.ts`:
- Around line 22-24: Remove the unnecessary double-cast on the mock resolved
values: the object literal passed to mockRunner.mockResolvedValue already
matches the { stdout: string } shape, so delete the "as unknown as { stdout:
string }" wrappers for the calls to mockRunner.mockResolvedValue (the instances
creating { stdout: '...'} in tests/git-ref-resolver.test.ts) — leave the plain
object literal (e.g., { stdout: 'abc123...' }) to keep the test types correct
and cleaner.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62e9b5a7-36c9-4913-82ba-be443a3da942

📥 Commits

Reviewing files that changed from the base of the PR and between 31479bf and cbb3ab5.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (43)
  • .github/FUNDING.yml
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/feature_request.md
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/workflows/codeql.yaml
  • .github/workflows/release.yml
  • .gitignore
  • .vscode/settings.json
  • CODE_OF_CONDUCT.md
  • README.md
  • SECURITY.md
  • eslint.config.cjs
  • package.json
  • src/adapters/git.ts
  • src/commands/add.ts
  • src/commands/audit.ts
  • src/commands/install.ts
  • src/commands/list.ts
  • src/commands/types.ts
  • src/commands/update.ts
  • src/core/config.ts
  • src/core/errors.ts
  • src/core/filesystem.ts
  • src/core/git-ref-resolver.ts
  • src/core/install.ts
  • src/core/lock.ts
  • src/core/logger.ts
  • src/core/manifest.ts
  • src/core/parse.ts
  • src/core/repos.ts
  • src/core/resolve.ts
  • src/core/types.ts
  • src/core/validate.ts
  • src/env.ts
  • src/index.ts
  • tests/commands.add.test.ts
  • tests/commands.install.test.ts
  • tests/commands.update.test.ts
  • tests/describe.test.ts
  • tests/flow.test.ts
  • tests/git-ref-resolver.test.ts
  • tsconfig.json
  • typedoc.json
💤 Files with no reviewable changes (1)
  • .github/workflows/release.yml

Comment thread .gitignore Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
eslint.config.cjs (1)

10-22: Consider widening the TypeScript file glob for future-proof rule coverage.

Line 10 scopes this override to **/*.ts only. While the repository currently has only TypeScript files with this extension, if .tsx, .mts, or .cts files are added in the future, the no-unused-vars override won't apply to them.

♻️ Optional refactor
-    files: ['**/*.ts'],
+    files: ['**/*.{ts,tsx,mts,cts}'],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@eslint.config.cjs` around lines 10 - 22, The override's files glob currently
only matches '**/*.ts' so the TypeScript-specific rules ('no-unused-vars' and
'@typescript-eslint/no-unused-vars') won't apply to .tsx/.mts/.cts files; update
the files pattern (the files: entry in this config) to a broader glob that
includes tsx, mts, and cts (e.g., a brace or multiple patterns) so the rules
declared under rules: apply to those file types as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@eslint.config.cjs`:
- Around line 10-22: The override's files glob currently only matches '**/*.ts'
so the TypeScript-specific rules ('no-unused-vars' and
'@typescript-eslint/no-unused-vars') won't apply to .tsx/.mts/.cts files; update
the files pattern (the files: entry in this config) to a broader glob that
includes tsx, mts, and cts (e.g., a brace or multiple patterns) so the rules
declared under rules: apply to those file types as well.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: adba7a02-1baa-4c53-b6b9-26d7ae3db657

📥 Commits

Reviewing files that changed from the base of the PR and between cbb3ab5 and e4c7ef9.

📒 Files selected for processing (9)
  • .gitignore
  • eslint.config.cjs
  • src/commands/types.ts
  • src/core/config.ts
  • src/core/git-ref-resolver.ts
  • src/core/resolve.ts
  • src/index.ts
  • tests/git-ref-resolver.test.ts
  • typedoc.json
✅ Files skipped from review due to trivial changes (6)
  • src/commands/types.ts
  • typedoc.json
  • .gitignore
  • tests/git-ref-resolver.test.ts
  • src/core/git-ref-resolver.ts
  • src/index.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/core/resolve.ts
  • src/core/config.ts

@Fcmam5 Fcmam5 merged commit 5651ee3 into master Apr 5, 2026
4 checks passed
@Fcmam5 Fcmam5 deleted the fix/fix-linting-and-add-docstrings branch April 5, 2026 14:56
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.

1 participant