Package Management
Section titled “Package Management”The Package Management endpoints let you read, compare, initialize, update, install, and pin package.json dependencies inside a project. Use these endpoints to inspect the current state of a package.json, reconcile declared versus installed packages, scaffold a new manifest, install new dependencies on demand, and lock declared versions to exact pins.
All endpoints are namespaced under the exec service and addressed through the exec container hostname. They accept a JSON request body where applicable and return JSON.
Reading and Comparing
Section titled “Reading and Comparing”GET /api/v1/exec/package/read
Section titled “GET /api/v1/exec/package/read”Returns the current package.json for the project, including its raw content, separated dependency maps, scripts, and counts.
This endpoint takes no parameters.
curl -X GET "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/package/read" \ -H "Authorization: Bearer <token>"import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.exec.package.readJson();Response
Section titled “Response”{ "path": "/app/package.json", "content": { "name": "hoody-exec-project", "version": "1.0.0", "description": "Hoody Exec project", "main": "src/index.ts", "scripts": { "start": "bun src/index.ts" } }, "dependencies": { "lodash": "^4.17.21" }, "devDependencies": { "typescript": "^5.3.3" }, "scripts": { "start": "bun src/index.ts" }, "dependencyCount": 1, "devDependencyCount": 1}{ "error": "VALIDATION_ERROR", "code": "ERROR_400", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "package.json not found", "code": "ERROR_404", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
NOT_FOUND | Resource not found | The requested resource does not exist | Verify the resource identifier |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2024-01-15T10:30:00.000Z"}POST /api/v1/exec/package/compare
Section titled “POST /api/v1/exec/package/compare”Compares the dependencies declared in package.json against the packages actually installed in node_modules and reports missing, outdated, and extra entries.
This endpoint takes no parameters.
This endpoint accepts an empty JSON object as the request body.
curl -X POST "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/package/compare" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d "{}"import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.exec.package.compare({});Response
Section titled “Response”{ "summary": { "total": 5, "installed": 3, "missing": 1, "outdated": 1, "extra": 0 }, "missing": ["chalk"], "outdated": [ { "package": "lodash", "declared": "^4.17.21", "installed": "4.17.20" } ], "extra": [], "allInstalled": false, "upToDate": false}{ "error": "VALIDATION_ERROR", "code": "ERROR_400", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "package.json not found", "code": "ERROR_404", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
NOT_FOUND | Resource not found | The requested resource does not exist | Verify the resource identifier |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2024-01-15T10:30:00.000Z"}Creating and Updating
Section titled “Creating and Updating”POST /api/v1/exec/package/init
Section titled “POST /api/v1/exec/package/init”Creates a new package.json at the project root if one does not already exist. Returns the generated manifest and a created flag.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | No | "hoody-exec-project" | Package name written to package.json. |
version | string | No | "1.0.0" | Initial version written to package.json. |
description | string | No | "Hoody Exec project" | Description written to package.json. |
force | boolean | No | false | Overwrite package.json if it already exists. |
curl -X POST "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/package/init" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "name": "hoody-exec-project", "version": "1.0.0", "description": "Hoody Exec project", "force": false }'import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.exec.package.initJson({ name: 'hoody-exec-project', version: '1.0.0', description: 'Hoody Exec project', force: false});Response
Section titled “Response”{ "message": "package.json created successfully", "path": "/app/package.json", "content": { "name": "hoody-exec-project", "version": "1.0.0", "description": "Hoody Exec project", "main": "src/index.ts", "scripts": { "start": "bun src/index.ts", "compile:modern": "bun build --compile --external=* --outfile bin/hoody-exec src/index.ts", "build:openapi": "bun run" }, "dependencies": {} }, "created": true}{ "error": "VALIDATION_ERROR", "code": "ERROR_400", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "package.json already exists", "code": "ERROR_409", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
CONFLICT | Resource conflict | Operation conflicts with existing resource state | Check resource state and retry |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2024-01-15T10:30:00.000Z"}POST /api/v1/exec/package/update
Section titled “POST /api/v1/exec/package/update”Updates an existing package.json by adding or modifying dependencies, scripts, metadata, and by removing named packages.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
dependencies | string | No | Dependency entries to add or update, expressed as a single string in the form accepted by the underlying package manager (for example lodash@^4.17.21). |
scripts | string | No | Script entries to add or update, expressed as a single string in name=command form (for example start=bun src/index.ts). |
metadata | object | No | Additional metadata fields to merge into package.json. |
remove | string | No | Name of a single dependency to remove from package.json. |
curl -X POST "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/package/update" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "dependencies": "lodash@^4.17.21", "scripts": "start=bun src/index.ts" }'import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.exec.package.updateJson({ dependencies: 'lodash@^4.17.21', scripts: 'start=bun src/index.ts'});Response
Section titled “Response”{ "message": "package.json updated successfully", "changes": [ "added lodash@^4.17.21 to dependencies", "updated script start" ], "changeCount": 2, "dependencies": { "lodash": "^4.17.21" }}{ "error": "VALIDATION_ERROR", "code": "ERROR_400", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "package.json not found", "code": "ERROR_404", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
NOT_FOUND | Resource not found | The requested resource does not exist | Verify the resource identifier |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2024-01-15T10:30:00.000Z"}Installing and Pinning
Section titled “Installing and Pinning”POST /api/v1/exec/package/install
Section titled “POST /api/v1/exec/package/install”Kicks off an installation of the listed packages (or all declared dependencies when the list is omitted) and returns immediately with the command that was launched.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
packages | array | No | — | Package specifiers to install (for example ["lodash@^4.17.21"]). When omitted, all declared dependencies are installed. |
dev | boolean | No | false | Install as devDependencies. |
save | boolean | No | true | Persist installed packages to package.json. |
force | boolean | No | false | Force a reinstall even if packages are already installed. |
curl -X POST "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/package/install" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "packages": ["lodash@^4.17.21"], "dev": false, "save": true, "force": false }'import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.exec.package.install({ packages: ['lodash@^4.17.21'], dev: false, save: true, force: false});Response
Section titled “Response”{ "status": "installing", "command": "bun install lodash@^4.17.21", "message": "Installation started"}{ "error": "VALIDATION_ERROR", "code": "ERROR_400", "timestamp": "2024-01-15T10:30:00.000Z"}{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2024-01-15T10:30:00.000Z"}POST /api/v1/exec/package/pin
Section titled “POST /api/v1/exec/package/pin”Rewrites declared dependency ranges in package.json to exact installed versions, producing reproducible builds. When all declared dependencies are already pinned, the response indicates that nothing changed.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
packages | array | No | Subset of package names to pin. When omitted, every declared dependency is pinned. |
curl -X POST "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/package/pin" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{}'import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.exec.package.pinVersions({});Response
Section titled “Response”When at least one dependency is updated:
{ "message": "Dependencies pinned to exact versions", "pinned": ["lodash"], "count": 1, "dependencies": { "lodash": "4.17.21" }}When every declared dependency is already pinned:
{ "message": "All dependencies are already pinned to exact versions", "pinned": [], "count": 0}{ "error": "VALIDATION_ERROR", "code": "ERROR_400", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "package.json not found", "code": "ERROR_404", "timestamp": "2024-01-15T10:30:00.000Z"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
NOT_FOUND | Resource not found | The requested resource does not exist | Verify the resource identifier |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2024-01-15T10:30:00.000Z"}