Skip to content

feat: Commander V1 autocomplete scaffold - #1

Open
Gitcoder12 wants to merge 1 commit into
mainfrom
scaffold/mvp
Open

feat: Commander V1 autocomplete scaffold#1
Gitcoder12 wants to merge 1 commit into
mainfrom
scaffold/mvp

Conversation

@Gitcoder12

Copy link
Copy Markdown
Owner

Summary

Implements the V1 Commander autocomplete scaffold on scaffold/mvp.

Included

  • Mock + OpenAI provider adapter
  • Finisher-style autocomplete continuations
  • Deterministic scoring, deduplication, and diversity ranking
  • Seven-agent parallel orchestration with failure tolerance
  • Safety filtering
  • API tests and ranker tests
  • Generate → Suggestions → Combine → Final → Copy UI
  • Health, suggest, and combine API flows

Verification

CI should be treated as the automated gate. Manual browser verification remains environment-dependent.

V1 product boundary

Commander is an intelligent autocomplete layer for human thoughts, requests, and AI instructions. Autocomplete is the core UX; prompt improvement is a supporting capability.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01d13f1e0f

ℹ️ 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".

Comment thread src/server.js
};
})
);
const express = require('express');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep server module syntax compatible with the package

Because package.json still declares "type": "module", running the configured npm start evaluates this file as an ES module and immediately throws ReferenceError: require is not defined at this line, before the server can bind a port. Convert this file and its exports to ESM or explicitly use CommonJS files/configuration so every API endpoint remains reachable.

Useful? React with 👍 / 👎.

Comment thread src/server.js
Comment on lines +1 to +5
const express = require('express');
const path = require('path');
const helmet = require('helmet');
const rateLimit = require('express-rate-limit');
const cors = require('cors');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Declare the new runtime dependencies

A fresh checkout followed by npm install will not install any of these packages: the unchanged manifest has no dependencies section or lockfile, while this server now requires Express and its middleware at startup. Once the module-format issue is corrected, startup will instead fail with MODULE_NOT_FOUND unless these production dependencies are added to the manifest.

Useful? React with 👍 / 👎.

Comment thread src/server.js
Comment on lines +6 to +7
const { orchestrate } = require('./orchestrator');
const { combineSelected } = require('./combine');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the orchestrator and combiner modules

The target commit contains no src/orchestrator.js or src/combine.js (confirmed from its tracked file tree), so these local imports cannot resolve. Even with the module format and npm dependencies fixed, Node will fail while loading the server rather than serving either /api/suggest or /api/combine; include the implementations or retain the existing request handlers.

Useful? React with 👍 / 👎.

Comment thread src/server.js
app.post('/api/suggest', async (req, res) => {
try {
const body = req.body || {};
const { promptPartial, cursorIndex = null, context = {}, max_suggestions = 5, all = false } = body;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Respect MAX_SUGGESTIONS when no request override is sent

When a deployment sets the documented MAX_SUGGESTIONS environment variable and a caller omits max_suggestions, this destructuring default always passes 5 to orchestrate, bypassing the setting. The previous handler used the environment-derived default, so restore that behavior to keep configured fan-out and model cost effective.

Useful? React with 👍 / 👎.

Comment thread src/server.js
Comment on lines +29 to +30
if (!promptPartial || typeof promptPartial !== 'string') return res.status(400).json({ error: 'promptPartial (string) required' });
if (max_suggestions <= 0) return res.status(400).json({ error: 'max_suggestions must be positive' });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain the prompt-length guard before orchestration

Requests with prompt text between the former 20,000-character limit and the 64 KB JSON-body limit now pass this validation and are forwarded to generation instead of receiving a 400 response. In deployments with model generation enabled, those oversized requests can multiply token cost and latency across the orchestrated agents; retain an explicit prompt-length limit here.

Useful? React with 👍 / 👎.

Comment thread src/server.js
if (req.method === "OPTIONS") return json(res, 204, {});
if (req.method !== "POST" || req.url !== "/api/suggest") {
return json(res, 404, { error: "Not found" });
const suggestions = await orchestrate({ promptPartial, cursorIndex, context, max_suggestions, all });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Invoke the safety filter before generating suggestions

The newly added isDangerous function is never imported or called anywhere in the target commit (verified with a repository-wide search), and this route forwards promptPartial directly to orchestration. Consequently, inputs matching the filter's dangerous patterns are generated normally, so the added safety filter has no effect until it is applied in the request and/or output path.

Useful? React with 👍 / 👎.

Comment thread src/server.js
app.use(limiter);

// serve static frontend
app.use(express.static(path.join(__dirname, '..', 'public')));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include the static frontend assets

The target commit tracks no public/ directory or frontend files, so this middleware has nothing to serve: a browser request for / falls through and receives Express's 404 response. Add the referenced static assets (or remove this route until they exist) so the newly introduced frontend entry point is usable.

Useful? React with 👍 / 👎.

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