@mafianacho/nacholens 0.0.0-stage → 0.3.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 (69) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +13 -0
  3. package/README.de.md +46 -0
  4. package/README.fr.md +46 -0
  5. package/README.ja.md +46 -0
  6. package/README.ko.md +46 -0
  7. package/README.md +45 -2
  8. package/README.zh.md +46 -0
  9. package/demo/shop/v1/README.md +7 -0
  10. package/demo/shop/v1/api.js +78 -0
  11. package/demo/shop/v1/db.js +38 -0
  12. package/demo/shop/v1/gateway.js +50 -0
  13. package/demo/shop/v1/mock-external.js +17 -0
  14. package/demo/shop/v1/public/app.js +32 -0
  15. package/demo/shop/v1/public/format.js +2 -0
  16. package/demo/shop/v1/public/index.html +13 -0
  17. package/demo/shop/v1/public/styles.css +4 -0
  18. package/demo/shop/v2/README.md +7 -0
  19. package/demo/shop/v2/api.js +88 -0
  20. package/demo/shop/v2/db.js +38 -0
  21. package/demo/shop/v2/gateway.js +50 -0
  22. package/demo/shop/v2/mock-external.js +17 -0
  23. package/demo/shop/v2/public/app.js +33 -0
  24. package/demo/shop/v2/public/format.js +3 -0
  25. package/demo/shop/v2/public/index.html +13 -0
  26. package/demo/shop/v2/public/styles.css +5 -0
  27. package/docs/guide.ko.md +97 -0
  28. package/docs/guide.md +142 -0
  29. package/docs/model-schema.md +137 -0
  30. package/docs/review.md +78 -0
  31. package/examples/demo-shop.artifact.html +1535 -0
  32. package/examples/demo-shop.artifact.json +7 -0
  33. package/examples/demo-shop.html +1535 -0
  34. package/examples/external/README.md +12 -0
  35. package/examples/external/full-stack-fastapi-template/LICENSE +21 -0
  36. package/examples/external/full-stack-fastapi-template/changes.json +56 -0
  37. package/examples/external/full-stack-fastapi-template/full-stack-fastapi-template-backend.html +1535 -0
  38. package/models/demo-shop/changes.auto.json +121 -0
  39. package/models/demo-shop/changes.example.json +16 -0
  40. package/models/demo-shop/intent.example.json +75 -0
  41. package/models/demo-shop/model.json +3151 -0
  42. package/package.json +60 -4
  43. package/skills/nacholens/SKILL.md +235 -0
  44. package/src/cli.js +377 -0
  45. package/src/demo.js +42 -0
  46. package/src/diff.js +254 -0
  47. package/src/gitio.js +67 -0
  48. package/src/install.js +94 -0
  49. package/src/model.js +434 -0
  50. package/src/page.js +87 -0
  51. package/src/player/fonts/FONTLOG.md +30 -0
  52. package/src/player/fonts/OFL-Anton.txt +93 -0
  53. package/src/player/fonts/OFL-IBMPlex.txt +94 -0
  54. package/src/player/fonts/anton-400.woff2 +0 -0
  55. package/src/player/fonts/nacho-mono-500.woff2 +0 -0
  56. package/src/player/fonts/nacho-mono-600.woff2 +0 -0
  57. package/src/player/fonts/nacho-sans-400.woff2 +0 -0
  58. package/src/player/fonts/nacho-sans-500.woff2 +0 -0
  59. package/src/player/fonts/nacho-sans-600.woff2 +0 -0
  60. package/src/player/fonts/nacho-sans-700.woff2 +0 -0
  61. package/src/player/player.css +318 -0
  62. package/src/player/player.js +872 -0
  63. package/src/player/review.css +49 -0
  64. package/src/player/review.js +230 -0
  65. package/src/player/template.html +58 -0
  66. package/src/review.js +321 -0
  67. package/src/scan.js +255 -0
  68. package/src/template.js +36 -0
  69. package/src/verify.js +90 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,13 @@
