@mytegroupinc/myte-core 0.0.52 → 0.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/cli.js +86 -15
- package/mytecody-cli.js +27 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ This package exists so the public wrapper can stay small and versioned cleanly.
|
|
|
44
44
|
`MyteCommandCenter/feedback-sync/comment-attachments`; binary formats remain
|
|
45
45
|
visible as metadata-only context. Raw S3/object-storage URLs are not written
|
|
46
46
|
into local sync artifacts.
|
|
47
|
-
- `feedback status|edit|assign|archive|refine` writes reviewable local YAML artifacts.
|
|
47
|
+
- `feedback status|edit|document-add|assign|archive|refine` writes reviewable local YAML artifacts.
|
|
48
48
|
- `feedback submit|revise|comment` are live writes that require `--confirm-write --approval-artifact <path>`.
|
|
49
49
|
- `feedback review|move|undo|apply` are governed writes with backend permission checks but no approval artifact flags.
|
|
50
50
|
- `feedback-sync|get|history|reviews|prd-versions|prd-diff|validate` are read/sync/validation commands with no approval artifact flags.
|
|
@@ -90,6 +90,8 @@ Only selected project-key writes require a server-validated approval envelope. T
|
|
|
90
90
|
with ordered PRD documents. List every file/title/client ref and the matching
|
|
91
91
|
count in the approval artifact.
|
|
92
92
|
- Feedback submit/revise/comment artifacts are usually the same YAML or markdown file being submitted. For inline text or stdin, use a separate approval memo with the feedback id or request id and exact content.
|
|
93
|
+
- `feedback document-add --feedback-id <id> --prd-file ./document.md` creates a governed proposal to append one linked PRD document to the existing Feedback context. The addition is not live until the normal `feedback submit` -> owner/delegate `feedback review` flow applies it.
|
|
94
|
+
- Governed document additions preserve existing document IDs, append a new stable document, create a new immutable PRD version, and emit `feedback_prd_document_added` so the Feedback context bubble/notification feed can link users back to the updated PRD context. Existing PRD sets may grow to twelve documents; new `create-prd --document-set` uploads remain capped at three.
|
|
93
95
|
- Team, owner, and client update artifacts should name the audience and include the exact message body or a complete summary. Client updates should include target contact ids when used.
|
|
94
96
|
- `feedback review --request-ids`, `feedback move --feedback-ids`, `mission status --mission-ids`, `mission archive --mission-ids`, and `run-qaqc --mission-ids` are batched governed writes, but they are marked `Not required` and should not receive approval artifact flags.
|
|
95
97
|
- The package does not bundle the large MyteCody engine binary or the async
|
|
@@ -106,6 +108,7 @@ Coding agents should treat `MYTE_API_KEY` as a project-scoped Project Assistant
|
|
|
106
108
|
- Use `suggestions sync` only when you need to refresh mission review-thread state without refreshing the full board.
|
|
107
109
|
- Use `query --with-diff` for project-scoped code review, planning, and implementation questions.
|
|
108
110
|
- Use `create-prd` only with reviewed markdown files and `--confirm-write --approval-artifact <path>`. The markdown file body is the PRD document; `description` is only the short board/card summary.
|
|
111
|
+
- New PRDs are unassigned by default. Add `--assigned-user-id <id>` or `--assigned-user-email <exact-email>` to validate and assign an eligible project user in the same create request.
|
|
109
112
|
- Use `create-prd --document-set` only when the explicit intent is one parent
|
|
110
113
|
Feedback with one to three ordered documents; omitting it preserves
|
|
111
114
|
independent multi-file creation.
|
|
@@ -248,7 +251,8 @@ Agent rule: never guess `suggestion_id`. If `mission-ops.yml` is missing or stal
|
|
|
248
251
|
| `feedback-sync` | Pulls non-archived feedback metadata, comments, and PRD context into `MyteCommandCenter`. | Read-only project-key API call; archived Feedback is intentionally excluded. |
|
|
249
252
|
| `feedback get` | Reads one feedback item's current server snapshot and `snapshot_hash`. | Read-only; backend checks project access. |
|
|
250
253
|
| `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`. |
|
|
251
|
-
| `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. |
|
|
254
|
+
| `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. |
|
|
255
|
+
| `feedback document-add` | Creates a local YAML proposal to append one linked Markdown PRD document to an existing Feedback item. | Owner-only field; normal submit/review/apply flow, stale protection, idempotency, version history, and notification apply. |
|
|
252
256
|
| `feedback assign` | Creates a local YAML proposal to change assignee. | Goes through review unless applied through owner-direct path. |
|
|
253
257
|
| `feedback archive` | Creates a local YAML proposal to archive. | Archive is governed by backend owner/delegate capability. |
|
|
254
258
|
| `feedback submit` | Sends a local proposal artifact to the backend as a review request. | Requires `--confirm-write --approval-artifact <path>`; does not mutate live feedback before approval. |
|
package/cli.js
CHANGED
|
@@ -220,6 +220,7 @@ function printHelp() {
|
|
|
220
220
|
" myte feedback history --feedback-id <id> [--limit 50] [--json]",
|
|
221
221
|
" myte feedback status --feedback-id <id> --status frozen|todo|in_progress|in_review|completed|deployed|rejected|archived --reason \"...\"",
|
|
222
222
|
" myte feedback edit --feedback-id <id> [--title \"...\"] [--feedback-text \"...\"] [--prd-file ./document.md] [--document-id <id>] [--priority High] [--reason \"...\"]",
|
|
223
|
+
" myte feedback document-add --feedback-id <id> --prd-file ./document.md [--title \"...\"] [--filename name.md] [--client-ref ref] [--reason \"...\"]",
|
|
223
224
|
" myte feedback assign --feedback-id <id> --user-id <id> [--reason \"...\"]",
|
|
224
225
|
" myte feedback archive --feedback-id <id> --reason \"...\"",
|
|
225
226
|
" myte feedback submit --file ./MyteCommandCenter/reviews/feedback/<id>-edit.yml --confirm-write --approval-artifact <path> [--json]",
|
|
@@ -235,8 +236,8 @@ function printHelp() {
|
|
|
235
236
|
" myte feedback prd-diff --feedback-id <id> --version-id <id> [--compare-to <id>] [--document-id <id>] [--json]",
|
|
236
237
|
" myte feedback validate --file ./MyteCommandCenter/reviews/feedback/<id>-status.yml [--json]",
|
|
237
238
|
" myte feedback apply --file ./MyteCommandCenter/reviews/feedback/<id>-status.yml [--json]",
|
|
238
|
-
" myte create-prd <file.md> [more.md ...] [--document-set] --confirm-write --approval-artifact <path> [--json] [--title \"...\"] [--description \"...\"]",
|
|
239
|
-
" cat file.md | myte create-prd --stdin --confirm-write --approval-artifact <path> [--title \"...\"] [--description \"...\"]",
|
|
239
|
+
" myte create-prd <file.md> [more.md ...] [--document-set] [--assigned-user-id <id> | --assigned-user-email <email>] --confirm-write --approval-artifact <path> [--json] [--title \"...\"] [--description \"...\"]",
|
|
240
|
+
" cat file.md | myte create-prd --stdin [--assigned-user-id <id> | --assigned-user-email <email>] --confirm-write --approval-artifact <path> [--title \"...\"] [--description \"...\"]",
|
|
240
241
|
" cat update.md | myte update-owner --stdin --subject \"Owner update\" --confirm-write --approval-artifact ./update.md",
|
|
241
242
|
" cat update.md | myte update-client --stdin --subject \"Weekly client update\" --confirm-write --approval-artifact ./update.md",
|
|
242
243
|
"",
|
|
@@ -305,7 +306,9 @@ function printHelp() {
|
|
|
305
306
|
" - Add --document-set to create one feedback item containing up to three ordered markdown documents",
|
|
306
307
|
" - Document-set source markdown is preserved exactly; canonical markdown is generated server-side for reading and DOCX rendering",
|
|
307
308
|
" - Title source: myte-kanban.title, first # heading, or --title",
|
|
308
|
-
" - Description source: myte-kanban.description or --description; this is a short feedback/card summary only",
|
|
309
|
+
" - Description source: myte-kanban.description or --description; this is a short feedback/card summary only",
|
|
310
|
+
" - New PRDs are unassigned unless --assigned-user-id or --assigned-user-email is provided",
|
|
311
|
+
" - Explicit assignees must be the project owner or an active assigned project collaborator",
|
|
309
312
|
" - Never put the full PRD in description. The complete PRD must live in the markdown file body",
|
|
310
313
|
" - Each item carries the full PRD markdown blob as prd_markdown/ticket_markdown",
|
|
311
314
|
" - Backend stores that blob as the renderable PRD document source, mirrors it for PRD text search/sync, and generates a DOCX attachment",
|
|
@@ -352,6 +355,7 @@ function printHelp() {
|
|
|
352
355
|
" - get/history read current feedback snapshots and audited event history through the project-key API",
|
|
353
356
|
" - prd-versions/prd-diff expose retained PRD versions and backend-generated per-document text diffs",
|
|
354
357
|
" - edit/refine with --prd-file updates a review artifact only; --document-id targets one document in a PRD document set",
|
|
358
|
+
" - document-add creates a governed review artifact that appends one linked PRD document; approval applies it through the same stale-safe PRD version flow",
|
|
355
359
|
" - validate/apply send artifacts to /api/project-assistant/feedback/<id>/refinement/* for validation or owner-direct apply",
|
|
356
360
|
" - The backend owns authorization, stale snapshot checks, allowed field/transition rules, and history",
|
|
357
361
|
" - apply is idempotent and does not rewrite local feedback.yml; run feedback-sync after apply to refresh local state",
|
|
@@ -377,7 +381,8 @@ function printHelp() {
|
|
|
377
381
|
" - reviews: list open/terminal/all requests or inspect one request",
|
|
378
382
|
" - review: approve, reject, request_changes, or cancel; backend restricts this to owner/delegate capability",
|
|
379
383
|
" - move: direct audited board movement for allowed states; governed transitions remain backend-authorized",
|
|
380
|
-
" -
|
|
384
|
+
" - document-add: create a governed proposal to append one linked PRD document to an existing Feedback item",
|
|
385
|
+
" - comment: create a text-only comment on one Feedback item",
|
|
381
386
|
" - undo: reverse an audited board event when conflict checks allow it",
|
|
382
387
|
" - prd-versions: list retained PRD baselines/revisions for a feedback item",
|
|
383
388
|
" - prd-diff: fetch backend-generated text diff between PRD versions",
|
|
@@ -402,6 +407,8 @@ function printHelp() {
|
|
|
402
407
|
" --title <text> Override PRD title for raw markdown uploads",
|
|
403
408
|
" --description <text> Set feedback description/card summary for raw markdown uploads",
|
|
404
409
|
" --document-set Create one PRD feedback item containing one to three ordered markdown files",
|
|
410
|
+
" --assigned-user-id Assign a newly created PRD to an eligible project user ObjectId",
|
|
411
|
+
" --assigned-user-email Assign a newly created PRD to an eligible project user by exact email",
|
|
405
412
|
" --content <text> Team update content for update-team",
|
|
406
413
|
" --body <text> Feedback comment body for feedback comment",
|
|
407
414
|
" --subject <text> Subject for update-owner or update-client",
|
|
@@ -424,10 +431,9 @@ function printHelp() {
|
|
|
424
431
|
" --reason <text> Human review reason included in feedback refinement artifacts",
|
|
425
432
|
" --status <value> Mission status target, feedback-sync filter, or feedback review state depending on command",
|
|
426
433
|
" --source <value> Feedback source filter for feedback-sync",
|
|
427
|
-
" --priority <value> Feedback review priority target: Low, Medium, or High",
|
|
428
|
-
" --user-id <id> Feedback assignee user id for `myte feedback assign`",
|
|
429
|
-
" --
|
|
430
|
-
" --due-date <date> Feedback due date target for edit artifacts",
|
|
434
|
+
" --priority <value> Feedback review priority target: Low, Medium, or High",
|
|
435
|
+
" --user-id <id> Feedback assignee user id for `myte feedback assign`",
|
|
436
|
+
" --due-date <date> Feedback due date target for edit artifacts",
|
|
431
437
|
" --review-note <text> Review note stored in feedback refinement history",
|
|
432
438
|
" --with-prd-text Include extracted PRD text so local PRD files are materialized during feedback-sync (default: on)",
|
|
433
439
|
" --no-with-prd-text Skip PRD and readable comment-attachment extraction; keep feedback/comment/attachment metadata",
|
|
@@ -471,13 +477,14 @@ function printHelp() {
|
|
|
471
477
|
" myte feedback review --request-id 507f1f77bcf86cd799439022 --action approve --reason \"Looks correct\" --json",
|
|
472
478
|
" myte feedback move --feedback-id 507f1f77bcf86cd799439011 --to-state in_progress --reason \"Started\" --json",
|
|
473
479
|
" myte feedback comment --feedback-id 507f1f77bcf86cd799439011 --body-file ./comments/implementation.md --confirm-write --approval-artifact ./comments/implementation.md --json",
|
|
480
|
+
" myte feedback document-add --feedback-id 507f1f77bcf86cd799439011 --prd-file ./drafts/sidebar-branding.md --title \"Individual Use Sidebar Branding\" --reason \"Link governed UX addendum to the Feedback context.\"",
|
|
474
481
|
" myte feedback validate --file ./MyteCommandCenter/reviews/feedback/507f1f77bcf86cd799439011-status.yml --json",
|
|
475
482
|
" myte feedback apply --file ./MyteCommandCenter/reviews/feedback/507f1f77bcf86cd799439011-status.yml --json",
|
|
476
483
|
" myte suggestions create --file ./suggestions/create.yml --confirm-write --approval-artifact ./suggestions/create.yml",
|
|
477
484
|
" myte suggestions revise --file ./suggestions/revise.yml --confirm-write --approval-artifact ./suggestions/revise.yml",
|
|
478
485
|
" myte suggestions review",
|
|
479
486
|
" myte update-client --subject \"Weekly client update\" --body-markdown \"## Progress\\n- Login complete\" --target-contact-ids 507f1f77bcf86cd799439011,507f1f77bcf86cd799439012 --confirm-write --approval-artifact ./updates/week-12.md",
|
|
480
|
-
" myte create-prd ./drafts/auth-prd.md --description \"Short card summary\" --confirm-write --approval-artifact ./drafts/auth-prd.md",
|
|
487
|
+
" myte create-prd ./drafts/auth-prd.md --description \"Short card summary\" --assigned-user-email dev@example.com --confirm-write --approval-artifact ./drafts/auth-prd.md",
|
|
481
488
|
" myte create-prd ./drafts/auth-prd.md ./drafts/billing-prd.md --confirm-write --approval-artifact ./drafts/prd-batch.md",
|
|
482
489
|
" myte create-prd ./drafts/overview.md ./drafts/api.md ./drafts/web.md --document-set --title \"Platform PRD\" --confirm-write --approval-artifact ./drafts/platform-prd-approval.md",
|
|
483
490
|
" cat ./drafts/auth-prd.md | myte create-prd --stdin --confirm-write --approval-artifact ./drafts/auth-prd.md",
|
|
@@ -5479,6 +5486,27 @@ async function runCreatePrd(args) {
|
|
|
5479
5486
|
const documentSetMode = Boolean(
|
|
5480
5487
|
args["document-set"] || args.documentSet || args.document_set
|
|
5481
5488
|
);
|
|
5489
|
+
const assignedUserId = firstNonEmptyString(
|
|
5490
|
+
args["assigned-user-id"],
|
|
5491
|
+
args.assignedUserId,
|
|
5492
|
+
args.assigned_user_id
|
|
5493
|
+
);
|
|
5494
|
+
const assignedUserEmail = firstNonEmptyString(
|
|
5495
|
+
args["assigned-user-email"],
|
|
5496
|
+
args.assignedUserEmail,
|
|
5497
|
+
args.assigned_user_email
|
|
5498
|
+
);
|
|
5499
|
+
|
|
5500
|
+
if (assignedUserId && assignedUserEmail) {
|
|
5501
|
+
console.error("Use either --assigned-user-id or --assigned-user-email, not both.");
|
|
5502
|
+
process.exit(1);
|
|
5503
|
+
}
|
|
5504
|
+
|
|
5505
|
+
const applyCreatePrdAssignment = (payload) => {
|
|
5506
|
+
if (assignedUserId) payload.assigned_user_id = assignedUserId;
|
|
5507
|
+
if (assignedUserEmail) payload.assigned_user_email = assignedUserEmail;
|
|
5508
|
+
return payload;
|
|
5509
|
+
};
|
|
5482
5510
|
|
|
5483
5511
|
if (useStdin && providedPaths.length) {
|
|
5484
5512
|
console.error("Use either file paths or --stdin for create-prd, not both.");
|
|
@@ -5520,7 +5548,7 @@ async function runCreatePrd(args) {
|
|
|
5520
5548
|
if (includeClientRef && filePath) {
|
|
5521
5549
|
payload.client_ref = path.relative(process.cwd(), filePath) || path.basename(filePath);
|
|
5522
5550
|
}
|
|
5523
|
-
return payload;
|
|
5551
|
+
return applyCreatePrdAssignment(payload);
|
|
5524
5552
|
};
|
|
5525
5553
|
|
|
5526
5554
|
let payloads = [];
|
|
@@ -5596,7 +5624,7 @@ async function runCreatePrd(args) {
|
|
|
5596
5624
|
if (priority) documentSetPayload.priority = priority;
|
|
5597
5625
|
if (status) documentSetPayload.status = status;
|
|
5598
5626
|
if (tags) documentSetPayload.tags = tags;
|
|
5599
|
-
payloads = [documentSetPayload];
|
|
5627
|
+
payloads = [applyCreatePrdAssignment(documentSetPayload)];
|
|
5600
5628
|
} else {
|
|
5601
5629
|
payloads = resolvedFiles.map(({ absPath, sourceText }) =>
|
|
5602
5630
|
buildCreatePrdPayload({
|
|
@@ -6629,7 +6657,50 @@ async function buildFeedbackDraftForCommand(args, subcommand) {
|
|
|
6629
6657
|
process.exit(1);
|
|
6630
6658
|
}
|
|
6631
6659
|
changes.assigned_user_id = feedbackChange(firstNonEmptyString(item.assigned_user_id), assignee);
|
|
6632
|
-
} else if (action === "
|
|
6660
|
+
} else if (action === "document-add") {
|
|
6661
|
+
const prdFile = firstNonEmptyString(
|
|
6662
|
+
args["prd-file"],
|
|
6663
|
+
args.prdFile,
|
|
6664
|
+
args.prd_file,
|
|
6665
|
+
args["document-file"],
|
|
6666
|
+
args.documentFile,
|
|
6667
|
+
args.document_file,
|
|
6668
|
+
args._?.[2],
|
|
6669
|
+
);
|
|
6670
|
+
if (!prdFile) {
|
|
6671
|
+
console.error("Missing --prd-file for feedback document-add.");
|
|
6672
|
+
process.exit(1);
|
|
6673
|
+
}
|
|
6674
|
+
const proposedPath = resolveInputFile(prdFile, "PRD document addition");
|
|
6675
|
+
const proposedMarkdown = fs.readFileSync(proposedPath, "utf8");
|
|
6676
|
+
if (!proposedMarkdown.trim()) {
|
|
6677
|
+
console.error("PRD document markdown cannot be empty.");
|
|
6678
|
+
process.exit(1);
|
|
6679
|
+
}
|
|
6680
|
+
if (proposedMarkdown.length > 250000) {
|
|
6681
|
+
console.error("PRD document markdown must be at most 250000 characters.");
|
|
6682
|
+
process.exit(1);
|
|
6683
|
+
}
|
|
6684
|
+
const filename = firstNonEmptyString(
|
|
6685
|
+
args.filename,
|
|
6686
|
+
args["file-name"],
|
|
6687
|
+
args.fileName,
|
|
6688
|
+
path.basename(proposedPath),
|
|
6689
|
+
);
|
|
6690
|
+
const derivedTitle = firstNonEmptyString(
|
|
6691
|
+
args.title,
|
|
6692
|
+
String(proposedMarkdown.match(/^#\s+(.+)$/m)?.[1] || "").trim(),
|
|
6693
|
+
path.basename(proposedPath, path.extname(proposedPath)),
|
|
6694
|
+
"Linked PRD document",
|
|
6695
|
+
);
|
|
6696
|
+
const clientRef = firstNonEmptyString(args["client-ref"], args.clientRef, args.client_ref, filename);
|
|
6697
|
+
changes.prd_document_addition = feedbackChange(null, {
|
|
6698
|
+
source_markdown: proposedMarkdown,
|
|
6699
|
+
title: derivedTitle,
|
|
6700
|
+
filename,
|
|
6701
|
+
client_ref: clientRef,
|
|
6702
|
+
});
|
|
6703
|
+
} else if (action === "edit" || action === "refine") {
|
|
6633
6704
|
const title = firstNonEmptyString(args.title);
|
|
6634
6705
|
if (title) changes.title = feedbackChange(firstNonEmptyString(item.title), title);
|
|
6635
6706
|
|
|
@@ -6706,7 +6777,7 @@ async function buildFeedbackDraftForCommand(args, subcommand) {
|
|
|
6706
6777
|
}
|
|
6707
6778
|
}
|
|
6708
6779
|
} else {
|
|
6709
|
-
console.error("Unknown feedback draft command. Use status, edit, assign, archive, or refine.");
|
|
6780
|
+
console.error("Unknown feedback draft command. Use status, edit, document-add, assign, archive, or refine.");
|
|
6710
6781
|
process.exit(1);
|
|
6711
6782
|
}
|
|
6712
6783
|
|
|
@@ -7616,7 +7687,7 @@ async function runFeedback(args) {
|
|
|
7616
7687
|
printHelp();
|
|
7617
7688
|
return;
|
|
7618
7689
|
}
|
|
7619
|
-
if (["status", "edit", "assign", "archive", "refine"].includes(subcommand)) {
|
|
7690
|
+
if (["status", "edit", "document-add", "assign", "archive", "refine"].includes(subcommand)) {
|
|
7620
7691
|
await buildFeedbackDraftForCommand(args, subcommand);
|
|
7621
7692
|
return;
|
|
7622
7693
|
}
|
|
@@ -7664,7 +7735,7 @@ async function runFeedback(args) {
|
|
|
7664
7735
|
await runFeedbackGetOrHistory(args, subcommand);
|
|
7665
7736
|
return;
|
|
7666
7737
|
}
|
|
7667
|
-
console.error("Unknown feedback command. Use status, edit, assign, archive, submit, revise, reviews, review, move, comment, undo, prd-versions, prd-diff, get, history, validate, or apply.");
|
|
7738
|
+
console.error("Unknown feedback command. Use status, edit, document-add, assign, archive, submit, revise, reviews, review, move, comment, undo, prd-versions, prd-diff, get, history, validate, or apply.");
|
|
7668
7739
|
process.exit(1);
|
|
7669
7740
|
}
|
|
7670
7741
|
|
package/mytecody-cli.js
CHANGED
|
@@ -634,12 +634,12 @@ function manifestWithoutSignature(manifest) {
|
|
|
634
634
|
return clone;
|
|
635
635
|
}
|
|
636
636
|
|
|
637
|
-
function verifyManifestSignature(manifest) {
|
|
637
|
+
function verifyManifestSignature(manifest, { publicKeyPem } = {}) {
|
|
638
638
|
const signature = manifest && manifest.signature;
|
|
639
639
|
if (!signature || !signature.value) {
|
|
640
640
|
return { status: "missing", verified: false };
|
|
641
641
|
}
|
|
642
|
-
const publicKey = builtInPublicKeyPem();
|
|
642
|
+
const publicKey = publicKeyPem || builtInPublicKeyPem();
|
|
643
643
|
if (!publicKey) {
|
|
644
644
|
return {
|
|
645
645
|
status: "public-key-missing",
|
|
@@ -772,8 +772,8 @@ function artifactBytesForInstall(bytes, artifact) {
|
|
|
772
772
|
throw new Error(`Unsupported MyteCody release artifact format: ${format}`);
|
|
773
773
|
}
|
|
774
774
|
|
|
775
|
-
function signatureAccepted(manifest, args = {}) {
|
|
776
|
-
const signature = verifyManifestSignature(manifest);
|
|
775
|
+
function signatureAccepted(manifest, args = {}, { publicKeyPem } = {}) {
|
|
776
|
+
const signature = verifyManifestSignature(manifest, { publicKeyPem });
|
|
777
777
|
if (signature.verified) return { ok: true, signature, trusted_unsigned: false };
|
|
778
778
|
return { ok: false, signature, trusted_unsigned: false };
|
|
779
779
|
}
|
|
@@ -1776,7 +1776,11 @@ async function runDoctor(args, envPath) {
|
|
|
1776
1776
|
return 0;
|
|
1777
1777
|
}
|
|
1778
1778
|
|
|
1779
|
-
async function buildUpdatePayload(
|
|
1779
|
+
async function buildUpdatePayload(
|
|
1780
|
+
args,
|
|
1781
|
+
envPath,
|
|
1782
|
+
{ dryRun = false, progress = null, publicKeyPem } = {},
|
|
1783
|
+
) {
|
|
1780
1784
|
const isDryRun = Boolean(dryRun);
|
|
1781
1785
|
const source = manifestUrl(args);
|
|
1782
1786
|
const manifestResult = await readManifest(source, {
|
|
@@ -1785,7 +1789,9 @@ async function buildUpdatePayload(args, envPath, { dryRun = false, progress = nu
|
|
|
1785
1789
|
});
|
|
1786
1790
|
const manifest = manifestResult.manifest;
|
|
1787
1791
|
const artifact = manifest ? artifactForPlatform(manifest) : null;
|
|
1788
|
-
const signature = manifest
|
|
1792
|
+
const signature = manifest
|
|
1793
|
+
? signatureAccepted(manifest, args, { publicKeyPem })
|
|
1794
|
+
: { ok: false, signature: { status: "not-checked", verified: false } };
|
|
1789
1795
|
const artifactMetadata = manifest ? validateArtifactMetadata(artifact) : { status: "not-checked", ok: false };
|
|
1790
1796
|
const releaseAssets = manifest ? releaseAssetsForPlatform(manifest, artifact) : [];
|
|
1791
1797
|
const payload = {
|
|
@@ -1870,7 +1876,11 @@ function autoInstallEnabled(args = {}) {
|
|
|
1870
1876
|
return true;
|
|
1871
1877
|
}
|
|
1872
1878
|
|
|
1873
|
-
async function ensureBrandedEngineInstalled(
|
|
1879
|
+
async function ensureBrandedEngineInstalled(
|
|
1880
|
+
args = {},
|
|
1881
|
+
envPath = null,
|
|
1882
|
+
{ progress = null, publicKeyPem } = {},
|
|
1883
|
+
) {
|
|
1874
1884
|
const updateArgs = {
|
|
1875
1885
|
...args,
|
|
1876
1886
|
"fetch-manifest": true,
|
|
@@ -1906,7 +1916,7 @@ async function ensureBrandedEngineInstalled(args = {}, envPath = null, { progres
|
|
|
1906
1916
|
}
|
|
1907
1917
|
return { ok: false, installed: false, reason: "manifest-unavailable", manifest_status: manifestResult.status };
|
|
1908
1918
|
}
|
|
1909
|
-
const signature = signatureAccepted(manifest, updateArgs);
|
|
1919
|
+
const signature = signatureAccepted(manifest, updateArgs, { publicKeyPem });
|
|
1910
1920
|
if (!signature.ok) {
|
|
1911
1921
|
return { ok: false, installed: false, reason: "manifest-untrusted", signature: signature.signature };
|
|
1912
1922
|
}
|
|
@@ -1923,7 +1933,11 @@ async function ensureBrandedEngineInstalled(args = {}, envPath = null, { progres
|
|
|
1923
1933
|
return { ok: false, installed: false, reason: "update-required-auto-install-disabled" };
|
|
1924
1934
|
}
|
|
1925
1935
|
|
|
1926
|
-
const payload = await buildUpdatePayload(updateArgs, envPath, {
|
|
1936
|
+
const payload = await buildUpdatePayload(updateArgs, envPath, {
|
|
1937
|
+
dryRun: false,
|
|
1938
|
+
progress,
|
|
1939
|
+
publicKeyPem,
|
|
1940
|
+
});
|
|
1927
1941
|
return {
|
|
1928
1942
|
ok: Boolean(payload.installed && payload.installed.ok),
|
|
1929
1943
|
installed: Boolean(payload.installed && payload.installed.ok),
|
|
@@ -1932,11 +1946,12 @@ async function ensureBrandedEngineInstalled(args = {}, envPath = null, { progres
|
|
|
1932
1946
|
};
|
|
1933
1947
|
}
|
|
1934
1948
|
|
|
1935
|
-
async function runUpdate(args, envPath) {
|
|
1949
|
+
async function runUpdate(args, envPath, { publicKeyPem } = {}) {
|
|
1936
1950
|
const dryRun = Boolean(args["dry-run"]);
|
|
1937
1951
|
const payload = await buildUpdatePayload(args, envPath, {
|
|
1938
1952
|
dryRun,
|
|
1939
1953
|
progress: args.json ? null : statusLine,
|
|
1954
|
+
publicKeyPem,
|
|
1940
1955
|
});
|
|
1941
1956
|
|
|
1942
1957
|
if (args.json) {
|
|
@@ -1964,7 +1979,7 @@ async function runUpdate(args, envPath) {
|
|
|
1964
1979
|
return 0;
|
|
1965
1980
|
}
|
|
1966
1981
|
|
|
1967
|
-
async function run(argv = process.argv.slice(2)) {
|
|
1982
|
+
async function run(argv = process.argv.slice(2), { publicKeyPem } = {}) {
|
|
1968
1983
|
const envPath = loadEnv();
|
|
1969
1984
|
const parsed = parseArgs(argv);
|
|
1970
1985
|
const command = argv[0] || "codex";
|
|
@@ -1975,7 +1990,7 @@ async function run(argv = process.argv.slice(2)) {
|
|
|
1975
1990
|
return 0;
|
|
1976
1991
|
}
|
|
1977
1992
|
if (command === "doctor") return runDoctor(restArgs, envPath);
|
|
1978
|
-
if (command === "update") return runUpdate(restArgs, envPath);
|
|
1993
|
+
if (command === "update") return runUpdate(restArgs, envPath, { publicKeyPem });
|
|
1979
1994
|
if (command === "controller-sidecar") return runControllerSidecar();
|
|
1980
1995
|
if (command === "version" || command === "--version" || command === "-v") {
|
|
1981
1996
|
console.log(PACKAGE_VERSION);
|