Skip to content
Merged

Demo #26

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
5486b56
chore: update workflow to include `demo` branch in deployment checks
gentlementlegen Jul 25, 2025
df1b7f6
chore: [skip ci] updated manifest.json and dist build
github-actions[bot] Jul 25, 2025
9ce6c01
Merge pull request #14 from gentlementlegen/demo
gentlementlegen Jul 25, 2025
8f3c72c
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jul 25, 2025
a81dbc7
chore: update dependencies to latest versions, including @ubiquity-os…
gentlementlegen Jan 1, 2026
d39d953
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 1, 2026
7cd9ddd
chore: update packages
gentlementlegen Jan 1, 2026
369eb86
chore: update packages
gentlementlegen Jan 1, 2026
d2d15a9
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 1, 2026
59639fa
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 1, 2026
a41c75e
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 1, 2026
a1e9e58
chore: update knip config and remove unused type guard
gentlementlegen Jan 2, 2026
028afaf
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 2, 2026
2755e46
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 2, 2026
239e046
test: increase timeout for main.test.ts
gentlementlegen Jan 2, 2026
3bee74a
Merge branch 'demo' into fix/demo
gentlementlegen Jan 2, 2026
448ab48
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 2, 2026
e9c4aee
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 2, 2026
206175a
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 2, 2026
c0bb39c
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 2, 2026
38c0ad4
Merge pull request #16 from ubiquity-os/fix/demo
gentlementlegen Jan 2, 2026
386a6ce
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 2, 2026
4e7df69
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 2, 2026
00917ea
chore: update dotenv and ts-node dependencies to latest versions
gentlementlegen Jan 5, 2026
9a88347
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 5, 2026
5895b6d
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 5, 2026
12e7746
fix: handle invalid GitHub credentials and fix infinite loop
gentlementlegen Jan 5, 2026
d559e45
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 5, 2026
2d7c0a9
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 5, 2026
b121378
chore: remove extra space in BAD_CREDENTIALS_MESSAGE string
gentlementlegen Jan 5, 2026
3a46bb9
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 5, 2026
3bd8c70
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 5, 2026
e20dba4
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 5, 2026
46cf247
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 5, 2026
3ee8159
Merge remote-tracking branch 'origin/demo' into fix/demo
gentlementlegen Jan 5, 2026
a26ae17
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 5, 2026
bde9c79
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 5, 2026
63252dd
chore: migrate to @swc/jest, update Jest setup, and clean up unused d…
gentlementlegen Jan 5, 2026
8942054
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 5, 2026
8a238cc
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 5, 2026
d37582f
chore: remove unused cross-env dependency from bun.lock and package.json
gentlementlegen Jan 5, 2026
c910e92
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 5, 2026
a01710c
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 5, 2026
5c7a016
Merge pull request #17 from ubiquity-os/fix/demo
gentlementlegen Jan 7, 2026
23732e3
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Jan 7, 2026
87f09f5
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Jan 7, 2026
da72f32
fix: pin manifest workflow to issue-27 deploy action
gentlementlegen Feb 10, 2026
bde0ed2
fix: sync workflow skipBotEvents and parameter metadata
gentlementlegen Feb 10, 2026
c5cf744
fix: exclude issue_comment.created from manifest listeners
gentlementlegen Feb 10, 2026
c1c5b85
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Feb 10, 2026
fa3a05d
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Feb 10, 2026
26b4c81
Update update-configuration.yml
gentlementlegen Feb 11, 2026
66be4a1
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Feb 11, 2026
51d1a47
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Feb 11, 2026
e79ee58
chore: [skip ci] update labels configuration
ubiquity-os-beta[bot] Jan 15, 2026
e056bb5
chore: [skip ci] update labels configuration
ubiquity-os-beta[bot] Jan 20, 2026
2f5158b
chore: [skip ci] update labels configuration
ubiquity-os-beta[bot] Jan 24, 2026
b2444ae
chore: [skip ci] update labels configuration
ubiquity-os-beta[bot] Jan 24, 2026
372c7fd
chore: [skip ci] update labels configuration
ubiquity-os-beta[bot] Jan 24, 2026
4857d93
Merge remote-tracking branch 'origin/development' into codex/fix/mani…
gentlementlegen Feb 11, 2026
62670c5
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Feb 11, 2026
8681352
Merge remote-tracking branch 'origin/demo' into codex/fix/manifest-bu…
gentlementlegen Feb 11, 2026
076c9e1
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Feb 11, 2026
72d3f3b
Merge remote-tracking branch 'origin/codex/fix/manifest-build-plugin-…
gentlementlegen Feb 11, 2026
9b7f161
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Feb 11, 2026
50a4bfa
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Feb 11, 2026
2de815b
Update update-configuration.yml
gentlementlegen Feb 11, 2026
3820add
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Feb 11, 2026
0b4e0be
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Feb 11, 2026
828a601
chore: [skip ci] Update manifest.json
gentlementlegen Feb 11, 2026
9c6f2c4
Merge pull request #19 from ubiquity-os/codex/fix/manifest-build-plug…
gentlementlegen Feb 11, 2026
0016a7c
chore: [skip ci] updated manifest.json and dist build
ubiquity-os-beta[bot] Feb 11, 2026
824f571
chore: [skip ci] update manifest.json url
ubiquity-os-beta[bot] Feb 11, 2026
88bc621
chore(ci): migrate demo branch to artifact deploy flow
gentlementlegen Mar 10, 2026
dcf9658
fix(ci): generate manifest before deno deploy
gentlementlegen Mar 10, 2026
d1bfdae
fix(ci): install dependencies before deno deploy manifest step
gentlementlegen Mar 10, 2026
1af8791
Merge pull request #20 from ubiquity-os/feat/320-workflow-artifact-mi…
gentlementlegen Mar 10, 2026
2b1650a
chore(ci): sync demo with development deploy flow
gentlementlegen Mar 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { KnipConfig } from "knip";

