taphound 0.2.0-dev.11 → 0.2.0-dev.13

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.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/assets/skills/taphound-case-suite/SKILL.md +8 -6
  4. package/assets/skills/taphound-case-suite/scripts/ledger.mjs +84 -19
  5. package/assets/skills/taphound-journey-brief-author/SKILL.md +8 -3
  6. package/assets/skills/taphound-journey-brief-author/prompts/brief-author-role.md +3 -1
  7. package/assets/skills/taphound-journey-brief-author/prompts/brief-author-role.zh-CN.md +1 -1
  8. package/assets/skills/taphound-journey-generator/SKILL.md +21 -5
  9. package/assets/skills/taphound-journey-generator/prompts/consume-journey-brief.md +3 -1
  10. package/assets/skills/taphound-journey-generator/prompts/generate-step.md +9 -0
  11. package/assets/skills/taphound-journey-generator/scripts/envelope.mjs +80 -10
  12. package/assets/skills/taphound-verify-change/references/preserve.md +15 -7
  13. package/assets/skills/taphound-verify-change/scripts/ui-refactor.mjs +1 -1
  14. package/dist/adapters/appium/appium-ui-snapshot-provider.d.ts +8 -0
  15. package/dist/adapters/appium/appium-ui-snapshot-provider.js +123 -54
  16. package/dist/adapters/filesystem/diagnostics-journal.d.ts +17 -0
  17. package/dist/adapters/filesystem/diagnostics-journal.js +130 -0
  18. package/dist/application/diagnostics/diagnostics-exporter.d.ts +29 -0
  19. package/dist/application/diagnostics/diagnostics-exporter.js +283 -0
  20. package/dist/application/diagnostics/ui-capture-telemetry.d.ts +16 -0
  21. package/dist/application/diagnostics/ui-capture-telemetry.js +81 -0
  22. package/dist/application/generation/proposed-step-validator.js +5 -1
  23. package/dist/application/journey/journey-check-service.d.ts +7 -1
  24. package/dist/application/journey/journey-check-service.js +16 -1
  25. package/dist/application/report/report-writer.d.ts +5 -0
  26. package/dist/application/report/report-writer.js +20 -0
  27. package/dist/application/runtime/verify-runtime.js +32 -2
  28. package/dist/application/ui/observed-ui-snapshot-provider.d.ts +15 -0
  29. package/dist/application/ui/observed-ui-snapshot-provider.js +66 -0
  30. package/dist/application/ui/ui-stability-probe.d.ts +6 -0
  31. package/dist/application/ui/ui-stability-probe.js +21 -5
  32. package/dist/application/wait/idle-waiter.js +29 -6
  33. package/dist/cli/commands/diagnose.d.ts +3 -0
  34. package/dist/cli/commands/diagnose.js +84 -0
  35. package/dist/cli/commands/generation/session-commands.js +4 -1
  36. package/dist/cli/commands/journey.js +3 -1
  37. package/dist/cli/commands/verify.js +55 -3
  38. package/dist/cli/dependencies.d.ts +11 -0
  39. package/dist/cli/dependencies.js +58 -5
  40. package/dist/cli/diagnostics-recorder.d.ts +31 -0
  41. package/dist/cli/diagnostics-recorder.js +82 -0
  42. package/dist/cli/main.d.ts +1 -1
  43. package/dist/cli/main.js +58 -1
  44. package/dist/cli/program.js +3 -1
  45. package/dist/domain/contract.d.ts +6 -6
  46. package/dist/domain/diagnostics.d.ts +1396 -0
  47. package/dist/domain/diagnostics.js +193 -0
  48. package/dist/domain/failure.js +1 -1
  49. package/dist/domain/report.d.ts +11 -3
  50. package/dist/domain/report.js +1 -0
  51. package/dist/domain/verify-receipt.d.ts +17 -0
  52. package/dist/domain/verify-receipt.js +17 -0
  53. package/dist/domain/workspace.d.ts +11 -0
  54. package/dist/domain/workspace.js +14 -0
  55. package/dist/ports/diagnostics.d.ts +15 -0
  56. package/dist/ports/diagnostics.js +1 -0
  57. package/package.json +4 -3
  58. package/scripts/feedback-pack.mjs +399 -0
package/dist/cli/main.js CHANGED
@@ -6,6 +6,7 @@ import { pathToFileURL } from "node:url";
6
6
  import { CommanderError } from "commander";
7
7
  import { createProductionDependencies } from "./dependencies.js";
8
8
  import { RuntimeBackendConfigError, RuntimeBackendSelectionError, resolveRuntimeBackendChoiceFromInvocation } from "./runtime-selection.js";
9
+ import { commandEvent, describeInvocation } from "./diagnostics-recorder.js";
9
10
  import { errorMessage, failureOutput, writeJson, writeLine } from "./output.js";
10
11
  import { createProgram } from "./program.js";
11
12
  export async function withTerminationSignal(operation, source = process) {
@@ -43,11 +44,64 @@ function overrideCommandExits(command) {
43
44
  overrideCommandExits(child);
44
45
  }
45
46
  }
46
- export async function runMain(argv, dependencies = createProductionDependencies()) {
47
+ /**
48
+ * Wraps the dependencies so the finished invocation can be journaled: the
49
+ * last exit code, and stdout only when the command promised one JSON value.
50
+ */
51
+ function observeInvocation(dependencies, json) {
52
+ let exitCode = 0;
53
+ let stdout = "";
54
+ return {
55
+ dependencies: {
56
+ ...dependencies,
57
+ stdout: {
58
+ write: (content) => {
59
+ if (json)
60
+ stdout += content;
61
+ dependencies.stdout.write(content);
62
+ }
63
+ },
64
+ setExitCode: (code) => {
65
+ exitCode = code;
66
+ dependencies.setExitCode(code);
67
+ }
68
+ },
69
+ exitCode: () => exitCode,
70
+ stdout: () => (json ? stdout : undefined)
71
+ };
72
+ }
73
+ async function journalInvocation(dependencies, invocation, startedAt, observed) {
74
+ const diagnostics = dependencies.diagnostics;
75
+ if (diagnostics === undefined || invocation === undefined)
76
+ return;
77
+ try {
78
+ await diagnostics.journal.append(invocation.projectRoot, commandEvent({
79
+ invocation,
80
+ startedAt,
81
+ durationMs: Date.now() - startedAt.getTime(),
82
+ exitCode: observed.exitCode(),
83
+ stdout: observed.stdout(),
84
+ telemetry: diagnostics.telemetry
85
+ }));
86
+ }
87
+ catch {
88
+ // The journal is best-effort evidence; it never changes a command result.
89
+ }
90
+ }
91
+ export async function runMain(argv, baseDependencies = createProductionDependencies()) {
47
92
  const json = argv.includes("--json");
93
+ const startedAt = new Date();
94
+ const observed = observeInvocation(baseDependencies, json);
95
+ const dependencies = baseDependencies.diagnostics === undefined
96
+ ? baseDependencies
97
+ : observed.dependencies;
98
+ let invocation;
48
99
  try {
49
100
  const program = createProgram(dependencies);
50
101
  overrideCommandExits(program);
102
+ program.hook("preAction", (_program, action) => {
103
+ invocation = describeInvocation(action, dependencies.cwd());
104
+ });
51
105
  await program.parseAsync([...argv]);
52
106
  }
53
107
  catch (error) {
@@ -67,6 +121,9 @@ export async function runMain(argv, dependencies = createProductionDependencies(
67
121
  }
68
122
  dependencies.setExitCode(exitCode);
69
123
  }
124
+ finally {
125
+ await journalInvocation(dependencies, invocation, startedAt, observed);
126
+ }
70
127
  }
71
128
  const entryPath = process.argv[1];
72
129
  if (entryPath !== undefined
@@ -15,6 +15,7 @@ import { createImpactCommand } from "./commands/impact.js";
15
15
  import { createKnowledgeCommand } from "./commands/knowledge.js";
16
16
  import { createBaselineCommand } from "./commands/baseline.js";
17
17
  import { createFailureCommand } from "./commands/failure.js";
18
+ import { createDiagnoseCommand } from "./commands/diagnose.js";
18
19
  import { createProductionDependencies } from "./dependencies.js";
19
20
  export function createProgram(dependencies = createProductionDependencies()) {
20
21
  const configureOutput = (command) => {
@@ -57,5 +58,6 @@ export function createProgram(dependencies = createProductionDependencies()) {
57
58
  .addCommand(configureOutput(createFailureCommand(dependencies)))
58
59
  .addCommand(configureOutput(createInitCommand(dependencies)))
59
60
  .addCommand(configureOutput(createAlignCommand(dependencies)))
60
- .addCommand(configureOutput(createImpactCommand(dependencies)));
61
+ .addCommand(configureOutput(createImpactCommand(dependencies)))
62
+ .addCommand(configureOutput(createDiagnoseCommand(dependencies)));
61
63
  }
@@ -214,8 +214,8 @@ export declare const ContractPreconditionOutcomeSchema: z.ZodObject<{
214
214
  status: z.ZodEnum<{
215
215
  passed: "passed";
216
216
  failed: "failed";
217
- unresolved: "unresolved";
218
217
  notRun: "notRun";
218
+ unresolved: "unresolved";
219
219
  }>;
220
220
  message: z.ZodOptional<z.ZodString>;
221
221
  }, z.core.$strict>;
@@ -228,8 +228,8 @@ export declare const ContractAssertionOutcomeSchema: z.ZodObject<{
228
228
  status: z.ZodEnum<{
229
229
  passed: "passed";
230
230
  failed: "failed";
231
- unresolved: "unresolved";
232
231
  notRun: "notRun";
232
+ unresolved: "unresolved";
233
233
  }>;
234
234
  message: z.ZodOptional<z.ZodString>;
235
235
  }, z.core.$strict>;
@@ -248,8 +248,8 @@ export declare const ContractCheckpointOutcomeSchema: z.ZodObject<{
248
248
  status: z.ZodEnum<{
249
249
  passed: "passed";
250
250
  failed: "failed";
251
- unresolved: "unresolved";
252
251
  notRun: "notRun";
252
+ unresolved: "unresolved";
253
253
  }>;
254
254
  message: z.ZodOptional<z.ZodString>;
255
255
  }, z.core.$strict>;
@@ -294,8 +294,8 @@ export declare const ContractVerdictViewSchema: z.ZodObject<{
294
294
  status: z.ZodEnum<{
295
295
  passed: "passed";
296
296
  failed: "failed";
297
- unresolved: "unresolved";
298
297
  notRun: "notRun";
298
+ unresolved: "unresolved";
299
299
  }>;
300
300
  message: z.ZodOptional<z.ZodString>;
301
301
  }, z.core.$strict>>;
@@ -308,8 +308,8 @@ export declare const ContractVerdictViewSchema: z.ZodObject<{
308
308
  status: z.ZodEnum<{
309
309
  passed: "passed";
310
310
  failed: "failed";
311
- unresolved: "unresolved";
312
311
  notRun: "notRun";
312
+ unresolved: "unresolved";
313
313
  }>;
314
314
  message: z.ZodOptional<z.ZodString>;
315
315
  }, z.core.$strict>>;
@@ -318,8 +318,8 @@ export declare const ContractVerdictViewSchema: z.ZodObject<{
318
318
  status: z.ZodEnum<{
319
319
  passed: "passed";
320
320
  failed: "failed";
321
- unresolved: "unresolved";
322
321
  notRun: "notRun";
322
+ unresolved: "unresolved";
323
323
  }>;
324
324
  message: z.ZodOptional<z.ZodString>;
325
325
  }, z.core.$strict>>>;