Repository navigation
[WIP] Add doc-analyst GitHub Copilot extension to repository - #2
Conversation
Agent-Logs-Url: https://github.com/HarrisConsulting/business-assets-toolkit/sessions/7983b453-e614-4bdf-86c7-df6c963535ea Co-authored-by: HarrisConsulting <210942603+HarrisConsulting@users.noreply.github.com>
Agent-Logs-Url: https://github.com/HarrisConsulting/business-assets-toolkit/sessions/7983b453-e614-4bdf-86c7-df6c963535ea Co-authored-by: HarrisConsulting <210942603+HarrisConsulting@users.noreply.github.com>
Agent-Logs-Url: https://github.com/HarrisConsulting/business-assets-toolkit/sessions/7983b453-e614-4bdf-86c7-df6c963535ea Co-authored-by: HarrisConsulting <210942603+HarrisConsulting@users.noreply.github.com>
Agent-Logs-Url: https://github.com/HarrisConsulting/business-assets-toolkit/sessions/7983b453-e614-4bdf-86c7-df6c963535ea Co-authored-by: HarrisConsulting <210942603+HarrisConsulting@users.noreply.github.com>
Agent-Logs-Url: https://github.com/HarrisConsulting/business-assets-toolkit/sessions/7983b453-e614-4bdf-86c7-df6c963535ea Co-authored-by: HarrisConsulting <210942603+HarrisConsulting@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fae60e94e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private readonly documents = new Map<string, DocumentRecord>(); | ||
|
|
||
| private latestId: string | null = null; |
There was a problem hiding this comment.
Scope documents to the requesting user
Because this store is process-global and records no GitHub user/session/installation ownership, every request shares the same latestId and document map. In a deployed Copilot extension with multiple users, a user who omits document_id after another user's ingest will query/summarize the other user's latest document, and any known UUID can be retrieved with get(id) without an owner check. Store documents under the authenticated identity or enforce owner matching on reads.
Useful? React with 👍 / 👎.
copilot-extension/service files at the repository root, migrated fromHarrisConsulting/NewSchoolConnect#618npm installinsidecopilot-extension/to generate a lockfile and install the scoped dependenciescopilot-extension/.github/workflows/copilot-extension-ci.ymlworkflow for the extensionOriginal prompt
Overview
Add the
doc-analystGitHub Copilot Extension to this repository as a reusable, project-agnostic service. This extension was originally built forNewSchoolConnectbut belongs here inbusiness-assets-toolkitsince it is applicable across all projects.Place all files under
copilot-extension/at the root of the repository.File Structure to Create
Also add:
.github/workflows/copilot-extension-ci.ymlExact File Contents
copilot-extension/package.json{ "name": "doc-analyst", "version": "1.0.0", "private": true, "scripts": { "dev": "ts-node-dev --respawn src/index.ts", "build": "tsc", "start": "node dist/index.js", "lint": "eslint src" }, "dependencies": { "@copilot-extensions/preview-sdk": "^5.0.1", "dotenv": "^16.4.5", "express": "^4.19.2", "openai": "^4.52.0", "tiktoken": "^1.0.15", "uuid": "^10.0.0" }, "devDependencies": { "@types/express": "^4.17.21", "@types/node": "^20.0.0", "@types/uuid": "^10.0.0", "ts-node-dev": "^2.0.0", "typescript": "^5.4.0" } }copilot-extension/tsconfig.json{ "compilerOptions": { "target": "ES2020", "module": "commonjs", "lib": ["ES2020"], "rootDir": "src", "outDir": "dist", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "noEmit": false, "types": ["node"], "allowJs": false, "allowImportingTsExtensions": false, "resolveJsonModule": true }, "include": ["src/**/*"] }copilot-extension/.env.examplecopilot-extension/.gitignorecopilot-extension/Dockerfilecopilot-extension/README.mdHealth check:
curl http://localhost:3000/ # {"status":"ok","extension":"doc-analyst"}Build & Run
Docker
npm run build docker build -t doc-analyst . docker run --rm -p 3000:3000 --env-file .env doc-analystEnvironment Variables
OPENAI_API_KEYPORTNotes
src/utils/store.tswith a Redis or database-backed implementation.copilot-extension/— this does not affect the root repository.