Skip to content

Add afip-constancia skill#113

Open
naza00000 wants to merge 1 commit into
browserbase:mainfrom
naza00000:add-afip-constancia-skill
Open

Add afip-constancia skill#113
naza00000 wants to merge 1 commit into
browserbase:mainfrom
naza00000:add-afip-constancia-skill

Conversation

@naza00000
Copy link
Copy Markdown

@naza00000 naza00000 commented May 19, 2026

What

Adds the afip-constancia skill: fetch the official ARCA (ex-AFIP) Constancia de Inscripción for an Argentine CUIT from the public web form (afip.gob.ar/genericos/constanciainscripcion/) — no Clave Fiscal, no login.

Returns one JSON envelope: the parsed fiscal situation (régimen / monotributo categoría / responsable inscripto, domicilio fiscal, actividades CLAE, impuestos, fecha de inscripción) plus the official PDF document with its código verificador.

Why it's a good fit

This is a high-demand Argentine surface (every alta-de-proveedor, KYC, expediente, and licitación needs the constancia) with no public API for the PDF — browser automation is the only path, exactly browse's strength. Same pattern/structure as the existing company-research skill (frontmatter, procedural runbook, a scripts/ helper instead of fragile inline pipelines).

Notes for review

  • Read-only / public: drives a public form with just a CUIT. No credentials, no auth, no mutation.
  • Strict output contract: scripts/emit_constancia.mjs is zero-dependency (Node builtins only) and normalizes scraped fields into a fixed JSON shape; a "not registered" CUIT and any failure map to explicit {found:false} / {error} rather than fabricated data.
  • Throttling: documented one-attempt-per-CUIT, never loop (ARCA rate-limits).
  • The same lookup ships as a typed companion npm package (@ar-agents/constancia, part of the open-source Arg toolkit) sharing this exact output contract — one artifact, two surfaces. The skill is fully standalone; the package is not required to run it.

Note

Low Risk
Low risk because this PR only adds a new standalone skill and a small zero-dependency Node helper, without modifying existing runtime logic. Primary risk is contract/edge-case correctness when normalizing scraped fields into the strict JSON output.

Overview
Introduces the new afip-constancia skill, documenting a browser-driven flow to query ARCA’s public Constancia de Inscripción form for a CUIT, detect the not registered case, extract key fiscal fields, and capture the official PDF.

Adds scripts/emit_constancia.mjs, a zero-dependency normalizer that converts loosely-scraped input into the strict, single-line JSON output contract, including explicit {found:false} and {error:...} outcomes and optional pdf (base64/url/codigoVerificador) handling.

Reviewed by Cursor Bugbot for commit 46859a3. Bugbot is set up for automated code reviews on this repo. Configure here.

Fetch the official ARCA (ex-AFIP) Constancia de Inscripción for an
Argentine CUIT from the public web form (no Clave Fiscal). Returns the
parsed fiscal situation plus the official PDF artifact as a single JSON
envelope. Includes a zero-dependency helper that enforces a strict
output contract shared with the typed companion npm package
@ar-agents/constancia.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 46859a3. Configure here.

raw.tipoPersona === "juridica" ||
/sociedad|s\.?a\.?|s\.?r\.?l\.?|asociaci/i.test(den)
? "juridica"
: "fisica";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Regex falsely classifies many physical persons as juridica

High Severity

The s\.?a\.? alternation in the tipoPersona regex matches the bare substring "sa" anywhere in the denomination, with no word boundaries or anchors. Extremely common Argentine names like "ROSA", "CASAS", "SAAVEDRA", "SALVADOR", "CASADO" all contain "sa" and would be incorrectly classified as "juridica". Additionally, even when raw.tipoPersona is explicitly "fisica" (correctly scraped), the regex override still fires, discarding the accurate value.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 46859a3. Configure here.

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