@poetics/cli 0.1.2 → 0.2.0

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 (60) hide show
  1. package/dist/backfill.d.ts +98 -0
  2. package/dist/backfill.d.ts.map +1 -0
  3. package/dist/backfill.js +582 -0
  4. package/dist/backfill.js.map +1 -0
  5. package/dist/change.d.ts +18 -0
  6. package/dist/change.d.ts.map +1 -0
  7. package/dist/change.js +155 -0
  8. package/dist/change.js.map +1 -0
  9. package/dist/changes.d.ts +4 -0
  10. package/dist/changes.d.ts.map +1 -0
  11. package/dist/changes.js +38 -0
  12. package/dist/changes.js.map +1 -0
  13. package/dist/commands.d.ts.map +1 -1
  14. package/dist/commands.js +6 -2
  15. package/dist/commands.js.map +1 -1
  16. package/dist/coverage.d.ts +39 -0
  17. package/dist/coverage.d.ts.map +1 -0
  18. package/dist/coverage.js +88 -0
  19. package/dist/coverage.js.map +1 -0
  20. package/dist/declarations.d.ts +26 -0
  21. package/dist/declarations.d.ts.map +1 -0
  22. package/dist/declarations.js +34 -0
  23. package/dist/declarations.js.map +1 -0
  24. package/dist/drift.d.ts +29 -0
  25. package/dist/drift.d.ts.map +1 -0
  26. package/dist/drift.js +84 -0
  27. package/dist/drift.js.map +1 -0
  28. package/dist/frameworks.d.ts +6 -0
  29. package/dist/frameworks.d.ts.map +1 -0
  30. package/dist/frameworks.js +8 -0
  31. package/dist/frameworks.js.map +1 -0
  32. package/dist/git.d.ts +19 -0
  33. package/dist/git.d.ts.map +1 -0
  34. package/dist/git.js +40 -0
  35. package/dist/git.js.map +1 -0
  36. package/dist/history.d.ts +6 -0
  37. package/dist/history.d.ts.map +1 -0
  38. package/dist/history.js +53 -0
  39. package/dist/history.js.map +1 -0
  40. package/dist/index.d.ts +21 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +12 -0
  43. package/dist/index.js.map +1 -1
  44. package/dist/indexing.d.ts +91 -0
  45. package/dist/indexing.d.ts.map +1 -0
  46. package/dist/indexing.js +372 -0
  47. package/dist/indexing.js.map +1 -0
  48. package/dist/init.d.ts +35 -0
  49. package/dist/init.d.ts.map +1 -0
  50. package/dist/init.js +186 -0
  51. package/dist/init.js.map +1 -0
  52. package/dist/rehash.d.ts +31 -0
  53. package/dist/rehash.d.ts.map +1 -0
  54. package/dist/rehash.js +73 -0
  55. package/dist/rehash.js.map +1 -0
  56. package/dist/run.d.ts +2 -2
  57. package/dist/run.d.ts.map +1 -1
  58. package/dist/run.js +258 -2
  59. package/dist/run.js.map +1 -1
  60. package/package.json +6 -3
@@ -0,0 +1,98 @@
1
+ import type { Inferred, Unit, Version } from "@poetics/core";
2
+ import type { PoeticsConfig, StoreLayout } from "@poetics/store";
3
+ /** One piece of evidence about why a unit exists. */
4
+ export interface Evidence {
5
+ source: Inferred["sources"][number];
6
+ /** Where it came from: a commit, a file, a path. */
7
+ ref: string;
8
+ text?: string;
9
+ }
10
+ export interface BackfillPlan {
11
+ /** New units, each with its inferred rationale, ready to write. */
12
+ created: Array<{
13
+ unit: Unit;
14
+ evidence: Evidence[];
15
+ }>;
16
+ byConfidence: Record<Inferred["confidence"], number>;
17
+ /** Existing units with code changes nobody recorded: `poetics index` is the tool for those. */
18
+ unrecorded: number;
19
+ /** Existing units the code has TSDoc or a sibling test for that the unit file lacks. */
20
+ missingDocs: Array<{
21
+ uid: string;
22
+ name: string;
23
+ file: string;
24
+ }>;
25
+ missingTests: Array<{
26
+ uid: string;
27
+ name: string;
28
+ file: string;
29
+ test: string;
30
+ }>;
31
+ /** Comments that read like a workaround or an invariant: candidates for a note, never written. */
32
+ candidateNotes: Array<{
33
+ file: string;
34
+ line: number;
35
+ text: string;
36
+ }>;
37
+ }
38
+ /** What a snapshot backfill would write. Nothing is written until `applyBackfill`. */
39
+ export declare function planBackfill(root: string, config: PoeticsConfig): Promise<BackfillPlan>;
40
+ /** Writes the planned units, each as the actor its evidence names. Returns how many were written. */
41
+ export declare function applyBackfill(root: string, plan: BackfillPlan, layout?: StoreLayout): Promise<number>;
42
+ /** The report for people: confidence counts, then what to add or record by hand. */
43
+ export declare function formatBackfillPlan(plan: BackfillPlan, written?: number): string;
44
+ /** Whether there is anything to write. */
45
+ export declare function hasBackfill(plan: BackfillPlan): boolean;
46
+ /** A unit's reconstructed history, or why it stops short. */
47
+ export interface PrehistoryEntry {
48
+ uid: string;
49
+ name: string;
50
+ file: string;
51
+ prehistory: Version[];
52
+ /** Where matching would only queue the unit: its history before this commit is not claimed. */
53
+ stoppedAt?: {
54
+ commit: string;
55
+ reason: string;
56
+ };
57
+ }
58
+ export interface PrehistoryPlan {
59
+ /** First-parent commits walked, oldest first. */
60
+ commits: number;
61
+ /** The range walked, as full commit ids: after `from` (the root when unset) up to and including `to`. */
62
+ range: {
63
+ from?: string;
64
+ to: string;
65
+ };
66
+ units: PrehistoryEntry[];
67
+ /** Units first recorded after `to`: left for a walk that reaches them, since prehistory can only be extended further back. */
68
+ beyond: number;
69
+ /** With `includeRemoved`: exports deleted before anyone recorded them, as new unit files ending in `removed`. */
70
+ removed: Unit[];
71
+ }
72
+ /** Where `poetics backfill --history [from] [to]` walks (refs or commit ids, both optional), and whether to recover deleted exports. */
73
+ export interface PrehistoryRange {
74
+ from?: string;
75
+ to?: string;
76
+ /** `--include-removed`: recover exports deleted before they were recorded (ADR 0011). */
77
+ includeRemoved?: boolean;
78
+ }
79
+ /**
80
+ * `poetics backfill --history` (ADR 0011): walks the first-parent history,
81
+ * reads each changed file's units syntactically, and follows them from commit
82
+ * to commit with `matchIdentities`, recording a version whenever a unit's code
83
+ * changed. A unit's prehistory is what happened before the commit that first
84
+ * recorded its unit file. Where matching would only queue a unit, its history
85
+ * restarts there, and the plan says so: history is never guessed.
86
+ *
87
+ * `range` limits the walk to the first-parent commits after `from` up to `to`
88
+ * (default: the root to HEAD). Code that exists at `from` starts there: its
89
+ * first change in the range opens its prehistory, which a later walk from
90
+ * further back extends. Units first recorded after `to` are left out, since
91
+ * prehistory that stops short of their recording could never be filled in.
92
+ */
93
+ export declare function planPrehistory(root: string, config: PoeticsConfig, range?: PrehistoryRange): Promise<PrehistoryPlan>;
94
+ /** Writes each unit's prehistory, unless it already has exactly that, and a unit file for each recovered deletion. Returns how many unit files changed. */
95
+ export declare function applyPrehistory(root: string, plan: PrehistoryPlan, layout?: StoreLayout): Promise<number>;
96
+ /** The prehistory plan for people: one line per unit with how far back it reaches, then a summary. */
97
+ export declare function formatPrehistoryPlan(plan: PrehistoryPlan, written?: number): string;
98
+ //# sourceMappingURL=backfill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAiD,QAAQ,EAAQ,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAElH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKjE,qDAAqD;AACrD,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,mEAAmE;IACnE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,QAAQ,EAAE,CAAA;KAAE,CAAC,CAAC;IACrD,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;IACrD,+FAA+F;IAC/F,UAAU,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,WAAW,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,YAAY,EAAE,KAAK,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