@mytegroupinc/myte-core
v0.0.32
Published
Myte CLI core implementation.
Readme
@mytegroupinc/myte-core
Implementation package for the myte CLI.
Most users should install the public wrapper instead:
npm install myte- run with
npx myte ...
This package exists so the public wrapper can stay small and versioned cleanly. It is not the recommended public install target.
Requirements
- Node
18+ MYTE_API_KEYfor project-scoped commandsMYTEAI_API_KEYformyte aigitonly when usingquery --with-diff- No runtime npm dependencies. The CLI uses Node 18+ built-ins for env loading, argument parsing, HTTP, and local context serialization.
Behavior Summary
- Snapshot-style commands such as
bootstrap,sync-qaqc,feedback-sync, andsuggestions syncwrite localMyteCommandCenterdata. feedback status|edit|assign|archivewrites reviewable local YAML artifacts;feedback submit|revise|reviews|reviewroutes them through the backend owner-review membrane.feedback move|undo|prd-versions|prd-diff|historycalls the project-key Feedback API while leaving lifecycle rules and permissions server-side.feedback move --feedback-idssends one batch move request.feedback validate|applyremains available for validation and owner-direct apply paths; live authorization, stale checks, and history stay server-side.query --with-diffrequires project repos to be configured for diff collection and fails fast when no matching local project repo can be resolved.- Public package documentation is intentionally minimal. Internal rollout and design notes are not part of the npm package contract.
Agent Usage Contract
Coding agents should treat MYTE_API_KEY as a project-scoped Project Assistant key:
- Load it from the workspace
.envor environment.MYTE_PROJECT_API_KEYis accepted as a compatibility fallback. - Call
myte config --jsonfirst when project identity or local repo detection is uncertain. - Hydrate mission context with
bootstrapfirst instead of scraping the web UI.bootstrapwrites mission cards and mission suggestion thread state. - Use
suggestions synconly when you need to refresh mission review-thread state without refreshing the full board. - Use
query --with-difffor project-scoped code review, planning, and implementation questions. - Use
create-prdonly with reviewed markdown files. The markdown file body is the PRD document;descriptionis only the short board/card summary. - Use
feedback status|edit|assign|archivefor reviewable local artifacts,feedback submitfor owner review, andfeedback reviewfor owner/delegate decisions. - Use
feedback review --request-idsfor batch owner/delegate decisions; it sends one grouped backend batch, not one request per item. - Use
suggestions createfor both existing-mission edits and new-mission proposals. The only validchange_typevalues areupdateandcreate. - Use
suggestions reviseonly against an existingsuggestion_id; do not sendchange_typeon revisions because the backend keeps the thread's original type. - Use
suggestions reviewfor owner/elevated mission-review decisions:approve,request_changes, orreject. - Use
mission archivefor project-key lifecycle archival. Do not sendArchivedthroughmission status; restore archived missions from the web archived-board view. - Use
feedback moveonly when a direct audited state move is intended and include a concrete--reason. Use--feedback-idsfor batch active-state moves or authorized batch archive. - Do not use the project-key API/CLI to unarchive Feedback. Normal
feedback-syncexcludes archived Feedback; unarchive from the web archived Feedback view. - Use
update-teamwhen an agent needs to leave a project-level implementation note or verification comment.
Do not use MYTE_API_KEY against account/JWT web endpoints. The direct project-key surface is /api/project-assistant/*.
PRD document contract:
- Always put the complete PRD in the markdown file passed to
myte create-prd. titlemaps to the feedback/board title.descriptionmaps to the short feedback/card summary and must not contain the full PRD.- Raw markdown uploads send
{ title, description?, prd_markdown }. myte-kanbanuploads send{ ticket_markdown }, where the leading JSON block contains metadata and the remaining markdown is the PRD body.- The backend stores the markdown as
prd_markdown, mirrors it as PRD text for search/sync, generates a DOCX attachment from it, and marksprd_format=markdown. - The UI renders the PRD from stored PRD text/document content, not from
description. - Renderer-friendly PRDs should use one
# Title,##sections, concise paragraphs, bullets, GitHub tables/checklists where useful, and fenced code blocks only for real code/config. - Do not wrap the whole PRD in a
```markdownfence. Do not use raw HTML, inline style blocks, or decorative banners. - PRD identity is explicit:
myte create-prdcreates a PRD asset with PRD metadata. Generic uploaded.md,.docx,.pdf, and.txtfiles remain normal attachments unless explicitly created as PRDs.
Feedback comment support:
feedback-syncincludes existing feedback comment turns in local context.- Feedback-specific comment creation exists in the web backend at
/api/feedbacks/<feedback_id>/comments, protected by JWT/project assignment. - There is no project-key CLI command for
myte feedback commentyet. That requires a Project Assistant feedback-comment route plus npm command before agents should rely on it.
Mission Action Map
| Action | Command / Surface | Contract |
| --- | --- | --- |
| Sync mission cards and review threads | myte bootstrap --json | Refreshes MyteCommandCenter/data/missions/*.yml, project structure, and MyteCommandCenter/data/mission-ops.yml. |
| Sync only mission review threads | myte suggestions sync --json | Refreshes MyteCommandCenter/data/mission-ops.yml while preserving local workspace drafts. |
| Suggest edit to existing mission | myte suggestions create with change_type: update and mission_id | Creates or appends to an active review thread; live mission is unchanged until approval. |
| Suggest new mission | myte suggestions create with change_type: create | Requires change_set.title and change_set.description; creates a review thread only; the mission card is created only after approval. |
| Revise a suggestion | myte suggestions revise with suggestion_id | Adds another revision to the same thread. Do not include change_type. |
| Review a suggestion | myte suggestions review with review_action: approve|request_changes|reject | Project Owner or elevated mission-review delegate required. Approval mutates/creates the mission once; reject archives the thread only; request_changes keeps it actionable. |
| Update mission status | myte mission status --mission-ids "M001" --status todo|in_progress|done | Project-key surface updates canonical mission status for active cards and refreshes local bootstrap + mission-ops by default. |
| Archive mission | myte mission archive --mission-ids "M001[,M002]" --reason "..." | Project Owner or elevated delegate required. Sets Archived, removes cards from normal bootstrap/board state, writes mission activity, and refreshes local bootstrap + mission-ops by default. |
Create payloads:
items:
- change_type: update
mission_id: M001
change_description: Tighten acceptance criteria
change_set:
acceptance_criteria:
- The API returns a stable error code for invalid input.items:
- change_type: create
change_description: Add observability mission
change_set:
title: Add mission observability
description: Track mission lifecycle actions with safe audit metadata.Revise payload:
items:
- suggestion_id: 507f1f77bcf86cd799439302
expected_revision: 1
change_description: Revise after review
change_set:
description: Updated proposed mission description.YAML note: quote scalar values that contain : or other YAML-significant punctuation.
Finding Mission And Suggestion IDs
Run this first:
myte bootstrap --jsonThen read:
| Needed Value | Local Source |
| --- | --- |
| Existing mission business id | MyteCommandCenter/data/missions/*.yml -> mission_id, for example M001. |
| Pending suggestion id | MyteCommandCenter/data/mission-ops.yml -> queue[].suggestion_id or threads[].suggestion_id. |
| Existing suggestion latest revision | MyteCommandCenter/data/mission-ops.yml -> threads[].latest_revision or threads[].latest_server_revision.revision. |
| Existing suggestion review revision | MyteCommandCenter/data/mission-ops.yml -> threads[].review_revision. |
| Thread type | MyteCommandCenter/data/mission-ops.yml -> threads[].change_type, either update or create. |
Agent rule: never guess suggestion_id. If mission-ops.yml is missing or stale, run myte bootstrap --json again. Use myte suggestions sync --json only for a narrow refresh after a mutation.
Feedback Action Map
| Command | What It Does | Governance |
| --- | --- | --- |
| feedback-sync | Pulls non-archived feedback metadata, comments, and PRD context into MyteCommandCenter. | Read-only project-key API call; archived Feedback is intentionally excluded. |
| feedback get | Reads one feedback item's current server snapshot and snapshot_hash. | Read-only; backend checks project access. |
| feedback status | Creates a local YAML proposal to change canonical lifecycle state. | No live mutation until submit and owner/delegate review, except owner-direct apply. |
| feedback edit / feedback refine | Creates a local YAML proposal for title, description/body, priority, due date, tags, or notes. | Content changes go through owner-review membrane. |
| feedback assign | Creates a local YAML proposal to change assignee. | Goes through review unless applied through owner-direct path. |
| feedback archive | Creates a local YAML proposal to archive. | Archive is governed by backend owner/delegate capability. |
| feedback submit | Sends a local proposal artifact to the backend as a review request. | Does not mutate live feedback before approval. |
| feedback revise | Resubmits the original submitter's request after request_changes. | Only valid for the original submitter and needs_changes requests. |
| feedback reviews | Lists review requests or fetches one request by --request-id. | Read-only; response includes backend permissions. |
| feedback review | Approves, rejects, requests changes, or cancels one review request, or a batch with --request-ids. | Backend restricts approval/review decisions to Project Owner or elevated delegate for Feedback scope; batch review uses one grouped notification path. |
| feedback move | Moves a card or batch of cards across allowed board states directly with an audit event. | --feedback-ids sends one batch request. Blocked with pending_feedback_review while an active linked review request exists; governed states such as archive/reject/deploy/freeze remain backend-authorized. Project-key unarchive is not supported. |
| feedback undo | Reverses an audited board event when there is no conflict. | Backend validates event ownership/project scope and conflict state. |
| feedback prd-versions | Lists retained PRD baselines/revisions for a feedback item. | Read-only; old S3 objects are retained by reference. |
| feedback prd-diff | Fetches backend-generated text diff for PRD versions. | Read-only; backend controls version access. |
| feedback history | Lists audited feedback board/refinement events. | Read-only; backend checks project access. |
| feedback validate | Sends an artifact to backend validation without mutation. | Useful before submit or owner-direct apply. |
| feedback apply | Applies an artifact through the owner-direct/emergency path. | Not the normal collaborator flow; normal flow is submit -> review. |
Canonical feedback lifecycle states are frozen, todo, in_progress, in_review, completed, deployed, rejected, and archived.
Reusable live smoke harness after deploy:
node ./scripts/feedback-live-full-harness.js --confirm-live --base-url https://api.myte.dev/apiThe harness creates five disposable TEST feedback items from markdown, verifies batch review and batch board movement, batch archives the disposable items, verifies normal feedback-sync excludes archived items, and verifies the project-key surface does not expose Feedback unarchive/restore.
Direct Project API Surface
All routes use Authorization: Bearer <MYTE_API_KEY>. The CLI adds idempotency and client-session headers on mutation routes.
Read/sync routes:
GET /api/project-assistant/configGET /api/project-assistant/bootstrapGET /api/project-assistant/qaqc-syncGET /api/project-assistant/feedback-syncGET /api/project-assistant/feedback/<feedback_id>GET /api/project-assistant/feedback/<feedback_id>/refinement/historyGET /api/project-assistant/feedback-review-requestsGET /api/project-assistant/feedback-review-requests/<request_id>GET /api/project-assistant/feedback/<feedback_id>/eventsGET /api/project-assistant/feedback/<feedback_id>/prd/versionsGET /api/project-assistant/feedback/<feedback_id>/prd/versions/<version_id>/diffGET /api/project-assistant/suggestionsGET /api/project-assistant/run-qaqc/<batch_id>
Mutation routes:
POST /api/project-assistant/queryPOST /api/project-assistant/run-qaqcPOST /api/project-assistant/mission-status-updatePOST /api/project-assistant/mission-archivePOST /api/project-assistant/project-commentPOST /api/project-assistant/update-ownerPOST /api/project-assistant/client-update-draftsPOST /api/project-assistant/create-prdPOST /api/project-assistant/create-prdsPOST /api/project-assistant/feedback/<feedback_id>/refinement/validatePOST /api/project-assistant/feedback/<feedback_id>/refinement/requestsPOST /api/project-assistant/feedback-review-requests/<request_id>/revisePOST /api/project-assistant/feedback/<feedback_id>/refinement/applyPOST /api/project-assistant/feedback-review-requests/<request_id>/reviewPOST /api/project-assistant/feedback-review-requests/batch-reviewPOST /api/project-assistant/feedback-review-requests/<request_id>/request-changesPOST /api/project-assistant/feedback-review-requests/<request_id>/cancelPOST /api/project-assistant/feedback/<feedback_id>/board-movePOST /api/project-assistant/feedback/batch-board-movePOST /api/project-assistant/feedback/<feedback_id>/events/<event_id>/undoPOST /api/project-assistant/suggestionsPOST /api/project-assistant/suggestions/revisePOST /api/project-assistant/suggestions/review
