Skip to content

docs: expand agent guidelines - #9

Closed
Slashmsu wants to merge 13 commits into
mainfrom
codex/refine-project-and-identify-problems-13y736
Closed

docs: expand agent guidelines#9
Slashmsu wants to merge 13 commits into
mainfrom
codex/refine-project-and-identify-problems-13y736

Conversation

@Slashmsu

Copy link
Copy Markdown
Collaborator

Summary

  • replace the root AGENTS guide with the expanded production-readiness methodology and collaboration standards

Testing

  • not run (documentation-only change)

https://chatgpt.com/codex/tasks/task_e_68d453fb0b20832c8ccf9de8e33e99b9

@Slashmsu

Copy link
Copy Markdown
Collaborator Author

@codex review

@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.

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

Comment thread src/cli/program.ts
Comment on lines +448 to +470
.action((input: string, options: CompileOptions, command: Command): void => {
let tempDir: string | null = null;
try {
const merged = mergeOptions(input, options);
const result = compileFile(input, merged);
if (result.errors.length > 0) return;

// eslint-disable-next-line no-eval
eval(result.code);
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'somon-run-'));
const baseName = path.basename(input);
const jsFileName = baseName.match(/\.som$/i)
? baseName.replace(/\.som$/i, '.js')
: `${baseName}.js`;
const tempFile = path.join(tempDir, jsFileName);
fs.writeFileSync(tempFile, result.code, 'utf8');

if (merged.sourceMap && result.sourceMap) {
fs.writeFileSync(`${tempFile}.map`, result.sourceMap, 'utf8');
}

const child = cliRuntime.executeCompiledFile(
tempFile,
resolveForwardedArgv(command, input)
);

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] Run command breaks relative imports

The new run implementation writes the compiled code into a temporary directory and then executes that file via spawnSync. Because the generated JS still contains require('./…') statements (the compiler leaves relative imports untouched), Node resolves those requires relative to the temporary directory instead of the original source file’s directory. Any SomonScript program that imports sibling modules now fails at runtime with “Cannot find module …”. Consider executing the temporary file with cwd set to path.dirname(input) or emitting the compiled file alongside the source so relative require paths continue to resolve correctly.

Useful? React with 👍 / 👎.

@Slashmsu

Copy link
Copy Markdown
Collaborator Author

@codex review

@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.

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

Comment on lines +771 to +777
for (const [moduleId, moduleData] of result.modules) {
const processedCode = this.rewriteRequiresForModule(moduleId, moduleData.code, context);
const key = moduleIdMapping.get(moduleId);
if (!key) {
continue;
}
modules.push({ id: moduleId, key, code: processedCode, map: moduleData.map });

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] Keep source maps in sync with rewritten require paths

prepareModulesForBundle rewrites each module’s code before bundling but keeps the original moduleData.map untouched. When generateCommonJSBundle later emits mappings from these maps, it assumes the mappings refer to the rewritten code. Any change in specifier (e.g., normalising require('./dep') to require('dep.som')) shifts column offsets and produces a bundle source map that no longer matches the generated output, breaking debugging and stack traces whenever source maps are requested.

Useful? React with 👍 / 👎.

@Slashmsu

Slashmsu commented Oct 2, 2025

Copy link
Copy Markdown
Collaborator Author

@codex review

@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@github-actions

github-actions Bot commented Oct 2, 2025

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@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.

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

Comment thread src/cli/program.ts
Comment on lines 120 to +133
async function executeBundleCommand(input: string, options: BundleOptions): Promise<void> {
try {
const baseDir = path.dirname(path.resolve(input));
const config = loadConfig(baseDir);
const moduleSystem = await createModuleSystem(baseDir, config);

const bundleOptions = createBundleOptions(input, options, config, baseDir);
const isProduction = options.production || process.env.NODE_ENV === 'production';

if (bundleOptions.format !== 'commonjs' && !bundleOptions.force) {
console.error('ESM/UMD bundle formats are experimental. Re-run with --force to proceed.');
process.exitCode = 1;
return;
// Validate production environment if --production flag is set
if (isProduction) {
const outputPath = options.output || input.replace(/\.som$/, '.bundle.js');

try {
validateProductionEnvironment(outputPath, [input]);
} catch (error) {

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 Resolve production validation output path consistently

The new production-mode check validates options.output || input.replace(/\.som$/, '.bundle.js') before bundling. createBundleOptions and getBundleOutputPath resolve a relative --output against the input file’s directory, not the current working directory. When the user supplies a relative output path, the validator exercises a different path than the bundler writes to, so a directory can pass validation and still fail during the actual write (or vice versa). The validation should compute the path with the same logic used for emitting the bundle, e.g. by reusing getBundleOutputPath or resolving relative to path.dirname(input) before calling validateProductionEnvironment.

Useful? React with 👍 / 👎.

@Slashmsu Slashmsu closed this Oct 2, 2025
@ggulpari
ggulpari deleted the codex/refine-project-and-identify-problems-13y736 branch October 27, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants