zcode-app-cli 3.14.1-27 → 3.14.3-28

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.
@@ -1,11 +1,12 @@
1
1
  # Worked dynamic-workflow examples
2
2
 
3
- Four complete scripts, end to end. Each is a whole arc — world read, topology, loop or
3
+ Five complete scripts, end to end. Each is a whole arc — world read, topology, loop or
4
4
  fan-out, salvage, artifacts, return shape — so read one when you want to see how the pieces
5
5
  sit together rather than looking up a single shape (`patterns.md` is for that).
6
6
 
7
- Every script here is submitted as the `script` argument of the `CreateWorkflow` tool, whose
8
- description carries the API surface these scripts are written against.
7
+ Every script here is submitted as the `script` argument of the `CreateWorkflow` tool. The
8
+ API surface they are written against is `SKILL.md` §16 (the facade block in §16.2 and the
9
+ rules in §16.3), not the tool description.
9
10
 
10
11
  ---
11
12
 
@@ -659,3 +660,142 @@ One artifact, deliberately. The report lists every attempt, which is more than t
659
660
  could follow is the round number and whether the checker passed, and the phase timeline
660
661
  lighting up "Repair what the checker rejected" again already shows exactly that. A metrics
661
662
  tile would repeat it, and the proof file is the repository's to show, not a card's.
