Brazilian researchers often need to update a Currículo Lattes record without rewriting an entire XML document by hand. The difficult part is not changing one sentence. It is preserving the document, keeping a recoverable copy, and knowing exactly what the tool did before importing the result back into the Lattes platform.

This tutorial uses lattes-toolkit, an MIT-licensed TypeScript toolkit for exported Lattes XML. The current npm package is 2.12.1, and the repository tag v2.12.2 contains the current documented CLI shape. The workflow below uses the published npm package and a synthetic fixture, so it does not expose a real curriculum.

TL;DR

Install Node.js 18 or newer and the package, copy an XML export into a working directory, inspect it with parse, update one typed field with set, and inspect the generated backup with backup list. The toolkit writes the XML locally. You still review and import the file yourself in the Lattes platform.

Prerequisites

You need:

  • Node.js 18 or newer, as required by the package metadata.
  • A Lattes XML export that you are allowed to edit, or a synthetic test file.
  • A shell with permission to create a local backup directory.
  • A review step before importing the resulting file.

Install the currently published package:

npm install @paladini/lattes-toolkit@2.12.1 

The package exposes the lattes-toolkit executable. You can also run it with npx when you do not want a global installation.

Start with a local copy

Create a directory that contains only the working copy. Keep the original export somewhere separate and protected from accidental writes.

mkdir lattes-edit cd lattes-edit copy C:\path\to\curriculo.xml .\curriculo.xml 

On macOS or Linux, use cp instead of copy. Do not place a real curriculum in a public issue, repository fixture, or untrusted debugging upload. The project's limitations guide treats the XML as a local file containing potentially sensitive information.

Initialize the workspace backup directory:

npx lattes-toolkit init 

Without a custom configuration, backups are stored in .lattes-backup/ in the workspace. The CLI reference documents LATTES_TOOLKIT_BACKUP_DIR and the optional lattes.config.json for changing the backup location and retention settings.

Inspect the export before editing

Start with a summary rather than opening the complete XML in an editor:

npx lattes-toolkit parse curriculo.xml 

The summary exposes basic identity and production counts. If you need the complete typed object for a local inspection, use --json:

npx lattes-toolkit parse curriculo.xml --json > curriculum.json 

The output is local JSON. Treat it with the same care as the source XML because it can contain personal and professional data.

Read one field with a typed path. For example, this command reads the identification summary:

npx lattes-toolkit get curriculo.xml identification.summary 

The path syntax also supports list indexes, such as bibliographicProduction.journalArticles[0].title. The exact field must exist in the exported document and in the toolkit's typed model. Use the field coverage documentation before automating a path across many files.

Update one field with a backup

Now replace the summary with a deliberate value:

npx lattes-toolkit set curriculo.xml identification.summary "Updated research profile." 

The command serializes the curriculum back to the same file. When the target already exists, it creates a backup snapshot before overwriting it. The library also preserves document content that is not represented by a typed field through its document and unmapped structures. That helps with round trips, but it is not a substitute for reviewing the generated XML.

List the snapshot manifest:

npx lattes-toolkit backup list 

The manifest records the original path, timestamp, curriculum identifier, and SHA-256 value. It does not turn the backup directory into a secure archive. Protect it with the same access controls as the XML.

Verify the change reproducibly

Read the edited field again:

npx lattes-toolkit get curriculo.xml identification.summary 

If you want a structured before-and-after check, compare the backup copy with the working file using diff:

npx lattes-toolkit diff .lattes-backup\BACKUP_ID\curriculo.xml curriculo.xml 

Replace BACKUP_ID with the identifier shown by backup list. The command reports changed typed paths and exits with code 1 when differences exist. That exit code means the files differ; it is not automatically an error. In a script, capture the output and interpret it as a review result.

You can also validate against the packaged XSD when xmllint is available:

npx lattes-toolkit validate curriculo.xml 

The command reports skipped when the required validator is unavailable. The optional DTD mode requires a DTD path supplied by you and is disabled by default. A skipped check should be reported as skipped, not as proof that the platform will accept every field.

Why this workflow works

The workflow separates three responsibilities:

  1. parse and get make the current document observable before a write.
  2. set applies a narrow, typed change and creates a recoverable snapshot.
  3. backup list, diff, and validate provide evidence for reviewing the result.

The package is not a web scraper or a browser bot. Its normal path reads and writes files you already possess. The optional Extrator client is a separate integration that sends requests to a WSDL endpoint configured by the institution. The security policy calls out XML and ZIP resource exhaustion, untrusted backup manifests, dependency supply-chain risk, and credential handling in release workflows.

Batch changes with an allowlist

For repeated edits, use patch rather than assembling raw XML replacements. The documented input format includes an explicit allowlist:

{ "allowlist": ["identification.summary"], "patches": [ { "path": "identification.summary", "value": "Updated research profile." } ] } 

Run it with:

npx lattes-toolkit patch curriculo.xml patches.json 

Keep the allowlist narrow. Do not generate patch paths from untrusted input, and test batch changes against synthetic fixtures before using real curricula.

Failure modes and limitations

If get cannot find a path, check the exported XML and field coverage rather than guessing a nearby name. If validate is skipped, install xmllint or document that the check was unavailable. If a backup is missing, stop before further edits and inspect the workspace configuration and permissions.

The toolkit does not log in to Lattes, click Importar XML, download a public curriculum, query by CPF, or promise full schema coverage. The documented flow is export locally, edit locally, review locally, and import manually. The repository also warns that Lattes terms prohibit robots and collectors without express permission from CNPq.

FAQ

Does this upload my XML?

The core file workflow is local. Do not enable the optional Extrator integration unless you understand the configured institutional endpoint and its data handling.

Can I restore the previous file?

Yes. Use npx lattes-toolkit restore --last or restore a specific snapshot ID after checking the manifest. Keep the backup directory local and trusted.

Can I use a ZIP export?

The toolkit documents XML and ZIP input for parsing. Test the exact export format with a synthetic or redacted file before processing a production curriculum.

Is a successful parse proof that Lattes will accept the file?

No. Parsing and optional local validation are evidence about the toolkit's processing. You must review the output and use the platform's own import flow.

Takeaway

Treat a Lattes XML edit as a controlled file transformation: preserve the original, inspect the typed path, make the smallest change, verify the backup and diff, and only then import manually. lattes-toolkit gives you the local building blocks, while privacy review and the final platform action remain your responsibility.

This tutorial was prepared with AI assistance for research organization and editorial drafting. Commands, versions, limitations, and project behavior were checked against the repository, tag v2.12.2, package metadata, npm package 2.12.1, documentation, source tests, and a local smoke test.

What additional verification would you require before importing an edited curriculum into the Lattes platform?