const config: KnipConfig = {
entry: ["src/action.ts", "src/worker.ts"],
project: ["src/", "test/"],
project: ["src/**/*.ts"],
ignore: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**"],
ignoreExportsUsedInFile: true,
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
with:
bun-version: latest

- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Jest With Coverage
run: |
bun install --frozen-lockfile
bun run test
bun run jest:test

- name: Add Jest Report to Summary
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
name: "Deploy (Action / Deno)"
runs-on: ubuntu-latest
permissions: write-all
environment: ${{ (github.event.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || github.event.workflow_run.head_branch == 'main') && 'main' || 'development' }}
environment: ${{ (github.event.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || github.event.workflow_run.head_branch == 'main' || github.event.ref == 'refs/heads/demo' || github.ref == 'refs/heads/demo' || github.event.workflow_run.head_branch == 'demo') && 'main' || 'development' }}
env:
BUILD_ACTION_ENABLED: ${{ github.event_name == 'workflow_dispatch' && inputs.build_action_enabled || vars.BUILD_ACTION_ENABLED || 'true' }}
DEPLOY_DENO_ENABLED: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_deno_enabled || vars.DEPLOY_DENO_ENABLED || 'true' }}
Expand Down
1,063 changes: 578 additions & 485 deletions bun.lock

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import type { Config } from "jest";