663
+
664
+ ## 5. Changed-file review with confirmation as reviews land
665
+
666
+ Review every changed file, triage its findings on one scale, confirm each kept finding
667
+ independently, and hand back a report. Everything a file needs happens as soon as its own
668
+ review lands; the only join is the cross-file deduplication that needs every finding.
669
+
670
+ <!-- compile -->
671
+ ```ts
672
+ interface Finding {
673
+ /** Workspace-relative path, with a line when it applies: "src/a.ts:42". */
674
+ where: string;
675
+ /** One sentence: what is wrong. */
676
+ what: string;
677
+ /** What showed it: the lines read, or the command and the output that proved it. */
678
+ evidence: string;
679
+ /** How much it matters. Reserve "high" for data loss, a crash, or a wrong result. */
680
+ severity: "low" | "medium" | "high";
681
+ }
682
+ interface Review {
683
+ findings: Finding[];
684
+ }
685
+ interface Keep {
686
+ /** True when this finding is worth putting in front of a human. */
687
+ keep: boolean;
688
+ }
689
+ interface Confirmation {
690
+ /** True only when you reproduced the problem yourself from the evidence. */
691
+ reproduced: boolean;
692
+ /** What you did to check, one sentence. */
693
+ note: string;
694
+ }
695
+ interface ReportedFinding extends Finding {
696
+ /** "verified" when the confirmer reproduced it; "unconfirmed" when it could not. */
697
+ status: "verified" | "unconfirmed";
698
+ }
699
+ interface Digest {
700
+ /** The confirmed findings with duplicates across files merged, one line each. */
701
+ lines: string[];
702
+ /** Two or three sentences a reader can act on. */
703
+ summary: string;
704
+ }
705
+ interface WorkflowReport {
706
+ /** Two or three sentences answering what the user asked for. */
707
+ conclusion: string;
708
+ findings: ReportedFinding[];
709
+ /** What the run checked and how. */
710
+ verified: string[];
711
+ /** What the run did not look at or could not check, and why. */
712
+ notCovered: string[];
713
+ }
714
+
715
+ phase("Review each changed file and confirm its findings as they land");
716
+ let paths: string[];
717
+ try {
718
+ paths = await git.changedFiles("origin/main");
719
+ } catch {
720
+ paths = await files.glob("src/**/*.ts");
721
+ }
722
+ log(`reviewing ${paths.length} changed files`);
723
+
724
+ // One triage subagent for all findings: severity only means anything if it is judged on a
725
+ // consistent scale. It is a queue, not a barrier — asks on it run FIFO, so a finding reaches
726
+ // it the moment its file's review lands, whichever file that is.
727
+ const triage = agent("triage", "You decide which review findings deserve a human's attention. Be strict.");
728
+
729
+ // One reviewer per file, fresh each: the files are unrelated, so nothing is gained by
730
+ // sharing a context and everything is gained by running them at once. Triage and
731
+ // confirmation live inside the same callback, so no file waits for the slowest review
732
+ // before its findings move on; the outer `Promise.all` is the only join the report waits on.
733
+ const perFile = await Promise.all(
734
+ paths.map(async (p) => {
735
+ const review = await agent(`reviewer-${p}`).ask<Review>(`Review ${p} for correctness bugs.`);
736
+
737
+ const kept: Finding[] = [];
738
+ for (const finding of review.findings) {
739
+ const verdict = await triage.ask<Keep>(`Worth reporting? ${JSON.stringify(finding)}`);
740
+ if (verdict.keep) kept.push(finding);
741
+ }
742
+
743
+ // A separate confirmer per kept finding, blind to the reviewer that raised it: it reads
744
+ // the code, runs a check if one decides it, and is told not to fix anything. The name
745
+ // carries the path and the index, because every subagent name in a run must be unique.
746
+ return Promise.all(
747
+ kept.map(async (finding, index) => {
748
+ const check = await agent(`confirmer-${p}-${index}`).ask<Confirmation>(
749
+ `Reproduce this finding from its evidence alone: read the code, run a check if one exists. Do not edit any file.\n${JSON.stringify(finding)}`,
750
+ );
751
+ const reported: ReportedFinding = {
752
+ ...finding,
753
+ status: check.reproduced ? "verified" : "unconfirmed",
754
+ };
755
+ report(reported); // published now, with its status, so it survives a later failure
756
+ return reported;
757
+ }),
758
+ );
759
+ }),
760
+ );
761
+ const confirmed = perFile.flat();
762
+ log(`${confirmed.length} findings confirmed or labelled`);
763
+
764
+ // The one stage that genuinely needs every finding: two reviewers can flag the same root
765
+ // cause from two files, and only a reader of the whole list can merge them.
766
+ phase("Merge duplicate findings across files and write them up");
767
+ const digest = await agent("editor", "You merge review findings that share a root cause and write them up for the engineer who fixes them.")
768
+ .ask<Digest>(`Merge duplicates and write these up:\n${JSON.stringify(confirmed)}`);
769
+
770
+ const verifiedCount = confirmed.filter((f) => f.status === "verified").length;
771
+ await artifact.markdown(
772
+ "report",
773
+ [
774
+ `# Review of ${paths.length} changed files: ${confirmed.length} findings, ${verifiedCount} reproduced`,
775
+ "",
776
+ digest.summary,
777
+ "",
778
+ ...digest.lines.map((line) => `- ${line}`),
779
+ "",
780
+ "## Every finding",
781
+ ...confirmed.map((f) => `- **${f.where}** (${f.severity}, ${f.status}): ${f.what}\n ${f.evidence}`),
782
+ ].join("\n"),
783
+ { title: "Review report" },
784
+ );
785
+ const result: WorkflowReport = {
786
+ conclusion: digest.summary,
787
+ findings: confirmed,
788
+ verified: paths.map((p) => `reviewed ${p}; every kept finding re-checked by a separate subagent`),
789
+ notCovered: ["files outside the change set", "runtime behaviour no existing test exercises"],
790
+ };
791
+ return result;
792
+ ```
793
+
794
+ Three shapes in one script, each chosen for a reason. The reviewers are fresh and parallel
795
+ because the files are unrelated. The triage subagent is shared because severity must mean the
796
+ same thing twice — and sharing costs nothing here, because its FIFO queue is fed as reviews
797
+ land rather than after all of them. The confirmers are fresh, per finding and blind to the
798
+ reviewer, and they start the moment their file's triage is done: with twelve files and one
799
+ slow reviewer, eleven files' findings are confirmed and reported while it is still reading.
800
+ Nothing gets a second reader on top: each finding was confirmed, and the editor's job is
801
+ merging and writing up, not re-checking.
@@ -87460,7 +87460,7 @@ var ZCODE_CUA_HELPER_BUILD_ID;
87460
87460
  var init_cua_version = __esm({
87461
87461
  "src/broker/shared/cua-version.ts"() {
87462
87462
  "use strict";
87463
- ZCODE_CUA_HELPER_BUILD_ID = true ? "pipeline-291748-cead36fd" : "";
87463
+ ZCODE_CUA_HELPER_BUILD_ID = true ? "pipeline-293504-ab4d5e6b" : "";
87464
87464
  }
87465
87465
  });
87466
87466
  var init_shared = __esm({
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "zcode-guide",
3
- "version": "0.2.0",
4
- "description": "ZCode usage and self-diagnosis guide: teaches agents and users how to configure MCP servers, commands, skills, hooks, and plugins, how to locate and fix configuration problems for each, and how to author dynamic workflows.",
3
+ "version": "0.3.0",
4
+ "description": "ZCode usage and self-diagnosis guide: teaches agents and users how to configure MCP servers, commands, skills, hooks, and plugins, and how to locate and fix configuration problems for each.",
5
5
  "author": { "name": "Z.ai" },
6
6
  "license": "MIT",
7
- "commands": "commands",
8
7
  "skills": "skills"
9
8
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@zcode/zcode-guide-plugin",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "private": true,
6
6
  "license": "MIT",
7
7
  "description": "作为官方 ZCode 内置插件发布的使用与自诊断指南技能集。"