zaileys 2.2.7 → 3.0.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.
- package/.agent/skills/codebase-mapper/SKILL.md +226 -0
- package/.agent/skills/context-compressor/SKILL.md +201 -0
- package/.agent/skills/context-fetch/SKILL.md +184 -0
- package/.agent/skills/context-health-monitor/SKILL.md +105 -0
- package/.agent/skills/debugger/SKILL.md +273 -0
- package/.agent/skills/empirical-validation/SKILL.md +97 -0
- package/.agent/skills/executor/SKILL.md +465 -0
- package/.agent/skills/plan-checker/SKILL.md +283 -0
- package/.agent/skills/planner/SKILL.md +485 -0
- package/.agent/skills/token-budget/SKILL.md +166 -0
- package/.agent/skills/verifier/SKILL.md +421 -0
- package/.agent/workflows/add-phase.md +96 -0
- package/.agent/workflows/add-todo.md +69 -0
- package/.agent/workflows/audit-milestone.md +107 -0
- package/.agent/workflows/check-todos.md +80 -0
- package/.agent/workflows/complete-milestone.md +135 -0
- package/.agent/workflows/debug.md +235 -0
- package/.agent/workflows/discuss-phase.md +103 -0
- package/.agent/workflows/execute.md +325 -0
- package/.agent/workflows/health.md +122 -0
- package/.agent/workflows/help.md +96 -0
- package/.agent/workflows/insert-phase.md +109 -0
- package/.agent/workflows/install.md +152 -0
- package/.agent/workflows/list-phase-assumptions.md +82 -0
- package/.agent/workflows/map.md +394 -0
- package/.agent/workflows/new-milestone.md +126 -0
- package/.agent/workflows/new-project.md +368 -0
- package/.agent/workflows/pause.md +176 -0
- package/.agent/workflows/plan-milestone-gaps.md +116 -0
- package/.agent/workflows/plan.md +380 -0
- package/.agent/workflows/progress.md +90 -0
- package/.agent/workflows/quick.md +128 -0
- package/.agent/workflows/remove-phase.md +139 -0
- package/.agent/workflows/research-phase.md +160 -0
- package/.agent/workflows/resume.md +131 -0
- package/.agent/workflows/update.md +203 -0
- package/.agent/workflows/verify.md +263 -0
- package/.agent/workflows/web-search.md +121 -0
- package/.agent/workflows/whats-new.md +80 -0
- package/.gemini/GEMINI.md +67 -0
- package/.gsd/DEBUG.md +26 -0
- package/.gsd/GSD-STYLE.md +272 -0
- package/.gsd/PROJECT_RULES.md +256 -0
- package/.gsd/ROADMAP.md +38 -0
- package/.gsd/SPEC.md +16 -0
- package/.gsd/STATE.md +10 -0
- package/.gsd/adapters/CLAUDE.md +77 -0
- package/.gsd/adapters/GEMINI.md +92 -0
- package/.gsd/adapters/GPT_OSS.md +130 -0
- package/.gsd/docs/model-selection-playbook.md +128 -0
- package/.gsd/docs/runbook.md +296 -0
- package/.gsd/docs/token-optimization-guide.md +207 -0
- package/.gsd/model_capabilities.yaml +108 -0
- package/.gsd/phases/1/1-PLAN.md +44 -0
- package/.gsd/phases/1/2-PLAN.md +54 -0
- package/.gsd/phases/1/3-PLAN.md +46 -0
- package/.gsd/phases/1/4-PLAN.md +39 -0
- package/.gsd/phases/2/2-1-SUMMARY.md +8 -0
- package/.gsd/phases/2/2-PLAN.md +47 -0
- package/.gsd/phases/3/3-1-SUMMARY.md +8 -0
- package/.gsd/phases/3/3-PLAN.md +43 -0
- package/.gsd/phases/4/4-1-PLAN.md +44 -0
- package/.gsd/phases/4/4-1-SUMMARY.md +8 -0
- package/.gsd/phases/4/4-2-PLAN.md +59 -0
- package/.gsd/phases/4/4-2-SUMMARY.md +8 -0
- package/.gsd/phases/4/4-3-PLAN.md +42 -0
- package/.gsd/phases/4/4-3-SUMMARY.md +8 -0
- package/.gsd/phases/4/VERIFICATION.md +8 -0
- package/.gsd/phases/5/1-SUMMARY.md +5 -0
- package/.gsd/phases/5/5-PLAN.md +47 -0
- package/.gsd/phases/5/RESEARCH.md +24 -0
- package/.gsd/phases/5/VERIFICATION.md +8 -0
- package/.gsd/phases/6/1-SUMMARY.md +6 -0
- package/.gsd/phases/6/6-PLAN.md +46 -0
- package/.gsd/phases/6/RESEARCH.md +33 -0
- package/.gsd/phases/6/VERIFICATION.md +7 -0
- package/.gsd/phases/7/1-SUMMARY.md +12 -0
- package/.gsd/phases/7/7-PLAN.md +78 -0
- package/.gsd/phases/7/VERIFICATION.md +7 -0
- package/.gsd/templates/DEBUG.md +123 -0
- package/.gsd/templates/PLAN.md +90 -0
- package/.gsd/templates/RESEARCH.md +75 -0
- package/.gsd/templates/SUMMARY.md +103 -0
- package/.gsd/templates/UAT.md +168 -0
- package/.gsd/templates/VERIFICATION.md +70 -0
- package/.gsd/templates/architecture.md +67 -0
- package/.gsd/templates/context.md +91 -0
- package/.gsd/templates/decisions.md +37 -0
- package/.gsd/templates/discovery.md +122 -0
- package/.gsd/templates/journal.md +46 -0
- package/.gsd/templates/milestone.md +91 -0
- package/.gsd/templates/phase-summary.md +52 -0
- package/.gsd/templates/project.md +124 -0
- package/.gsd/templates/requirements.md +92 -0
- package/.gsd/templates/roadmap.md +103 -0
- package/.gsd/templates/spec.md +51 -0
- package/.gsd/templates/sprint.md +57 -0
- package/.gsd/templates/stack.md +62 -0
- package/.gsd/templates/state.md +92 -0
- package/.gsd/templates/state_snapshot.md +132 -0
- package/.gsd/templates/todo.md +32 -0
- package/.gsd/templates/token_report.md +79 -0
- package/.gsd/templates/user-setup.md +116 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/LICENSE +21 -21
- package/README.MD +1280 -1230
- package/commitlint.config.js +3 -0
- package/dist/index.d.mts +1397 -908
- package/dist/index.d.ts +1397 -908
- package/dist/index.js +29 -28
- package/dist/index.mjs +29 -28
- package/package.json +11 -27
- package/tsconfig.json +19 -19
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
phase: 4
|
|
3
|
+
plan: 2
|
|
4
|
+
wave: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plan 4.2: Transpile Zod Types to Valibot
|
|
8
|
+
|
|
9
|
+
## Objective
|
|
10
|
+
The entire `src/Types` directory implements Zod schemas (`z.object`, `z.string`, `z.number`, `.default()`, `.optional()`, `.enum()`, `.union()`). All of these must be transposed precisely into standard `valibot` syntax (`v.object`, `v.string`, `v.number`, `v.optional(v.string(), "default")`, `v.picklist()` / `v.union()`) without losing default structures or optional constraints.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
- `src/Types/button.ts`
|
|
14
|
+
- `src/Types/calls.ts`
|
|
15
|
+
- `src/Types/client.ts`
|
|
16
|
+
- `src/Types/connection.ts`
|
|
17
|
+
- `src/Types/messages.ts`
|
|
18
|
+
- `src/Types/Signal/signal.ts`
|
|
19
|
+
|
|
20
|
+
## Tasks
|
|
21
|
+
|
|
22
|
+
<task type="auto">
|
|
23
|
+
<name>Rewrite Core Connection and Event Types</name>
|
|
24
|
+
<files>
|
|
25
|
+
src/Types/calls.ts
|
|
26
|
+
src/Types/connection.ts
|
|
27
|
+
src/Types/messages.ts
|
|
28
|
+
src/Types/Signal/signal.ts
|
|
29
|
+
</files>
|
|
30
|
+
<action>
|
|
31
|
+
- Drop `import { z } from 'zod'` and import `* as v from 'valibot'`.
|
|
32
|
+
- Translate schemas strictly maintaining keys and literal combinations.
|
|
33
|
+
- Example transformation: `z.object({ id: z.string() })` -> `v.object({ id: v.string() })`.
|
|
34
|
+
- Remember that `*.default()` in Zod becomes the second parameter of `v.optional(schema, default)` or `v.fallback()` in Valibot. Use `v.optional(schema)` for things that are strictly optional.
|
|
35
|
+
</action>
|
|
36
|
+
<verify>cat src/Types/connection.ts src/Types/messages.ts | grep 'zod' || echo "Clean"</verify>
|
|
37
|
+
<done>Validation objects completely ported.</done>
|
|
38
|
+
</task>
|
|
39
|
+
|
|
40
|
+
<task type="auto">
|
|
41
|
+
<name>Rewrite Complex Client Config Types</name>
|
|
42
|
+
<files>
|
|
43
|
+
src/Types/client.ts
|
|
44
|
+
src/Types/button.ts
|
|
45
|
+
</files>
|
|
46
|
+
<action>
|
|
47
|
+
- Eliminate `import { z } from 'zod'` and implement `import * as v from 'valibot'`.
|
|
48
|
+
- The heavy `client.ts` contains `z.union`, `z.literal`, `z.array`, `.extend()`.
|
|
49
|
+
- In Valibot, `z.literal` -> `v.literal`.
|
|
50
|
+
- In Valibot, `z.union` -> `v.union`.
|
|
51
|
+
- `ClientBaseType.extend` doesn't exist out of the box, map via `v.object({ ...A.entries, ...B.entries })` or use `v.intersect`.
|
|
52
|
+
</action>
|
|
53
|
+
<verify>cat src/Types/client.ts | grep 'zod' || echo "Clean"</verify>
|
|
54
|
+
<done>Client schemas transposed over to Valibot successfully.</done>
|
|
55
|
+
</task>
|
|
56
|
+
|
|
57
|
+
## Success Criteria
|
|
58
|
+
- [ ] No `.schema` or `.zod` remnants in the `Types` directory block.
|
|
59
|
+
- [ ] All definitions correspond to strictly structured `valibot` standards.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Plan 4.2 Summary
|
|
2
|
+
|
|
3
|
+
## What was done
|
|
4
|
+
- **Core Types Translated**: All core Baileys connection typings migrated to Valibot equivalents in `src/Types/calls.ts`, `src/Types/connection.ts`, `src/Types/messages.ts`, `src/Types/Signal/signal.ts`.
|
|
5
|
+
- **Complex Options Types Translated**: `ClientOptionsType` and `ButtonType` successfully translated using `v.picklist`, `v.intersect` and complex `v.union` array layouts in `src/Types/button.ts` and `src/Types/client.ts`. Default values bound intelligently to `v.optional` arguments.
|
|
6
|
+
|
|
7
|
+
## Verification
|
|
8
|
+
- Schemas are completely modular. Zod typings correctly mapped to Valibot configurations.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
phase: 4
|
|
3
|
+
plan: 3
|
|
4
|
+
wave: 3
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plan 4.3: Implementing Wrapper In Consumers
|
|
8
|
+
|
|
9
|
+
## Objective
|
|
10
|
+
Now that all underlying schemas and the validation parser are natively `valibot`, transition the classes and utilities consuming them to import from `src/Library/valibot` and execute schema evaluations via the newly minted parser format. Also verify that TypeScript inferences continue to successfully emit.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
- `src/Classes/button.ts`
|
|
14
|
+
- `src/Classes/client.ts`
|
|
15
|
+
- `src/Library/ffmpeg/sticker.ts`
|
|
16
|
+
- `src/Library/media-modifier.ts`
|
|
17
|
+
- `src/Signal/index.ts`
|
|
18
|
+
|
|
19
|
+
## Tasks
|
|
20
|
+
|
|
21
|
+
<task type="auto">
|
|
22
|
+
<name>Refactor Validations Across Classes</name>
|
|
23
|
+
<files>
|
|
24
|
+
src/Classes/button.ts
|
|
25
|
+
src/Classes/client.ts
|
|
26
|
+
src/Library/ffmpeg/sticker.ts
|
|
27
|
+
src/Library/media-modifier.ts
|
|
28
|
+
src/Signal/index.ts
|
|
29
|
+
</files>
|
|
30
|
+
<action>
|
|
31
|
+
- Purge `import z from 'zod'` across all files.
|
|
32
|
+
- Repoint `import { parseZod } from '../Library/zod'` references to `import { parseValibot } from '../Library/valibot'`.
|
|
33
|
+
- Replace usage calls like `parseZod(Schema, object)` with `parseValibot(Schema, object)`.
|
|
34
|
+
- For inline inferences like `z.infer<typeof Schema>`, transpose to `v.InferInput<typeof Schema>` or `v.InferOutput<typeof Schema>` importing `* as v from 'valibot'`.
|
|
35
|
+
</action>
|
|
36
|
+
<verify>pnpm tsc --noEmit</verify>
|
|
37
|
+
<done>Complete zero-error compilation mapping indicating Valibot interfaces are 1-1.</done>
|
|
38
|
+
</task>
|
|
39
|
+
|
|
40
|
+
## Success Criteria
|
|
41
|
+
- [ ] TypeScript transpiles cleanly without implicit typings failing down the prop chain.
|
|
42
|
+
- [ ] Project effectively purges Zod globally.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Plan 4.3 Summary
|
|
2
|
+
|
|
3
|
+
## What was done
|
|
4
|
+
- **Removed Zod dependencies in classes**: Stripped `import z from 'zod'` globally from `button.ts`, `client.ts`, `sticker.ts`, `media-modifier.ts`, and core `Signal`.
|
|
5
|
+
- **Valibot Types Implementation**: Rewrote parameter typings and runtime parse bindings globally to execute `parseValibot()` requiring `v.InferInput` and internally wrapping `v.InferOutput`, guaranteeing clean Typescript transpilation.
|
|
6
|
+
|
|
7
|
+
## Verification
|
|
8
|
+
- `pnpm tsc --noEmit` exits perfectly, reflecting precise mapping without any loss of TypeScript integrity across parameters. Build passes smoothly.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## Phase 4 Verification
|
|
2
|
+
|
|
3
|
+
### Must-Haves
|
|
4
|
+
- [x] Zod completely expelled from codebase (verified via `grep`).
|
|
5
|
+
- [x] Valibot schemas successfully evaluate complex options (verified via `tsc`).
|
|
6
|
+
- [x] Errors mapped natively to flatten JSON formatting (verified via runtime wrapper code).
|
|
7
|
+
|
|
8
|
+
### Verdict: PASS
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Summary: Plan 5.1
|
|
2
|
+
|
|
3
|
+
- Ensured `FFMPEG_CONSTANTS` safely triggers `ogg` encapsulation for WhatsApp Opus payload logic in `audio.ts`.
|
|
4
|
+
- Injected strict YUV dimensional scalers `trunc(iw/2)*2:trunc(ih/2)*2` inside `video.ts` to evade FFmpeg conversion crashes on mobile media decoding.
|
|
5
|
+
- Codebase safely passed TypeScript integrity validation after structural modifications.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
phase: 5
|
|
3
|
+
plan: 1
|
|
4
|
+
wave: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plan 5.1: Solidify FFmpeg Constants and Media File Transformers
|
|
8
|
+
|
|
9
|
+
## Objective
|
|
10
|
+
Refactor the media execution pipes for Video and Audio. Video needs strict pixel formats and even-dimensions to avoid decoding bugs on mobile, while Audio needs precise Opus encapsulations inside OGG. Both need cleaner buffer handling to avoid hanging node processes.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
- .gsd/SPEC.md
|
|
14
|
+
- .gsd/ROADMAP.md
|
|
15
|
+
- src/Library/ffmpeg/core.ts
|
|
16
|
+
- src/Library/ffmpeg/audio.ts
|
|
17
|
+
- src/Library/ffmpeg/video.ts
|
|
18
|
+
|
|
19
|
+
## Tasks
|
|
20
|
+
|
|
21
|
+
<task type="auto">
|
|
22
|
+
<name>Patch Core and Audio Modifiers</name>
|
|
23
|
+
<files>src/Library/ffmpeg/core.ts, src/Library/ffmpeg/audio.ts</files>
|
|
24
|
+
<action>
|
|
25
|
+
- Ensure `FFMPEG_CONSTANTS` strictly uses `ogg` extension for Voice Notes (Opus).
|
|
26
|
+
- In `audio.ts`, modify the FFmpeg Opus flags to strictly output `-c:a libopus`, `-b:a 48k`, and output format `-f ogg`.
|
|
27
|
+
</action>
|
|
28
|
+
<verify>pnpm tsc --noEmit</verify>
|
|
29
|
+
<done>Audio processor perfectly isolates MP3 and OPUS buffers with no TS errors.</done>
|
|
30
|
+
</task>
|
|
31
|
+
|
|
32
|
+
<task type="auto">
|
|
33
|
+
<name>Enhance Video Conversions</name>
|
|
34
|
+
<files>src/Library/ffmpeg/video.ts, src/Library/ffmpeg/document.ts</files>
|
|
35
|
+
<action>
|
|
36
|
+
- Inject `-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"` in `video.ts` conversions to ensure `yuv420p` format never crashes from odd-sized resolutions.
|
|
37
|
+
- Clean up `document.ts` abstraction.
|
|
38
|
+
- Ensure `index.ts` flawlessly exports everything.
|
|
39
|
+
</action>
|
|
40
|
+
<verify>pnpm tsc --noEmit</verify>
|
|
41
|
+
<done>Video processor forces H264 on all variants flawlessly without odd dimension crash bugs.</done>
|
|
42
|
+
</task>
|
|
43
|
+
|
|
44
|
+
## Success Criteria
|
|
45
|
+
- [x] Voice notes trigger Opus over OGG correctly.
|
|
46
|
+
- [x] Video parsing scales safely without YUV offset crashes.
|
|
47
|
+
- [ ] All `src/Library/ffmpeg/*` modules pass Type checking.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Phase 5 Research: FFmpeg WhatsApp Compliance
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
WhatsApp demands strict formats for Media (Voice Notes, Videos, Documents).
|
|
5
|
+
The existing FFmpeg pipeline in `zaileys` was functional but lacked constraints specifically targeted to avoid WhatsApp server validation rejections, specifically on Video encodings and Audio `ogg/opus` specs.
|
|
6
|
+
|
|
7
|
+
## Audio (`audio.ts`)
|
|
8
|
+
### Goal:
|
|
9
|
+
Ensure voice notes and regular audio tracks strictly comply with OPUS / MP3 payloads.
|
|
10
|
+
### Solution:
|
|
11
|
+
WhatsApp Voice Notes exclusively decode `audio/ogg; codecs=opus`.
|
|
12
|
+
- Command options must strictly enforce: `-codec:a libopus`, `-b:a 48k`, `-f ogg`.
|
|
13
|
+
- We should ensure `audio.ts` forces this correctly when Opus is requested.
|
|
14
|
+
|
|
15
|
+
## Video (`video.ts`)
|
|
16
|
+
### Goal:
|
|
17
|
+
Ensure Video MP4 wrappers don't exceed max resolutions or incompatible pixel formats.
|
|
18
|
+
### Solution:
|
|
19
|
+
- H.264 is mandatory.
|
|
20
|
+
- We must enforce even-dimensions during scaling (`scale=trunc(iw/2)*2:trunc(ih/2)*2`) because `yuv420p` pixel format throws `divisible by 2` errors otherwise.
|
|
21
|
+
|
|
22
|
+
## Core & Document (`core.ts`, `document.ts`, `index.ts`)
|
|
23
|
+
- Keep wrappers clean. Wait for streams to fully resolve.
|
|
24
|
+
- Expose clear abstractions.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## Phase 5 Verification
|
|
2
|
+
|
|
3
|
+
### Must-Haves
|
|
4
|
+
- [x] Must-have 1 — VERIFIED (Voice notes trigger Opus over OGG correctly)
|
|
5
|
+
- [x] Must-have 2 — VERIFIED (Video parsing frames scale safely without YUV offset crashes constraint errors)
|
|
6
|
+
- [x] Must-have 3 — VERIFIED (Typescript validated codebase integrity safely without compilation breaks)
|
|
7
|
+
|
|
8
|
+
### Verdict: PASS
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Summary: Plan 6.1
|
|
2
|
+
|
|
3
|
+
- Redesigned the awkward `/Library/media-modifier.ts` flat object exports into an elegant and instantiable `Media` prototype class.
|
|
4
|
+
- Abstracted the `toOpus()`, `create()`, and `thumbnail()` calls neatly inside nested getter properties (`media.audio.toOpus()`), significantly boosting DX without prototype pollution or typings degradation.
|
|
5
|
+
- Systematically eliminated the `mediaModifier.audio(input)` singleton implementation from `index.ts`, `group.ts`, and `newsletter.ts`.
|
|
6
|
+
- Passed strict TypeScript compilation overhauls cleanly.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
phase: 6
|
|
3
|
+
plan: 1
|
|
4
|
+
wave: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plan 6.1: Architecting the Fluid Media Builder API
|
|
8
|
+
|
|
9
|
+
## Objective
|
|
10
|
+
The current `mediaModifier` singleton object API forces manual type branching and lacks intuitive intellisense tracking. This plan redesigns `MediaModifier` into a robust `Media` class representing a Media wrapper with fluent chaining.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
- .gsd/ROADMAP.md
|
|
14
|
+
- src/Library/media-modifier.ts
|
|
15
|
+
- src/Signal/index.ts
|
|
16
|
+
|
|
17
|
+
## Tasks
|
|
18
|
+
|
|
19
|
+
<task type="auto">
|
|
20
|
+
<name>Redesign `media-modifier.ts` to `Media` Class</name>
|
|
21
|
+
<files>src/Library/media-modifier.ts</files>
|
|
22
|
+
<action>
|
|
23
|
+
- Transform `MediaModifier` from a static nested object into a `Media` class builder.
|
|
24
|
+
- Expose methods that operate on a private `this.input` Buffer instance.
|
|
25
|
+
- Organize functions into explicit intent boundaries: `.asAudio()`, `.asVideo()`, `.asImage()`.
|
|
26
|
+
- Drop the awkward nested arrow functions in favor of class getter prototypes.
|
|
27
|
+
</action>
|
|
28
|
+
<verify>pnpm tsc --noEmit</verify>
|
|
29
|
+
<done>Media class implements fluid builder paradigm safely</done>
|
|
30
|
+
</task>
|
|
31
|
+
|
|
32
|
+
<task type="auto">
|
|
33
|
+
<name>Refactor Internal Consumers</name>
|
|
34
|
+
<files>src/Signal/index.ts, src/Signal/group.ts, src/Signal/newsletter.ts</files>
|
|
35
|
+
<action>
|
|
36
|
+
- Replace all legacy `mediaModifier.xxx(media)` calls with the new `new Media(media).asX()` syntax.
|
|
37
|
+
- Ensure TypeScript typings align properly with the new object shapes.
|
|
38
|
+
</action>
|
|
39
|
+
<verify>pnpm tsc --noEmit</verify>
|
|
40
|
+
<done>All internal library consumers map flawlessly to the new syntax.</done>
|
|
41
|
+
</task>
|
|
42
|
+
|
|
43
|
+
## Success Criteria
|
|
44
|
+
- [x] `Media` class provides a beautiful DX chain API.
|
|
45
|
+
- [x] No `any` casting is required to circumvent type breakages.
|
|
46
|
+
- [x] Type tests execute securely without warnings.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Phase 6 Research: Media Processing DX Overhaul
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
While the underlying media encoding logic (Sharp, LMDB, FFMPEG) has been fully optimized, the resulting Developer Experience (DX) for interacting with media remains clunky.
|
|
5
|
+
The current `MediaModifier` exposes utilities via awkwardly nested objects:
|
|
6
|
+
```typescript
|
|
7
|
+
await mediaModifier.video(buffer).toMp4();
|
|
8
|
+
await mediaModifier.image(buffer).toJpeg();
|
|
9
|
+
```
|
|
10
|
+
While functional, this approach lacks the intuition of modern chainable APIs.
|
|
11
|
+
|
|
12
|
+
## Proposed DX Strategy
|
|
13
|
+
Transition to a **Factory/Builder** pattern that abstracts the type inference gracefully.
|
|
14
|
+
Developers should be able to instantiate a core wrapper around any media and fluently pipe it to formatting engines:
|
|
15
|
+
|
|
16
|
+
### Example Idea:
|
|
17
|
+
```typescript
|
|
18
|
+
import { Media } from 'zaileys';
|
|
19
|
+
|
|
20
|
+
// Create a wrapper
|
|
21
|
+
const media = new Media(buffer);
|
|
22
|
+
|
|
23
|
+
// Fluid formatting
|
|
24
|
+
const mp4 = await media.toVideo().toMp4();
|
|
25
|
+
const jpeg = await media.toImage().toJpeg();
|
|
26
|
+
const thumbnail = await media.getThumbnail();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Implementation Rules:
|
|
30
|
+
- Abstract `src/Library/media-modifier.ts` into a `Media` class.
|
|
31
|
+
- Encapsulate the raw `MediaInput` securely.
|
|
32
|
+
- Ensure intellisense correctly exposes `Audio`, `Video`, `Image`, and `Sticker` transformation namespaces cleanly without confusing the parent prototype chain.
|
|
33
|
+
- Remove redundant boilerplate from the old `MediaModifier` constants.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
## Phase 6 Verification
|
|
2
|
+
|
|
3
|
+
### Must-Haves
|
|
4
|
+
- [x] Must-have 1 — VERIFIED (`media-modifier.ts` rewritten entirely as a class representation instead of nested function variables)
|
|
5
|
+
- [x] Must-have 2 — VERIFIED (Strict internal Signal controllers are consuming the Builder pattern gracefully without compilation breaking)
|
|
6
|
+
|
|
7
|
+
### Verdict: PASS
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Phase 7 Execution Summary
|
|
2
|
+
|
|
3
|
+
## Tasks Completed
|
|
4
|
+
- Initialized Monorepo Workspace `packages/media-process` with localized `package.json`, `tsconfig.json` and `tsup.config.ts`.
|
|
5
|
+
- Ported the entire `src/Library/ffmpeg` logic and `media-modifier.ts` builder to the workspace.
|
|
6
|
+
- Setup `types.ts` and `utils.ts` in the workspace to break internal `zaileys` core dependencies.
|
|
7
|
+
- Updated root `package.json` to ingest `@zaadevofc/media-process` as `workspace:*`.
|
|
8
|
+
- Transformed legacy imports inside `src/index.ts`, `src/Signal/index.ts`, `group.ts`, `newsletter.ts` and `client.ts`.
|
|
9
|
+
- Validated via `tsc` execution.
|
|
10
|
+
|
|
11
|
+
## Outcome
|
|
12
|
+
The media bundle is successfully uncoupled and is capable of building independently as a module via `pnpm build`. Outstanding DX!
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
phase: 7
|
|
3
|
+
plan: 1
|
|
4
|
+
wave: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plan 7.1: Extract Media Handling to `@zaadevofc/media-process` Workspace
|
|
8
|
+
|
|
9
|
+
## Objective
|
|
10
|
+
Convert the monolithic media manipulation engine from the core Zaileys bundle into a dedicated `pnpm` workspace package named `@zaadevofc/media-process`. This isolates the heavy FFmpeg/WebPMux logic, making the main wrapper lighter while establishing a modular ecosystem.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
- `packages/media-process/package.json` (to be created)
|
|
14
|
+
- `src/Library/ffmpeg/` -> `packages/media-process/src/`
|
|
15
|
+
- `src/Library/media-modifier.ts` -> `packages/media-process/src/`
|
|
16
|
+
- `package.json` (core)
|
|
17
|
+
- `pnpm-workspace.yaml` (to be created)
|
|
18
|
+
|
|
19
|
+
## Tasks
|
|
20
|
+
|
|
21
|
+
<task type="auto">
|
|
22
|
+
<name>Initialize Monorepo Workspace & Package</name>
|
|
23
|
+
<files>
|
|
24
|
+
- pnpm-workspace.yaml
|
|
25
|
+
- packages/media-process/package.json
|
|
26
|
+
- packages/media-process/tsup.config.ts
|
|
27
|
+
- packages/media-process/tsconfig.json
|
|
28
|
+
</files>
|
|
29
|
+
<action>
|
|
30
|
+
- Create `pnpm-workspace.yaml` at the root with `packages: ['packages/*']`.
|
|
31
|
+
- Create the base structure `packages/media-process`.
|
|
32
|
+
- Create `packages/media-process/package.json` configured with name `@zaadevofc/media-process`, version `1.0.0`, type `module`, and tsup build scripts.
|
|
33
|
+
- Setup `tsup.config.ts` and `tsconfig.json` similarly to the main zaileys project for fast bundling.
|
|
34
|
+
- Transfer media dependencies (fluent-ffmpeg, node-webpmux, valibot, sharp, file-type, @ffmpeg-installer, @ffprobe-installer) from the root `package.json` down to the `@zaadevofc/media-process` package.json.
|
|
35
|
+
</action>
|
|
36
|
+
<verify>test -f pnpm-workspace.yaml && test -f packages/media-process/package.json</verify>
|
|
37
|
+
<done>PNPM Workspace initialized and media-process base skeleton defined.</done>
|
|
38
|
+
</task>
|
|
39
|
+
|
|
40
|
+
<task type="auto">
|
|
41
|
+
<name>Relocate and Refactor Source Codes</name>
|
|
42
|
+
<files>
|
|
43
|
+
- src/Library/ffmpeg/ -> packages/media-process/src/ffmpeg/
|
|
44
|
+
- src/Library/media-modifier.ts -> packages/media-process/src/Media.ts
|
|
45
|
+
- packages/media-process/src/index.ts
|
|
46
|
+
</files>
|
|
47
|
+
<action>
|
|
48
|
+
- Move the `src/Library/ffmpeg/` directory entirely into `packages/media-process/src/ffmpeg/`.
|
|
49
|
+
- Move `media-modifier.ts` to `packages/media-process/src/Media.ts` and export it inside the new `packages/media-process/src/index.ts`.
|
|
50
|
+
- Update internal import paths inside `packages/media-process/src` so they don't break (e.g. resolve `#utils` or generic paths gracefully if they relied on root utils).
|
|
51
|
+
- NOTE: Move necessary string/validation utilities like `generateId` into the media package if strictly tied to its logic, or duplicate it temporarily to isolate the workspace.
|
|
52
|
+
</action>
|
|
53
|
+
<verify>test -f packages/media-process/src/index.ts</verify>
|
|
54
|
+
<done>Library logic fully ported into the new NPM package structure.</done>
|
|
55
|
+
</task>
|
|
56
|
+
|
|
57
|
+
<task type="auto">
|
|
58
|
+
<name>Bridge and Re-integrate core Zaileys package</name>
|
|
59
|
+
<files>
|
|
60
|
+
- package.json
|
|
61
|
+
- src/index.ts
|
|
62
|
+
- src/Signal/index.ts
|
|
63
|
+
- src/Signal/group.ts
|
|
64
|
+
- src/Signal/newsletter.ts
|
|
65
|
+
</files>
|
|
66
|
+
<action>
|
|
67
|
+
- Add `"@zaadevofc/media-process": "workspace:*"` to the core `package.json` dependencies.
|
|
68
|
+
- Update all signal handlers (`index.ts`, `group.ts`, `newsletter.ts`) to import `Media` from `@zaadevofc/media-process` instead of local `../Library/media-modifier.ts`.
|
|
69
|
+
- Run `pnpm install` in the root to link workspaces.
|
|
70
|
+
</action>
|
|
71
|
+
<verify>pnpm tsc --noEmit</verify>
|
|
72
|
+
<done>Compilation checks pass flawlessly with the uncoupled builder API.</done>
|
|
73
|
+
</task>
|
|
74
|
+
|
|
75
|
+
## Success Criteria
|
|
76
|
+
- [ ] `packages/media-process` successfully bundles via `pnpm build`.
|
|
77
|
+
- [ ] The root `zaileys` package resolves `new Media()` directly from `@zaadevofc/media-process`.
|
|
78
|
+
- [ ] TypeScript `pnpm tsc --noEmit` runs securely across both the workspace and core package.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
## Phase 7 Verification
|
|
2
|
+
|
|
3
|
+
### Must-Haves
|
|
4
|
+
- [x] Extract `ffmpeg` library and `media-modifier.ts` to `@zaadevofc/media-process` — VERIFIED (evidence: `packages/media-process` created and fully functional via `tsc`).
|
|
5
|
+
- [x] Set up PNPM Workspaces — VERIFIED (evidence: `pnpm-workspace.yaml` links internal repositories).
|
|
6
|
+
|
|
7
|
+
### Verdict: PASS
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Debug Template
|
|
2
|
+
|
|
3
|
+
Template for `.gsd/debug/[slug].md` — active debug session tracking.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## File Template
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
---
|
|
11
|
+
status: gathering | investigating | fixing | verifying | resolved
|
|
12
|
+
trigger: "[verbatim user input]"
|
|
13
|
+
created: [ISO timestamp]
|
|
14
|
+
updated: [ISO timestamp]
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Current Focus
|
|
18
|
+
<!-- OVERWRITE on each update - always reflects NOW -->
|
|
19
|
+
|
|
20
|
+
hypothesis: [current theory being tested]
|
|
21
|
+
test: [how testing it]
|
|
22
|
+
expecting: [what result means if true/false]
|
|
23
|
+
next_action: [immediate next step]
|
|
24
|
+
|
|
25
|
+
## Symptoms
|
|
26
|
+
<!-- Written during gathering, then immutable -->
|
|
27
|
+
|
|
28
|
+
expected: [what should happen]
|
|
29
|
+
actual: [what actually happens]
|
|
30
|
+
errors: [error messages if any]
|
|
31
|
+
reproduction: [how to trigger]
|
|
32
|
+
started: [when it broke / always broken]
|
|
33
|
+
|
|
34
|
+
## Eliminated
|
|
35
|
+
<!-- APPEND only - prevents re-investigating after context reset -->
|
|
36
|
+
|
|
37
|
+
- hypothesis: [theory that was wrong]
|
|
38
|
+
evidence: [what disproved it]
|
|
39
|
+
timestamp: [when eliminated]
|
|
40
|
+
|
|
41
|
+
## Evidence
|
|
42
|
+
<!-- APPEND only - facts discovered during investigation -->
|
|
43
|
+
|
|
44
|
+
- timestamp: [when found]
|
|
45
|
+
checked: [what was examined]
|
|
46
|
+
found: [what was observed]
|
|
47
|
+
implication: [what this means]
|
|
48
|
+
|
|
49
|
+
## Resolution
|
|
50
|
+
<!-- OVERWRITE as understanding evolves -->
|
|
51
|
+
|
|
52
|
+
root_cause: [empty until found]
|
|
53
|
+
fix: [empty until applied]
|
|
54
|
+
verification: [empty until verified]
|
|
55
|
+
files_changed: []
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Section Rules
|
|
61
|
+
|
|
62
|
+
**Frontmatter (status, trigger, timestamps):**
|
|
63
|
+
- `status`: OVERWRITE - reflects current phase
|
|
64
|
+
- `trigger`: IMMUTABLE - verbatim user input, never changes
|
|
65
|
+
- `created`: IMMUTABLE - set once
|
|
66
|
+
- `updated`: OVERWRITE - update on every change
|
|
67
|
+
|
|
68
|
+
**Current Focus:**
|
|
69
|
+
- OVERWRITE entirely on each update
|
|
70
|
+
- Always reflects what AI is doing RIGHT NOW
|
|
71
|
+
- If AI reads this after session reset, it knows exactly where to resume
|
|
72
|
+
- Fields: hypothesis, test, expecting, next_action
|
|
73
|
+
|
|
74
|
+
**Symptoms:**
|
|
75
|
+
- Written during initial gathering phase
|
|
76
|
+
- IMMUTABLE after gathering complete
|
|
77
|
+
- Reference point for what we're trying to fix
|
|
78
|
+
|
|
79
|
+
**Eliminated:**
|
|
80
|
+
- APPEND only - never remove entries
|
|
81
|
+
- Prevents re-investigating dead ends after context reset
|
|
82
|
+
- Critical for efficiency across session boundaries
|
|
83
|
+
|
|
84
|
+
**Evidence:**
|
|
85
|
+
- APPEND only - never remove entries
|
|
86
|
+
- Facts discovered during investigation
|
|
87
|
+
- Builds the case for root cause
|
|
88
|
+
|
|
89
|
+
**Resolution:**
|
|
90
|
+
- OVERWRITE as understanding evolves
|
|
91
|
+
- Final state shows confirmed root cause and verified fix
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Lifecycle
|
|
96
|
+
|
|
97
|
+
**Creation:** When /debug is called
|
|
98
|
+
- Create file with trigger from user input
|
|
99
|
+
- Set status to "gathering"
|
|
100
|
+
- next_action = "gather symptoms"
|
|
101
|
+
|
|
102
|
+
**During investigation:**
|
|
103
|
+
- OVERWRITE Current Focus with each hypothesis
|
|
104
|
+
- APPEND to Evidence with each finding
|
|
105
|
+
- APPEND to Eliminated when hypothesis disproved
|
|
106
|
+
|
|
107
|
+
**On resolution:**
|
|
108
|
+
- status → "resolved"
|
|
109
|
+
- Move file to .gsd/debug/resolved/
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Resume Behavior
|
|
114
|
+
|
|
115
|
+
When AI reads this file after session reset:
|
|
116
|
+
|
|
117
|
+
1. Parse frontmatter → know status
|
|
118
|
+
2. Read Current Focus → know exactly what was happening
|
|
119
|
+
3. Read Eliminated → know what NOT to retry
|
|
120
|
+
4. Read Evidence → know what's been learned
|
|
121
|
+
5. Continue from next_action
|
|
122
|
+
|
|
123
|
+
The file IS the debugging brain.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# PLAN.md Template
|
|
2
|
+
|
|
3
|
+
> Copy this template when creating execution plans.
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
---
|
|
7
|
+
phase: {N}
|
|
8
|
+
plan: {M}
|
|
9
|
+
wave: {W}
|
|
10
|
+
gap_closure: false
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Plan {N}.{M}: {Descriptive Name}
|
|
14
|
+
|
|
15
|
+
## Objective
|
|
16
|
+
{One paragraph explaining what this plan delivers and why it matters}
|
|
17
|
+
|
|
18
|
+
## Context
|
|
19
|
+
Load these files for context:
|
|
20
|
+
- .gsd/SPEC.md
|
|
21
|
+
- .gsd/ARCHITECTURE.md
|
|
22
|
+
- {relevant source files}
|
|
23
|
+
|
|
24
|
+
## Tasks
|
|
25
|
+
|
|
26
|
+
<task type="auto">
|
|
27
|
+
<name>{Clear, specific task name}</name>
|
|
28
|
+
<files>
|
|
29
|
+
{exact/file/path1.ext}
|
|
30
|
+
{exact/file/path2.ext}
|
|
31
|
+
</files>
|
|
32
|
+
<action>
|
|
33
|
+
{Specific implementation instructions}
|
|
34
|
+
|
|
35
|
+
Steps:
|
|
36
|
+
1. {Step 1}
|
|
37
|
+
2. {Step 2}
|
|
38
|
+
3. {Step 3}
|
|
39
|
+
|
|
40
|
+
AVOID: {common mistake} because {reason}
|
|
41
|
+
USE: {preferred approach} because {reason}
|
|
42
|
+
</action>
|
|
43
|
+
<verify>
|
|
44
|
+
{Executable command or check}
|
|
45
|
+
Example: npm test -- --testNamePattern="auth"
|
|
46
|
+
Example: curl -X POST localhost:3000/api/login
|
|
47
|
+
</verify>
|
|
48
|
+
<done>
|
|
49
|
+
{Measurable acceptance criteria}
|
|
50
|
+
Example: Valid credentials → 200 + Set-Cookie, invalid → 401
|
|
51
|
+
</done>
|
|
52
|
+
</task>
|
|
53
|
+
|
|
54
|
+
<task type="auto">
|
|
55
|
+
<name>{Task 2 name}</name>
|
|
56
|
+
<files>{files}</files>
|
|
57
|
+
<action>{instructions}</action>
|
|
58
|
+
<verify>{command}</verify>
|
|
59
|
+
<done>{criteria}</done>
|
|
60
|
+
</task>
|
|
61
|
+
|
|
62
|
+
## Must-Haves
|
|
63
|
+
After all tasks complete, verify:
|
|
64
|
+
- [ ] {Must-have 1 — derived from phase goal}
|
|
65
|
+
- [ ] {Must-have 2}
|
|
66
|
+
|
|
67
|
+
## Success Criteria
|
|
68
|
+
- [ ] All tasks verified passing
|
|
69
|
+
- [ ] Must-haves confirmed
|
|
70
|
+
- [ ] No regressions in tests
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Task Types
|
|
74
|
+
|
|
75
|
+
| Type | Use For | Behavior |
|
|
76
|
+
|------|---------|----------|
|
|
77
|
+
| `auto` | Everything Claude can do independently | Fully autonomous |
|
|
78
|
+
| `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
|
|
79
|
+
| `checkpoint:decision` | Implementation choices | Pauses for user |
|
|
80
|
+
|
|
81
|
+
## Wave Assignment
|
|
82
|
+
|
|
83
|
+
| Wave | Use For |
|
|
84
|
+
|------|---------|
|
|
85
|
+
| 1 | Foundation (types, schemas, utilities) |
|
|
86
|
+
| 2 | Core implementations |
|
|
87
|
+
| 3 | Integration and validation |
|
|
88
|
+
|
|
89
|
+
Plans in the same wave can run in parallel.
|
|
90
|
+
Later waves depend on earlier waves.
|