Skip to content

fix(vscode-ext): correct affinescript compile invocation + document build#58

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/vscode-ext-compile-invocation
May 18, 2026
Merged

fix(vscode-ext): correct affinescript compile invocation + document build#58
hyperpolymath merged 1 commit into
mainfrom
fix/vscode-ext-compile-invocation

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

While unblocking the VS Code extension build (affinescript compiler now installed locally), found two my-lang-side defects:

  1. package.json compile missing --vscode-extension — without it the output isn't a loadable extension main shim. Fixed.
  2. README build docs didn't mention the AffineScript compiler / AFFINESCRIPT_STDLIB requirement, and referenced a stale my-lang-0.2.0.vsix (package is 0.3.0). Fixed + added an honest status note.

Not claimed to make the build pass. The src/extension.affineout/extension.cjs recompile is gated on upstream affinescript#35 Phase 2 (vscode-API stdlib bindings — stdlib/Vscode.affine does not yet type-check; the affinescript repo reports "stdlib 13/19 compile"). The committed out/extension.cjs + src/index.cjs remain the working runtime artifacts. vsce package produces an installable .vsix from them with no Azure Marketplace PAT (only vsce publish needs one).

🤖 Generated with Claude Code

…uild

The `compile` script invoked `affinescript compile` without
`--vscode-extension`, so the generated file is not a loadable VS Code
extension shim. Added the flag.

Also documented the real build requirements (AffineScript compiler on
PATH + AFFINESCRIPT_STDLIB env var — the compiler does not yet bundle
stdlib bindings) and fixed a stale README .vsix version (0.2.0 -> 0.3.0).

Honest status recorded in README: the src/extension.affine recompile is
gated on upstream affinescript#35 Phase 2 (stdlib/Vscode.affine doesn't
yet type-check); the committed out/extension.cjs + src/index.cjs remain
the working artifacts and `vsce package` needs no Azure PAT.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath merged commit 7b1b9fd into main May 18, 2026
10 of 11 checks passed
@hyperpolymath hyperpolymath deleted the fix/vscode-ext-compile-invocation branch May 18, 2026 10:15
hyperpolymath added a commit that referenced this pull request May 18, 2026
…#61)

`vsce` 2.15.0 (the deprecated package) predates `.cjs`-entrypoint
support, so `vsce package` failed looking for `src/index.cjs.js`.
Migrated devDependency to the renamed, maintained `@vscode/vsce` ^3.2.0
(same `vsce` binary, so the `package` script is unchanged).

Also corrected the README "Status" block, which #58 left stale: the
extension DOES compile and the affinescript Vscode stdlib bindings DO
type-check on affinescript main (#35 P2 effectively complete) — the only
real bug was my-lang's own extension.affine (fixed in #60). Documented
that packaging needs a registry-reachable env (WSL npm is unreachable
here, so package/publish must run on CI or a non-WSL host) and that
`.vsix` packaging needs no Azure PAT (only `vsce publish` does).

Refs affinescript#35

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request May 18, 2026
Building the .vsix per #62 surfaced a wiring defect: PR #58 switched the
compile to `--vscode-extension` codegen, whose auto-glue emits a top-level
`require("@hyperpolymath/affine-vscode")` — an unpublished npm package — while
the repo still routed activation through the hand-written `src/index.cjs` +
vendored `src/affine-vscode-adapter.cjs`. Result: VS Code loaded
`src/index.cjs` -> `require("../out/extension.cjs")` -> MODULE_NOT_FOUND on
`@hyperpolymath/affine-vscode`; the extension crashed on activation.

Fix, using the mechanism affinescript already provides:

- `compile`/`vscode:prepublish`: pass
  `--vscode-extension-adapter=../src/affine-vscode-adapter.cjs` so the
  auto-glue requires the already-vendored adapter by relative path (no npm
  package, resolves offline). `affinescript compile --help` documents this
  flag precisely for "vendoring a custom adapter".
- `main`: `./src/index.cjs` -> `./out/extension.cjs` — the directly-loadable
  entry the `--vscode-extension` codegen is designed to produce (#58/#105's
  stated end-state). `src/index.cjs` is now dead and removed.
- `vscode:prepublish`: no longer shells through `npm run` (repo CLAUDE.md
  bans npm) — it is the affinescript invocation directly.
- Add `.vscodeignore` so lockfiles/build noise stay out of the .vsix.
- `.gitignore`: ignore bun/deno lockfiles and the built `*.vsix`
  (distributed via GitHub Release, not git), extending the #57 policy.

Verified: `out/extension.cjs` loads standalone; from the packaged .vsix's
bundled tree `extraImports()` returns {Vscode, VscodeLanguageClient} with
only host-provided `vscode` stubbed; `activate`/`deactivate` present.
`my-lang-0.3.0.vsix` (324 files) now packages as a *functional* artifact.

Refs #62

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 35 issues detected

Severity Count
🔴 Critical 6
🟠 High 11
🟡 Medium 18

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "unwrap_or(0) with dangerous default (1 occurrences, CWE-754)",
    "type": "unwrap_dangerous_default",
    "file": "/home/runner/work/my-lang/my-lang/_exploratory/me-scaffolding/crates/parser/src/lib.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "expect() in hot path (80 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/my-lang/my-lang/_exploratory/me-scaffolding/crates/parser/src/lib.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unwrap() without prior check -- DoS via panic (1 occurrences, CWE-754)",
    "type": "unwrap_without_check",
    "file": "/home/runner/work/my-lang/my-lang/my-ssg/src/generator.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "expect() in hot path (5 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/my-lang/my-lang/crates/my-mir/src/lib.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unwrap() without prior check -- DoS via panic (26 occurrences, CWE-754)",
    "type": "unwrap_without_check",
    "file": "/home/runner/work/my-lang/my-lang/crates/my-fmt/src/lib.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "unwrap() without prior check -- DoS via panic (1 occurrences, CWE-754)",
    "type": "unwrap_without_check",
    "file": "/home/runner/work/my-lang/my-lang/crates/my-hir/src/lib.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "unwrap() without prior check -- DoS via panic (3 occurrences, CWE-754)",
    "type": "unwrap_without_check",
    "file": "/home/runner/work/my-lang/my-lang/crates/my-llvm/src/lib.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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