const cfg: Config = {
testEnvironment: "node",
transform: {
"^.+\\.tsx?$": [
"ts-jest",
{
useESM: true,
},
],
"^.+\\.[jt]s$": "@swc/jest",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
coveragePathIgnorePatterns: ["node_modules", "mocks"],
coveragePathIgnorePatterns: ["node_modules", "mocks", "tests"],
collectCoverage: true,
coverageReporters: ["json", "lcov", "text", "clover", "json-summary"],
reporters: ["default", "jest-junit", "jest-md-dashboard"],
coverageDirectory: "coverage",
testTimeout: 20000,
roots: ["<rootDir>", "tests"],
extensionsToTreatAsEsm: [".ts"],
transformIgnorePatterns: [],
extensionsToTreatAsEsm: [".ts", ".tsx"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
Expand Down
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"prepare": "bun run prepare:manifest && husky install",
"prepare:manifest": "bunx @ubiquity-os/plugin-manifest-tool@latest",
"prebuild": "bun run prepare:manifest",
"test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --setupFiles dotenv/config --coverage",
"jest:test": "jest --coverage",
"test": "jest --coverage",
"worker": "wrangler dev --env dev --port 4000"
},
"keywords": [
Expand All @@ -34,12 +35,10 @@
"open-source"
],
"dependencies": {
"@sinclair/typebox": "0.34.15",
"@ubiquity-os/plugin-sdk": "^3.1.4",
"@sinclair/typebox": "0.34.41",
"@ubiquity-os/plugin-sdk": "^3.8.1",
"@ubiquity-os/ubiquity-os-logger": "^1.4.0",
"dotenv": "16.4.7",
"hono": "^4.6.19",
"ts-node": "^10.9.2"
"hono": "^4.11.3"
},
"devDependencies": {
"@commitlint/cli": "19.6.1",
Expand All @@ -50,10 +49,11 @@
"@eslint/js": "9.19.0",
"@jest/globals": "29.7.0",
"@mswjs/data": "0.16.2",
"@swc/jest": "^0.2.39",
"@types/jest": "^29.5.14",
"@types/node": "22.12.0",
"cross-env": "^7.0.3",
"cspell": "8.17.3",
"dotenv": "^17.2.3",
"eslint": "9.19.0",
"eslint-plugin-check-file": "3.0.0",
"eslint-plugin-sonarjs": "3.0.1",
Expand All @@ -65,7 +65,7 @@
"lint-staged": "15.4.3",
"npm-run-all": "4.1.5",
"prettier": "3.4.2",
"ts-jest": "29.2.5",
"ts-node": "^10.9.2",
"typescript": "5.6.2",
"typescript-eslint": "8.22.0",
"wrangler": "3.102.0"
Expand All @@ -83,5 +83,8 @@
"extends": [
"@commitlint/config-conventional"
]
},
"resolutions": {
"@sinclair/typebox": "0.34.41"
}
}
31 changes: 27 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import { handleCommentCreated, handleCommentEdited } from "./handlers/run-demo";
import { Context } from "./types/index";
import { isCommentCreatedEvent, isCommentEditedEvent } from "./types/typeguards";

const BAD_CREDENTIALS_MESSAGE = "The credentials provided for the GitHub user are invalid, the demo cannot proceed.";

export async function runPlugin(context: Context) {
const { logger, eventName } = context;

context.userOctokit = new customOctokit({
auth: context.env.USER_GITHUB_TOKEN,
});
const { data: user } = await context.userOctokit.rest.users.getAuthenticated();
if (shouldIgnoreEvent(context)) {
logger.info(`Ignoring event: ${eventName}`);
return;
}
const user = await getGitHubUser(context);
context.userName = user.login;
if (isCommentCreatedEvent(context)) {
return await handleCommentCreated(context);
Expand All @@ -19,3 +22,23 @@ export async function runPlugin(context: Context) {

logger.error(`Unsupported event: ${eventName}`);
}

async function getGitHubUser(context: Context) {
try {
context.userOctokit = new customOctokit({
auth: context.env.USER_GITHUB_TOKEN,
});
const { data: user } = await context.userOctokit.rest.users.getAuthenticated();
return user;
} catch (err) {
throw context.logger.error(BAD_CREDENTIALS_MESSAGE, { err });
}
Comment on lines +33 to +35

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check what logger.error returns in `@ubiquity-os/ubiquity-os-logger`
ast-grep --pattern 'error($$$) {
  $$$
  return $_;
}'

Repository: ubiquity-os/command-demo

Length of output: 50


🌐 Web query:

Does @ubiquity-os/ubiquity-os-logger error method return an Error object?

💡 Result:

No, the @ubiquity-os/ubiquity-os-logger error method does not return an Error object. Evidence from Ubiquity OS plugin SDK documentation and usage shows the logger provides methods like logger.ok("Done"), which are used for logging messages, not throwing or returning Error instances. In error contexts from GitHub issues (e.g., command-start-stop #136), errors are standard JavaScript Error objects ("name": "Error") passed to logging, indicating the logger.error likely logs the error rather than returning one. No sources explicitly state or demonstrate the error method returning an Error object; it aligns with standard logger patterns where log methods return void or log metadata.

Citations:


🏁 Script executed:

# Find references to context.logger.error to understand how it's used
rg "logger\.error" -A 2 -B 2 --max-count 5

Repository: ubiquity-os/command-demo

Length of output: 715


🏁 Script executed:

# Check if there's a logger configuration or type definitions in the repo
fd -t f "logger" --max-one-result | head -20

Repository: ubiquity-os/command-demo

Length of output: 301


🏁 Script executed:

# Check package.json for the `@ubiquity-os/ubiquity-os-logger` dependency
cat package.json | grep -A 2 -B 2 "ubiquity-os-logger"

Repository: ubiquity-os/command-demo

Length of output: 220


Fix throwing logger.error() calls — logger.error() returns void, not Error.

The code at lines 33-35 throws context.logger.error(), but this method returns void (confirmed via package documentation). Throwing undefined breaks exception handling and loses stack traces. This pattern also appears in src/handlers/run-demo.ts.

Instead, log first then throw a proper Error:

Example fix
} catch (err) {
  context.logger.error(BAD_CREDENTIALS_MESSAGE, { err });
  throw new Error(BAD_CREDENTIALS_MESSAGE);
}

}

function shouldIgnoreEvent(context: Context) {
if (isCommentCreatedEvent(context)) {
const content = context.payload.comment.body;
return content.includes(BAD_CREDENTIALS_MESSAGE);
}
return false;
}
4 changes: 0 additions & 4 deletions src/types/typeguards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ export function isCommentCreatedEvent(context: Context): context is Context<"iss
export function isCommentEditedEvent(context: Context): context is Context<"issue_comment.edited"> {
return context.eventName === "issue_comment.edited";
}

export function isLabelEvent(context: Context): context is Context<"issues.labeled"> {
return context.eventName === "issues.labeled";
}
5 changes: 1 addition & 4 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { drop } from "@mswjs/data";
import { CommentHandler } from "@ubiquity-os/plugin-sdk";
import { customOctokit as Octokit } from "@ubiquity-os/plugin-sdk/octokit";
import { Logs } from "@ubiquity-os/ubiquity-os-logger";
import dotenv from "dotenv";
import manifest from "../manifest.json";
import { runPlugin } from "../src";
import { Context, Env } from "../src/types/index";
Expand All @@ -12,8 +11,6 @@ import { createComment, setupTests } from "./__mocks__/helpers";
import { server } from "./__mocks__/node";
import { STRINGS } from "./__mocks__/strings";

dotenv.config();

const octokit = new Octokit();

beforeAll(() => {
Expand Down Expand Up @@ -50,7 +47,7 @@ describe("Plugin tests", () => {

expect(errorSpy).not.toHaveBeenCalled();
expect(infoSpy).toHaveBeenNthCalledWith(1, "Processing /demo command");
});
}, 50000);
});

function createContext(
Expand Down
Loading