1
+ nacholens
2
+ Copyright 2026 Mafianacho
3
+
4
+ This product includes no third-party code, icons or images.
5
+
6
+ It includes fonts licensed under the SIL Open Font License, Version 1.1 (not under Apache-2.0), in
7
+ src/player/fonts/, embedded into every generated page:
8
+ - Nacho Sans, Nacho Mono: Modified Versions (subset, WOFF2, renamed) of IBM Plex Sans and IBM Plex Mono,
9
+ Copyright 2017 IBM Corp. with Reserved Font Name "Plex". See src/player/fonts/OFL-IBMPlex.txt.
10
+ - Anton (subset, WOFF2): Copyright 2020 The Anton Project Authors. See src/player/fonts/OFL-Anton.txt.
11
+ Details and source checksums: src/player/fonts/FONTLOG.md. The look follows the Nacho Combo design system
12
+ (https://github.com/mafianacho/nachocombo). The player needs no network access.
13
+ (The Apache-2.0 license text in LICENSE is the unmodified text from apache.org.)
package/README.de.md ADDED
@@ -0,0 +1,46 @@
1
+ # nacholens
2
+
3
+ [English](README.md) · [日本語](README.ja.md) · **Deutsch** · [Français](README.fr.md) · [中文](README.zh.md) · [한국어](README.ko.md)
4
+
5
+ Sieh, was eine KI in einem Backend geändert hat, ohne Code zu lesen. nacholens macht aus einem Repository eine einzige Seite: Wähle einen Anwendungsfall und sieh, wie die Anfrage vom Client durch deine Dienste, die Datenbank und Drittanbieter läuft. Die geänderten Teile sind aus `git diff` hervorgehoben.
6
+
7
+ ![nacholens: eine Anfrage läuft durch den Demo-Shop, geänderte Teile hervorgehoben](docs/images/overview.png)
8
+
9
+ ## Verwendung
10
+
11
+ Öffne deinen KI-Coding-Agenten (Claude Code, Codex, Cursor, …) im Repository, das du sehen willst. Kopiere den Block unten, schreibe deine Anfrage in die Zeile `Meine Anfrage:` und füge ihn ein.
12
+
13
+ ```text
14
+ Nutze nacholens, um meine Anfrage unten zu diesem Repository als Seite zu beantworten, die ich öffnen kann.
15
+
16
+ Meine Anfrage: <hier schreiben, was du sehen willst>
17
+
18
+ So geht's:
19
+ 1. Hole das nacholens-Playbook und die CLI (braucht Node.js 20+ und git; in dieses Repository wird nichts installiert):
20
+ npx -y @mafianacho/nacholens@latest install --to "$HOME/.nacholens-skill" --force
21
+ 2. Lies "$HOME/.nacholens-skill/nacholens/SKILL.md" und folge ihm. Die CLI ist:
22
+ node "$HOME/.nacholens-skill/nacholens/cli/src/cli.js" <command>
23
+ 3. Ändere keine Datei dieses Repositorys außer dem Modell in .nacholens/. Schreibe die Seite nach ./nacholens-out.
24
+ 4. Wenn die Seite fertig ist, nenne mir ihren Pfad und erkläre in einfachen Worten, was sie zeigt.
25
+ ```
26
+
27
+ Beispielanfragen:
28
+
29
+ - `Was hat sich in den letzten 5 Commits geändert, und was sollte ich erneut testen?`
30
+ - `Zeig, wie die Anmeldung funktioniert, vom Browser bis zur Datenbank.`
31
+ - `Vergleiche diesen Branch mit main: Welche Abläufe hat diese Arbeit berührt?`
32
+
33
+ ## Demo ausprobieren
34
+
35
+ ```bash
36
+ npx -y @mafianacho/nacholens@latest demo
37
+ # → ./nacholens-demo/demo-shop.html (im Browser öffnen)
38
+ ```
39
+
40
+ ## Mehr
41
+
42
+ - [Anleitung](docs/guide.md) (Englisch): Befehle, wie die Änderungsansicht funktioniert, Grenzen
43
+ - [Agenten-Playbook](skills/nacholens/SKILL.md), [Modellformat](docs/model-schema.md), [Review-Dock](docs/review.md)
44
+ - [Mitwirken](CONTRIBUTING.md), [Sicherheit](SECURITY.md)
45
+
46
+ Apache License 2.0 ([`LICENSE`](LICENSE), [`NOTICE`](NOTICE)). Die eingebetteten Schriften stehen unter der SIL Open Font License 1.1 ([`FONTLOG`](src/player/fonts/FONTLOG.md)). Made by [Mafianacho Inc.](https://mafianacho.com)
package/README.fr.md ADDED
@@ -0,0 +1,46 @@
1
+ # nacholens
2
+
3
+ [English](README.md) · [日本語](README.ja.md) · [Deutsch](README.de.md) · **Français** · [中文](README.zh.md) · [한국어](README.ko.md)
4
+
5
+ Voyez ce qu'une IA a changé dans un backend, sans lire le code. nacholens transforme un dépôt en une seule page : choisissez un cas d'usage et regardez la requête passer du client à vos services, à la base de données et aux services tiers, les parties modifiées étant mises en évidence à partir de `git diff`.
6
+
7
+ ![nacholens : une requête traverse la boutique de démonstration, parties modifiées en évidence](docs/images/overview.png)
8
+
9
+ ## Utilisation
10
+
11
+ Ouvrez votre agent de code IA (Claude Code, Codex, Cursor, …) dans le dépôt que vous voulez voir, copiez le bloc ci-dessous, écrivez votre demande sur la ligne `Ma demande :` et collez-le.
12
+
13
+ ```text
14
+ Utilise nacholens pour répondre à ma demande ci-dessous sur ce dépôt, sous la forme d'une page que je peux ouvrir.
15
+
16
+ Ma demande : <écrivez ici ce que vous voulez voir>
17
+
18
+ Comment :
19
+ 1. Récupère le guide d'agent et la CLI de nacholens (Node.js 20+ et git nécessaires ; rien n'est installé dans ce dépôt) :
20
+ npx -y @mafianacho/nacholens@latest install --to "$HOME/.nacholens-skill" --force
21
+ 2. Lis "$HOME/.nacholens-skill/nacholens/SKILL.md" et suis-le. La CLI est :
22
+ node "$HOME/.nacholens-skill/nacholens/cli/src/cli.js" <command>
23
+ 3. Ne modifie aucun fichier de ce dépôt, sauf le modèle dans .nacholens/. Écris la page dans ./nacholens-out.
24
+ 4. Une fois la page générée, donne-moi son chemin et explique simplement ce qu'elle montre.
25
+ ```
26
+
27
+ Exemples de demandes:
28
+
29
+ - `Qu'est-ce qui a changé dans les 5 derniers commits, et que dois-je retester ?`
30
+ - `Montre comment fonctionne la connexion, du navigateur à la base de données.`
31
+ - `Compare cette branche avec main : quels parcours ce travail a-t-il touchés ?`
32
+
33
+ ## Essayer la démo
34
+
35
+ ```bash
36
+ npx -y @mafianacho/nacholens@latest demo
37
+ # → ./nacholens-demo/demo-shop.html (à ouvrir dans un navigateur)
38
+ ```
39
+
40
+ ## Plus
41
+
42
+ - [Guide](docs/guide.md) (en anglais) : commandes, fonctionnement de la vue des changements, limites
43
+ - [Guide d'agent](skills/nacholens/SKILL.md), [format du modèle](docs/model-schema.md), [panneau de revue](docs/review.md)
44
+ - [Contribuer](CONTRIBUTING.md), [Sécurité](SECURITY.md)
45
+
46
+ Apache License 2.0 ([`LICENSE`](LICENSE), [`NOTICE`](NOTICE)). Les polices intégrées sont sous SIL Open Font License 1.1 ([`FONTLOG`](src/player/fonts/FONTLOG.md)). Made by [Mafianacho Inc.](https://mafianacho.com)
package/README.ja.md ADDED
@@ -0,0 +1,46 @@
1
+ # nacholens
2
+
3
+ [English](README.md) · **日本語** · [Deutsch](README.de.md) · [Français](README.fr.md) · [中文](README.zh.md) · [한국어](README.ko.md)
4
+
5
+ AIがバックエンドに加えた変更を、コードを読まずに確かめられます。nacholens はリポジトリを1枚のページにします。ユースケースを選ぶと、リクエストがクライアントからサービス、データベース、外部サービスへと動き、`git diff` から求めた変更箇所が強調されます。
6
+
7
+ ![nacholens: デモショップを流れるリクエストと強調された変更箇所](docs/images/overview.png)
8
+
9
+ ## 使い方
10
+
11
+ 見たいリポジトリで AI コーディングエージェント(Claude Code、Codex、Cursor など)を開き、下のブロックをコピーして `依頼:` の行に見たいことを書き、そのまま貼り付けてください。
12
+
13
+ ```text
14
+ nacholens を使って、このリポジトリについての下の依頼に、開けるページで答えてください。
15
+
16
+ 依頼: <見たいことをここに書く>
17
+
18
+ 手順:
19
+ 1. nacholens の手順書と CLI を取得する(Node.js 20 以上と git が必要。このリポジトリには何もインストールしない):
20
+ npx -y @mafianacho/nacholens@latest install --to "$HOME/.nacholens-skill" --force
21
+ 2. "$HOME/.nacholens-skill/nacholens/SKILL.md" を読み、その手順に従う。CLI は次のとおり:
22
+ node "$HOME/.nacholens-skill/nacholens/cli/src/cli.js" <command>
23
+ 3. .nacholens/ のモデル以外、このリポジトリのファイルは変更しない。ページは ./nacholens-out に書き出す。
24
+ 4. ページができたら、そのパスを伝え、何が分かるかを平易な言葉で説明する。
25
+ ```
26
+
27
+ 依頼の例:
28
+
29
+ - `直近5コミットで何が変わった?何を再テストすべき?`
30
+ - `ログインの流れを、ブラウザからデータベースまで見せて。`
31
+ - `このブランチを main と比べて、この作業が触れたフローはどれ?`
32
+
33
+ ## デモを試す
34
+
35
+ ```bash
36
+ npx -y @mafianacho/nacholens@latest demo
37
+ # → ./nacholens-demo/demo-shop.html(ブラウザで開く)
38
+ ```
39
+
40
+ ## 詳しく
41
+
42
+ - [ガイド](docs/guide.md)(英語): コマンド、変更オーバーレイの仕組み、制限
43
+ - [エージェント用手順書](skills/nacholens/SKILL.md)、[モデル形式](docs/model-schema.md)、[レビュードック](docs/review.md)
44
+ - [コントリビュート](CONTRIBUTING.md)、[セキュリティ](SECURITY.md)
45
+
46
+ Apache License 2.0([`LICENSE`](LICENSE)、[`NOTICE`](NOTICE))。同梱フォントは SIL Open Font License 1.1 です([`FONTLOG`](src/player/fonts/FONTLOG.md))。Made by [Mafianacho Inc.](https://mafianacho.com)
package/README.ko.md ADDED
@@ -0,0 +1,46 @@
1
+ # nacholens
2
+
3
+ [English](README.md) · [日本語](README.ja.md) · [Deutsch](README.de.md) · [Français](README.fr.md) · [中文](README.zh.md) · **한국어**
4
+
5
+ AI가 백엔드에서 무엇을 바꿨는지 코드를 읽지 않고 확인하세요. nacholens는 저장소를 한 페이지로 보여 줍니다. 유즈케이스를 고르면 요청이 클라이언트에서 서비스, 데이터베이스, 외부 서비스로 움직이고, `git diff`로 찾은 바뀐 곳이 강조됩니다.
6
+
7
+ ![nacholens: 데모 쇼핑몰을 지나가는 요청과 강조된 변경 부분](docs/images/overview.png)
8
+
9
+ ## 사용법
10
+
11
+ 보고 싶은 저장소에서 AI 코딩 에이전트(Claude Code, Codex, Cursor 등)를 열고, 아래 블록을 복사해 `요청:` 줄에 보고 싶은 것을 적은 뒤 그대로 붙여 넣으세요.
12
+
13
+ ```text
14
+ nacholens로 이 저장소에 대한 아래 요청에, 열어 볼 수 있는 페이지로 답해 줘.
15
+
16
+ 요청: <보고 싶은 것을 여기에 적기>
17
+
18
+ 방법:
19
+ 1. nacholens 플레이북과 CLI를 받는다 (Node.js 20 이상과 git 필요, 이 저장소에는 아무것도 설치하지 않음):
20
+ npx -y @mafianacho/nacholens@latest install --to "$HOME/.nacholens-skill" --force
21
+ 2. "$HOME/.nacholens-skill/nacholens/SKILL.md" 를 읽고 그대로 따른다. CLI는 다음과 같다:
22
+ node "$HOME/.nacholens-skill/nacholens/cli/src/cli.js" <command>
23
+ 3. .nacholens/ 의 모델 말고는 이 저장소의 파일을 바꾸지 않는다. 페이지는 ./nacholens-out 에 만든다.
24
+ 4. 페이지가 만들어지면 경로를 알려 주고, 무엇을 보여 주는지 쉬운 말로 설명한다.
25
+ ```
26
+
27
+ 요청 예시:
28
+
29
+ - `최근 커밋 5개에서 뭐가 바뀌었고, 무엇을 다시 테스트해야 해?`
30
+ - `로그인이 브라우저에서 데이터베이스까지 어떻게 흐르는지 보여 줘.`
31
+ - `이 브랜치를 main과 비교해서 이번 작업이 건드린 흐름을 알려 줘.`
32
+
33
+ ## 데모 보기
34
+
35
+ ```bash
36
+ npx -y @mafianacho/nacholens@latest demo
37
+ # → ./nacholens-demo/demo-shop.html (브라우저로 열기)
38
+ ```
39
+
40
+ ## 더 보기
41
+
42
+ - [안내서](docs/guide.ko.md): 명령, 변경 강조가 만들어지는 방식, 한계
43
+ - [에이전트 플레이북](skills/nacholens/SKILL.md), [모델 형식](docs/model-schema.md), [검토 독](docs/review.md)
44
+ - [기여하기](CONTRIBUTING.md), [보안](SECURITY.md)
45
+
46
+ Apache License 2.0 ([`LICENSE`](LICENSE), [`NOTICE`](NOTICE)). 내장 글꼴은 SIL Open Font License 1.1을 따릅니다 ([`FONTLOG`](src/player/fonts/FONTLOG.md)). Made by [Mafianacho Inc.](https://mafianacho.com)
package/README.md CHANGED
@@ -1,3 +1,46 @@
1
- # Temporary Holding Version
1
+ # nacholens
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **English** · [日本語](README.ja.md) · [Deutsch](README.de.md) · [Français](README.fr.md) · [中文](README.zh.md) · [한국어](README.ko.md)
4
+
5
+ See what an AI changed in a backend, without reading code. nacholens turns a repository into one page: pick a use case and watch the request move from the client through your services, database and third parties, with the changed parts highlighted from `git diff`.
6
+
7
+ ![nacholens: a request moving through the demo shop, changed parts highlighted](docs/images/overview.png)
8
+
9
+ ## Use it
10
+
11
+ Open your AI coding agent (Claude Code, Codex, Cursor, …) in the repository you want to see, copy the block below, write your request on the `My request:` line, and paste it.
12
+
13
+ ```text
14
+ Use nacholens to answer my request below about this repository, as a page I can open.
15
+
16
+ My request: <write what you want to see here>
17
+
18
+ How:
19
+ 1. Get the nacholens playbook and CLI (needs Node.js 20+ and git; nothing is installed into this repository):
20
+ npx -y @mafianacho/nacholens@latest install --to "$HOME/.nacholens-skill" --force
21
+ 2. Read "$HOME/.nacholens-skill/nacholens/SKILL.md" and follow it. The CLI is:
22
+ node "$HOME/.nacholens-skill/nacholens/cli/src/cli.js" <command>
23
+ 3. Do not change any file of this repository except the model in .nacholens/. Write the page to ./nacholens-out.
24
+ 4. When the page is built, give me its path and explain what it shows in plain words.
25
+ ```
26
+
27
+ Example requests:
28
+
29
+ - `What changed in the last 5 commits, and what should I re-test?`
30
+ - `Show how sign-in works, from the browser to the database.`
31
+ - `Compare this branch with main: which flows did this work touch?`
32
+
33
+ ## Try the demo
34
+
35
+ ```bash
36
+ npx -y @mafianacho/nacholens@latest demo
37
+ # → ./nacholens-demo/demo-shop.html (open it in a browser)
38
+ ```
39
+
40
+ ## More
41
+
42
+ - [Guide](docs/guide.md): commands, how the change overlay works, limits
43
+ - [Agent playbook](skills/nacholens/SKILL.md), [model format](docs/model-schema.md), [review dock](docs/review.md)
44
+ - [Contributing](CONTRIBUTING.md), [Security](SECURITY.md)
45
+
46
+ Apache License 2.0 ([`LICENSE`](LICENSE), [`NOTICE`](NOTICE)). The embedded fonts are under the SIL Open Font License 1.1 ([`FONTLOG`](src/player/fonts/FONTLOG.md)). Made by [Mafianacho Inc.](https://mafianacho.com)
package/README.zh.md ADDED
@@ -0,0 +1,46 @@
1
+ # nacholens
2
+
3
+ [English](README.md) · [日本語](README.ja.md) · [Deutsch](README.de.md) · [Français](README.fr.md) · **中文** · [한국어](README.ko.md)
4
+
5
+ 不读代码,也能看清 AI 改了后端的哪些地方。nacholens 把一个代码仓库变成一个页面:选一个用例,就能看到请求从客户端经过你的服务、数据库和第三方服务,并根据 `git diff` 高亮显示改动的部分。
6
+
7
+ ![nacholens:请求在演示商店中流动,改动部分被高亮](docs/images/overview.png)
8
+
9
+ ## 用法
10
+
11
+ 在要查看的仓库里打开你的 AI 编程助手(Claude Code、Codex、Cursor 等),复制下面的代码块,在 `我的请求:` 一行写下你想看的内容,然后直接粘贴。
12
+
13
+ ```text
14
+ 请用 nacholens 回答我下面关于这个仓库的请求,结果做成一个我能打开的页面。
15
+
16
+ 我的请求:<在这里写你想看的内容>
17
+
18
+ 做法:
19
+ 1. 获取 nacholens 的操作手册和 CLI(需要 Node.js 20+ 和 git;不会往这个仓库安装任何东西):
20
+ npx -y @mafianacho/nacholens@latest install --to "$HOME/.nacholens-skill" --force
21
+ 2. 阅读 "$HOME/.nacholens-skill/nacholens/SKILL.md" 并照做。CLI 是:
22
+ node "$HOME/.nacholens-skill/nacholens/cli/src/cli.js" <command>
23
+ 3. 除 .nacholens/ 里的模型外,不要修改这个仓库的任何文件。页面写到 ./nacholens-out。
24
+ 4. 页面生成后,告诉我它的路径,并用通俗的话说明它展示了什么。
25
+ ```
26
+
27
+ 请求示例:
28
+
29
+ - `最近 5 次提交改了什么?我需要重新测试哪些?`
30
+ - `展示登录是怎么工作的,从浏览器到数据库。`
31
+ - `把这个分支和 main 比较:这次工作涉及了哪些流程?`
32
+
33
+ ## 试试演示
34
+
35
+ ```bash
36
+ npx -y @mafianacho/nacholens@latest demo
37
+ # → ./nacholens-demo/demo-shop.html(用浏览器打开)
38
+ ```
39
+
40
+ ## 更多
41
+
42
+ - [指南](docs/guide.md)(英文):命令、改动叠加的原理、局限
43
+ - [助手操作手册](skills/nacholens/SKILL.md)、[模型格式](docs/model-schema.md)、[评审面板](docs/review.md)
44
+ - [参与贡献](CONTRIBUTING.md)、[安全](SECURITY.md)
45
+
46
+ Apache License 2.0([`LICENSE`](LICENSE)、[`NOTICE`](NOTICE))。内嵌字体采用 SIL Open Font License 1.1([`FONTLOG`](src/player/fonts/FONTLOG.md))。Made by [Mafianacho Inc.](https://mafianacho.com)
@@ -0,0 +1,7 @@
1
+ # demo shop (v1)
2
+
3
+ Tiny zero-dependency Node app used as the public example for `nacholens`:
4
+ browser (`public/`) → gateway (`gateway.js`) → API (`api.js`) → SQLite (`db.js`),
5
+ plus three third-party services (`mock-external.js`).
6
+
7
+ node mock-external.js & node api.js & node gateway.js # Node >= 22.13
@@ -0,0 +1,78 @@
1
+ // Order API: sessions, orders, sales report. Talks to SQLite and to external services.
2
+ import http from "node:http";
3
+ import { randomUUID } from "node:crypto";
4
+ import { saveState, consumeState, saveSession, findSession, listOrders, insertOrder } from "./db.js";
5
+
6
+ const EXTERNAL = process.env.EXTERNAL_URL ?? "http://127.0.0.1:8090";
7
+ const PUBLIC_ORIGIN = process.env.PUBLIC_ORIGIN ?? "http://127.0.0.1:8080";
8
+ const SESSION_TTL_MS = 8 * 60 * 60 * 1000;
9
+ const ADMINS = new Set((process.env.ADMIN_EMAILS ?? "buyer@example.com").split(","));
10
+
11
+ const send = (res, code, body, headers = {}) => {
12
+ res.writeHead(code, { "content-type": "application/json", ...headers });
13
+ res.end(JSON.stringify(body));
14
+ };
15
+
16
+ const readBody = (req) => new Promise((resolve) => {
17
+ let raw = "";
18
+ req.on("data", (c) => (raw += c));
19
+ req.on("end", () => { try { resolve(JSON.parse(raw || "{}")); } catch { resolve(null); } });
20
+ });
21
+
22
+ function sessionOf(req) {
23
+ const m = /(?:^|; )sid=([\w-]+)/.exec(req.headers.cookie ?? "");
24
+ return m ? findSession(m[1]) : null;
25
+ }
26
+
27
+ async function route(req, res) {
28
+ const url = new URL(req.url, "http://x");
29
+ const key = `${req.method} ${url.pathname}`;
30
+
31
+ if (key === "GET /api/auth/start") {
32
+ const state = randomUUID();
33
+ saveState(state);
34
+ const to = new URL(EXTERNAL + "/authorize");
35
+ to.searchParams.set("state", state);
36
+ to.searchParams.set("redirect_uri", PUBLIC_ORIGIN + "/api/auth/callback");
37
+ return send(res, 302, { redirect: to.toString() }, { location: to.toString() });
38
+ }
39
+
40
+ if (key === "GET /api/auth/callback") {
41
+ if (!consumeState(url.searchParams.get("state") ?? "")) return send(res, 400, { error: "bad_state" });
42
+ const token = await fetch(EXTERNAL + "/token", { method: "POST", body: JSON.stringify({ code: url.searchParams.get("code") }) });
43
+ if (!token.ok) return send(res, 502, { error: "provider_failed" });
44
+ const { email } = await token.json();
45
+ const sid = randomUUID();
46
+ saveSession(sid, email, SESSION_TTL_MS);
47
+ return send(res, 302, { ok: true }, { location: "/", "set-cookie": `sid=${sid}; HttpOnly; SameSite=Lax; Path=/; Max-Age=${SESSION_TTL_MS / 1000}` });
48
+ }
49
+
50
+ const me = sessionOf(req);
51
+ if (!me) return send(res, 401, { error: "unauthenticated" });
52
+
53
+ if (key === "GET /api/orders") {
54
+ const rows = listOrders(me.email);
55
+ return send(res, 200, { orders: rows.map((o) => ({ id: o.id, item: o.item, qty: o.qty, createdAt: o.created_at })) });
56
+ }
57
+
58
+ if (key === "POST /api/orders") {
59
+ if (req.headers.origin !== PUBLIC_ORIGIN) return send(res, 403, { error: "bad_origin" });
60
+ const body = await readBody(req);
61
+ if (!body || typeof body.item !== "string" || !Number.isInteger(body.qty) || body.qty < 1 || body.qty > 99)
62
+ return send(res, 400, { error: "invalid_order" });
63
+ const id = insertOrder(me.email, body.item.slice(0, 80), body.qty);
64
+ return send(res, 201, { id });
65
+ }
66
+
67
+ if (key === "GET /api/reports/sales") {
68
+ if (!ADMINS.has(me.email)) return send(res, 403, { error: "forbidden" });
69
+ const r = await fetch(EXTERNAL + "/sales");
70
+ if (!r.ok) return send(res, 502, { error: "analytics_unavailable" });
71
+ return send(res, 200, await r.json());
72
+ }
73
+
74
+ send(res, 404, { error: "not_found" });
75
+ }
76
+
77
+ const server = http.createServer((req, res) => route(req, res).catch(() => send(res, 500, { error: "internal" })));
78
+ server.listen(Number(process.env.API_PORT ?? 8081), "127.0.0.1", () => console.log("listening on :" + server.address().port));
@@ -0,0 +1,38 @@
1
+ // SQLite storage for the demo shop (node:sqlite, Node >= 22.13).
2
+ import { DatabaseSync } from "node:sqlite";
3
+
4
+ const db = new DatabaseSync(process.env.SHOP_DB ?? ":memory:");
5
+ db.exec(`
6
+ CREATE TABLE IF NOT EXISTS oauth_state (state TEXT PRIMARY KEY, created_at INTEGER NOT NULL);
7
+ CREATE TABLE IF NOT EXISTS sessions (id TEXT PRIMARY KEY, email TEXT NOT NULL, expires_at INTEGER NOT NULL);
8
+ CREATE TABLE IF NOT EXISTS orders (
9
+ id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT NOT NULL, item TEXT NOT NULL,
10
+ qty INTEGER NOT NULL, tracking TEXT, created_at INTEGER NOT NULL
11
+ );
12
+ `);
13
+
14
+ export function saveState(state) {
15
+ db.prepare("INSERT INTO oauth_state (state, created_at) VALUES (?, ?)").run(state, Date.now());
16
+ }
17
+
18
+ // A state value works once: the row is removed in the same statement that reads it.
19
+ export function consumeState(state) {
20
+ return db.prepare("DELETE FROM oauth_state WHERE state = ? RETURNING state").get(state) ?? null;
21
+ }
22
+
23
+ export function saveSession(id, email, ttlMs) {
24
+ db.prepare("INSERT INTO sessions (id, email, expires_at) VALUES (?, ?, ?)").run(id, email, Date.now() + ttlMs);
25
+ }
26
+
27
+ export function findSession(id) {
28
+ return db.prepare("SELECT email FROM sessions WHERE id = ? AND expires_at > ?").get(id, Date.now()) ?? null;
29
+ }
30
+
31
+ export function listOrders(email) {
32
+ return db.prepare("SELECT id, item, qty, tracking, created_at FROM orders WHERE email = ? ORDER BY id DESC LIMIT 50").all(email);
33
+ }
34
+
35
+ export function insertOrder(email, item, qty, tracking) {
36
+ const r = db.prepare("INSERT INTO orders (email, item, qty, tracking, created_at) VALUES (?, ?, ?, ?, ?)").run(email, item, qty, tracking ?? null, Date.now());
37
+ return Number(r.lastInsertRowid);
38
+ }