@truenine/memory-sync-cli 2026.10213.0 → 2026.10213.10155
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/LICENSE +661 -0
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +24 -25
package/LICENSE
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 19 November 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
Preamble
|
|
9
|
+
|
|
10
|
+
The GNU Affero General Public License is a free, copyleft license for
|
|
11
|
+
software and other kinds of works, specifically designed to ensure
|
|
12
|
+
cooperation with the community in the case of network server software.
|
|
13
|
+
|
|
14
|
+
The licenses for most software and other practical works are designed
|
|
15
|
+
to take away your freedom to share and change the works. By contrast,
|
|
16
|
+
our General Public Licenses are intended to guarantee your freedom to
|
|
17
|
+
share and change all versions of a program--to make sure it remains free
|
|
18
|
+
software for all its users.
|
|
19
|
+
|
|
20
|
+
When we speak of free software, we are referring to freedom, not
|
|
21
|
+
price. Our General Public Licenses are designed to make sure that you
|
|
22
|
+
have the freedom to distribute copies of free software (and charge for
|
|
23
|
+
them if you wish), that you receive source code or can get it if you
|
|
24
|
+
want it, that you can change the software or use pieces of it in new
|
|
25
|
+
free programs, and that you know you can do these things.
|
|
26
|
+
|
|
27
|
+
Developers that use our General Public Licenses protect your rights
|
|
28
|
+
with two steps: (1) assert copyright on the software, and (2) offer
|
|
29
|
+
you this License which gives you legal permission to copy, distribute
|
|
30
|
+
and/or modify the software.
|
|
31
|
+
|
|
32
|
+
A secondary benefit of defending all users' freedom is that
|
|
33
|
+
improvements made in alternate versions of the program, if they
|
|
34
|
+
receive widespread use, become available for other developers to
|
|
35
|
+
incorporate. Many developers of free software are heartened and
|
|
36
|
+
encouraged by the resulting cooperation. However, in the case of
|
|
37
|
+
software used on network servers, this result may fail to come about.
|
|
38
|
+
The GNU General Public License permits making a modified version and
|
|
39
|
+
letting the public access it on a server without ever releasing its
|
|
40
|
+
source code to the public.
|
|
41
|
+
|
|
42
|
+
The GNU Affero General Public License is designed specifically to
|
|
43
|
+
ensure that, in such cases, the modified source code becomes available
|
|
44
|
+
to the community. It requires the operator of a network server to
|
|
45
|
+
provide the source code of the modified version running there to the
|
|
46
|
+
users of that server. Therefore, public use of a modified version, on
|
|
47
|
+
a publicly accessible server, gives the public access to the source
|
|
48
|
+
code of the modified version.
|
|
49
|
+
|
|
50
|
+
An older license, called the Affero General Public License and
|
|
51
|
+
published by Affero, was designed to accomplish similar goals. This is
|
|
52
|
+
a different license, not a version of the Affero GPL, but Affero has
|
|
53
|
+
released a new version of the Affero GPL which permits relicensing under
|
|
54
|
+
this license.
|
|
55
|
+
|
|
56
|
+
The precise terms and conditions for copying, distribution and
|
|
57
|
+
modification follow.
|
|
58
|
+
|
|
59
|
+
TERMS AND CONDITIONS
|
|
60
|
+
|
|
61
|
+
0. Definitions.
|
|
62
|
+
|
|
63
|
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
64
|
+
|
|
65
|
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
66
|
+
works, such as semiconductor masks.
|
|
67
|
+
|
|
68
|
+
"The Program" refers to any copyrightable work licensed under this
|
|
69
|
+
License. Each licensee is addressed as "you". "Licensees" and
|
|
70
|
+
"recipients" may be individuals or organizations.
|
|
71
|
+
|
|
72
|
+
To "modify" a work means to copy from or adapt all or part of the work
|
|
73
|
+
in a fashion requiring copyright permission, other than the making of an
|
|
74
|
+
exact copy. The resulting work is called a "modified version" of the
|
|
75
|
+
earlier work or a work "based on" the earlier work.
|
|
76
|
+
|
|
77
|
+
A "covered work" means either the unmodified Program or a work based
|
|
78
|
+
on the Program.
|
|
79
|
+
|
|
80
|
+
To "propagate" a work means to do anything with it that, without
|
|
81
|
+
permission, would make you directly or secondarily liable for
|
|
82
|
+
infringement under applicable copyright law, except executing it on a
|
|
83
|
+
computer or modifying a private copy. Propagation includes copying,
|
|
84
|
+
distribution (with or without modification), making available to the
|
|
85
|
+
public, and in some countries other activities as well.
|
|
86
|
+
|
|
87
|
+
To "convey" a work means any kind of propagation that enables other
|
|
88
|
+
parties to make or receive copies. Mere interaction with a user through
|
|
89
|
+
a computer network, with no transfer of a copy, is not conveying.
|
|
90
|
+
|
|
91
|
+
An interactive user interface displays "Appropriate Legal Notices"
|
|
92
|
+
to the extent that it includes a convenient and prominently visible
|
|
93
|
+
feature that (1) displays an appropriate copyright notice, and (2)
|
|
94
|
+
tells the user that there is no warranty for the work (except to the
|
|
95
|
+
extent that warranties are provided), that licensees may convey the
|
|
96
|
+
work under this License, and how to view a copy of this License. If
|
|
97
|
+
the interface presents a list of user commands or options, such as a
|
|
98
|
+
menu, a prominent item in the list meets this criterion.
|
|
99
|
+
|
|
100
|
+
1. Source Code.
|
|
101
|
+
|
|
102
|
+
The "source code" for a work means the preferred form of the work
|
|
103
|
+
for making modifications to it. "Object code" means any non-source
|
|
104
|
+
form of a work.
|
|
105
|
+
|
|
106
|
+
A "Standard Interface" means an interface that either is an official
|
|
107
|
+
standard defined by a recognized standards body, or, in the case of
|
|
108
|
+
interfaces specified for a particular programming language, one that
|
|
109
|
+
is widely used among developers working in that language.
|
|
110
|
+
|
|
111
|
+
The "System Libraries" of an executable work include anything, other
|
|
112
|
+
than the work as a whole, that (a) is included in the normal form of
|
|
113
|
+
packaging a Major Component, but which is not part of that Major
|
|
114
|
+
Component, and (b) serves only to enable use of the work with that
|
|
115
|
+
Major Component, or to implement a Standard Interface for which an
|
|
116
|
+
implementation is available to the public in source code form. A
|
|
117
|
+
"Major Component", in this context, means a major essential component
|
|
118
|
+
(kernel, window system, and so on) of the specific operating system
|
|
119
|
+
(if any) on which the executable work runs, or a compiler used to
|
|
120
|
+
produce the work, or an object code interpreter used to run it.
|
|
121
|
+
|
|
122
|
+
The "Corresponding Source" for a work in object code form means all
|
|
123
|
+
the source code needed to generate, install, and (for an executable
|
|
124
|
+
work) run the object code and to modify the work, including scripts to
|
|
125
|
+
control those activities. However, it does not include the work's
|
|
126
|
+
System Libraries, or general-purpose tools or generally available free
|
|
127
|
+
programs which are used unmodified in performing those activities but
|
|
128
|
+
which are not part of the work. For example, Corresponding Source
|
|
129
|
+
includes interface definition files associated with source files for
|
|
130
|
+
the work, and the source code for shared libraries and dynamically
|
|
131
|
+
linked subprograms that the work is specifically designed to require,
|
|
132
|
+
such as by intimate data communication or control flow between those
|
|
133
|
+
subprograms and other parts of the work.
|
|
134
|
+
|
|
135
|
+
The Corresponding Source need not include anything that users
|
|
136
|
+
can regenerate automatically from other parts of the Corresponding
|
|
137
|
+
Source.
|
|
138
|
+
|
|
139
|
+
The Corresponding Source for a work in source code form is that
|
|
140
|
+
same work.
|
|
141
|
+
|
|
142
|
+
2. Basic Permissions.
|
|
143
|
+
|
|
144
|
+
All rights granted under this License are granted for the term of
|
|
145
|
+
copyright on the Program, and are irrevocable provided the stated
|
|
146
|
+
conditions are met. This License explicitly affirms your unlimited
|
|
147
|
+
permission to run the unmodified Program. The output from running a
|
|
148
|
+
covered work is covered by this License only if the output, given its
|
|
149
|
+
content, constitutes a covered work. This License acknowledges your
|
|
150
|
+
rights of fair use or other equivalent, as provided by copyright law.
|
|
151
|
+
|
|
152
|
+
You may make, run and propagate covered works that you do not
|
|
153
|
+
convey, without conditions so long as your license otherwise remains
|
|
154
|
+
in force. You may convey covered works to others for the sole purpose
|
|
155
|
+
of having them make modifications exclusively for you, or provide you
|
|
156
|
+
with facilities for running those works, provided that you comply with
|
|
157
|
+
the terms of this License in conveying all material for which you do
|
|
158
|
+
not control copyright. Those thus making or running the covered works
|
|
159
|
+
for you must do so exclusively on your behalf, under your direction
|
|
160
|
+
and control, on terms that prohibit them from making any copies of
|
|
161
|
+
your copyrighted material outside their relationship with you.
|
|
162
|
+
|
|
163
|
+
Conveying under any other circumstances is permitted solely under
|
|
164
|
+
the conditions stated below. Sublicensing is not allowed; section 10
|
|
165
|
+
makes it unnecessary.
|
|
166
|
+
|
|
167
|
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
168
|
+
|
|
169
|
+
No covered work shall be deemed part of an effective technological
|
|
170
|
+
measure under any applicable law fulfilling obligations under article
|
|
171
|
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
172
|
+
similar laws prohibiting or restricting circumvention of such
|
|
173
|
+
measures.
|
|
174
|
+
|
|
175
|
+
When you convey a covered work, you waive any legal power to forbid
|
|
176
|
+
circumvention of technological measures to the extent such circumvention
|
|
177
|
+
is effected by exercising rights under this License with respect to
|
|
178
|
+
the covered work, and you disclaim any intention to limit operation or
|
|
179
|
+
modification of the work as a means of enforcing, against the work's
|
|
180
|
+
users, your or third parties' legal rights to forbid circumvention of
|
|
181
|
+
technological measures.
|
|
182
|
+
|
|
183
|
+
4. Conveying Verbatim Copies.
|
|
184
|
+
|
|
185
|
+
You may convey verbatim copies of the Program's source code as you
|
|
186
|
+
receive it, in any medium, provided that you conspicuously and
|
|
187
|
+
appropriately publish on each copy an appropriate copyright notice;
|
|
188
|
+
keep intact all notices stating that this License and any
|
|
189
|
+
non-permissive terms added in accord with section 7 apply to the code;
|
|
190
|
+
keep intact all notices of the absence of any warranty; and give all
|
|
191
|
+
recipients a copy of this License along with the Program.
|
|
192
|
+
|
|
193
|
+
You may charge any price or no price for each copy that you convey,
|
|
194
|
+
and you may offer support or warranty protection for a fee.
|
|
195
|
+
|
|
196
|
+
5. Conveying Modified Source Versions.
|
|
197
|
+
|
|
198
|
+
You may convey a work based on the Program, or the modifications to
|
|
199
|
+
produce it from the Program, in the form of source code under the
|
|
200
|
+
terms of section 4, provided that you also meet all of these conditions:
|
|
201
|
+
|
|
202
|
+
a) The work must carry prominent notices stating that you modified
|
|
203
|
+
it, and giving a relevant date.
|
|
204
|
+
|
|
205
|
+
b) The work must carry prominent notices stating that it is
|
|
206
|
+
released under this License and any conditions added under section
|
|
207
|
+
7. This requirement modifies the requirement in section 4 to
|
|
208
|
+
"keep intact all notices".
|
|
209
|
+
|
|
210
|
+
c) You must license the entire work, as a whole, under this
|
|
211
|
+
License to anyone who comes into possession of a copy. This
|
|
212
|
+
License will therefore apply, along with any applicable section 7
|
|
213
|
+
additional terms, to the whole of the work, and all its parts,
|
|
214
|
+
regardless of how they are packaged. This License gives no
|
|
215
|
+
permission to license the work in any other way, but it does not
|
|
216
|
+
invalidate such permission if you have separately received it.
|
|
217
|
+
|
|
218
|
+
d) If the work has interactive user interfaces, each must display
|
|
219
|
+
Appropriate Legal Notices; however, if the Program has interactive
|
|
220
|
+
interfaces that do not display Appropriate Legal Notices, your
|
|
221
|
+
work need not make them do so.
|
|
222
|
+
|
|
223
|
+
A compilation of a covered work with other separate and independent
|
|
224
|
+
works, which are not by their nature extensions of the covered work,
|
|
225
|
+
and which are not combined with it such as to form a larger program,
|
|
226
|
+
in or on a volume of a storage or distribution medium, is called an
|
|
227
|
+
"aggregate" if the compilation and its resulting copyright are not
|
|
228
|
+
used to limit the access or legal rights of the compilation's users
|
|
229
|
+
beyond what the individual works permit. Inclusion of a covered work
|
|
230
|
+
in an aggregate does not cause this License to apply to the other
|
|
231
|
+
parts of the aggregate.
|
|
232
|
+
|
|
233
|
+
6. Conveying Non-Source Forms.
|
|
234
|
+
|
|
235
|
+
You may convey a covered work in object code form under the terms
|
|
236
|
+
of sections 4 and 5, provided that you also convey the
|
|
237
|
+
machine-readable Corresponding Source under the terms of this License,
|
|
238
|
+
in one of these ways:
|
|
239
|
+
|
|
240
|
+
a) Convey the object code in, or embodied in, a physical product
|
|
241
|
+
(including a physical distribution medium), accompanied by the
|
|
242
|
+
Corresponding Source fixed on a durable physical medium
|
|
243
|
+
customarily used for software interchange.
|
|
244
|
+
|
|
245
|
+
b) Convey the object code in, or embodied in, a physical product
|
|
246
|
+
(including a physical distribution medium), accompanied by a
|
|
247
|
+
written offer, valid for at least three years and valid for as
|
|
248
|
+
long as you offer spare parts or customer support for that product
|
|
249
|
+
model, to give anyone who possesses the object code either (1) a
|
|
250
|
+
copy of the Corresponding Source for all the software in the
|
|
251
|
+
product that is covered by this License, on a durable physical
|
|
252
|
+
medium customarily used for software interchange, for a price no
|
|
253
|
+
more than your reasonable cost of physically performing this
|
|
254
|
+
conveying of source, or (2) access to copy the
|
|
255
|
+
Corresponding Source from a network server at no charge.
|
|
256
|
+
|
|
257
|
+
c) Convey individual copies of the object code with a copy of the
|
|
258
|
+
written offer to provide the Corresponding Source. This
|
|
259
|
+
alternative is allowed only occasionally and noncommercially, and
|
|
260
|
+
only if you received the object code with such an offer, in accord
|
|
261
|
+
with subsection 6b.
|
|
262
|
+
|
|
263
|
+
d) Convey the object code by offering access from a designated
|
|
264
|
+
place (gratis or for a charge), and offer equivalent access to the
|
|
265
|
+
Corresponding Source in the same way through the same place at no
|
|
266
|
+
further charge. You need not require recipients to copy the
|
|
267
|
+
Corresponding Source along with the object code. If the place to
|
|
268
|
+
copy the object code is a network server, the Corresponding Source
|
|
269
|
+
may be on a different server (operated by you or a third party)
|
|
270
|
+
that supports equivalent copying facilities, provided you maintain
|
|
271
|
+
clear directions next to the object code saying where to find the
|
|
272
|
+
Corresponding Source. Regardless of what server hosts the
|
|
273
|
+
Corresponding Source, you remain obligated to ensure that it is
|
|
274
|
+
available for as long as needed to satisfy these requirements.
|
|
275
|
+
|
|
276
|
+
e) Convey the object code using peer-to-peer transmission, provided
|
|
277
|
+
you inform other peers where the object code and Corresponding
|
|
278
|
+
Source of the work are being offered to the general public at no
|
|
279
|
+
charge under subsection 6d.
|
|
280
|
+
|
|
281
|
+
A separable portion of the object code, whose source code is excluded
|
|
282
|
+
from the Corresponding Source as a System Library, need not be
|
|
283
|
+
included in conveying the object code work.
|
|
284
|
+
|
|
285
|
+
A "User Product" is either (1) a "consumer product", which means any
|
|
286
|
+
tangible personal property which is normally used for personal, family,
|
|
287
|
+
or household purposes, or (2) anything designed or sold for incorporation
|
|
288
|
+
into a dwelling. In determining whether a product is a consumer product,
|
|
289
|
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
290
|
+
product received by a particular user, "normally used" refers to a
|
|
291
|
+
typical or common use of that class of product, regardless of the status
|
|
292
|
+
of the particular user or of the way in which the particular user
|
|
293
|
+
actually uses, or expects or is expected to use, the product. A product
|
|
294
|
+
is a consumer product regardless of whether the product has substantial
|
|
295
|
+
commercial, industrial or non-consumer uses, unless such uses represent
|
|
296
|
+
the only significant mode of use of the product.
|
|
297
|
+
|
|
298
|
+
"Installation Information" for a User Product means any methods,
|
|
299
|
+
procedures, authorization keys, or other information required to install
|
|
300
|
+
and execute modified versions of a covered work in that User Product from
|
|
301
|
+
a modified version of its Corresponding Source. The information must
|
|
302
|
+
suffice to ensure that the continued functioning of the modified object
|
|
303
|
+
code is in no case prevented or interfered with solely because
|
|
304
|
+
modification has been made.
|
|
305
|
+
|
|
306
|
+
If you convey an object code work under this section in, or with, or
|
|
307
|
+
specifically for use in, a User Product, and the conveying occurs as
|
|
308
|
+
part of a transaction in which the right of possession and use of the
|
|
309
|
+
User Product is transferred to the recipient in perpetuity or for a
|
|
310
|
+
fixed term (regardless of how the transaction is characterized), the
|
|
311
|
+
Corresponding Source conveyed under this section must be accompanied
|
|
312
|
+
by the Installation Information. But this requirement does not apply
|
|
313
|
+
if neither you nor any third party retains the ability to install
|
|
314
|
+
modified object code on the User Product (for example, the work has
|
|
315
|
+
been installed in ROM).
|
|
316
|
+
|
|
317
|
+
The requirement to provide Installation Information does not include a
|
|
318
|
+
requirement to continue to provide support service, warranty, or updates
|
|
319
|
+
for a work that has been modified or installed by the recipient, or for
|
|
320
|
+
the User Product in which it has been modified or installed. Access to a
|
|
321
|
+
network may be denied when the modification itself materially and
|
|
322
|
+
adversely affects the operation of the network or violates the rules and
|
|
323
|
+
protocols for communication across the network.
|
|
324
|
+
|
|
325
|
+
Corresponding Source conveyed, and Installation Information provided,
|
|
326
|
+
in accord with this section must be in a format that is publicly
|
|
327
|
+
documented (and with an implementation available to the public in
|
|
328
|
+
source code form), and must require no special password or key for
|
|
329
|
+
unpacking, reading or copying.
|
|
330
|
+
|
|
331
|
+
7. Additional Terms.
|
|
332
|
+
|
|
333
|
+
"Additional permissions" are terms that supplement the terms of this
|
|
334
|
+
License by making exceptions from one or more of its conditions.
|
|
335
|
+
Additional permissions that are applicable to the entire Program shall
|
|
336
|
+
be treated as though they were included in this License, to the extent
|
|
337
|
+
that they are valid under applicable law. If additional permissions
|
|
338
|
+
apply only to part of the Program, that part may be used separately
|
|
339
|
+
under those permissions, but the entire Program remains governed by
|
|
340
|
+
this License without regard to the additional permissions.
|
|
341
|
+
|
|
342
|
+
When you convey a copy of a covered work, you may at your option
|
|
343
|
+
remove any additional permissions from that copy, or from any part of
|
|
344
|
+
it. (Additional permissions may be written to require their own
|
|
345
|
+
removal in certain cases when you modify the work.) You may place
|
|
346
|
+
additional permissions on material, added by you to a covered work,
|
|
347
|
+
for which you have or can give appropriate copyright permission.
|
|
348
|
+
|
|
349
|
+
Notwithstanding any other provision of this License, for material you
|
|
350
|
+
add to a covered work, you may (if authorized by the copyright holders of
|
|
351
|
+
that material) supplement the terms of this License with terms:
|
|
352
|
+
|
|
353
|
+
a) Disclaiming warranty or limiting liability differently from the
|
|
354
|
+
terms of sections 15 and 16 of this License; or
|
|
355
|
+
|
|
356
|
+
b) Requiring preservation of specified reasonable legal notices or
|
|
357
|
+
author attributions in that material or in the Appropriate Legal
|
|
358
|
+
Notices displayed by works containing it; or
|
|
359
|
+
|
|
360
|
+
c) Prohibiting misrepresentation of the origin of that material, or
|
|
361
|
+
requiring that modified versions of such material be marked in
|
|
362
|
+
reasonable ways as different from the original version; or
|
|
363
|
+
|
|
364
|
+
d) Limiting the use for publicity purposes of names of licensors or
|
|
365
|
+
authors of the material; or
|
|
366
|
+
|
|
367
|
+
e) Declining to grant rights under trademark law for use of some
|
|
368
|
+
trade names, trademarks, or service marks; or
|
|
369
|
+
|
|
370
|
+
f) Requiring indemnification of licensors and authors of that
|
|
371
|
+
material by anyone who conveys the material (or modified versions of
|
|
372
|
+
it) with contractual assumptions of liability to the recipient, for
|
|
373
|
+
any liability that these contractual assumptions directly impose on
|
|
374
|
+
those licensors and authors.
|
|
375
|
+
|
|
376
|
+
All other non-permissive additional terms are considered "further
|
|
377
|
+
restrictions" within the meaning of section 10. If the Program as you
|
|
378
|
+
received it, or any part of it, contains a notice stating that it is
|
|
379
|
+
governed by this License along with a term that is a further
|
|
380
|
+
restriction, you may remove that term. If a license document contains
|
|
381
|
+
a further restriction but permits relicensing or conveying under this
|
|
382
|
+
License, you may add to a covered work material governed by the terms
|
|
383
|
+
of that license document, provided that the further restriction does
|
|
384
|
+
not survive such relicensing or conveying.
|
|
385
|
+
|
|
386
|
+
If you add terms to a covered work in accord with this section, you
|
|
387
|
+
must place, in the relevant source files, a statement of the
|
|
388
|
+
additional terms that apply to those files, or a notice indicating
|
|
389
|
+
where to find the applicable terms.
|
|
390
|
+
|
|
391
|
+
Additional terms, permissive or non-permissive, may be stated in the
|
|
392
|
+
form of a separately written license, or stated as exceptions;
|
|
393
|
+
the above requirements apply either way.
|
|
394
|
+
|
|
395
|
+
8. Termination.
|
|
396
|
+
|
|
397
|
+
You may not propagate or modify a covered work except as expressly
|
|
398
|
+
provided under this License. Any attempt otherwise to propagate or
|
|
399
|
+
modify it is void, and will automatically terminate your rights under
|
|
400
|
+
this License (including any patent licenses granted under the third
|
|
401
|
+
paragraph of section 11).
|
|
402
|
+
|
|
403
|
+
However, if you cease all violation of this License, then your
|
|
404
|
+
license from a particular copyright holder is reinstated (a)
|
|
405
|
+
provisionally, unless and until the copyright holder explicitly and
|
|
406
|
+
finally terminates your license, and (b) permanently, if the copyright
|
|
407
|
+
holder fails to notify you of the violation by some reasonable means
|
|
408
|
+
prior to 60 days after the cessation.
|
|
409
|
+
|
|
410
|
+
Moreover, your license from a particular copyright holder is
|
|
411
|
+
reinstated permanently if the copyright holder notifies you of the
|
|
412
|
+
violation by some reasonable means, this is the first time you have
|
|
413
|
+
received notice of violation of this License (for any work) from that
|
|
414
|
+
copyright holder, and you cure the violation prior to 30 days after
|
|
415
|
+
your receipt of the notice.
|
|
416
|
+
|
|
417
|
+
Termination of your rights under this section does not terminate the
|
|
418
|
+
licenses of parties who have received copies or rights from you under
|
|
419
|
+
this License. If your rights have been terminated and not permanently
|
|
420
|
+
reinstated, you do not qualify to receive new licenses for the same
|
|
421
|
+
material under section 10.
|
|
422
|
+
|
|
423
|
+
9. Acceptance Not Required for Having Copies.
|
|
424
|
+
|
|
425
|
+
You are not required to accept this License in order to receive or
|
|
426
|
+
run a copy of the Program. Ancillary propagation of a covered work
|
|
427
|
+
occurring solely as a consequence of using peer-to-peer transmission
|
|
428
|
+
to receive a copy likewise does not require acceptance. However,
|
|
429
|
+
nothing other than this License grants you permission to propagate or
|
|
430
|
+
modify any covered work. These actions infringe copyright if you do
|
|
431
|
+
not accept this License. Therefore, by modifying or propagating a
|
|
432
|
+
covered work, you indicate your acceptance of this License to do so.
|
|
433
|
+
|
|
434
|
+
10. Automatic Licensing of Downstream Recipients.
|
|
435
|
+
|
|
436
|
+
Each time you convey a covered work, the recipient automatically
|
|
437
|
+
receives a license from the original licensors, to run, modify and
|
|
438
|
+
propagate that work, subject to this License. You are not responsible
|
|
439
|
+
for enforcing compliance by third parties with this License.
|
|
440
|
+
|
|
441
|
+
An "entity transaction" is a transaction transferring control of an
|
|
442
|
+
organization, or substantially all assets of one, or subdividing an
|
|
443
|
+
organization, or merging organizations. If propagation of a covered
|
|
444
|
+
work results from an entity transaction, each party to that
|
|
445
|
+
transaction who receives a copy of the work also receives whatever
|
|
446
|
+
licenses to the work the party's predecessor in interest had or could
|
|
447
|
+
give under the previous paragraph, plus a right to possession of the
|
|
448
|
+
Corresponding Source of the work from the predecessor in interest, if
|
|
449
|
+
the predecessor has it or can get it with reasonable efforts.
|
|
450
|
+
|
|
451
|
+
You may not impose any further restrictions on the exercise of the
|
|
452
|
+
rights granted or affirmed under this License. For example, you may
|
|
453
|
+
not impose a license fee, royalty, or other charge for exercise of
|
|
454
|
+
rights granted under this License, and you may not initiate litigation
|
|
455
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
456
|
+
any patent claim is infringed by making, using, selling, offering for
|
|
457
|
+
sale, or importing the Program or any portion of it.
|
|
458
|
+
|
|
459
|
+
11. Patents.
|
|
460
|
+
|
|
461
|
+
A "contributor" is a copyright holder who authorizes use under this
|
|
462
|
+
License of the Program or a work on which the Program is based. The
|
|
463
|
+
work thus licensed is called the contributor's "contributor version".
|
|
464
|
+
|
|
465
|
+
A contributor's "essential patent claims" are all patent claims
|
|
466
|
+
owned or controlled by the contributor, whether already acquired or
|
|
467
|
+
hereafter acquired, that would be infringed by some manner, permitted
|
|
468
|
+
by this License, of making, using, or selling its contributor version,
|
|
469
|
+
but do not include claims that would be infringed only as a
|
|
470
|
+
consequence of further modification of the contributor version. For
|
|
471
|
+
purposes of this definition, "control" includes the right to grant
|
|
472
|
+
patent sublicenses in a manner consistent with the requirements of
|
|
473
|
+
this License.
|
|
474
|
+
|
|
475
|
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
476
|
+
patent license under the contributor's essential patent claims, to
|
|
477
|
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
478
|
+
propagate the contents of its contributor version.
|
|
479
|
+
|
|
480
|
+
In the following three paragraphs, a "patent license" is any express
|
|
481
|
+
agreement or commitment, however denominated, not to enforce a patent
|
|
482
|
+
(such as an express permission to practice a patent or covenant not to
|
|
483
|
+
sue for patent infringement). To "grant" such a patent license to a
|
|
484
|
+
party means to make such an agreement or commitment not to enforce a
|
|
485
|
+
patent against the party.
|
|
486
|
+
|
|
487
|
+
If you convey a covered work, knowingly relying on a patent license,
|
|
488
|
+
and the Corresponding Source of the work is not available for anyone
|
|
489
|
+
to copy, free of charge and under the terms of this License, through a
|
|
490
|
+
publicly available network server or other readily accessible means,
|
|
491
|
+
then you must either (1) cause the Corresponding Source to be so
|
|
492
|
+
available, or (2) arrange to deprive yourself of the benefit of the
|
|
493
|
+
patent license for this particular work, or (3) arrange, in a manner
|
|
494
|
+
consistent with the requirements of this License, to extend the patent
|
|
495
|
+
license to downstream recipients. "Knowingly relying" means you have
|
|
496
|
+
actual knowledge that, but for the patent license, your conveying the
|
|
497
|
+
covered work in a country, or your recipient's use of the covered work
|
|
498
|
+
in a country, would infringe one or more identifiable patents in that
|
|
499
|
+
country that you have reason to believe are valid.
|
|
500
|
+
|
|
501
|
+
If, pursuant to or in connection with a single transaction or
|
|
502
|
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
503
|
+
covered work, and grant a patent license to some of the parties
|
|
504
|
+
receiving the covered work authorizing them to use, propagate, modify
|
|
505
|
+
or convey a specific copy of the covered work, then the patent license
|
|
506
|
+
you grant is automatically extended to all recipients of the covered
|
|
507
|
+
work and works based on it.
|
|
508
|
+
|
|
509
|
+
A patent license is "discriminatory" if it does not include within
|
|
510
|
+
the scope of its coverage, prohibits the exercise of, or is
|
|
511
|
+
conditioned on the non-exercise of one or more of the rights that are
|
|
512
|
+
specifically granted under this License. You may not convey a covered
|
|
513
|
+
work if you are a party to an arrangement with a third party that is
|
|
514
|
+
in the business of distributing software, under which you make payment
|
|
515
|
+
to the third party based on the extent of your activity of conveying
|
|
516
|
+
the work, and under which the third party grants, to any of the
|
|
517
|
+
parties who would receive the covered work from you, a discriminatory
|
|
518
|
+
patent license (a) in connection with copies of the covered work
|
|
519
|
+
conveyed by you (or copies made from those copies), or (b) primarily
|
|
520
|
+
for and in connection with specific products or compilations that
|
|
521
|
+
contain the covered work, unless you entered into that arrangement,
|
|
522
|
+
or that patent license was granted, prior to 28 March 2007.
|
|
523
|
+
|
|
524
|
+
Nothing in this License shall be construed as excluding or limiting
|
|
525
|
+
any implied license or other defenses to infringement that may
|
|
526
|
+
otherwise be available to you under applicable patent law.
|
|
527
|
+
|
|
528
|
+
12. No Surrender of Others' Freedom.
|
|
529
|
+
|
|
530
|
+
If conditions are imposed on you (whether by court order, agreement or
|
|
531
|
+
otherwise) that contradict the conditions of this License, they do not
|
|
532
|
+
excuse you from the conditions of this License. If you cannot convey a
|
|
533
|
+
covered work so as to satisfy simultaneously your obligations under this
|
|
534
|
+
License and any other pertinent obligations, then as a consequence you may
|
|
535
|
+
not convey it at all. For example, if you agree to terms that obligate you
|
|
536
|
+
to collect a royalty for further conveying from those to whom you convey
|
|
537
|
+
the Program, the only way you could satisfy both those terms and this
|
|
538
|
+
License would be to refrain entirely from conveying the Program.
|
|
539
|
+
|
|
540
|
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
541
|
+
|
|
542
|
+
Notwithstanding any other provision of this License, if you modify the
|
|
543
|
+
Program, your modified version must prominently offer all users
|
|
544
|
+
interacting with it remotely through a computer network (if your version
|
|
545
|
+
supports such interaction) an opportunity to receive the Corresponding
|
|
546
|
+
Source of your version by providing access to the Corresponding Source
|
|
547
|
+
from a network server at no charge, through some standard or customary
|
|
548
|
+
means of facilitating copying of software. This Corresponding Source
|
|
549
|
+
shall include the Corresponding Source for any work covered by version 3
|
|
550
|
+
of the GNU General Public License that is incorporated pursuant to the
|
|
551
|
+
following paragraph.
|
|
552
|
+
|
|
553
|
+
Notwithstanding any other provision of this License, you have
|
|
554
|
+
permission to link or combine any covered work with a work licensed
|
|
555
|
+
under version 3 of the GNU General Public License into a single
|
|
556
|
+
combined work, and to convey the resulting work. The terms of this
|
|
557
|
+
License will continue to apply to the part which is the covered work,
|
|
558
|
+
but the work with which it is combined will remain governed by version
|
|
559
|
+
3 of the GNU General Public License.
|
|
560
|
+
|
|
561
|
+
14. Revised Versions of this License.
|
|
562
|
+
|
|
563
|
+
The Free Software Foundation may publish revised and/or new versions of
|
|
564
|
+
the GNU Affero General Public License from time to time. Such new versions
|
|
565
|
+
will be similar in spirit to the present version, but may differ in detail to
|
|
566
|
+
address new problems or concerns.
|
|
567
|
+
|
|
568
|
+
Each version is given a distinguishing version number. If the
|
|
569
|
+
Program specifies that a certain numbered version of the GNU Affero General
|
|
570
|
+
Public License "or any later version" applies to it, you have the
|
|
571
|
+
option of following the terms and conditions either of that numbered
|
|
572
|
+
version or of any later version published by the Free Software
|
|
573
|
+
Foundation. If the Program does not specify a version number of the
|
|
574
|
+
GNU Affero General Public License, you may choose any version ever published
|
|
575
|
+
by the Free Software Foundation.
|
|
576
|
+
|
|
577
|
+
If the Program specifies that a proxy can decide which future
|
|
578
|
+
versions of the GNU Affero General Public License can be used, that proxy's
|
|
579
|
+
public statement of acceptance of a version permanently authorizes you
|
|
580
|
+
to choose that version for the Program.
|
|
581
|
+
|
|
582
|
+
Later license versions may give you additional or different
|
|
583
|
+
permissions. However, no additional obligations are imposed on any
|
|
584
|
+
author or copyright holder as a result of your choosing to follow a
|
|
585
|
+
later version.
|
|
586
|
+
|
|
587
|
+
15. Disclaimer of Warranty.
|
|
588
|
+
|
|
589
|
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
590
|
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
591
|
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
592
|
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
593
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
594
|
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
595
|
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
596
|
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
597
|
+
|
|
598
|
+
16. Limitation of Liability.
|
|
599
|
+
|
|
600
|
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
601
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
602
|
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
603
|
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
604
|
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
605
|
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
606
|
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
607
|
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
608
|
+
SUCH DAMAGES.
|
|
609
|
+
|
|
610
|
+
17. Interpretation of Sections 15 and 16.
|
|
611
|
+
|
|
612
|
+
If the disclaimer of warranty and limitation of liability provided
|
|
613
|
+
above cannot be given local legal effect according to their terms,
|
|
614
|
+
reviewing courts shall apply local law that most closely approximates
|
|
615
|
+
an absolute waiver of all civil liability in connection with the
|
|
616
|
+
Program, unless a warranty or assumption of liability accompanies a
|
|
617
|
+
copy of the Program in return for a fee.
|
|
618
|
+
|
|
619
|
+
END OF TERMS AND CONDITIONS
|
|
620
|
+
|
|
621
|
+
How to Apply These Terms to Your New Programs
|
|
622
|
+
|
|
623
|
+
If you develop a new program, and you want it to be of the greatest
|
|
624
|
+
possible use to the public, the best way to achieve this is to make it
|
|
625
|
+
free software which everyone can redistribute and change under these terms.
|
|
626
|
+
|
|
627
|
+
To do so, attach the following notices to the program. It is safest
|
|
628
|
+
to attach them to the start of each source file to most effectively
|
|
629
|
+
state the exclusion of warranty; and each file should have at least
|
|
630
|
+
the "copyright" line and a pointer to where the full notice is found.
|
|
631
|
+
|
|
632
|
+
<one line to give the program's name and a brief idea of what it does.>
|
|
633
|
+
Copyright (C) <year> <name of author>
|
|
634
|
+
|
|
635
|
+
This program is free software: you can redistribute it and/or modify
|
|
636
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
637
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
638
|
+
(at your option) any later version.
|
|
639
|
+
|
|
640
|
+
This program is distributed in the hope that it will be useful,
|
|
641
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
642
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
643
|
+
GNU Affero General Public License for more details.
|
|
644
|
+
|
|
645
|
+
You should have received a copy of the GNU Affero General Public License
|
|
646
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
647
|
+
|
|
648
|
+
Also add information on how to contact you by electronic and paper mail.
|
|
649
|
+
|
|
650
|
+
If your software can interact with users remotely through a computer
|
|
651
|
+
network, you should also make sure that it provides a way for users to
|
|
652
|
+
get its source. For example, if your program is a web application, its
|
|
653
|
+
interface could display a "Source" link that leads users to an archive
|
|
654
|
+
of the code. There are many ways you could offer source, and different
|
|
655
|
+
solutions will be better for different programs; see section 13 for the
|
|
656
|
+
specific requirements.
|
|
657
|
+
|
|
658
|
+
You should also get your employer (if you work as a programmer) or school,
|
|
659
|
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
660
|
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
661
|
+
<https://www.gnu.org/licenses/>.
|
package/dist/index.cjs
CHANGED
|
@@ -954,7 +954,7 @@ API 接口 (Spring WebFlux 6.2)
|
|
|
954
954
|
- \`controllers/\`: 控制器
|
|
955
955
|
- \`dto/\`: 数据传输对象
|
|
956
956
|
\`\`\`
|
|
957
|
-
`};const Ht=Object.fromEntries(Bt.map(e=>[e,{path:e,content:Vt[e]??``}])),Ut={USER_HOME:`~`,WORKSPACE:`$WORKSPACE`,SHADOW_SOURCE_PROJECT:`$SHADOW_SOURCE_PROJECT`},R=JSON.parse(Ht[`public/tnmsc.example.json`].content),Wt={reset:`\x1B[0m`,red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,magenta:`\x1B[35m`,gray:`\x1B[90m`,blue:`\x1B[34m`,green:`\x1B[32m`,white:`\x1B[37m`,dim:`\x1B[2m`,bgRed:`\x1B[41m`},Gt={red:e=>`${Wt.red}${e}${Wt.reset}`,yellow:e=>`${Wt.yellow}${e}${Wt.reset}`,cyan:e=>`${Wt.cyan}${e}${Wt.reset}`,magenta:e=>`${Wt.magenta}${e}${Wt.reset}`,gray:e=>`${Wt.gray}${e}${Wt.reset}`,blue:e=>`${Wt.blue}${e}${Wt.reset}`,green:e=>`${Wt.green}${e}${Wt.reset}`,white:e=>`${Wt.white}${e}${Wt.reset}`,dim:e=>`${Wt.dim}${e}${Wt.reset}`,bgRed:e=>`${Wt.bgRed}${e}${Wt.reset}`};let Kt;const qt={error:Gt.red,warn:Gt.yellow,info:Gt.cyan,debug:Gt.magenta,trace:Gt.gray,fatal:Gt.bgRed},Jt={silent:0,fatal:1,error:2,warn:3,info:4,debug:5,trace:6};function Yt(e){if(e===null)return Gt.dim(`null`);if(e===void 0)return Gt.dim(`undefined`);if(typeof e==`boolean`)return Gt.yellow(String(e));if(typeof e==`number`)return Gt.blue(String(e));if(typeof e==`string`)return Gt.green(`"${e}"`);if(Array.isArray(e))return e.length===0?`[]`:`[${e.map(e=>Yt(e)).join(`,`)}]`;if(e instanceof Error){let t={name:e.name,message:e.message,stack:e.stack};for(let n of Object.getOwnPropertyNames(e))n!==`name`&&n!==`message`&&n!==`stack`&&(t[n]=e[n]);return Xt(t)}return typeof e==`object`?Xt(e):String(e)}function Xt(e){let t=Object.entries(e);return t.length===0?`{}`:`{${t.map(([e,t])=>`${/^[\w$]+$/.test(e)?Gt.magenta(e):Gt.yellow(`"${e}"`)}:${Yt(t)}`).join(`,`)}}`}function Zt(){let e=new Date;return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}.${String(e.getMilliseconds()).padStart(3,`0`)}`}function Qt(e,t,n,r){let i=Zt(),a=qt[e]??Gt.white,o=String(n),s=r!=null&&Object.keys(r).length>0,c=o===``,l={$:[i,e,t],_:s?c?r:{[o]:r}:n},u={$:[i,a(e.toUpperCase()),t]},d=s?c?r:{[o]:r}:n,f=Xt({...u,_:d});return e===`error`||e===`fatal`?console.error(f):e===`warn`?console.warn(f):e===`debug`||e===`trace`?console.debug(f):console.log(f),l}function $t(e,t,n){let r=Jt[e],i=Jt[n];return(n,...a)=>r>i?{$:[Zt(),e,t],_:n}:typeof n==`string`?Qt(e,t,n,a.length===1&&typeof a[0]==`object`&&a[0]!==null?a[0]:a.length>0?{args:a}:void 0):typeof n==`object`&&n?Qt(e,t,``,n):Qt(e,t,n)}function en(e){Kt=e}function tn(){return Kt}function nn(e,t){let n=t??Kt??process.env.LOG_LEVEL??`info`;return{error:$t(`error`,e,n),warn:$t(`warn`,e,n),info:$t(`info`,e,n),debug:$t(`debug`,e,n),trace:$t(`trace`,e,n),fatal:$t(`fatal`,e,n)}}const rn=`.tnmsc.json`,an=`.aindex`;function on(){return f.join(p.homedir(),an,rn)}function sn(){return{...R}}function cn(e,t){let n=on(),r=f.dirname(n);d.existsSync(r)||d.mkdirSync(r,{recursive:!0}),d.writeFileSync(n,`${JSON.stringify(e,null,2)}\n`,`utf8`),t.info(`global config created`,{path:n})}var ln=class{configFileName;searchCwd;searchGlobal;customSearchPaths;logger;constructor(e={}){this.configFileName=e.configFileName??rn,this.searchCwd=e.searchCwd??!0,this.searchGlobal=e.searchGlobal??!0,this.customSearchPaths=e.searchPaths??[],this.logger=nn(`ConfigLoader`)}getSearchPaths(e=u.default.cwd()){let t=[];for(let e of this.customSearchPaths)t.push(this.resolveTilde(e));return this.searchCwd&&t.push(f.join(e,this.configFileName)),this.searchGlobal&&t.push(f.join(p.homedir(),an,this.configFileName)),t}loadFromFile(e){let t=this.resolveTilde(e);try{if(!d.existsSync(t))return{config:{},source:null,found:!1};let e=d.readFileSync(t,`utf8`),n=this.parseConfig(e,t);return this.logger.debug(`loaded`,{source:t}),{config:n,source:t,found:!0}}catch(e){return this.logger.warn(`load failed`,{path:t,error:e}),{config:{},source:null,found:!1}}}load(e=u.default.cwd()){let t=this.getSearchPaths(e),n=[];for(let e of t){let t=this.loadFromFile(e);t.found&&n.push(t)}return{config:this.mergeConfigs(n.map(e=>e.config)),sources:n.map(e=>e.source).filter(e=>e!==null),found:n.length>0}}parseConfig(e,t){try{let n=JSON.parse(e);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`Config must be a JSON object`);return this.validateConfig(n,t)}catch(e){throw e instanceof SyntaxError?Error(`Invalid JSON in ${t}: ${e.message}`):e}}validateConfig(e,t){let n={},r=[];for(let t of[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`])t in e&&(typeof e[t]==`string`?n[t]=e[t]:r.push(`${t} must be a string`));if(`logLevel`in e){let t=[`trace`,`debug`,`info`,`warn`,`error`],i=e.logLevel;typeof i==`string`&&t.includes(i)?n.logLevel=i:r.push(`logLevel must be one of: ${t.join(`, `)}`)}if(`externalProjects`in e){let t=e.externalProjects;Array.isArray(t)?t.every(e=>typeof e==`string`)?n.externalProjects=t:r.push(`externalProjects must be an array of strings`):r.push(`externalProjects must be an array`)}if(`excludePatterns`in e){let t=e.excludePatterns;if(typeof t==`object`&&t){let e=t,i={},a=!0;for(let[t,n]of Object.entries(e))Array.isArray(n)&&n.every(e=>typeof e==`string`)?i[t]=n:(r.push(`excludePatterns.${t} must be an array of strings`),a=!1);a&&(n.excludePatterns=i)}else r.push(`excludePatterns must be an object`)}if(`profile`in e){let t=e.profile;typeof t==`object`&&t&&!Array.isArray(t)?n.profile=t:r.push(`profile must be an object`)}if(`tool`in e){let t=e.tool;if(typeof t==`object`&&t&&!Array.isArray(t)){let e=t,i={},a=!0;for(let[t,n]of Object.entries(e))typeof n==`string`||n===void 0?i[t]=n:(r.push(`tool.${t} must be a string`),a=!1);a&&(n.tool=i)}else r.push(`tool must be an object`)}return r.length>0&&this.logger.warn(`validation warnings`,{path:t,errors:r}),n}mergeConfigs(e){if(e.length===0)return{};let t=e[0];return e.length===1&&t!=null?t:[...e].reverse().reduce((e,t)=>{let n=[...e.externalProjects??[],...t.externalProjects??[]],r=this.mergeExcludePatterns(e.excludePatterns,t.excludePatterns);return{...e,...t,...n.length>0?{externalProjects:n}:{},...r==null?{}:{excludePatterns:r}}},{})}mergeExcludePatterns(e,t){if(e==null&&t==null)return null;if(e==null)return t??null;if(t==null)return e;let n={...e};for(let[e,r]of Object.entries(t))n[e]=[...n[e]??[],...r];return n}resolveTilde(e){return e.startsWith(`~`)?f.join(p.homedir(),e.slice(1)):e}};let un=null;function dn(e){return(e||!un)&&(un=new ln(e)),un}function fn(e){return dn().load(e)}function pn(){let e=nn(`ConfigLoader`),t=on();if(!d.existsSync(t))return e.warn(`global config not found, creating default config`,{path:t}),cn(sn(),e),{valid:!0,exists:!1,errors:[],shouldExit:!1};let n;try{n=d.readFileSync(t,`utf8`)}catch(n){let r=n instanceof Error?n.message:String(n);return e.error(`failed to read global config`,{path:t,error:r}),hn(t,e,[`Failed to read config: ${r}`])}let r;try{r=JSON.parse(n)}catch(n){let r=n instanceof Error?n.message:String(n);return e.error(`invalid JSON in global config`,{path:t,error:r}),hn(t,e,[`Invalid JSON: ${r}`])}if(typeof r!=`object`||!r||Array.isArray(r))return e.error(`global config must be a JSON object`,{path:t}),hn(t,e,[`Config must be a JSON object`]);let i=mn(r);if(i.length>0){for(let n of i)e.error(`config validation error`,{path:t,error:n});return hn(t,e,i)}return{valid:!0,exists:!0,errors:[],shouldExit:!1}}function mn(e){let t=[];for(let n of[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`])n in e&&typeof e[n]!=`string`&&t.push(`${n} must be a string`);if(`logLevel`in e){let n=[`trace`,`debug`,`info`,`warn`,`error`],r=e.logLevel;(typeof r!=`string`||!n.includes(r))&&t.push(`logLevel must be one of: ${n.join(`, `)}`)}if(`externalProjects`in e){let n=e.externalProjects;Array.isArray(n)?n.every(e=>typeof e==`string`)||t.push(`externalProjects must be an array of strings`):t.push(`externalProjects must be an array`)}if(`excludePatterns`in e){let n=e.excludePatterns;if(typeof n!=`object`||!n||Array.isArray(n))t.push(`excludePatterns must be an object`);else{let e=n;for(let[n,r]of Object.entries(e))(!Array.isArray(r)||!r.every(e=>typeof e==`string`))&&t.push(`excludePatterns.${n} must be an array of strings`)}}if(`profile`in e){let n=e.profile;(typeof n!=`object`||!n||Array.isArray(n))&&t.push(`profile must be an object`)}if(!(`tool`in e))return t;let n=e.tool;if(typeof n!=`object`||!n||Array.isArray(n))t.push(`tool must be an object`);else{let e=n;for(let[n,r]of Object.entries(e))typeof r!=`string`&&r!==void 0&&t.push(`tool.${n} must be a string`)}return t}function hn(e,t,n){try{d.unlinkSync(e),t.info(`deleted invalid config`,{path:e})}catch{t.warn(`failed to delete invalid config`,{path:e})}return cn(sn(),t),t.error(`recreated default config, please review and restart`,{path:e}),{valid:!1,exists:!0,errors:n,shouldExit:!0}}const gn=[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`,`logLevel`];function _n(e){return gn.includes(e)}function vn(e){return[`trace`,`debug`,`info`,`warn`,`error`].includes(e)}function yn(){return f.join(p.homedir(),an,rn)}function bn(){let e=yn();if(!d.existsSync(e))return{};try{let t=d.readFileSync(e,`utf8`);return JSON.parse(t)}catch{return{}}}function xn(e){let t=yn(),n=f.dirname(t);d.existsSync(n)||d.mkdirSync(n,{recursive:!0}),d.writeFileSync(t,`${JSON.stringify(e,null,2)}\n`,`utf8`)}var Sn=class{name=`config`;constructor(e){this.options=e}async execute(e){let{logger:t}=e;if(this.options.length===0)return t.error(`No configuration key-value pairs provided`),t.info(`Usage: tnmsc config key=value`),t.info(`Valid keys: ${gn.join(`, `)}`),{success:!1,filesAffected:0,dirsAffected:0,message:`No options provided`};let n=bn(),r=[],i=[];for(let[e,a]of this.options){if(!_n(e)){r.push(`Invalid key: ${e} (valid keys: ${gn.join(`, `)})`);continue}if(e===`logLevel`&&!vn(a)){r.push(`Invalid logLevel value: ${a} (must be: trace, debug, info, warn, or error)`);continue}let o=n[e];n[e]=a,o!==a&&i.push(`${e}=${a}`),t.info(`configuration updated`,{key:e,value:a})}if(i.length>0&&(xn(n),t.info(`global config written`,{path:yn()})),r.length>0)for(let e of r)t.error(e);let a=r.length===0,o=a?`Configuration updated: ${i.join(`, `)}`:`Partial update: ${i.join(`, `)}. Errors: ${r.join(`, `)}`;return{success:a,filesAffected:i.length>0?1:0,dirsAffected:0,message:o}}},Cn=class{name=`config-show`;async execute(e){let{logger:t}=e,n=new ln,r=n.load(),i=r.sources.map(e=>{let t=n.loadFromFile(e);return{path:e,layer:this.inferLayer(e),config:t.config}}),a={merged:r.config,sources:i};return u.default.stdout.write(`${JSON.stringify(a)}\n`),t.info(`config shown`,{sources:r.sources.length}),{success:!0,filesAffected:0,dirsAffected:0,message:`Configuration displayed (${i.length} source(s))`}}inferLayer(e){let t=u.default.cwd();return e.startsWith(t)?`cwd`:`global`}},wn=class{name=`dry-run-clean`;async execute(e){let{logger:t,outputPlugins:n,createCleanContext:r}=e;t.info(`running clean pipeline`,{command:`dry-run-clean`,dryRun:!0});let i=r(!0),a=await ut(n,i);t.info(`collected outputs for cleanup`,{dryRun:!0,projectDirs:a.projectDirs.length,projectFiles:a.projectFiles.length,globalDirs:a.globalDirs.length,globalFiles:a.globalFiles.length});let{filesToDelete:o,dirsToDelete:s}=await ht(n,await dt(n,i),i);return this.logDryRunFiles(o,t),this.logDryRunDirectories(s,t),await ft(n,i),t.info(`clean complete`,{dryRun:!0,filesAffected:o.length,dirsAffected:s.length}),{success:!0,filesAffected:o.length,dirsAffected:s.length,message:`Dry-run complete, no files were deleted`}}logDryRunFiles(e,t){for(let n of e){let e=f.isAbsolute(n)?n:f.resolve(n);t.info(`would delete file`,{path:e,dryRun:!0})}}logDryRunDirectories(e,t){let n=[...e].sort((e,t)=>t.length-e.length);for(let e of n){let n=f.isAbsolute(e)?e:f.resolve(e);t.info(`would delete directory`,{path:n,dryRun:!0})}}},Tn=class{name=`dry-run-output`;async execute(e){let{logger:t,outputPlugins:n,createWriteContext:r}=e;t.info(`started`,{command:`dry-run-output`,dryRun:!0});let i=r(!0),a=await pt(n,i),o=await mt(n.filter(e=>!!(a.get(e.name)?.project??!0)),i),s=0,c=0;for(let[e,n]of o)s+=n.files.length,c+=n.dirs.length,t.info(`plugin result`,{plugin:e,files:n.files.length,dirs:n.dirs.length,dryRun:!0});return t.info(`complete`,{command:`dry-run-output`,totalFiles:s,totalDirs:c,dryRun:!0}),{success:!0,filesAffected:s,dirsAffected:c,message:`Dry-run complete, no files were written`}}},En=class{name=`execute`;async execute(e){let{logger:t,outputPlugins:n,createCleanContext:r,createWriteContext:i}=e;t.info(`started`,{command:`execute`});let a=await vt(n,r(!1),t,{executeHooks:!1});t.info(`cleanup complete`,{deletedFiles:a.deletedFiles,deletedDirs:a.deletedDirs});let o=i(!1),s=await pt(n,o),c=await mt(n.filter(e=>s.get(e.name)?.project??!0),o),l=0,u=0;for(let e of c.values())l+=e.files.length,u+=e.dirs.length;return t.info(`complete`,{command:`execute`,pluginCount:c.size}),{success:!0,filesAffected:l,dirsAffected:u}}};function Dn(){return`2026.10213.0`}var On=class{name=`version`;async execute(e){return e.logger.error(`tnmsc v${Dn()}`),{success:!0,filesAffected:0,dirsAffected:0,message:`Version displayed`}}};const z=`tnmsc`,kn=`
|
|
957
|
+
`};const Ht=Object.fromEntries(Bt.map(e=>[e,{path:e,content:Vt[e]??``}])),Ut={USER_HOME:`~`,WORKSPACE:`$WORKSPACE`,SHADOW_SOURCE_PROJECT:`$SHADOW_SOURCE_PROJECT`},R=JSON.parse(Ht[`public/tnmsc.example.json`].content),Wt={reset:`\x1B[0m`,red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,magenta:`\x1B[35m`,gray:`\x1B[90m`,blue:`\x1B[34m`,green:`\x1B[32m`,white:`\x1B[37m`,dim:`\x1B[2m`,bgRed:`\x1B[41m`},Gt={red:e=>`${Wt.red}${e}${Wt.reset}`,yellow:e=>`${Wt.yellow}${e}${Wt.reset}`,cyan:e=>`${Wt.cyan}${e}${Wt.reset}`,magenta:e=>`${Wt.magenta}${e}${Wt.reset}`,gray:e=>`${Wt.gray}${e}${Wt.reset}`,blue:e=>`${Wt.blue}${e}${Wt.reset}`,green:e=>`${Wt.green}${e}${Wt.reset}`,white:e=>`${Wt.white}${e}${Wt.reset}`,dim:e=>`${Wt.dim}${e}${Wt.reset}`,bgRed:e=>`${Wt.bgRed}${e}${Wt.reset}`};let Kt;const qt={error:Gt.red,warn:Gt.yellow,info:Gt.cyan,debug:Gt.magenta,trace:Gt.gray,fatal:Gt.bgRed},Jt={silent:0,fatal:1,error:2,warn:3,info:4,debug:5,trace:6};function Yt(e){if(e===null)return Gt.dim(`null`);if(e===void 0)return Gt.dim(`undefined`);if(typeof e==`boolean`)return Gt.yellow(String(e));if(typeof e==`number`)return Gt.blue(String(e));if(typeof e==`string`)return Gt.green(`"${e}"`);if(Array.isArray(e))return e.length===0?`[]`:`[${e.map(e=>Yt(e)).join(`,`)}]`;if(e instanceof Error){let t={name:e.name,message:e.message,stack:e.stack};for(let n of Object.getOwnPropertyNames(e))n!==`name`&&n!==`message`&&n!==`stack`&&(t[n]=e[n]);return Xt(t)}return typeof e==`object`?Xt(e):String(e)}function Xt(e){let t=Object.entries(e);return t.length===0?`{}`:`{${t.map(([e,t])=>`${/^[\w$]+$/.test(e)?Gt.magenta(e):Gt.yellow(`"${e}"`)}:${Yt(t)}`).join(`,`)}}`}function Zt(){let e=new Date;return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}.${String(e.getMilliseconds()).padStart(3,`0`)}`}function Qt(e,t,n,r){let i=Zt(),a=qt[e]??Gt.white,o=String(n),s=r!=null&&Object.keys(r).length>0,c=o===``,l={$:[i,e,t],_:s?c?r:{[o]:r}:n},u={$:[i,a(e.toUpperCase()),t]},d=s?c?r:{[o]:r}:n,f=Xt({...u,_:d});return e===`error`||e===`fatal`?console.error(f):e===`warn`?console.warn(f):e===`debug`||e===`trace`?console.debug(f):console.log(f),l}function $t(e,t,n){let r=Jt[e],i=Jt[n];return(n,...a)=>r>i?{$:[Zt(),e,t],_:n}:typeof n==`string`?Qt(e,t,n,a.length===1&&typeof a[0]==`object`&&a[0]!==null?a[0]:a.length>0?{args:a}:void 0):typeof n==`object`&&n?Qt(e,t,``,n):Qt(e,t,n)}function en(e){Kt=e}function tn(){return Kt}function nn(e,t){let n=t??Kt??process.env.LOG_LEVEL??`info`;return{error:$t(`error`,e,n),warn:$t(`warn`,e,n),info:$t(`info`,e,n),debug:$t(`debug`,e,n),trace:$t(`trace`,e,n),fatal:$t(`fatal`,e,n)}}const rn=`.tnmsc.json`,an=`.aindex`;function on(){return f.join(p.homedir(),an,rn)}function sn(){return{...R}}function cn(e,t){let n=on(),r=f.dirname(n);d.existsSync(r)||d.mkdirSync(r,{recursive:!0}),d.writeFileSync(n,`${JSON.stringify(e,null,2)}\n`,`utf8`),t.info(`global config created`,{path:n})}var ln=class{configFileName;searchCwd;searchGlobal;customSearchPaths;logger;constructor(e={}){this.configFileName=e.configFileName??rn,this.searchCwd=e.searchCwd??!0,this.searchGlobal=e.searchGlobal??!0,this.customSearchPaths=e.searchPaths??[],this.logger=nn(`ConfigLoader`)}getSearchPaths(e=u.default.cwd()){let t=[];for(let e of this.customSearchPaths)t.push(this.resolveTilde(e));return this.searchCwd&&t.push(f.join(e,this.configFileName)),this.searchGlobal&&t.push(f.join(p.homedir(),an,this.configFileName)),t}loadFromFile(e){let t=this.resolveTilde(e);try{if(!d.existsSync(t))return{config:{},source:null,found:!1};let e=d.readFileSync(t,`utf8`),n=this.parseConfig(e,t);return this.logger.debug(`loaded`,{source:t}),{config:n,source:t,found:!0}}catch(e){return this.logger.warn(`load failed`,{path:t,error:e}),{config:{},source:null,found:!1}}}load(e=u.default.cwd()){let t=this.getSearchPaths(e),n=[];for(let e of t){let t=this.loadFromFile(e);t.found&&n.push(t)}return{config:this.mergeConfigs(n.map(e=>e.config)),sources:n.map(e=>e.source).filter(e=>e!==null),found:n.length>0}}parseConfig(e,t){try{let n=JSON.parse(e);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`Config must be a JSON object`);return this.validateConfig(n,t)}catch(e){throw e instanceof SyntaxError?Error(`Invalid JSON in ${t}: ${e.message}`):e}}validateConfig(e,t){let n={},r=[];for(let t of[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`])t in e&&(typeof e[t]==`string`?n[t]=e[t]:r.push(`${t} must be a string`));if(`logLevel`in e){let t=[`trace`,`debug`,`info`,`warn`,`error`],i=e.logLevel;typeof i==`string`&&t.includes(i)?n.logLevel=i:r.push(`logLevel must be one of: ${t.join(`, `)}`)}if(`externalProjects`in e){let t=e.externalProjects;Array.isArray(t)?t.every(e=>typeof e==`string`)?n.externalProjects=t:r.push(`externalProjects must be an array of strings`):r.push(`externalProjects must be an array`)}if(`excludePatterns`in e){let t=e.excludePatterns;if(typeof t==`object`&&t){let e=t,i={},a=!0;for(let[t,n]of Object.entries(e))Array.isArray(n)&&n.every(e=>typeof e==`string`)?i[t]=n:(r.push(`excludePatterns.${t} must be an array of strings`),a=!1);a&&(n.excludePatterns=i)}else r.push(`excludePatterns must be an object`)}if(`profile`in e){let t=e.profile;typeof t==`object`&&t&&!Array.isArray(t)?n.profile=t:r.push(`profile must be an object`)}if(`tool`in e){let t=e.tool;if(typeof t==`object`&&t&&!Array.isArray(t)){let e=t,i={},a=!0;for(let[t,n]of Object.entries(e))typeof n==`string`||n===void 0?i[t]=n:(r.push(`tool.${t} must be a string`),a=!1);a&&(n.tool=i)}else r.push(`tool must be an object`)}return r.length>0&&this.logger.warn(`validation warnings`,{path:t,errors:r}),n}mergeConfigs(e){if(e.length===0)return{};let t=e[0];return e.length===1&&t!=null?t:[...e].reverse().reduce((e,t)=>{let n=[...e.externalProjects??[],...t.externalProjects??[]],r=this.mergeExcludePatterns(e.excludePatterns,t.excludePatterns);return{...e,...t,...n.length>0?{externalProjects:n}:{},...r==null?{}:{excludePatterns:r}}},{})}mergeExcludePatterns(e,t){if(e==null&&t==null)return null;if(e==null)return t??null;if(t==null)return e;let n={...e};for(let[e,r]of Object.entries(t))n[e]=[...n[e]??[],...r];return n}resolveTilde(e){return e.startsWith(`~`)?f.join(p.homedir(),e.slice(1)):e}};let un=null;function dn(e){return(e||!un)&&(un=new ln(e)),un}function fn(e){return dn().load(e)}function pn(){let e=nn(`ConfigLoader`),t=on();if(!d.existsSync(t))return e.warn(`global config not found, creating default config`,{path:t}),cn(sn(),e),{valid:!0,exists:!1,errors:[],shouldExit:!1};let n;try{n=d.readFileSync(t,`utf8`)}catch(n){let r=n instanceof Error?n.message:String(n);return e.error(`failed to read global config`,{path:t,error:r}),hn(t,e,[`Failed to read config: ${r}`])}let r;try{r=JSON.parse(n)}catch(n){let r=n instanceof Error?n.message:String(n);return e.error(`invalid JSON in global config`,{path:t,error:r}),hn(t,e,[`Invalid JSON: ${r}`])}if(typeof r!=`object`||!r||Array.isArray(r))return e.error(`global config must be a JSON object`,{path:t}),hn(t,e,[`Config must be a JSON object`]);let i=mn(r);if(i.length>0){for(let n of i)e.error(`config validation error`,{path:t,error:n});return hn(t,e,i)}return{valid:!0,exists:!0,errors:[],shouldExit:!1}}function mn(e){let t=[];for(let n of[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`])n in e&&typeof e[n]!=`string`&&t.push(`${n} must be a string`);if(`logLevel`in e){let n=[`trace`,`debug`,`info`,`warn`,`error`],r=e.logLevel;(typeof r!=`string`||!n.includes(r))&&t.push(`logLevel must be one of: ${n.join(`, `)}`)}if(`externalProjects`in e){let n=e.externalProjects;Array.isArray(n)?n.every(e=>typeof e==`string`)||t.push(`externalProjects must be an array of strings`):t.push(`externalProjects must be an array`)}if(`excludePatterns`in e){let n=e.excludePatterns;if(typeof n!=`object`||!n||Array.isArray(n))t.push(`excludePatterns must be an object`);else{let e=n;for(let[n,r]of Object.entries(e))(!Array.isArray(r)||!r.every(e=>typeof e==`string`))&&t.push(`excludePatterns.${n} must be an array of strings`)}}if(`profile`in e){let n=e.profile;(typeof n!=`object`||!n||Array.isArray(n))&&t.push(`profile must be an object`)}if(!(`tool`in e))return t;let n=e.tool;if(typeof n!=`object`||!n||Array.isArray(n))t.push(`tool must be an object`);else{let e=n;for(let[n,r]of Object.entries(e))typeof r!=`string`&&r!==void 0&&t.push(`tool.${n} must be a string`)}return t}function hn(e,t,n){try{d.unlinkSync(e),t.info(`deleted invalid config`,{path:e})}catch{t.warn(`failed to delete invalid config`,{path:e})}return cn(sn(),t),t.error(`recreated default config, please review and restart`,{path:e}),{valid:!1,exists:!0,errors:n,shouldExit:!0}}const gn=[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`,`logLevel`];function _n(e){return gn.includes(e)}function vn(e){return[`trace`,`debug`,`info`,`warn`,`error`].includes(e)}function yn(){return f.join(p.homedir(),an,rn)}function bn(){let e=yn();if(!d.existsSync(e))return{};try{let t=d.readFileSync(e,`utf8`);return JSON.parse(t)}catch{return{}}}function xn(e){let t=yn(),n=f.dirname(t);d.existsSync(n)||d.mkdirSync(n,{recursive:!0}),d.writeFileSync(t,`${JSON.stringify(e,null,2)}\n`,`utf8`)}var Sn=class{name=`config`;constructor(e){this.options=e}async execute(e){let{logger:t}=e;if(this.options.length===0)return t.error(`No configuration key-value pairs provided`),t.info(`Usage: tnmsc config key=value`),t.info(`Valid keys: ${gn.join(`, `)}`),{success:!1,filesAffected:0,dirsAffected:0,message:`No options provided`};let n=bn(),r=[],i=[];for(let[e,a]of this.options){if(!_n(e)){r.push(`Invalid key: ${e} (valid keys: ${gn.join(`, `)})`);continue}if(e===`logLevel`&&!vn(a)){r.push(`Invalid logLevel value: ${a} (must be: trace, debug, info, warn, or error)`);continue}let o=n[e];n[e]=a,o!==a&&i.push(`${e}=${a}`),t.info(`configuration updated`,{key:e,value:a})}if(i.length>0&&(xn(n),t.info(`global config written`,{path:yn()})),r.length>0)for(let e of r)t.error(e);let a=r.length===0,o=a?`Configuration updated: ${i.join(`, `)}`:`Partial update: ${i.join(`, `)}. Errors: ${r.join(`, `)}`;return{success:a,filesAffected:i.length>0?1:0,dirsAffected:0,message:o}}},Cn=class{name=`config-show`;async execute(e){let{logger:t}=e,n=new ln,r=n.load(),i=r.sources.map(e=>{let t=n.loadFromFile(e);return{path:e,layer:this.inferLayer(e),config:t.config}}),a={merged:r.config,sources:i};return u.default.stdout.write(`${JSON.stringify(a)}\n`),t.info(`config shown`,{sources:r.sources.length}),{success:!0,filesAffected:0,dirsAffected:0,message:`Configuration displayed (${i.length} source(s))`}}inferLayer(e){let t=u.default.cwd();return e.startsWith(t)?`cwd`:`global`}},wn=class{name=`dry-run-clean`;async execute(e){let{logger:t,outputPlugins:n,createCleanContext:r}=e;t.info(`running clean pipeline`,{command:`dry-run-clean`,dryRun:!0});let i=r(!0),a=await ut(n,i);t.info(`collected outputs for cleanup`,{dryRun:!0,projectDirs:a.projectDirs.length,projectFiles:a.projectFiles.length,globalDirs:a.globalDirs.length,globalFiles:a.globalFiles.length});let{filesToDelete:o,dirsToDelete:s}=await ht(n,await dt(n,i),i);return this.logDryRunFiles(o,t),this.logDryRunDirectories(s,t),await ft(n,i),t.info(`clean complete`,{dryRun:!0,filesAffected:o.length,dirsAffected:s.length}),{success:!0,filesAffected:o.length,dirsAffected:s.length,message:`Dry-run complete, no files were deleted`}}logDryRunFiles(e,t){for(let n of e){let e=f.isAbsolute(n)?n:f.resolve(n);t.info(`would delete file`,{path:e,dryRun:!0})}}logDryRunDirectories(e,t){let n=[...e].sort((e,t)=>t.length-e.length);for(let e of n){let n=f.isAbsolute(e)?e:f.resolve(e);t.info(`would delete directory`,{path:n,dryRun:!0})}}},Tn=class{name=`dry-run-output`;async execute(e){let{logger:t,outputPlugins:n,createWriteContext:r}=e;t.info(`started`,{command:`dry-run-output`,dryRun:!0});let i=r(!0),a=await pt(n,i),o=await mt(n.filter(e=>!!(a.get(e.name)?.project??!0)),i),s=0,c=0;for(let[e,n]of o)s+=n.files.length,c+=n.dirs.length,t.info(`plugin result`,{plugin:e,files:n.files.length,dirs:n.dirs.length,dryRun:!0});return t.info(`complete`,{command:`dry-run-output`,totalFiles:s,totalDirs:c,dryRun:!0}),{success:!0,filesAffected:s,dirsAffected:c,message:`Dry-run complete, no files were written`}}},En=class{name=`execute`;async execute(e){let{logger:t,outputPlugins:n,createCleanContext:r,createWriteContext:i}=e;t.info(`started`,{command:`execute`});let a=await vt(n,r(!1),t,{executeHooks:!1});t.info(`cleanup complete`,{deletedFiles:a.deletedFiles,deletedDirs:a.deletedDirs});let o=i(!1),s=await pt(n,o),c=await mt(n.filter(e=>s.get(e.name)?.project??!0),o),l=0,u=0;for(let e of c.values())l+=e.files.length,u+=e.dirs.length;return t.info(`complete`,{command:`execute`,pluginCount:c.size}),{success:!0,filesAffected:l,dirsAffected:u}}};function Dn(){return`2026.10213.10155`}var On=class{name=`version`;async execute(e){return e.logger.error(`tnmsc v${Dn()}`),{success:!0,filesAffected:0,dirsAffected:0,message:`Version displayed`}}};const z=`tnmsc`,kn=`
|
|
958
958
|
${z} v${Dn()} - Memory Sync CLI
|
|
959
959
|
|
|
960
960
|
Synchronize AI memory and configuration files across projects.
|
|
@@ -1008,7 +1008,7 @@ CONFIG OPTIONS:
|
|
|
1008
1008
|
CONFIGURATION:
|
|
1009
1009
|
Configure via plugin.config.ts in your project root.
|
|
1010
1010
|
See documentation for detailed configuration options.
|
|
1011
|
-
`.trim();var An=class{name=`help`;async execute(e){return console.log(kn),{success:!0,filesAffected:0,dirsAffected:0,message:`Help displayed`}}};function jn(e,t){let n=f.join(e,`.git`),r=d.existsSync(n);return r?t?.info(`version control detected`,{path:n}):t?.warn(`no version control detected, please use git to manage your shadow source project`,{path:e}),{hasGit:r,gitPath:n}}function Mn(e,t,n,r,i){if(n==null)return r;let a=f.relative(t,e),o=f.join(n,a);return d.existsSync(o)&&d.statSync(o).isFile()?(i?.debug(`copying from source`,{path:o}),d.readFileSync(o,`utf8`)):r}function Nn(e,t={}){let{sourceDir:n,logger:r}=t,i=[],a=[],o=[],s=[],c=new Set;d.existsSync(e)?(o.push(e),r?.debug(`directory exists`,{path:e})):(d.mkdirSync(e,{recursive:!0}),i.push(e),c.add(e),r?.info(`created directory`,{path:e}));for(let t of Object.values(Ht)){let o=t.path,l=f.join(e,o),u=f.dirname(l);if(!d.existsSync(u)){d.mkdirSync(u,{recursive:!0});let t=u;for(;t!==e&&!c.has(t);)c.add(t),i.push(t),r?.info(`created directory`,{path:t}),t=f.dirname(t)}if(d.existsSync(l))s.push(l),r?.debug(`file exists`,{path:l});else{let i=Mn(l,e,n,t.content,r);d.writeFileSync(l,i,`utf8`),a.push(l),r?.info(`created file`,{path:l})}}return{success:!0,rootPath:e,createdDirs:i,createdFiles:a,existedDirs:o,existedFiles:s}}function Pn(e,t,n){let r=e;return r=r.replace(Ut.SHADOW_SOURCE_PROJECT,n),r=r.replace(Ut.WORKSPACE,t),r.startsWith(`~`)&&(r=f.join(p.homedir(),r.slice(1))),f.normalize(r)}var Fn=class{name=`init`;async execute(e){let{logger:t,userConfigOptions:n}=e;t.info(`initializing shadow source project structure`,{command:`init`});let r=Pn(n.workspaceDir,``,``),i=Nn(Pn(n.shadowSourceProjectDir,r,``),{logger:t}),a=i.createdDirs.length===0&&i.createdFiles.length===0?`All ${i.existedDirs.length} directories and ${i.existedFiles.length} files already exist`:`Created ${i.createdDirs.length} directories and ${i.createdFiles.length} files (${i.existedDirs.length} dirs, ${i.existedFiles.length} files already existed)`;return t.info(`initialization complete`,{dirsCreated:i.createdDirs.length,filesCreated:i.createdFiles.length,dirsExisted:i.existedDirs.length,filesExisted:i.existedFiles.length}),{success:i.success,filesAffected:i.createdFiles.length,dirsAffected:i.createdDirs.length,message:a}}},In=class{name;inner;constructor(e){this.inner=e,this.name=`json:${e.name}`}async execute(e){let t=await this.inner.execute(e),n=Ln(t);return u.default.stdout.write(`${JSON.stringify(n)}\n`),t}};function Ln(e){return{success:e.success,filesAffected:e.filesAffected,dirsAffected:e.dirsAffected,...e.message!=null&&{message:e.message},pluginResults:[],errors:[]}}function Rn(){return`@truenine/memory-sync-cli`}function zn(){return`https://registry.npmjs.org/${Rn()}/latest`}function Bn(e){let t=e.replace(/^v/,``),n=/^(\d+)\.(\d+)\.(\d+)/.exec(t);return n==null?null:[Number.parseInt(n[1],10),Number.parseInt(n[2],10),Number.parseInt(n[3],10)]}function Vn(e,t){let n=Bn(e),r=Bn(t);if(n==null||r==null)return 0;for(let e=0;e<3;e++){if(n[e]<r[e])return-1;if(n[e]>r[e])return 1}return 0}const Hn=3e3;async function Un(){let e=new AbortController,t=setTimeout(()=>e.abort(),Hn);typeof t==`object`&&`unref`in t&&t.unref();try{let n=await fetch(zn(),{headers:{Accept:`application/json`},signal:e.signal});if(clearTimeout(t),!n.ok)return{error:`HTTP ${n.status}: ${n.statusText}`};let r=await n.json();return r.version==null?{error:`Invalid response: missing version field`}:{version:r.version}}catch(e){return clearTimeout(t),e instanceof Error?e.name===`TimeoutError`||e.name===`AbortError`?{error:`Request timeout after ${Hn}ms`}:{error:e.message}:{error:`Unknown network error`}}}function Wn(){return`2026.10213.0`}async function Gn(){let e=Wn();if(e===`dev`)return{status:`development`,localVersion:e,remoteVersion:null};let t=await Un();if(`error`in t)return{status:`current`,localVersion:e,remoteVersion:null,error:t.error};let n=t.version,r=Vn(e,n);return r<0?{status:`outdated`,localVersion:e,remoteVersion:n}:r>0?{status:`development`,localVersion:e,remoteVersion:n}:{status:`current`,localVersion:e,remoteVersion:n}}function Kn(e,t){let{status:n,localVersion:r,remoteVersion:i}=e;switch(n){case`outdated`:t.warn(`Version outdated: ${r} → ${i}. Run 'npm i -g ${Rn()}@latest' to update.`);break;case`current`:e.error==null?t.info(`Version ${r} is up to date.`):t.error(`Version check failed: ${e.error}`);break;case`development`:i==null?t.debug(`Running in development mode, version check skipped.`):t.info(`Development version detected: ${r} > ${i}. Thanks for contributing!`);break}}function qn(){return new Date().getMinutes()%2==0}function Jn(e){qn()&&Gn().then(t=>{(t.status===`outdated`||t.error!=null)&&Kn(t,e)}).catch(t=>{let n=t instanceof Error?t.message:`Unknown error`;e.error(`Version check failed: ${n}`)})}var Yn=class{name=`outdated`;async execute(e){let t=await Gn();return Kn(t,e.logger),{success:!0,filesAffected:0,dirsAffected:0,message:`Version status: ${t.status}`}}},Xn=class{name=`plugins`;async execute(e){let{logger:t,outputPlugins:n,userConfigOptions:r}=e,i=r.plugins,a=[];for(let e of i)a.push({name:e.name,kind:e.type===bt.Input?`Input`:`Output`,description:e.name,dependencies:[...e.dependsOn??[]]});let o=new Set(a.map(e=>e.name));for(let e of n)o.has(e.name)||a.push({name:e.name,kind:`Output`,description:e.name,dependencies:[...e.dependsOn??[]]});return u.default.stdout.write(`${JSON.stringify(a)}\n`),t.info(`plugins listed`,{count:a.length}),{success:!0,filesAffected:0,dirsAffected:0,message:`Listed ${a.length} plugin(s)`}}},Zn=class{name=`unknown`;constructor(e){this.unknownCmd=e}async execute(e){return console.error(`Unknown command: ${this.unknownCmd}`),console.error(`Run "tnmsc help" for available commands.`),{success:!1,filesAffected:0,dirsAffected:0}}};const Qn={default:{websearch:`web_search`,webfetch:`web_fetch`,readFile:`read_file`,writeFile:`write_file`,executeCommand:`execute_command`,todolistWrite:`todolist_write`,grep:`grep`,listDirectory:`list_directory`},claudeCode:{readFile:`Read`,writeFile:`Write`,executeCommand:`Execute`,todolistWrite:`TodoWrite`,listDirectory:`List`},kiro:{websearch:`remote_web_search`,webfetch:`webFetch`,readFile:`readFile`,writeFile:`fsWrite`,executeCommand:`executeBash`,todolistWrite:`todolistWrite`,grep:`grepSearch`,listDirectory:`listDir`}};let $n=function(e){return e.Bash=`bash`,e.Zsh=`zsh`,e.Fish=`fish`,e.Sh=`sh`,e.PowerShell=`powershell`,e.Pwsh=`pwsh`,e.Cmd=`cmd`,e.Unknown=`unknown`,e}({}),er=function(e){return e.Win=`win`,e.Mac=`mac`,e.Linux=`linux`,e.Unknown=`unknown`,e}({});var tr=class{userConfig;toolPreset;constructor(e={}){this.userConfig=e.userConfig,this.toolPreset=e.toolPreset??`default`}collect(){return{os:this.collectOsInfo(),env:this.collectEnvContext(),profile:this.collectProfile(),tool:this.collectToolReferences(),Md:this.createMdComponent()}}collectOsInfo(){let e=p.platform();return{platform:e,arch:p.arch(),hostname:p.hostname(),homedir:p.homedir(),tmpdir:p.tmpdir(),type:p.type(),release:p.release(),shellKind:this.detectShellKind(),kind:this.detectOsKind(e)}}detectOsKind(e){switch(e){case`win32`:return er.Win;case`darwin`:return er.Mac;case`linux`:case`freebsd`:case`openbsd`:case`sunos`:case`aix`:return er.Linux;default:return er.Unknown}}detectShellKind(){let e=(u.default.env.SHELL??u.default.env.ComSpec??``).toLowerCase();return e.includes(`bash`)?$n.Bash:e.includes(`zsh`)?$n.Zsh:e.includes(`fish`)?$n.Fish:e.includes(`pwsh`)?$n.Pwsh:e.includes(`powershell`)?$n.PowerShell:e.includes(`cmd`)?$n.Cmd:e.endsWith(`/sh`)?$n.Sh:$n.Unknown}collectEnvContext(){return{...u.default.env}}collectProfile(){return this.userConfig?.profile==null?{}:this.userConfig.profile}collectToolReferences(){let e={...Qn.default};return this.toolPreset===`claudeCode`?{...e,...Qn.claudeCode}:this.toolPreset===`kiro`?{...e,...Qn.kiro}:e}createMdComponent(){let e=(e=>e.when===!1?null:e.children);return e.Line=e=>e.when===!1?null:e.children,e}};let nr=function(e){return e[e.SystemDefault=0]=`SystemDefault`,e[e.UserConfig=10]=`UserConfig`,e[e.PluginRegistered=20]=`PluginRegistered`,e[e.CompileTime=30]=`CompileTime`,e}({});var rr=class{registrations=[];globalScope=null;setGlobalScope(e){this.globalScope=e}getGlobalScope(){return this.globalScope}register(e,t,n=nr.PluginRegistered){this.registrations.push({namespace:e,values:t,priority:n})}getRegistrations(){return this.registrations}merge(e){let t={};this.globalScope!=null&&(t.os={...this.globalScope.os},t.env={...this.globalScope.env},t.profile={...this.globalScope.profile},t.tool={...this.globalScope.tool});let n=[...this.registrations].sort((e,t)=>e.priority-t.priority);for(let e of n)t[e.namespace]=this.deepMerge(t[e.namespace],e.values);if(e!=null)for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r&&!Array.isArray(r)?this.deepMerge(t[n],r):r;return t}deepMerge(e,t){if(e==null)return{...t};let n={...e};for(let[e,r]of Object.entries(t))n[e]=typeof r==`object`&&r&&!Array.isArray(r)&&typeof n[e]==`object`&&n[e]!==null&&!Array.isArray(n[e])?this.deepMerge(n[e],r):r;return n}clear(){this.registrations.length=0,this.globalScope=null}};function ir(e){let t=[...e],n=t[0];n!=null&&ar(n)&&t.shift();let r=t[0];return r!=null&&or(r)&&t.shift(),t}function ar(e){let t=[`node`,`nodejs`,`bun`,`deno`,`tsx`,`ts-node`,`npx`,`pnpx`,`yarn`,`pnpm`],n=e.toLowerCase().replaceAll(`\\`,`/`);return t.some(e=>RegExp(`(?:^|/)${e}(?:\\.exe|\\.cmd|\\.ps1)?$`,`i`).test(n)||n===e)}function or(e){return/\.(?:m?[jt]s|cjs)$/.test(e)||/[/\\]/.test(e)&&!e.startsWith(`-`)?!0:/^(?:@[\w-]+\/)?[\w-]+$/.test(e)&&!e.startsWith(`-`)}const sr=new Set([`help`,`version`,`outdated`,`init`,`dry-run`,`clean`,`config`,`plugins`]),cr=new Map([[`--trace`,`trace`],[`--debug`,`debug`],[`--info`,`info`],[`--warn`,`warn`],[`--error`,`error`]]),lr=new Map([[`trace`,0],[`debug`,1],[`info`,2],[`warn`,3],[`error`,4]]);function ur(e){let{logLevelFlags:t}=e;if(t.length===0)return;let n=t[0],r=lr.get(n)??4;for(let e of t){let t=lr.get(e)??4;t<r&&(r=t,n=e)}return n}function dr(e){let{helpFlag:t,versionFlag:n,subcommand:r,dryRun:i,unknownCommand:a,setOption:o,positional:s,showFlag:c}=e;if(n)return new On;if(t)return new An;if(a!=null)return new Zn(a);if(r===`version`)return new On;if(r===`help`)return new An;if(r===`outdated`)return new Yn;if(r===`init`)return new Fn;if(r===`dry-run`)return new Tn;if(r===`clean`)return i?new wn:new yt;if(r===`plugins`)return new Xn;if(r===`config`&&c)return new Cn;if(r!==`config`||o.length>0)return new En;let l=[];for(let e of s){let t=e.indexOf(`=`);t>0&&l.push([e.slice(0,t),e.slice(t+1)])}return new Sn([...o,...l])}function fr(e){let t={subcommand:void 0,helpFlag:!1,versionFlag:!1,dryRun:!1,jsonFlag:!1,showFlag:!1,logLevel:void 0,logLevelFlags:[],setOption:[],unknownCommand:void 0,positional:[],unknown:[]},n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i!=null){if(i===`--`){t.positional.push(...e.slice(r+1).filter(e=>e!=null));break}if(i.startsWith(`--`)){let n=i.split(`=`),a=n[0]??``,o=cr.get(a);if(o!=null){t.logLevelFlags.push(o),t.logLevel=o;continue}switch(a){case`--help`:t.helpFlag=!0;break;case`--version`:t.versionFlag=!0;break;case`--dry-run`:t.dryRun=!0;break;case`--json`:t.jsonFlag=!0;break;case`--show`:t.showFlag=!0;break;case`--set`:if(n.length>1){let e=n.slice(1).join(`=`),r=e.indexOf(`=`);r>0&&t.setOption.push([e.slice(0,r),e.slice(r+1)])}else{let n=e[r+1];if(n!=null){let e=n.indexOf(`=`);e>0&&(t.setOption.push([n.slice(0,e),n.slice(e+1)]),r++)}}break;default:t.unknown.push(i)}continue}if(i.startsWith(`-`)&&i.length>1){let e=i.slice(1);for(let n of e)switch(n){case`h`:t.helpFlag=!0;break;case`v`:t.versionFlag=!0;break;case`n`:t.dryRun=!0;break;case`j`:t.jsonFlag=!0;break;default:t.unknown.push(`-${n}`)}continue}if(!n){n=!0,sr.has(i)?t.subcommand=i:t.unknownCommand=i;continue}t.positional.push(i)}}return t}var pr=class{logger;args;outputPlugins=[];constructor(...e){this.args=fr(ir(e.filter(e=>e!=null)));let t=ur(this.args);t!=null&&en(t),this.logger=nn(`PluginPipeline`,t),this.logger.debug(`initialized`,{args:this.args})}registerOutputPlugins(e){return this.outputPlugins.push(...e),this}async run(e){Jn(this.logger);let{context:t,outputPlugins:n,userConfigOptions:r}=e;this.registerOutputPlugins([...n]);let i=this.resolveCommand();this.args.jsonFlag&&(en(`silent`),new Set([`config-show`,`plugins`]).has(i.name)||(i=new In(i)));let a=this.createCommandContext(t,r);await i.execute(a)}resolveCommand(){return dr(this.args)}createCommandContext(e,t){return{logger:this.logger,outputPlugins:this.outputPlugins,collectedInputContext:e,userConfigOptions:t,createCleanContext:t=>this.createCleanContext(e,t),createWriteContext:t=>this.createWriteContext(e,t)}}createCleanContext(e,t){return{logger:this.logger,fs:d,path:f,glob:Je.default,collectedInputContext:e,dryRun:t}}createWriteContext(e,t){return{logger:this.logger,fs:d,path:f,glob:Je.default,collectedInputContext:e,dryRun:t,registeredPluginNames:this.outputPlugins.map(e=>e.name)}}buildDependencyGraph(e){let t=new Map;for(let n of e){let e=n.dependsOn??[];t.set(n.name,[...e])}return t}validateDependencies(e){let t=new Set(e.map(e=>e.name));for(let n of e){let e=n.dependsOn??[];for(let r of e)if(!t.has(r))throw new Dt(n.name,r)}}topologicalSort(e){this.validateDependencies(e);let t=new Map;for(let n of e)t.set(n.name,n);let n=new Map;for(let t of e)n.set(t.name,0);let r=new Map;for(let t of e)r.set(t.name,[]);for(let t of e){let e=t.dependsOn??[];for(let i of e){n.set(t.name,(n.get(t.name)??0)+1);let e=r.get(i)??[];e.push(t.name),r.set(i,e)}}let i=[];for(let t of e)n.get(t.name)===0&&i.push(t.name);let a=[];for(;i.length>0;){let o=i.shift(),s=t.get(o);a.push(s);let c=(r.get(o)??[]).sort((t,n)=>e.findIndex(e=>e.name===t)-e.findIndex(e=>e.name===n));for(let e of c){let t=(n.get(e)??0)-1;n.set(e,t),t===0&&i.push(e)}}if(a.length===e.length)return a;throw new Et(this.findCyclePath(e,n))}findCyclePath(e,t){let n=new Set;for(let[e,r]of t)r>0&&n.add(e);let r=new Map;for(let t of e)if(n.has(t.name)){let e=(t.dependsOn??[]).filter(e=>n.has(e));r.set(t.name,e)}let i=new Set,a=[],o=e=>{if(a.includes(e))return a.push(e),!0;if(i.has(e))return!1;i.add(e),a.push(e);for(let t of r.get(e)??[])if(o(t))return!0;return a.pop(),!1};for(let e of n){if(o(e)){let e=a.indexOf(a.at(-1));return a.slice(e)}i.clear(),a.length=0}return[...n]}async executePluginsInOrder(e,t,n=!1,r){if(e.length===0)return{};let i=this.topologicalSort(e),a=new tr({userConfig:r}).collect(),o=new rr;o.setGlobalScope(a),this.logger.debug(`global scope collected`,{osInfo:{platform:a.os.platform,arch:a.os.arch,shellKind:a.os.shellKind},hasProfile:Object.keys(a.profile).length>0,hasTool:Object.keys(a.tool).length>0});let s=new Map,c={};for(let e of i){let r=this.buildDependencyContext(e,s),i={...t,dependencyContext:r,globalScope:a,scopeRegistry:o},l=e;l.executeEffects!=null&&await l.executeEffects(i,n);let u=await e.collect(i);s.set(e.name,u),c=this.mergeContexts(c,u);let d=e;if(d.getRegisteredScopes!=null){let t=d.getRegisteredScopes();for(let{namespace:n,values:r}of t)o.register(n,r,nr.PluginRegistered),this.logger.debug(`plugin scope registered`,{plugin:e.name,namespace:n,keys:Object.keys(r)})}}return c}buildDependencyContext(e,t){if((e.dependsOn??[]).length===0)return{};let n=this.collectTransitiveDependencies(e,t),r={};for(let e of n){let n=t.get(e);n!=null&&(r=this.mergeContexts(r,n))}return r}collectTransitiveDependencies(e,t){let n=new Set,r=[];return(e=>{for(let i of e)n.has(i)||(n.add(i),t.get(i)!=null&&r.push(i))})(e.dependsOn??[]),r}mergeContexts(e,t){let{workspace:n}=e;if(t.workspace!=null)if(n!=null){let e=new Map;for(let t of n.projects)e.set(t.name,t);for(let n of t.workspace.projects)e.set(n.name,n);n={directory:t.workspace.directory??n.directory,projects:[...e.values()]}}else ({workspace:n}=t);let r=t.externalProjects==null?e.externalProjects:[...e.externalProjects??[],...t.externalProjects],i=t.ideConfigFiles==null?e.ideConfigFiles:[...e.ideConfigFiles??[],...t.ideConfigFiles],a=t.fastCommands==null?e.fastCommands:[...e.fastCommands??[],...t.fastCommands],o=t.subAgents==null?e.subAgents:[...e.subAgents??[],...t.subAgents],s=t.skills==null?e.skills:[...e.skills??[],...t.skills],c=t.aiAgentIgnoreConfigFiles==null?e.aiAgentIgnoreConfigFiles:[...e.aiAgentIgnoreConfigFiles??[],...t.aiAgentIgnoreConfigFiles],l=t.globalMemory??e.globalMemory,u=t.shadowSourceProjectDir??e.shadowSourceProjectDir,d=t.readmePrompts==null?e.readmePrompts:[...e.readmePrompts??[],...t.readmePrompts],f=t.globalGitIgnore??e.globalGitIgnore,p=t.shadowGitExclude??e.shadowGitExclude;return{...n==null?{}:{workspace:n},...r==null?{}:{externalProjects:r},...i==null?{}:{ideConfigFiles:i},...a==null?{}:{fastCommands:a},...o==null?{}:{subAgents:o},...s==null?{}:{skills:s},...c==null?{}:{aiAgentIgnoreConfigFiles:c},...l==null?{}:{globalMemory:l},...u==null?{}:{shadowSourceProjectDir:u},...d==null?{}:{readmePrompts:d},...f==null?{}:{globalGitIgnore:f},...p==null?{}:{shadowGitExclude:p}}}};const mr={...R,externalProjects:[],excludePatterns:{},fastCommandSeriesOptions:{},plugins:[]};function hr(e){return{...e.workspaceDir==null?{}:{workspaceDir:e.workspaceDir},...e.shadowSourceProjectDir==null?{}:{shadowSourceProjectDir:e.shadowSourceProjectDir},...e.shadowSkillSourceDir==null?{}:{shadowSkillSourceDir:e.shadowSkillSourceDir},...e.shadowFastCommandDir==null?{}:{shadowFastCommandDir:e.shadowFastCommandDir},...e.shadowSubAgentDir==null?{}:{shadowSubAgentDir:e.shadowSubAgentDir},...e.globalMemoryFile==null?{}:{globalMemoryFile:e.globalMemoryFile},...e.shadowProjectsDir==null?{}:{shadowProjectsDir:e.shadowProjectsDir},...e.externalProjects==null?{}:{externalProjects:e.externalProjects},...e.excludePatterns==null?{}:{excludePatterns:e.excludePatterns},...e.fastCommandSeriesOptions==null?{}:{fastCommandSeriesOptions:e.fastCommandSeriesOptions},...e.logLevel==null?{}:{logLevel:e.logLevel}}}function gr(...e){return e.reduce((e,t)=>_r(e,t),{...mr})}function _r(e,t){let n=t.externalProjects,r=t.plugins,i=t.excludePatterns,a=t.fastCommandSeriesOptions;return{...e,...t,externalProjects:[...e.externalProjects,...n??[]],plugins:[...e.plugins,...r??[]],excludePatterns:vr(e.excludePatterns,i),fastCommandSeriesOptions:yr(e.fastCommandSeriesOptions,a)}}function vr(e,t){let n={...e};if(t)for(let[e,r]of Object.entries(t))n[e]=[...n[e]??[],...r];return n}function yr(e,t){if(t==null)return e??{};if(e==null)return t;let n={};if(e.pluginOverrides!=null)for(let[t,r]of Object.entries(e.pluginOverrides))n[t]={...r};if(t.pluginOverrides!=null)for(let[e,r]of Object.entries(t.pluginOverrides))n[e]={...n[e],...r};let r=t.includeSeriesPrefix??e.includeSeriesPrefix,i=Object.keys(n).length>0;return r!=null&&i?{includeSeriesPrefix:r,pluginOverrides:n}:r==null?i?{pluginOverrides:n}:{}:{includeSeriesPrefix:r}}function br(e){return`pluginOptions`in e||`configLoaderOptions`in e||`loadUserConfig`in e}async function xr(e={}){pn().shouldExit&&u.default.exit(1);let t,n,r;br(e)?({pluginOptions:r={},cwd:n}={pluginOptions:e.pluginOptions,cwd:e.cwd},t=e.loadUserConfig??!0):(r=e,t=!0);let i={},a=!1,o=[],s;if(t){let e=fn(n);a=e.found,o=e.sources,e.found&&(i=hr(e.config),s=e.config)}let c=gr(i,r),{plugins:l=[],logLevel:p}=c,m=nn(`defineConfig`,p);a?m.info(`user config loaded`,{sources:o}):m.info(`no user config found, using defaults`,{workspaceDir:mr.workspaceDir,shadowSourceProjectDir:mr.shadowSourceProjectDir,shadowSkillSourceDir:mr.shadowSkillSourceDir,shadowFastCommandDir:mr.shadowFastCommandDir,shadowSubAgentDir:mr.shadowSubAgentDir,globalMemoryFile:mr.globalMemoryFile,shadowProjectsDir:mr.shadowProjectsDir,logLevel:mr.logLevel});let h={logger:m,userConfigOptions:c,fs:d,path:f,glob:Je.default},g=l.filter(e=>e.type===bt.Input),_=l.filter(e=>e.type===bt.Output),v=await new pr().executePluginsInOrder(g,h,!1,s);if(v.workspace==null)throw Error(`Workspace not initialized by any plugin`);let y={workspace:v.workspace,ideConfigFiles:v.ideConfigFiles??[],...v.externalProjects!=null&&{externalProjects:v.externalProjects},...v.fastCommands!=null&&{fastCommands:v.fastCommands},...v.subAgents!=null&&{subAgents:v.subAgents},...v.skills!=null&&{skills:v.skills},...v.globalMemory!=null&&{globalMemory:v.globalMemory},...v.aiAgentIgnoreConfigFiles!=null&&{aiAgentIgnoreConfigFiles:v.aiAgentIgnoreConfigFiles},...v.shadowSourceProjectDir!=null&&{shadowSourceProjectDir:v.shadowSourceProjectDir},...v.readmePrompts!=null&&{readmePrompts:v.readmePrompts},...v.globalGitIgnore!=null&&{globalGitIgnore:v.globalGitIgnore},...v.shadowGitExclude!=null&&{shadowGitExclude:v.shadowGitExclude}};return v.shadowSourceProjectDir!=null&&jn(v.shadowSourceProjectDir,m),{context:y,outputPlugins:_,userConfigOptions:c}}const Sr=jr(/[A-Za-z]/),Cr=jr(/[\dA-Za-z]/),wr=jr(/[#-'*+\--9=?A-Z^-~]/);function Tr(e){return e!==null&&(e<32||e===127)}const Er=jr(/\d/),Dr=jr(/[\dA-Fa-f]/),Or=jr(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function V(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}const kr=jr(/\p{P}|\p{S}/u),Ar=jr(/\s/);function jr(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var Mr=l(o(((e,t)=>{(function(){var e=t===void 0?function(){return this||(0,eval)(`this`)}():t.exports=i;e.format=i,e.vsprintf=r,typeof console<`u`&&typeof console.log==`function`&&(e.printf=n);function n(){console.log(i.apply(null,arguments))}function r(e,t){return i.apply(null,[e].concat(t))}function i(e){for(var t=1,n=[].slice.call(arguments),r=0,i=e.length,a=``,o,s=!1,c,l,u=!1,d,f=function(){return n[t++]},p=function(){for(var t=``;/\d/.test(e[r]);)t+=e[r++],o=e[r];return t.length>0?parseInt(t):null};r<i;++r)if(o=e[r],s)switch(s=!1,o==`.`?(u=!1,o=e[++r]):o==`0`&&e[r+1]==`.`?(u=!0,r+=2,o=e[r]):u=!0,d=p(),o){case`b`:a+=parseInt(f(),10).toString(2);break;case`c`:c=f(),typeof c==`string`||c instanceof String?a+=c:a+=String.fromCharCode(parseInt(c,10));break;case`d`:a+=parseInt(f(),10);break;case`f`:l=String(parseFloat(f()).toFixed(d||6)),a+=u?l:l.replace(/^0/,``);break;case`j`:a+=JSON.stringify(f());break;case`o`:a+=`0`+parseInt(f(),10).toString(8);break;case`s`:a+=f();break;case`x`:a+=`0x`+parseInt(f(),10).toString(16);break;case`X`:a+=`0x`+parseInt(f(),10).toString(16).toUpperCase();break;default:a+=o;break}else o===`%`?s=!0:a+=o;return a}})()}))(),1);const Nr=Object.assign(Pr(Error),{eval:Pr(EvalError),range:Pr(RangeError),reference:Pr(ReferenceError),syntax:Pr(SyntaxError),type:Pr(TypeError),uri:Pr(URIError)});function Pr(e){return t.displayName=e.displayName||e.name,t;function t(t,...n){return new e(t&&(0,Mr.default)(t,...n))}}const Fr={}.hasOwnProperty,Ir={yaml:`-`,toml:`+`};function Lr(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:[`yaml`];for(;++n<r.length;)t[n]=Rr(r[n]);return t}function Rr(e){let t=e;if(typeof t==`string`){if(!Fr.call(Ir,t))throw Nr("Missing matter definition for `%s`",t);t={type:t,marker:Ir[t]}}else if(typeof t!=`object`)throw Nr("Expected matter to be an object, not `%j`",t);if(!Fr.call(t,`type`))throw Nr("Missing `type` in matter `%j`",t);if(!Fr.call(t,`fence`)&&!Fr.call(t,`marker`))throw Nr("Missing `marker` or `fence` in matter `%j`",t);return t}function zr(e){let t=Lr(e),n={},r=-1;for(;++r<t.length;){let e=t[r],i=Vr(e,`open`).charCodeAt(0),a=Br(e),o=n[i];Array.isArray(o)?o.push(a):n[i]=[a]}return{flow:n}}function Br(e){let t=e.anywhere,n=e.type,r=n+`Fence`,i=r+`Sequence`,a=n+`Value`,o={tokenize:u,partial:!0},s,c=0;return{tokenize:l,concrete:!0};function l(l,u,d){let f=this;return p;function p(a){let o=f.now();return o.column===1&&(o.line===1||t)&&(s=Vr(e,`open`),c=0,a===s.charCodeAt(c))?(l.enter(n),l.enter(r),l.enter(i),m(a)):d(a)}function m(e){return c===s.length?(l.exit(i),H(e)?(l.enter(`whitespace`),h(e)):g(e)):e===s.charCodeAt(c++)?(l.consume(e),m):d(e)}function h(e){return H(e)?(l.consume(e),h):(l.exit(`whitespace`),g(e))}function g(t){return B(t)?(l.exit(r),l.enter(`lineEnding`),l.consume(t),l.exit(`lineEnding`),s=Vr(e,`close`),c=0,l.attempt(o,b,_)):d(t)}function _(e){return e===null||B(e)?y(e):(l.enter(a),v(e))}function v(e){return e===null||B(e)?(l.exit(a),y(e)):(l.consume(e),v)}function y(e){return e===null?d(e):(l.enter(`lineEnding`),l.consume(e),l.exit(`lineEnding`),l.attempt(o,b,_))}function b(e){return l.exit(n),u(e)}}function u(e,t,n){let a=0;return o;function o(t){return t===s.charCodeAt(a)?(e.enter(r),e.enter(i),c(t)):n(t)}function c(t){return a===s.length?(e.exit(i),H(t)?(e.enter(`whitespace`),l(t)):u(t)):t===s.charCodeAt(a++)?(e.consume(t),c):n(t)}function l(t){return H(t)?(e.consume(t),l):(e.exit(`whitespace`),u(t))}function u(i){return i===null||B(i)?(e.exit(r),t(i)):n(i)}}}function Vr(e,t){return e.marker?Hr(e.marker,t).repeat(3):Hr(e.fence,t)}function Hr(e,t){return typeof e==`string`?e:e[t]}function Ur(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Wr(e){let t=Lr(e),n={},r={},i=-1;for(;++i<t.length;){let e=t[i];n[e.type]=Gr(e),r[e.type]=Kr,r[e.type+`Value`]=qr}return{enter:n,exit:r}}function Gr(e){return t;function t(t){this.enter({type:e.type,value:``},t),this.buffer()}}function Kr(e){let t=this.resume(),n=this.stack[this.stack.length-1];`value`in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``)}function qr(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function Jr(e){let t=[],n={},r=Lr(e),i=-1;for(;++i<r.length;){let e=r[i];n[e.type]=Yr(e);let a=Xr(e,`open`);t.push({atBreak:!0,character:a.charAt(0),after:Ur(a.charAt(1))})}return{unsafe:t,handlers:n}}function Yr(e){let t=Xr(e,`open`),n=Xr(e,`close`);return r;function r(e){return t+(e.value?`
|
|
1011
|
+
`.trim();var An=class{name=`help`;async execute(e){return console.log(kn),{success:!0,filesAffected:0,dirsAffected:0,message:`Help displayed`}}};function jn(e,t){let n=f.join(e,`.git`),r=d.existsSync(n);return r?t?.info(`version control detected`,{path:n}):t?.warn(`no version control detected, please use git to manage your shadow source project`,{path:e}),{hasGit:r,gitPath:n}}function Mn(e,t,n,r,i){if(n==null)return r;let a=f.relative(t,e),o=f.join(n,a);return d.existsSync(o)&&d.statSync(o).isFile()?(i?.debug(`copying from source`,{path:o}),d.readFileSync(o,`utf8`)):r}function Nn(e,t={}){let{sourceDir:n,logger:r}=t,i=[],a=[],o=[],s=[],c=new Set;d.existsSync(e)?(o.push(e),r?.debug(`directory exists`,{path:e})):(d.mkdirSync(e,{recursive:!0}),i.push(e),c.add(e),r?.info(`created directory`,{path:e}));for(let t of Object.values(Ht)){let o=t.path,l=f.join(e,o),u=f.dirname(l);if(!d.existsSync(u)){d.mkdirSync(u,{recursive:!0});let t=u;for(;t!==e&&!c.has(t);)c.add(t),i.push(t),r?.info(`created directory`,{path:t}),t=f.dirname(t)}if(d.existsSync(l))s.push(l),r?.debug(`file exists`,{path:l});else{let i=Mn(l,e,n,t.content,r);d.writeFileSync(l,i,`utf8`),a.push(l),r?.info(`created file`,{path:l})}}return{success:!0,rootPath:e,createdDirs:i,createdFiles:a,existedDirs:o,existedFiles:s}}function Pn(e,t,n){let r=e;return r=r.replace(Ut.SHADOW_SOURCE_PROJECT,n),r=r.replace(Ut.WORKSPACE,t),r.startsWith(`~`)&&(r=f.join(p.homedir(),r.slice(1))),f.normalize(r)}var Fn=class{name=`init`;async execute(e){let{logger:t,userConfigOptions:n}=e;t.info(`initializing shadow source project structure`,{command:`init`});let r=Pn(n.workspaceDir,``,``),i=Nn(Pn(n.shadowSourceProjectDir,r,``),{logger:t}),a=i.createdDirs.length===0&&i.createdFiles.length===0?`All ${i.existedDirs.length} directories and ${i.existedFiles.length} files already exist`:`Created ${i.createdDirs.length} directories and ${i.createdFiles.length} files (${i.existedDirs.length} dirs, ${i.existedFiles.length} files already existed)`;return t.info(`initialization complete`,{dirsCreated:i.createdDirs.length,filesCreated:i.createdFiles.length,dirsExisted:i.existedDirs.length,filesExisted:i.existedFiles.length}),{success:i.success,filesAffected:i.createdFiles.length,dirsAffected:i.createdDirs.length,message:a}}},In=class{name;inner;constructor(e){this.inner=e,this.name=`json:${e.name}`}async execute(e){let t=await this.inner.execute(e),n=Ln(t);return u.default.stdout.write(`${JSON.stringify(n)}\n`),t}};function Ln(e){return{success:e.success,filesAffected:e.filesAffected,dirsAffected:e.dirsAffected,...e.message!=null&&{message:e.message},pluginResults:[],errors:[]}}function Rn(){return`@truenine/memory-sync-cli`}function zn(){return`https://registry.npmjs.org/${Rn()}/latest`}function Bn(e){let t=e.replace(/^v/,``),n=/^(\d+)\.(\d+)\.(\d+)/.exec(t);return n==null?null:[Number.parseInt(n[1],10),Number.parseInt(n[2],10),Number.parseInt(n[3],10)]}function Vn(e,t){let n=Bn(e),r=Bn(t);if(n==null||r==null)return 0;for(let e=0;e<3;e++){if(n[e]<r[e])return-1;if(n[e]>r[e])return 1}return 0}const Hn=3e3;async function Un(){let e=new AbortController,t=setTimeout(()=>e.abort(),Hn);typeof t==`object`&&`unref`in t&&t.unref();try{let n=await fetch(zn(),{headers:{Accept:`application/json`},signal:e.signal});if(clearTimeout(t),!n.ok)return{error:`HTTP ${n.status}: ${n.statusText}`};let r=await n.json();return r.version==null?{error:`Invalid response: missing version field`}:{version:r.version}}catch(e){return clearTimeout(t),e instanceof Error?e.name===`TimeoutError`||e.name===`AbortError`?{error:`Request timeout after ${Hn}ms`}:{error:e.message}:{error:`Unknown network error`}}}function Wn(){return`2026.10213.10155`}async function Gn(){let e=Wn();if(e===`dev`)return{status:`development`,localVersion:e,remoteVersion:null};let t=await Un();if(`error`in t)return{status:`current`,localVersion:e,remoteVersion:null,error:t.error};let n=t.version,r=Vn(e,n);return r<0?{status:`outdated`,localVersion:e,remoteVersion:n}:r>0?{status:`development`,localVersion:e,remoteVersion:n}:{status:`current`,localVersion:e,remoteVersion:n}}function Kn(e,t){let{status:n,localVersion:r,remoteVersion:i}=e;switch(n){case`outdated`:t.warn(`Version outdated: ${r} → ${i}. Run 'npm i -g ${Rn()}@latest' to update.`);break;case`current`:e.error==null?t.info(`Version ${r} is up to date.`):t.error(`Version check failed: ${e.error}`);break;case`development`:i==null?t.debug(`Running in development mode, version check skipped.`):t.info(`Development version detected: ${r} > ${i}. Thanks for contributing!`);break}}function qn(){return new Date().getMinutes()%2==0}function Jn(e){qn()&&Gn().then(t=>{(t.status===`outdated`||t.error!=null)&&Kn(t,e)}).catch(t=>{let n=t instanceof Error?t.message:`Unknown error`;e.error(`Version check failed: ${n}`)})}var Yn=class{name=`outdated`;async execute(e){let t=await Gn();return Kn(t,e.logger),{success:!0,filesAffected:0,dirsAffected:0,message:`Version status: ${t.status}`}}},Xn=class{name=`plugins`;async execute(e){let{logger:t,outputPlugins:n,userConfigOptions:r}=e,i=r.plugins,a=[];for(let e of i)a.push({name:e.name,kind:e.type===bt.Input?`Input`:`Output`,description:e.name,dependencies:[...e.dependsOn??[]]});let o=new Set(a.map(e=>e.name));for(let e of n)o.has(e.name)||a.push({name:e.name,kind:`Output`,description:e.name,dependencies:[...e.dependsOn??[]]});return u.default.stdout.write(`${JSON.stringify(a)}\n`),t.info(`plugins listed`,{count:a.length}),{success:!0,filesAffected:0,dirsAffected:0,message:`Listed ${a.length} plugin(s)`}}},Zn=class{name=`unknown`;constructor(e){this.unknownCmd=e}async execute(e){return console.error(`Unknown command: ${this.unknownCmd}`),console.error(`Run "tnmsc help" for available commands.`),{success:!1,filesAffected:0,dirsAffected:0}}};const Qn={default:{websearch:`web_search`,webfetch:`web_fetch`,readFile:`read_file`,writeFile:`write_file`,executeCommand:`execute_command`,todolistWrite:`todolist_write`,grep:`grep`,listDirectory:`list_directory`},claudeCode:{readFile:`Read`,writeFile:`Write`,executeCommand:`Execute`,todolistWrite:`TodoWrite`,listDirectory:`List`},kiro:{websearch:`remote_web_search`,webfetch:`webFetch`,readFile:`readFile`,writeFile:`fsWrite`,executeCommand:`executeBash`,todolistWrite:`todolistWrite`,grep:`grepSearch`,listDirectory:`listDir`}};let $n=function(e){return e.Bash=`bash`,e.Zsh=`zsh`,e.Fish=`fish`,e.Sh=`sh`,e.PowerShell=`powershell`,e.Pwsh=`pwsh`,e.Cmd=`cmd`,e.Unknown=`unknown`,e}({}),er=function(e){return e.Win=`win`,e.Mac=`mac`,e.Linux=`linux`,e.Unknown=`unknown`,e}({});var tr=class{userConfig;toolPreset;constructor(e={}){this.userConfig=e.userConfig,this.toolPreset=e.toolPreset??`default`}collect(){return{os:this.collectOsInfo(),env:this.collectEnvContext(),profile:this.collectProfile(),tool:this.collectToolReferences(),Md:this.createMdComponent()}}collectOsInfo(){let e=p.platform();return{platform:e,arch:p.arch(),hostname:p.hostname(),homedir:p.homedir(),tmpdir:p.tmpdir(),type:p.type(),release:p.release(),shellKind:this.detectShellKind(),kind:this.detectOsKind(e)}}detectOsKind(e){switch(e){case`win32`:return er.Win;case`darwin`:return er.Mac;case`linux`:case`freebsd`:case`openbsd`:case`sunos`:case`aix`:return er.Linux;default:return er.Unknown}}detectShellKind(){let e=(u.default.env.SHELL??u.default.env.ComSpec??``).toLowerCase();return e.includes(`bash`)?$n.Bash:e.includes(`zsh`)?$n.Zsh:e.includes(`fish`)?$n.Fish:e.includes(`pwsh`)?$n.Pwsh:e.includes(`powershell`)?$n.PowerShell:e.includes(`cmd`)?$n.Cmd:e.endsWith(`/sh`)?$n.Sh:$n.Unknown}collectEnvContext(){return{...u.default.env}}collectProfile(){return this.userConfig?.profile==null?{}:this.userConfig.profile}collectToolReferences(){let e={...Qn.default};return this.toolPreset===`claudeCode`?{...e,...Qn.claudeCode}:this.toolPreset===`kiro`?{...e,...Qn.kiro}:e}createMdComponent(){let e=(e=>e.when===!1?null:e.children);return e.Line=e=>e.when===!1?null:e.children,e}};let nr=function(e){return e[e.SystemDefault=0]=`SystemDefault`,e[e.UserConfig=10]=`UserConfig`,e[e.PluginRegistered=20]=`PluginRegistered`,e[e.CompileTime=30]=`CompileTime`,e}({});var rr=class{registrations=[];globalScope=null;setGlobalScope(e){this.globalScope=e}getGlobalScope(){return this.globalScope}register(e,t,n=nr.PluginRegistered){this.registrations.push({namespace:e,values:t,priority:n})}getRegistrations(){return this.registrations}merge(e){let t={};this.globalScope!=null&&(t.os={...this.globalScope.os},t.env={...this.globalScope.env},t.profile={...this.globalScope.profile},t.tool={...this.globalScope.tool});let n=[...this.registrations].sort((e,t)=>e.priority-t.priority);for(let e of n)t[e.namespace]=this.deepMerge(t[e.namespace],e.values);if(e!=null)for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r&&!Array.isArray(r)?this.deepMerge(t[n],r):r;return t}deepMerge(e,t){if(e==null)return{...t};let n={...e};for(let[e,r]of Object.entries(t))n[e]=typeof r==`object`&&r&&!Array.isArray(r)&&typeof n[e]==`object`&&n[e]!==null&&!Array.isArray(n[e])?this.deepMerge(n[e],r):r;return n}clear(){this.registrations.length=0,this.globalScope=null}};function ir(e){let t=[...e],n=t[0];n!=null&&ar(n)&&t.shift();let r=t[0];return r!=null&&or(r)&&t.shift(),t}function ar(e){let t=[`node`,`nodejs`,`bun`,`deno`,`tsx`,`ts-node`,`npx`,`pnpx`,`yarn`,`pnpm`],n=e.toLowerCase().replaceAll(`\\`,`/`);return t.some(e=>RegExp(`(?:^|/)${e}(?:\\.exe|\\.cmd|\\.ps1)?$`,`i`).test(n)||n===e)}function or(e){return/\.(?:m?[jt]s|cjs)$/.test(e)||/[/\\]/.test(e)&&!e.startsWith(`-`)?!0:/^(?:@[\w-]+\/)?[\w-]+$/.test(e)&&!e.startsWith(`-`)}const sr=new Set([`help`,`version`,`outdated`,`init`,`dry-run`,`clean`,`config`,`plugins`]),cr=new Map([[`--trace`,`trace`],[`--debug`,`debug`],[`--info`,`info`],[`--warn`,`warn`],[`--error`,`error`]]),lr=new Map([[`trace`,0],[`debug`,1],[`info`,2],[`warn`,3],[`error`,4]]);function ur(e){let{logLevelFlags:t}=e;if(t.length===0)return;let n=t[0],r=lr.get(n)??4;for(let e of t){let t=lr.get(e)??4;t<r&&(r=t,n=e)}return n}function dr(e){let{helpFlag:t,versionFlag:n,subcommand:r,dryRun:i,unknownCommand:a,setOption:o,positional:s,showFlag:c}=e;if(n)return new On;if(t)return new An;if(a!=null)return new Zn(a);if(r===`version`)return new On;if(r===`help`)return new An;if(r===`outdated`)return new Yn;if(r===`init`)return new Fn;if(r===`dry-run`)return new Tn;if(r===`clean`)return i?new wn:new yt;if(r===`plugins`)return new Xn;if(r===`config`&&c)return new Cn;if(r!==`config`||o.length>0)return new En;let l=[];for(let e of s){let t=e.indexOf(`=`);t>0&&l.push([e.slice(0,t),e.slice(t+1)])}return new Sn([...o,...l])}function fr(e){let t={subcommand:void 0,helpFlag:!1,versionFlag:!1,dryRun:!1,jsonFlag:!1,showFlag:!1,logLevel:void 0,logLevelFlags:[],setOption:[],unknownCommand:void 0,positional:[],unknown:[]},n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i!=null){if(i===`--`){t.positional.push(...e.slice(r+1).filter(e=>e!=null));break}if(i.startsWith(`--`)){let n=i.split(`=`),a=n[0]??``,o=cr.get(a);if(o!=null){t.logLevelFlags.push(o),t.logLevel=o;continue}switch(a){case`--help`:t.helpFlag=!0;break;case`--version`:t.versionFlag=!0;break;case`--dry-run`:t.dryRun=!0;break;case`--json`:t.jsonFlag=!0;break;case`--show`:t.showFlag=!0;break;case`--set`:if(n.length>1){let e=n.slice(1).join(`=`),r=e.indexOf(`=`);r>0&&t.setOption.push([e.slice(0,r),e.slice(r+1)])}else{let n=e[r+1];if(n!=null){let e=n.indexOf(`=`);e>0&&(t.setOption.push([n.slice(0,e),n.slice(e+1)]),r++)}}break;default:t.unknown.push(i)}continue}if(i.startsWith(`-`)&&i.length>1){let e=i.slice(1);for(let n of e)switch(n){case`h`:t.helpFlag=!0;break;case`v`:t.versionFlag=!0;break;case`n`:t.dryRun=!0;break;case`j`:t.jsonFlag=!0;break;default:t.unknown.push(`-${n}`)}continue}if(!n){n=!0,sr.has(i)?t.subcommand=i:t.unknownCommand=i;continue}t.positional.push(i)}}return t}var pr=class{logger;args;outputPlugins=[];constructor(...e){this.args=fr(ir(e.filter(e=>e!=null)));let t=ur(this.args);t!=null&&en(t),this.logger=nn(`PluginPipeline`,t),this.logger.debug(`initialized`,{args:this.args})}registerOutputPlugins(e){return this.outputPlugins.push(...e),this}async run(e){Jn(this.logger);let{context:t,outputPlugins:n,userConfigOptions:r}=e;this.registerOutputPlugins([...n]);let i=this.resolveCommand();this.args.jsonFlag&&(en(`silent`),new Set([`config-show`,`plugins`]).has(i.name)||(i=new In(i)));let a=this.createCommandContext(t,r);await i.execute(a)}resolveCommand(){return dr(this.args)}createCommandContext(e,t){return{logger:this.logger,outputPlugins:this.outputPlugins,collectedInputContext:e,userConfigOptions:t,createCleanContext:t=>this.createCleanContext(e,t),createWriteContext:t=>this.createWriteContext(e,t)}}createCleanContext(e,t){return{logger:this.logger,fs:d,path:f,glob:Je.default,collectedInputContext:e,dryRun:t}}createWriteContext(e,t){return{logger:this.logger,fs:d,path:f,glob:Je.default,collectedInputContext:e,dryRun:t,registeredPluginNames:this.outputPlugins.map(e=>e.name)}}buildDependencyGraph(e){let t=new Map;for(let n of e){let e=n.dependsOn??[];t.set(n.name,[...e])}return t}validateDependencies(e){let t=new Set(e.map(e=>e.name));for(let n of e){let e=n.dependsOn??[];for(let r of e)if(!t.has(r))throw new Dt(n.name,r)}}topologicalSort(e){this.validateDependencies(e);let t=new Map;for(let n of e)t.set(n.name,n);let n=new Map;for(let t of e)n.set(t.name,0);let r=new Map;for(let t of e)r.set(t.name,[]);for(let t of e){let e=t.dependsOn??[];for(let i of e){n.set(t.name,(n.get(t.name)??0)+1);let e=r.get(i)??[];e.push(t.name),r.set(i,e)}}let i=[];for(let t of e)n.get(t.name)===0&&i.push(t.name);let a=[];for(;i.length>0;){let o=i.shift(),s=t.get(o);a.push(s);let c=(r.get(o)??[]).sort((t,n)=>e.findIndex(e=>e.name===t)-e.findIndex(e=>e.name===n));for(let e of c){let t=(n.get(e)??0)-1;n.set(e,t),t===0&&i.push(e)}}if(a.length===e.length)return a;throw new Et(this.findCyclePath(e,n))}findCyclePath(e,t){let n=new Set;for(let[e,r]of t)r>0&&n.add(e);let r=new Map;for(let t of e)if(n.has(t.name)){let e=(t.dependsOn??[]).filter(e=>n.has(e));r.set(t.name,e)}let i=new Set,a=[],o=e=>{if(a.includes(e))return a.push(e),!0;if(i.has(e))return!1;i.add(e),a.push(e);for(let t of r.get(e)??[])if(o(t))return!0;return a.pop(),!1};for(let e of n){if(o(e)){let e=a.indexOf(a.at(-1));return a.slice(e)}i.clear(),a.length=0}return[...n]}async executePluginsInOrder(e,t,n=!1,r){if(e.length===0)return{};let i=this.topologicalSort(e),a=new tr({userConfig:r}).collect(),o=new rr;o.setGlobalScope(a),this.logger.debug(`global scope collected`,{osInfo:{platform:a.os.platform,arch:a.os.arch,shellKind:a.os.shellKind},hasProfile:Object.keys(a.profile).length>0,hasTool:Object.keys(a.tool).length>0});let s=new Map,c={};for(let e of i){let r=this.buildDependencyContext(e,s),i={...t,dependencyContext:r,globalScope:a,scopeRegistry:o},l=e;l.executeEffects!=null&&await l.executeEffects(i,n);let u=await e.collect(i);s.set(e.name,u),c=this.mergeContexts(c,u);let d=e;if(d.getRegisteredScopes!=null){let t=d.getRegisteredScopes();for(let{namespace:n,values:r}of t)o.register(n,r,nr.PluginRegistered),this.logger.debug(`plugin scope registered`,{plugin:e.name,namespace:n,keys:Object.keys(r)})}}return c}buildDependencyContext(e,t){if((e.dependsOn??[]).length===0)return{};let n=this.collectTransitiveDependencies(e,t),r={};for(let e of n){let n=t.get(e);n!=null&&(r=this.mergeContexts(r,n))}return r}collectTransitiveDependencies(e,t){let n=new Set,r=[];return(e=>{for(let i of e)n.has(i)||(n.add(i),t.get(i)!=null&&r.push(i))})(e.dependsOn??[]),r}mergeContexts(e,t){let{workspace:n}=e;if(t.workspace!=null)if(n!=null){let e=new Map;for(let t of n.projects)e.set(t.name,t);for(let n of t.workspace.projects)e.set(n.name,n);n={directory:t.workspace.directory??n.directory,projects:[...e.values()]}}else ({workspace:n}=t);let r=t.externalProjects==null?e.externalProjects:[...e.externalProjects??[],...t.externalProjects],i=t.ideConfigFiles==null?e.ideConfigFiles:[...e.ideConfigFiles??[],...t.ideConfigFiles],a=t.fastCommands==null?e.fastCommands:[...e.fastCommands??[],...t.fastCommands],o=t.subAgents==null?e.subAgents:[...e.subAgents??[],...t.subAgents],s=t.skills==null?e.skills:[...e.skills??[],...t.skills],c=t.aiAgentIgnoreConfigFiles==null?e.aiAgentIgnoreConfigFiles:[...e.aiAgentIgnoreConfigFiles??[],...t.aiAgentIgnoreConfigFiles],l=t.globalMemory??e.globalMemory,u=t.shadowSourceProjectDir??e.shadowSourceProjectDir,d=t.readmePrompts==null?e.readmePrompts:[...e.readmePrompts??[],...t.readmePrompts],f=t.globalGitIgnore??e.globalGitIgnore,p=t.shadowGitExclude??e.shadowGitExclude;return{...n==null?{}:{workspace:n},...r==null?{}:{externalProjects:r},...i==null?{}:{ideConfigFiles:i},...a==null?{}:{fastCommands:a},...o==null?{}:{subAgents:o},...s==null?{}:{skills:s},...c==null?{}:{aiAgentIgnoreConfigFiles:c},...l==null?{}:{globalMemory:l},...u==null?{}:{shadowSourceProjectDir:u},...d==null?{}:{readmePrompts:d},...f==null?{}:{globalGitIgnore:f},...p==null?{}:{shadowGitExclude:p}}}};const mr={...R,externalProjects:[],excludePatterns:{},fastCommandSeriesOptions:{},plugins:[]};function hr(e){return{...e.workspaceDir==null?{}:{workspaceDir:e.workspaceDir},...e.shadowSourceProjectDir==null?{}:{shadowSourceProjectDir:e.shadowSourceProjectDir},...e.shadowSkillSourceDir==null?{}:{shadowSkillSourceDir:e.shadowSkillSourceDir},...e.shadowFastCommandDir==null?{}:{shadowFastCommandDir:e.shadowFastCommandDir},...e.shadowSubAgentDir==null?{}:{shadowSubAgentDir:e.shadowSubAgentDir},...e.globalMemoryFile==null?{}:{globalMemoryFile:e.globalMemoryFile},...e.shadowProjectsDir==null?{}:{shadowProjectsDir:e.shadowProjectsDir},...e.externalProjects==null?{}:{externalProjects:e.externalProjects},...e.excludePatterns==null?{}:{excludePatterns:e.excludePatterns},...e.fastCommandSeriesOptions==null?{}:{fastCommandSeriesOptions:e.fastCommandSeriesOptions},...e.logLevel==null?{}:{logLevel:e.logLevel}}}function gr(...e){return e.reduce((e,t)=>_r(e,t),{...mr})}function _r(e,t){let n=t.externalProjects,r=t.plugins,i=t.excludePatterns,a=t.fastCommandSeriesOptions;return{...e,...t,externalProjects:[...e.externalProjects,...n??[]],plugins:[...e.plugins,...r??[]],excludePatterns:vr(e.excludePatterns,i),fastCommandSeriesOptions:yr(e.fastCommandSeriesOptions,a)}}function vr(e,t){let n={...e};if(t)for(let[e,r]of Object.entries(t))n[e]=[...n[e]??[],...r];return n}function yr(e,t){if(t==null)return e??{};if(e==null)return t;let n={};if(e.pluginOverrides!=null)for(let[t,r]of Object.entries(e.pluginOverrides))n[t]={...r};if(t.pluginOverrides!=null)for(let[e,r]of Object.entries(t.pluginOverrides))n[e]={...n[e],...r};let r=t.includeSeriesPrefix??e.includeSeriesPrefix,i=Object.keys(n).length>0;return r!=null&&i?{includeSeriesPrefix:r,pluginOverrides:n}:r==null?i?{pluginOverrides:n}:{}:{includeSeriesPrefix:r}}function br(e){return`pluginOptions`in e||`configLoaderOptions`in e||`loadUserConfig`in e}async function xr(e={}){pn().shouldExit&&u.default.exit(1);let t,n,r;br(e)?({pluginOptions:r={},cwd:n}={pluginOptions:e.pluginOptions,cwd:e.cwd},t=e.loadUserConfig??!0):(r=e,t=!0);let i={},a=!1,o=[],s;if(t){let e=fn(n);a=e.found,o=e.sources,e.found&&(i=hr(e.config),s=e.config)}let c=gr(i,r),{plugins:l=[],logLevel:p}=c,m=nn(`defineConfig`,p);a?m.info(`user config loaded`,{sources:o}):m.info(`no user config found, using defaults`,{workspaceDir:mr.workspaceDir,shadowSourceProjectDir:mr.shadowSourceProjectDir,shadowSkillSourceDir:mr.shadowSkillSourceDir,shadowFastCommandDir:mr.shadowFastCommandDir,shadowSubAgentDir:mr.shadowSubAgentDir,globalMemoryFile:mr.globalMemoryFile,shadowProjectsDir:mr.shadowProjectsDir,logLevel:mr.logLevel});let h={logger:m,userConfigOptions:c,fs:d,path:f,glob:Je.default},g=l.filter(e=>e.type===bt.Input),_=l.filter(e=>e.type===bt.Output),v=await new pr().executePluginsInOrder(g,h,!1,s);if(v.workspace==null)throw Error(`Workspace not initialized by any plugin`);let y={workspace:v.workspace,ideConfigFiles:v.ideConfigFiles??[],...v.externalProjects!=null&&{externalProjects:v.externalProjects},...v.fastCommands!=null&&{fastCommands:v.fastCommands},...v.subAgents!=null&&{subAgents:v.subAgents},...v.skills!=null&&{skills:v.skills},...v.globalMemory!=null&&{globalMemory:v.globalMemory},...v.aiAgentIgnoreConfigFiles!=null&&{aiAgentIgnoreConfigFiles:v.aiAgentIgnoreConfigFiles},...v.shadowSourceProjectDir!=null&&{shadowSourceProjectDir:v.shadowSourceProjectDir},...v.readmePrompts!=null&&{readmePrompts:v.readmePrompts},...v.globalGitIgnore!=null&&{globalGitIgnore:v.globalGitIgnore},...v.shadowGitExclude!=null&&{shadowGitExclude:v.shadowGitExclude}};return v.shadowSourceProjectDir!=null&&jn(v.shadowSourceProjectDir,m),{context:y,outputPlugins:_,userConfigOptions:c}}const Sr=jr(/[A-Za-z]/),Cr=jr(/[\dA-Za-z]/),wr=jr(/[#-'*+\--9=?A-Z^-~]/);function Tr(e){return e!==null&&(e<32||e===127)}const Er=jr(/\d/),Dr=jr(/[\dA-Fa-f]/),Or=jr(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function V(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}const kr=jr(/\p{P}|\p{S}/u),Ar=jr(/\s/);function jr(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var Mr=l(o(((e,t)=>{(function(){var e=t===void 0?function(){return this||(0,eval)(`this`)}():t.exports=i;e.format=i,e.vsprintf=r,typeof console<`u`&&typeof console.log==`function`&&(e.printf=n);function n(){console.log(i.apply(null,arguments))}function r(e,t){return i.apply(null,[e].concat(t))}function i(e){for(var t=1,n=[].slice.call(arguments),r=0,i=e.length,a=``,o,s=!1,c,l,u=!1,d,f=function(){return n[t++]},p=function(){for(var t=``;/\d/.test(e[r]);)t+=e[r++],o=e[r];return t.length>0?parseInt(t):null};r<i;++r)if(o=e[r],s)switch(s=!1,o==`.`?(u=!1,o=e[++r]):o==`0`&&e[r+1]==`.`?(u=!0,r+=2,o=e[r]):u=!0,d=p(),o){case`b`:a+=parseInt(f(),10).toString(2);break;case`c`:c=f(),typeof c==`string`||c instanceof String?a+=c:a+=String.fromCharCode(parseInt(c,10));break;case`d`:a+=parseInt(f(),10);break;case`f`:l=String(parseFloat(f()).toFixed(d||6)),a+=u?l:l.replace(/^0/,``);break;case`j`:a+=JSON.stringify(f());break;case`o`:a+=`0`+parseInt(f(),10).toString(8);break;case`s`:a+=f();break;case`x`:a+=`0x`+parseInt(f(),10).toString(16);break;case`X`:a+=`0x`+parseInt(f(),10).toString(16).toUpperCase();break;default:a+=o;break}else o===`%`?s=!0:a+=o;return a}})()}))(),1);const Nr=Object.assign(Pr(Error),{eval:Pr(EvalError),range:Pr(RangeError),reference:Pr(ReferenceError),syntax:Pr(SyntaxError),type:Pr(TypeError),uri:Pr(URIError)});function Pr(e){return t.displayName=e.displayName||e.name,t;function t(t,...n){return new e(t&&(0,Mr.default)(t,...n))}}const Fr={}.hasOwnProperty,Ir={yaml:`-`,toml:`+`};function Lr(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:[`yaml`];for(;++n<r.length;)t[n]=Rr(r[n]);return t}function Rr(e){let t=e;if(typeof t==`string`){if(!Fr.call(Ir,t))throw Nr("Missing matter definition for `%s`",t);t={type:t,marker:Ir[t]}}else if(typeof t!=`object`)throw Nr("Expected matter to be an object, not `%j`",t);if(!Fr.call(t,`type`))throw Nr("Missing `type` in matter `%j`",t);if(!Fr.call(t,`fence`)&&!Fr.call(t,`marker`))throw Nr("Missing `marker` or `fence` in matter `%j`",t);return t}function zr(e){let t=Lr(e),n={},r=-1;for(;++r<t.length;){let e=t[r],i=Vr(e,`open`).charCodeAt(0),a=Br(e),o=n[i];Array.isArray(o)?o.push(a):n[i]=[a]}return{flow:n}}function Br(e){let t=e.anywhere,n=e.type,r=n+`Fence`,i=r+`Sequence`,a=n+`Value`,o={tokenize:u,partial:!0},s,c=0;return{tokenize:l,concrete:!0};function l(l,u,d){let f=this;return p;function p(a){let o=f.now();return o.column===1&&(o.line===1||t)&&(s=Vr(e,`open`),c=0,a===s.charCodeAt(c))?(l.enter(n),l.enter(r),l.enter(i),m(a)):d(a)}function m(e){return c===s.length?(l.exit(i),H(e)?(l.enter(`whitespace`),h(e)):g(e)):e===s.charCodeAt(c++)?(l.consume(e),m):d(e)}function h(e){return H(e)?(l.consume(e),h):(l.exit(`whitespace`),g(e))}function g(t){return B(t)?(l.exit(r),l.enter(`lineEnding`),l.consume(t),l.exit(`lineEnding`),s=Vr(e,`close`),c=0,l.attempt(o,b,_)):d(t)}function _(e){return e===null||B(e)?y(e):(l.enter(a),v(e))}function v(e){return e===null||B(e)?(l.exit(a),y(e)):(l.consume(e),v)}function y(e){return e===null?d(e):(l.enter(`lineEnding`),l.consume(e),l.exit(`lineEnding`),l.attempt(o,b,_))}function b(e){return l.exit(n),u(e)}}function u(e,t,n){let a=0;return o;function o(t){return t===s.charCodeAt(a)?(e.enter(r),e.enter(i),c(t)):n(t)}function c(t){return a===s.length?(e.exit(i),H(t)?(e.enter(`whitespace`),l(t)):u(t)):t===s.charCodeAt(a++)?(e.consume(t),c):n(t)}function l(t){return H(t)?(e.consume(t),l):(e.exit(`whitespace`),u(t))}function u(i){return i===null||B(i)?(e.exit(r),t(i)):n(i)}}}function Vr(e,t){return e.marker?Hr(e.marker,t).repeat(3):Hr(e.fence,t)}function Hr(e,t){return typeof e==`string`?e:e[t]}function Ur(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Wr(e){let t=Lr(e),n={},r={},i=-1;for(;++i<t.length;){let e=t[i];n[e.type]=Gr(e),r[e.type]=Kr,r[e.type+`Value`]=qr}return{enter:n,exit:r}}function Gr(e){return t;function t(t){this.enter({type:e.type,value:``},t),this.buffer()}}function Kr(e){let t=this.resume(),n=this.stack[this.stack.length-1];`value`in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``)}function qr(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function Jr(e){let t=[],n={},r=Lr(e),i=-1;for(;++i<r.length;){let e=r[i];n[e.type]=Yr(e);let a=Xr(e,`open`);t.push({atBreak:!0,character:a.charAt(0),after:Ur(a.charAt(1))})}return{unsafe:t,handlers:n}}function Yr(e){let t=Xr(e,`open`),n=Xr(e,`close`);return r;function r(e){return t+(e.value?`
|
|
1012
1012
|
`+e.value:``)+`
|
|
1013
1013
|
`+n}}function Xr(e,t){return e.marker?Zr(e.marker,t).repeat(3):Zr(e.fence,t)}function Zr(e,t){return typeof e==`string`?e:e[t]}function Qr(e){let t=this,n=e||`yaml`,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(zr(n)),a.push(Wr(n)),o.push(Jr(n))}function $r(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const ei=(function(e){if(e==null)return ai;if(typeof e==`function`)return ii(e);if(typeof e==`object`)return Array.isArray(e)?ti(e):ni(e);if(typeof e==`string`)return ri(e);throw Error(`Expected function, string, or object as test`)});function ti(e){let t=[],n=-1;for(;++n<e.length;)t[n]=ei(e[n]);return ii(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function ni(e){let t=e;return ii(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ri(e){return ii(t);function t(t){return t&&t.type===e}}function ii(e){return t;function t(t,n,r){return!!(oi(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ai(){return!0}function oi(e){return typeof e==`object`&&!!e&&`type`in e}function si(e){return`\x1B[33m`+e+`\x1B[39m`}const ci=[];function li(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=ei(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+si(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=ci,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=ui(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function ui(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?ci:[e]}function di(e,t,n){let r=ei((n||{}).ignore||[]),i=fi(t),a=-1;for(;++a<i.length;)li(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function fi(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([pi(e[0]),mi(e[1])])}return t}function pi(e){return typeof e==`string`?new RegExp(Ur(e),`g`):e}function mi(e){return typeof e==`function`?e:function(){return e}}const hi=`phrasing`,gi=[`autolink`,`link`,`image`,`label`];function _i(){return{transforms:[Ti],enter:{literalAutolink:yi,literalAutolinkEmail:bi,literalAutolinkHttp:bi,literalAutolinkWww:bi},exit:{literalAutolink:wi,literalAutolinkEmail:Ci,literalAutolinkHttp:xi,literalAutolinkWww:Si}}}function vi(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:hi,notInConstruct:gi},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:hi,notInConstruct:gi},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:hi,notInConstruct:gi}]}}function yi(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function bi(e){this.config.enter.autolinkProtocol.call(this,e)}function xi(e){this.config.exit.autolinkProtocol.call(this,e)}function Si(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Ci(e){this.config.exit.autolinkEmail.call(this,e)}function wi(e){this.exit(e)}function Ti(e){di(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ei],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Di]],{ignore:[`link`,`linkReference`]})}function Ei(e,t,n,r,i){let a=``;if(!Ai(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Oi(n)))return!1;let o=ki(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Di(e,t,n,r){return!Ai(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Oi(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function ki(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=$r(e,`(`),a=$r(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Ai(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Ar(n)||kr(n))&&(!t||n!==47)}function ji(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}Vi.peek=Bi;function Mi(){this.buffer()}function Ni(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Pi(){this.buffer()}function Fi(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Ii(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ji(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Li(e){this.exit(e)}function Ri(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ji(this.sliceSerialize(e)).toLowerCase(),n.label=t}function zi(e){this.exit(e)}function Bi(){return`[`}function Vi(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Hi(){return{enter:{gfmFootnoteCallString:Mi,gfmFootnoteCall:Ni,gfmFootnoteDefinitionLabelString:Pi,gfmFootnoteDefinition:Fi},exit:{gfmFootnoteCallString:Ii,gfmFootnoteCall:Li,gfmFootnoteDefinitionLabelString:Ri,gfmFootnoteDefinition:zi}}}function Ui(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Vi},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
1014
1014
|
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Gi:Wi))),s(),o}}function Wi(e,t,n){return t===0?e:Gi(e,t,n)}function Gi(e,t,n){return(n?``:` `)+e}const Ki=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Zi.peek=Qi;function qi(){return{canContainEols:[`delete`],enter:{strikethrough:Yi},exit:{strikethrough:Xi}}}function Ji(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Ki}],handlers:{delete:Zi}}}function Yi(e){this.enter({type:`delete`,children:[]},e)}function Xi(e){this.exit(e)}function Zi(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Qi(){return`~`}function $i(e){return e.length}function ea(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||$i,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=ta(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=na(r[d]);else{let e=na(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
package/dist/index.mjs
CHANGED
|
@@ -954,7 +954,7 @@ API 接口 (Spring WebFlux 6.2)
|
|
|
954
954
|
- \`controllers/\`: 控制器
|
|
955
955
|
- \`dto/\`: 数据传输对象
|
|
956
956
|
\`\`\`
|
|
957
|
-
`};const Kt=Object.fromEntries(Wt.map(e=>[e,{path:e,content:Gt[e]??``}])),qt={USER_HOME:`~`,WORKSPACE:`$WORKSPACE`,SHADOW_SOURCE_PROJECT:`$SHADOW_SOURCE_PROJECT`},Jt=JSON.parse(Kt[`public/tnmsc.example.json`].content),Yt={reset:`\x1B[0m`,red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,magenta:`\x1B[35m`,gray:`\x1B[90m`,blue:`\x1B[34m`,green:`\x1B[32m`,white:`\x1B[37m`,dim:`\x1B[2m`,bgRed:`\x1B[41m`},Xt={red:e=>`${Yt.red}${e}${Yt.reset}`,yellow:e=>`${Yt.yellow}${e}${Yt.reset}`,cyan:e=>`${Yt.cyan}${e}${Yt.reset}`,magenta:e=>`${Yt.magenta}${e}${Yt.reset}`,gray:e=>`${Yt.gray}${e}${Yt.reset}`,blue:e=>`${Yt.blue}${e}${Yt.reset}`,green:e=>`${Yt.green}${e}${Yt.reset}`,white:e=>`${Yt.white}${e}${Yt.reset}`,dim:e=>`${Yt.dim}${e}${Yt.reset}`,bgRed:e=>`${Yt.bgRed}${e}${Yt.reset}`};let Zt;const Qt={error:Xt.red,warn:Xt.yellow,info:Xt.cyan,debug:Xt.magenta,trace:Xt.gray,fatal:Xt.bgRed},$t={silent:0,fatal:1,error:2,warn:3,info:4,debug:5,trace:6};function en(e){if(e===null)return Xt.dim(`null`);if(e===void 0)return Xt.dim(`undefined`);if(typeof e==`boolean`)return Xt.yellow(String(e));if(typeof e==`number`)return Xt.blue(String(e));if(typeof e==`string`)return Xt.green(`"${e}"`);if(Array.isArray(e))return e.length===0?`[]`:`[${e.map(e=>en(e)).join(`,`)}]`;if(e instanceof Error){let t={name:e.name,message:e.message,stack:e.stack};for(let n of Object.getOwnPropertyNames(e))n!==`name`&&n!==`message`&&n!==`stack`&&(t[n]=e[n]);return tn(t)}return typeof e==`object`?tn(e):String(e)}function tn(e){let t=Object.entries(e);return t.length===0?`{}`:`{${t.map(([e,t])=>`${/^[\w$]+$/.test(e)?Xt.magenta(e):Xt.yellow(`"${e}"`)}:${en(t)}`).join(`,`)}}`}function nn(){let e=new Date;return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}.${String(e.getMilliseconds()).padStart(3,`0`)}`}function rn(e,t,n,r){let i=nn(),a=Qt[e]??Xt.white,o=String(n),s=r!=null&&Object.keys(r).length>0,c=o===``,l={$:[i,e,t],_:s?c?r:{[o]:r}:n},u={$:[i,a(e.toUpperCase()),t]},d=s?c?r:{[o]:r}:n,f=tn({...u,_:d});return e===`error`||e===`fatal`?console.error(f):e===`warn`?console.warn(f):e===`debug`||e===`trace`?console.debug(f):console.log(f),l}function an(e,t,n){let r=$t[e],i=$t[n];return(n,...a)=>r>i?{$:[nn(),e,t],_:n}:typeof n==`string`?rn(e,t,n,a.length===1&&typeof a[0]==`object`&&a[0]!==null?a[0]:a.length>0?{args:a}:void 0):typeof n==`object`&&n?rn(e,t,``,n):rn(e,t,n)}function on(e){Zt=e}function sn(){return Zt}function cn(e,t){let n=t??Zt??process.env.LOG_LEVEL??`info`;return{error:an(`error`,e,n),warn:an(`warn`,e,n),info:an(`info`,e,n),debug:an(`debug`,e,n),trace:an(`trace`,e,n),fatal:an(`fatal`,e,n)}}const ln=`.tnmsc.json`,un=`.aindex`;function dn(){return i.join(s.homedir(),un,ln)}function fn(){return{...Jt}}function pn(e,t){let n=dn(),a=i.dirname(n);r.existsSync(a)||r.mkdirSync(a,{recursive:!0}),r.writeFileSync(n,`${JSON.stringify(e,null,2)}\n`,`utf8`),t.info(`global config created`,{path:n})}var mn=class{configFileName;searchCwd;searchGlobal;customSearchPaths;logger;constructor(e={}){this.configFileName=e.configFileName??ln,this.searchCwd=e.searchCwd??!0,this.searchGlobal=e.searchGlobal??!0,this.customSearchPaths=e.searchPaths??[],this.logger=cn(`ConfigLoader`)}getSearchPaths(e=n.cwd()){let t=[];for(let e of this.customSearchPaths)t.push(this.resolveTilde(e));return this.searchCwd&&t.push(i.join(e,this.configFileName)),this.searchGlobal&&t.push(i.join(s.homedir(),un,this.configFileName)),t}loadFromFile(e){let t=this.resolveTilde(e);try{if(!r.existsSync(t))return{config:{},source:null,found:!1};let e=r.readFileSync(t,`utf8`),n=this.parseConfig(e,t);return this.logger.debug(`loaded`,{source:t}),{config:n,source:t,found:!0}}catch(e){return this.logger.warn(`load failed`,{path:t,error:e}),{config:{},source:null,found:!1}}}load(e=n.cwd()){let t=this.getSearchPaths(e),r=[];for(let e of t){let t=this.loadFromFile(e);t.found&&r.push(t)}return{config:this.mergeConfigs(r.map(e=>e.config)),sources:r.map(e=>e.source).filter(e=>e!==null),found:r.length>0}}parseConfig(e,t){try{let n=JSON.parse(e);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`Config must be a JSON object`);return this.validateConfig(n,t)}catch(e){throw e instanceof SyntaxError?Error(`Invalid JSON in ${t}: ${e.message}`):e}}validateConfig(e,t){let n={},r=[];for(let t of[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`])t in e&&(typeof e[t]==`string`?n[t]=e[t]:r.push(`${t} must be a string`));if(`logLevel`in e){let t=[`trace`,`debug`,`info`,`warn`,`error`],i=e.logLevel;typeof i==`string`&&t.includes(i)?n.logLevel=i:r.push(`logLevel must be one of: ${t.join(`, `)}`)}if(`externalProjects`in e){let t=e.externalProjects;Array.isArray(t)?t.every(e=>typeof e==`string`)?n.externalProjects=t:r.push(`externalProjects must be an array of strings`):r.push(`externalProjects must be an array`)}if(`excludePatterns`in e){let t=e.excludePatterns;if(typeof t==`object`&&t){let e=t,i={},a=!0;for(let[t,n]of Object.entries(e))Array.isArray(n)&&n.every(e=>typeof e==`string`)?i[t]=n:(r.push(`excludePatterns.${t} must be an array of strings`),a=!1);a&&(n.excludePatterns=i)}else r.push(`excludePatterns must be an object`)}if(`profile`in e){let t=e.profile;typeof t==`object`&&t&&!Array.isArray(t)?n.profile=t:r.push(`profile must be an object`)}if(`tool`in e){let t=e.tool;if(typeof t==`object`&&t&&!Array.isArray(t)){let e=t,i={},a=!0;for(let[t,n]of Object.entries(e))typeof n==`string`||n===void 0?i[t]=n:(r.push(`tool.${t} must be a string`),a=!1);a&&(n.tool=i)}else r.push(`tool must be an object`)}return r.length>0&&this.logger.warn(`validation warnings`,{path:t,errors:r}),n}mergeConfigs(e){if(e.length===0)return{};let t=e[0];return e.length===1&&t!=null?t:[...e].reverse().reduce((e,t)=>{let n=[...e.externalProjects??[],...t.externalProjects??[]],r=this.mergeExcludePatterns(e.excludePatterns,t.excludePatterns);return{...e,...t,...n.length>0?{externalProjects:n}:{},...r==null?{}:{excludePatterns:r}}},{})}mergeExcludePatterns(e,t){if(e==null&&t==null)return null;if(e==null)return t??null;if(t==null)return e;let n={...e};for(let[e,r]of Object.entries(t))n[e]=[...n[e]??[],...r];return n}resolveTilde(e){return e.startsWith(`~`)?i.join(s.homedir(),e.slice(1)):e}};let hn=null;function gn(e){return(e||!hn)&&(hn=new mn(e)),hn}function _n(e){return gn().load(e)}function vn(){let e=cn(`ConfigLoader`),t=dn();if(!r.existsSync(t))return e.warn(`global config not found, creating default config`,{path:t}),pn(fn(),e),{valid:!0,exists:!1,errors:[],shouldExit:!1};let n;try{n=r.readFileSync(t,`utf8`)}catch(n){let r=n instanceof Error?n.message:String(n);return e.error(`failed to read global config`,{path:t,error:r}),bn(t,e,[`Failed to read config: ${r}`])}let i;try{i=JSON.parse(n)}catch(n){let r=n instanceof Error?n.message:String(n);return e.error(`invalid JSON in global config`,{path:t,error:r}),bn(t,e,[`Invalid JSON: ${r}`])}if(typeof i!=`object`||!i||Array.isArray(i))return e.error(`global config must be a JSON object`,{path:t}),bn(t,e,[`Config must be a JSON object`]);let a=yn(i);if(a.length>0){for(let n of a)e.error(`config validation error`,{path:t,error:n});return bn(t,e,a)}return{valid:!0,exists:!0,errors:[],shouldExit:!1}}function yn(e){let t=[];for(let n of[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`])n in e&&typeof e[n]!=`string`&&t.push(`${n} must be a string`);if(`logLevel`in e){let n=[`trace`,`debug`,`info`,`warn`,`error`],r=e.logLevel;(typeof r!=`string`||!n.includes(r))&&t.push(`logLevel must be one of: ${n.join(`, `)}`)}if(`externalProjects`in e){let n=e.externalProjects;Array.isArray(n)?n.every(e=>typeof e==`string`)||t.push(`externalProjects must be an array of strings`):t.push(`externalProjects must be an array`)}if(`excludePatterns`in e){let n=e.excludePatterns;if(typeof n!=`object`||!n||Array.isArray(n))t.push(`excludePatterns must be an object`);else{let e=n;for(let[n,r]of Object.entries(e))(!Array.isArray(r)||!r.every(e=>typeof e==`string`))&&t.push(`excludePatterns.${n} must be an array of strings`)}}if(`profile`in e){let n=e.profile;(typeof n!=`object`||!n||Array.isArray(n))&&t.push(`profile must be an object`)}if(!(`tool`in e))return t;let n=e.tool;if(typeof n!=`object`||!n||Array.isArray(n))t.push(`tool must be an object`);else{let e=n;for(let[n,r]of Object.entries(e))typeof r!=`string`&&r!==void 0&&t.push(`tool.${n} must be a string`)}return t}function bn(e,t,n){try{r.unlinkSync(e),t.info(`deleted invalid config`,{path:e})}catch{t.warn(`failed to delete invalid config`,{path:e})}return pn(fn(),t),t.error(`recreated default config, please review and restart`,{path:e}),{valid:!1,exists:!0,errors:n,shouldExit:!0}}const xn=[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`,`logLevel`];function Sn(e){return xn.includes(e)}function Cn(e){return[`trace`,`debug`,`info`,`warn`,`error`].includes(e)}function wn(){return i.join(s.homedir(),un,ln)}function Tn(){let e=wn();if(!r.existsSync(e))return{};try{let t=r.readFileSync(e,`utf8`);return JSON.parse(t)}catch{return{}}}function En(e){let t=wn(),n=i.dirname(t);r.existsSync(n)||r.mkdirSync(n,{recursive:!0}),r.writeFileSync(t,`${JSON.stringify(e,null,2)}\n`,`utf8`)}var Dn=class{name=`config`;constructor(e){this.options=e}async execute(e){let{logger:t}=e;if(this.options.length===0)return t.error(`No configuration key-value pairs provided`),t.info(`Usage: tnmsc config key=value`),t.info(`Valid keys: ${xn.join(`, `)}`),{success:!1,filesAffected:0,dirsAffected:0,message:`No options provided`};let n=Tn(),r=[],i=[];for(let[e,a]of this.options){if(!Sn(e)){r.push(`Invalid key: ${e} (valid keys: ${xn.join(`, `)})`);continue}if(e===`logLevel`&&!Cn(a)){r.push(`Invalid logLevel value: ${a} (must be: trace, debug, info, warn, or error)`);continue}let o=n[e];n[e]=a,o!==a&&i.push(`${e}=${a}`),t.info(`configuration updated`,{key:e,value:a})}if(i.length>0&&(En(n),t.info(`global config written`,{path:wn()})),r.length>0)for(let e of r)t.error(e);let a=r.length===0,o=a?`Configuration updated: ${i.join(`, `)}`:`Partial update: ${i.join(`, `)}. Errors: ${r.join(`, `)}`;return{success:a,filesAffected:i.length>0?1:0,dirsAffected:0,message:o}}},On=class{name=`config-show`;async execute(e){let{logger:t}=e,r=new mn,i=r.load(),a=i.sources.map(e=>{let t=r.loadFromFile(e);return{path:e,layer:this.inferLayer(e),config:t.config}}),o={merged:i.config,sources:a};return n.stdout.write(`${JSON.stringify(o)}\n`),t.info(`config shown`,{sources:i.sources.length}),{success:!0,filesAffected:0,dirsAffected:0,message:`Configuration displayed (${a.length} source(s))`}}inferLayer(e){let t=n.cwd();return e.startsWith(t)?`cwd`:`global`}},kn=class{name=`dry-run-clean`;async execute(e){let{logger:t,outputPlugins:n,createCleanContext:r}=e;t.info(`running clean pipeline`,{command:`dry-run-clean`,dryRun:!0});let i=r(!0),a=await gt(n,i);t.info(`collected outputs for cleanup`,{dryRun:!0,projectDirs:a.projectDirs.length,projectFiles:a.projectFiles.length,globalDirs:a.globalDirs.length,globalFiles:a.globalFiles.length});let{filesToDelete:o,dirsToDelete:s}=await xt(n,await _t(n,i),i);return this.logDryRunFiles(o,t),this.logDryRunDirectories(s,t),await vt(n,i),t.info(`clean complete`,{dryRun:!0,filesAffected:o.length,dirsAffected:s.length}),{success:!0,filesAffected:o.length,dirsAffected:s.length,message:`Dry-run complete, no files were deleted`}}logDryRunFiles(e,t){for(let n of e){let e=i.isAbsolute(n)?n:i.resolve(n);t.info(`would delete file`,{path:e,dryRun:!0})}}logDryRunDirectories(e,t){let n=[...e].sort((e,t)=>t.length-e.length);for(let e of n){let n=i.isAbsolute(e)?e:i.resolve(e);t.info(`would delete directory`,{path:n,dryRun:!0})}}},An=class{name=`dry-run-output`;async execute(e){let{logger:t,outputPlugins:n,createWriteContext:r}=e;t.info(`started`,{command:`dry-run-output`,dryRun:!0});let i=r(!0),a=await yt(n,i),o=await bt(n.filter(e=>!!(a.get(e.name)?.project??!0)),i),s=0,c=0;for(let[e,n]of o)s+=n.files.length,c+=n.dirs.length,t.info(`plugin result`,{plugin:e,files:n.files.length,dirs:n.dirs.length,dryRun:!0});return t.info(`complete`,{command:`dry-run-output`,totalFiles:s,totalDirs:c,dryRun:!0}),{success:!0,filesAffected:s,dirsAffected:c,message:`Dry-run complete, no files were written`}}},jn=class{name=`execute`;async execute(e){let{logger:t,outputPlugins:n,createCleanContext:r,createWriteContext:i}=e;t.info(`started`,{command:`execute`});let a=await Ct(n,r(!1),t,{executeHooks:!1});t.info(`cleanup complete`,{deletedFiles:a.deletedFiles,deletedDirs:a.deletedDirs});let o=i(!1),s=await yt(n,o),c=await bt(n.filter(e=>s.get(e.name)?.project??!0),o),l=0,u=0;for(let e of c.values())l+=e.files.length,u+=e.dirs.length;return t.info(`complete`,{command:`execute`,pluginCount:c.size}),{success:!0,filesAffected:l,dirsAffected:u}}};function Mn(){return`2026.10213.0`}var Nn=class{name=`version`;async execute(e){return e.logger.error(`tnmsc v${Mn()}`),{success:!0,filesAffected:0,dirsAffected:0,message:`Version displayed`}}};const Pn=`tnmsc`,Fn=`
|
|
957
|
+
`};const Kt=Object.fromEntries(Wt.map(e=>[e,{path:e,content:Gt[e]??``}])),qt={USER_HOME:`~`,WORKSPACE:`$WORKSPACE`,SHADOW_SOURCE_PROJECT:`$SHADOW_SOURCE_PROJECT`},Jt=JSON.parse(Kt[`public/tnmsc.example.json`].content),Yt={reset:`\x1B[0m`,red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,magenta:`\x1B[35m`,gray:`\x1B[90m`,blue:`\x1B[34m`,green:`\x1B[32m`,white:`\x1B[37m`,dim:`\x1B[2m`,bgRed:`\x1B[41m`},Xt={red:e=>`${Yt.red}${e}${Yt.reset}`,yellow:e=>`${Yt.yellow}${e}${Yt.reset}`,cyan:e=>`${Yt.cyan}${e}${Yt.reset}`,magenta:e=>`${Yt.magenta}${e}${Yt.reset}`,gray:e=>`${Yt.gray}${e}${Yt.reset}`,blue:e=>`${Yt.blue}${e}${Yt.reset}`,green:e=>`${Yt.green}${e}${Yt.reset}`,white:e=>`${Yt.white}${e}${Yt.reset}`,dim:e=>`${Yt.dim}${e}${Yt.reset}`,bgRed:e=>`${Yt.bgRed}${e}${Yt.reset}`};let Zt;const Qt={error:Xt.red,warn:Xt.yellow,info:Xt.cyan,debug:Xt.magenta,trace:Xt.gray,fatal:Xt.bgRed},$t={silent:0,fatal:1,error:2,warn:3,info:4,debug:5,trace:6};function en(e){if(e===null)return Xt.dim(`null`);if(e===void 0)return Xt.dim(`undefined`);if(typeof e==`boolean`)return Xt.yellow(String(e));if(typeof e==`number`)return Xt.blue(String(e));if(typeof e==`string`)return Xt.green(`"${e}"`);if(Array.isArray(e))return e.length===0?`[]`:`[${e.map(e=>en(e)).join(`,`)}]`;if(e instanceof Error){let t={name:e.name,message:e.message,stack:e.stack};for(let n of Object.getOwnPropertyNames(e))n!==`name`&&n!==`message`&&n!==`stack`&&(t[n]=e[n]);return tn(t)}return typeof e==`object`?tn(e):String(e)}function tn(e){let t=Object.entries(e);return t.length===0?`{}`:`{${t.map(([e,t])=>`${/^[\w$]+$/.test(e)?Xt.magenta(e):Xt.yellow(`"${e}"`)}:${en(t)}`).join(`,`)}}`}function nn(){let e=new Date;return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}.${String(e.getMilliseconds()).padStart(3,`0`)}`}function rn(e,t,n,r){let i=nn(),a=Qt[e]??Xt.white,o=String(n),s=r!=null&&Object.keys(r).length>0,c=o===``,l={$:[i,e,t],_:s?c?r:{[o]:r}:n},u={$:[i,a(e.toUpperCase()),t]},d=s?c?r:{[o]:r}:n,f=tn({...u,_:d});return e===`error`||e===`fatal`?console.error(f):e===`warn`?console.warn(f):e===`debug`||e===`trace`?console.debug(f):console.log(f),l}function an(e,t,n){let r=$t[e],i=$t[n];return(n,...a)=>r>i?{$:[nn(),e,t],_:n}:typeof n==`string`?rn(e,t,n,a.length===1&&typeof a[0]==`object`&&a[0]!==null?a[0]:a.length>0?{args:a}:void 0):typeof n==`object`&&n?rn(e,t,``,n):rn(e,t,n)}function on(e){Zt=e}function sn(){return Zt}function cn(e,t){let n=t??Zt??process.env.LOG_LEVEL??`info`;return{error:an(`error`,e,n),warn:an(`warn`,e,n),info:an(`info`,e,n),debug:an(`debug`,e,n),trace:an(`trace`,e,n),fatal:an(`fatal`,e,n)}}const ln=`.tnmsc.json`,un=`.aindex`;function dn(){return i.join(s.homedir(),un,ln)}function fn(){return{...Jt}}function pn(e,t){let n=dn(),a=i.dirname(n);r.existsSync(a)||r.mkdirSync(a,{recursive:!0}),r.writeFileSync(n,`${JSON.stringify(e,null,2)}\n`,`utf8`),t.info(`global config created`,{path:n})}var mn=class{configFileName;searchCwd;searchGlobal;customSearchPaths;logger;constructor(e={}){this.configFileName=e.configFileName??ln,this.searchCwd=e.searchCwd??!0,this.searchGlobal=e.searchGlobal??!0,this.customSearchPaths=e.searchPaths??[],this.logger=cn(`ConfigLoader`)}getSearchPaths(e=n.cwd()){let t=[];for(let e of this.customSearchPaths)t.push(this.resolveTilde(e));return this.searchCwd&&t.push(i.join(e,this.configFileName)),this.searchGlobal&&t.push(i.join(s.homedir(),un,this.configFileName)),t}loadFromFile(e){let t=this.resolveTilde(e);try{if(!r.existsSync(t))return{config:{},source:null,found:!1};let e=r.readFileSync(t,`utf8`),n=this.parseConfig(e,t);return this.logger.debug(`loaded`,{source:t}),{config:n,source:t,found:!0}}catch(e){return this.logger.warn(`load failed`,{path:t,error:e}),{config:{},source:null,found:!1}}}load(e=n.cwd()){let t=this.getSearchPaths(e),r=[];for(let e of t){let t=this.loadFromFile(e);t.found&&r.push(t)}return{config:this.mergeConfigs(r.map(e=>e.config)),sources:r.map(e=>e.source).filter(e=>e!==null),found:r.length>0}}parseConfig(e,t){try{let n=JSON.parse(e);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`Config must be a JSON object`);return this.validateConfig(n,t)}catch(e){throw e instanceof SyntaxError?Error(`Invalid JSON in ${t}: ${e.message}`):e}}validateConfig(e,t){let n={},r=[];for(let t of[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`])t in e&&(typeof e[t]==`string`?n[t]=e[t]:r.push(`${t} must be a string`));if(`logLevel`in e){let t=[`trace`,`debug`,`info`,`warn`,`error`],i=e.logLevel;typeof i==`string`&&t.includes(i)?n.logLevel=i:r.push(`logLevel must be one of: ${t.join(`, `)}`)}if(`externalProjects`in e){let t=e.externalProjects;Array.isArray(t)?t.every(e=>typeof e==`string`)?n.externalProjects=t:r.push(`externalProjects must be an array of strings`):r.push(`externalProjects must be an array`)}if(`excludePatterns`in e){let t=e.excludePatterns;if(typeof t==`object`&&t){let e=t,i={},a=!0;for(let[t,n]of Object.entries(e))Array.isArray(n)&&n.every(e=>typeof e==`string`)?i[t]=n:(r.push(`excludePatterns.${t} must be an array of strings`),a=!1);a&&(n.excludePatterns=i)}else r.push(`excludePatterns must be an object`)}if(`profile`in e){let t=e.profile;typeof t==`object`&&t&&!Array.isArray(t)?n.profile=t:r.push(`profile must be an object`)}if(`tool`in e){let t=e.tool;if(typeof t==`object`&&t&&!Array.isArray(t)){let e=t,i={},a=!0;for(let[t,n]of Object.entries(e))typeof n==`string`||n===void 0?i[t]=n:(r.push(`tool.${t} must be a string`),a=!1);a&&(n.tool=i)}else r.push(`tool must be an object`)}return r.length>0&&this.logger.warn(`validation warnings`,{path:t,errors:r}),n}mergeConfigs(e){if(e.length===0)return{};let t=e[0];return e.length===1&&t!=null?t:[...e].reverse().reduce((e,t)=>{let n=[...e.externalProjects??[],...t.externalProjects??[]],r=this.mergeExcludePatterns(e.excludePatterns,t.excludePatterns);return{...e,...t,...n.length>0?{externalProjects:n}:{},...r==null?{}:{excludePatterns:r}}},{})}mergeExcludePatterns(e,t){if(e==null&&t==null)return null;if(e==null)return t??null;if(t==null)return e;let n={...e};for(let[e,r]of Object.entries(t))n[e]=[...n[e]??[],...r];return n}resolveTilde(e){return e.startsWith(`~`)?i.join(s.homedir(),e.slice(1)):e}};let hn=null;function gn(e){return(e||!hn)&&(hn=new mn(e)),hn}function _n(e){return gn().load(e)}function vn(){let e=cn(`ConfigLoader`),t=dn();if(!r.existsSync(t))return e.warn(`global config not found, creating default config`,{path:t}),pn(fn(),e),{valid:!0,exists:!1,errors:[],shouldExit:!1};let n;try{n=r.readFileSync(t,`utf8`)}catch(n){let r=n instanceof Error?n.message:String(n);return e.error(`failed to read global config`,{path:t,error:r}),bn(t,e,[`Failed to read config: ${r}`])}let i;try{i=JSON.parse(n)}catch(n){let r=n instanceof Error?n.message:String(n);return e.error(`invalid JSON in global config`,{path:t,error:r}),bn(t,e,[`Invalid JSON: ${r}`])}if(typeof i!=`object`||!i||Array.isArray(i))return e.error(`global config must be a JSON object`,{path:t}),bn(t,e,[`Config must be a JSON object`]);let a=yn(i);if(a.length>0){for(let n of a)e.error(`config validation error`,{path:t,error:n});return bn(t,e,a)}return{valid:!0,exists:!0,errors:[],shouldExit:!1}}function yn(e){let t=[];for(let n of[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`])n in e&&typeof e[n]!=`string`&&t.push(`${n} must be a string`);if(`logLevel`in e){let n=[`trace`,`debug`,`info`,`warn`,`error`],r=e.logLevel;(typeof r!=`string`||!n.includes(r))&&t.push(`logLevel must be one of: ${n.join(`, `)}`)}if(`externalProjects`in e){let n=e.externalProjects;Array.isArray(n)?n.every(e=>typeof e==`string`)||t.push(`externalProjects must be an array of strings`):t.push(`externalProjects must be an array`)}if(`excludePatterns`in e){let n=e.excludePatterns;if(typeof n!=`object`||!n||Array.isArray(n))t.push(`excludePatterns must be an object`);else{let e=n;for(let[n,r]of Object.entries(e))(!Array.isArray(r)||!r.every(e=>typeof e==`string`))&&t.push(`excludePatterns.${n} must be an array of strings`)}}if(`profile`in e){let n=e.profile;(typeof n!=`object`||!n||Array.isArray(n))&&t.push(`profile must be an object`)}if(!(`tool`in e))return t;let n=e.tool;if(typeof n!=`object`||!n||Array.isArray(n))t.push(`tool must be an object`);else{let e=n;for(let[n,r]of Object.entries(e))typeof r!=`string`&&r!==void 0&&t.push(`tool.${n} must be a string`)}return t}function bn(e,t,n){try{r.unlinkSync(e),t.info(`deleted invalid config`,{path:e})}catch{t.warn(`failed to delete invalid config`,{path:e})}return pn(fn(),t),t.error(`recreated default config, please review and restart`,{path:e}),{valid:!1,exists:!0,errors:n,shouldExit:!0}}const xn=[`workspaceDir`,`shadowSourceProjectDir`,`shadowSkillSourceDir`,`shadowFastCommandDir`,`shadowSubAgentDir`,`globalMemoryFile`,`shadowProjectsDir`,`logLevel`];function Sn(e){return xn.includes(e)}function Cn(e){return[`trace`,`debug`,`info`,`warn`,`error`].includes(e)}function wn(){return i.join(s.homedir(),un,ln)}function Tn(){let e=wn();if(!r.existsSync(e))return{};try{let t=r.readFileSync(e,`utf8`);return JSON.parse(t)}catch{return{}}}function En(e){let t=wn(),n=i.dirname(t);r.existsSync(n)||r.mkdirSync(n,{recursive:!0}),r.writeFileSync(t,`${JSON.stringify(e,null,2)}\n`,`utf8`)}var Dn=class{name=`config`;constructor(e){this.options=e}async execute(e){let{logger:t}=e;if(this.options.length===0)return t.error(`No configuration key-value pairs provided`),t.info(`Usage: tnmsc config key=value`),t.info(`Valid keys: ${xn.join(`, `)}`),{success:!1,filesAffected:0,dirsAffected:0,message:`No options provided`};let n=Tn(),r=[],i=[];for(let[e,a]of this.options){if(!Sn(e)){r.push(`Invalid key: ${e} (valid keys: ${xn.join(`, `)})`);continue}if(e===`logLevel`&&!Cn(a)){r.push(`Invalid logLevel value: ${a} (must be: trace, debug, info, warn, or error)`);continue}let o=n[e];n[e]=a,o!==a&&i.push(`${e}=${a}`),t.info(`configuration updated`,{key:e,value:a})}if(i.length>0&&(En(n),t.info(`global config written`,{path:wn()})),r.length>0)for(let e of r)t.error(e);let a=r.length===0,o=a?`Configuration updated: ${i.join(`, `)}`:`Partial update: ${i.join(`, `)}. Errors: ${r.join(`, `)}`;return{success:a,filesAffected:i.length>0?1:0,dirsAffected:0,message:o}}},On=class{name=`config-show`;async execute(e){let{logger:t}=e,r=new mn,i=r.load(),a=i.sources.map(e=>{let t=r.loadFromFile(e);return{path:e,layer:this.inferLayer(e),config:t.config}}),o={merged:i.config,sources:a};return n.stdout.write(`${JSON.stringify(o)}\n`),t.info(`config shown`,{sources:i.sources.length}),{success:!0,filesAffected:0,dirsAffected:0,message:`Configuration displayed (${a.length} source(s))`}}inferLayer(e){let t=n.cwd();return e.startsWith(t)?`cwd`:`global`}},kn=class{name=`dry-run-clean`;async execute(e){let{logger:t,outputPlugins:n,createCleanContext:r}=e;t.info(`running clean pipeline`,{command:`dry-run-clean`,dryRun:!0});let i=r(!0),a=await gt(n,i);t.info(`collected outputs for cleanup`,{dryRun:!0,projectDirs:a.projectDirs.length,projectFiles:a.projectFiles.length,globalDirs:a.globalDirs.length,globalFiles:a.globalFiles.length});let{filesToDelete:o,dirsToDelete:s}=await xt(n,await _t(n,i),i);return this.logDryRunFiles(o,t),this.logDryRunDirectories(s,t),await vt(n,i),t.info(`clean complete`,{dryRun:!0,filesAffected:o.length,dirsAffected:s.length}),{success:!0,filesAffected:o.length,dirsAffected:s.length,message:`Dry-run complete, no files were deleted`}}logDryRunFiles(e,t){for(let n of e){let e=i.isAbsolute(n)?n:i.resolve(n);t.info(`would delete file`,{path:e,dryRun:!0})}}logDryRunDirectories(e,t){let n=[...e].sort((e,t)=>t.length-e.length);for(let e of n){let n=i.isAbsolute(e)?e:i.resolve(e);t.info(`would delete directory`,{path:n,dryRun:!0})}}},An=class{name=`dry-run-output`;async execute(e){let{logger:t,outputPlugins:n,createWriteContext:r}=e;t.info(`started`,{command:`dry-run-output`,dryRun:!0});let i=r(!0),a=await yt(n,i),o=await bt(n.filter(e=>!!(a.get(e.name)?.project??!0)),i),s=0,c=0;for(let[e,n]of o)s+=n.files.length,c+=n.dirs.length,t.info(`plugin result`,{plugin:e,files:n.files.length,dirs:n.dirs.length,dryRun:!0});return t.info(`complete`,{command:`dry-run-output`,totalFiles:s,totalDirs:c,dryRun:!0}),{success:!0,filesAffected:s,dirsAffected:c,message:`Dry-run complete, no files were written`}}},jn=class{name=`execute`;async execute(e){let{logger:t,outputPlugins:n,createCleanContext:r,createWriteContext:i}=e;t.info(`started`,{command:`execute`});let a=await Ct(n,r(!1),t,{executeHooks:!1});t.info(`cleanup complete`,{deletedFiles:a.deletedFiles,deletedDirs:a.deletedDirs});let o=i(!1),s=await yt(n,o),c=await bt(n.filter(e=>s.get(e.name)?.project??!0),o),l=0,u=0;for(let e of c.values())l+=e.files.length,u+=e.dirs.length;return t.info(`complete`,{command:`execute`,pluginCount:c.size}),{success:!0,filesAffected:l,dirsAffected:u}}};function Mn(){return`2026.10213.10155`}var Nn=class{name=`version`;async execute(e){return e.logger.error(`tnmsc v${Mn()}`),{success:!0,filesAffected:0,dirsAffected:0,message:`Version displayed`}}};const Pn=`tnmsc`,Fn=`
|
|
958
958
|
${Pn} v${Mn()} - Memory Sync CLI
|
|
959
959
|
|
|
960
960
|
Synchronize AI memory and configuration files across projects.
|
|
@@ -1008,7 +1008,7 @@ CONFIG OPTIONS:
|
|
|
1008
1008
|
CONFIGURATION:
|
|
1009
1009
|
Configure via plugin.config.ts in your project root.
|
|
1010
1010
|
See documentation for detailed configuration options.
|
|
1011
|
-
`.trim();var In=class{name=`help`;async execute(e){return console.log(Fn),{success:!0,filesAffected:0,dirsAffected:0,message:`Help displayed`}}};function Ln(e,t){let n=i.join(e,`.git`),a=r.existsSync(n);return a?t?.info(`version control detected`,{path:n}):t?.warn(`no version control detected, please use git to manage your shadow source project`,{path:e}),{hasGit:a,gitPath:n}}function Rn(e,t,n,a,o){if(n==null)return a;let s=i.relative(t,e),c=i.join(n,s);return r.existsSync(c)&&r.statSync(c).isFile()?(o?.debug(`copying from source`,{path:c}),r.readFileSync(c,`utf8`)):a}function zn(e,t={}){let{sourceDir:n,logger:a}=t,o=[],s=[],c=[],l=[],u=new Set;r.existsSync(e)?(c.push(e),a?.debug(`directory exists`,{path:e})):(r.mkdirSync(e,{recursive:!0}),o.push(e),u.add(e),a?.info(`created directory`,{path:e}));for(let t of Object.values(Kt)){let c=t.path,d=i.join(e,c),f=i.dirname(d);if(!r.existsSync(f)){r.mkdirSync(f,{recursive:!0});let t=f;for(;t!==e&&!u.has(t);)u.add(t),o.push(t),a?.info(`created directory`,{path:t}),t=i.dirname(t)}if(r.existsSync(d))l.push(d),a?.debug(`file exists`,{path:d});else{let i=Rn(d,e,n,t.content,a);r.writeFileSync(d,i,`utf8`),s.push(d),a?.info(`created file`,{path:d})}}return{success:!0,rootPath:e,createdDirs:o,createdFiles:s,existedDirs:c,existedFiles:l}}function Bn(e,t,n){let r=e;return r=r.replace(qt.SHADOW_SOURCE_PROJECT,n),r=r.replace(qt.WORKSPACE,t),r.startsWith(`~`)&&(r=i.join(s.homedir(),r.slice(1))),i.normalize(r)}var Vn=class{name=`init`;async execute(e){let{logger:t,userConfigOptions:n}=e;t.info(`initializing shadow source project structure`,{command:`init`});let r=Bn(n.workspaceDir,``,``),i=zn(Bn(n.shadowSourceProjectDir,r,``),{logger:t}),a=i.createdDirs.length===0&&i.createdFiles.length===0?`All ${i.existedDirs.length} directories and ${i.existedFiles.length} files already exist`:`Created ${i.createdDirs.length} directories and ${i.createdFiles.length} files (${i.existedDirs.length} dirs, ${i.existedFiles.length} files already existed)`;return t.info(`initialization complete`,{dirsCreated:i.createdDirs.length,filesCreated:i.createdFiles.length,dirsExisted:i.existedDirs.length,filesExisted:i.existedFiles.length}),{success:i.success,filesAffected:i.createdFiles.length,dirsAffected:i.createdDirs.length,message:a}}},Hn=class{name;inner;constructor(e){this.inner=e,this.name=`json:${e.name}`}async execute(e){let t=await this.inner.execute(e),r=Un(t);return n.stdout.write(`${JSON.stringify(r)}\n`),t}};function Un(e){return{success:e.success,filesAffected:e.filesAffected,dirsAffected:e.dirsAffected,...e.message!=null&&{message:e.message},pluginResults:[],errors:[]}}function Wn(){return`@truenine/memory-sync-cli`}function Gn(){return`https://registry.npmjs.org/${Wn()}/latest`}function Kn(e){let t=e.replace(/^v/,``),n=/^(\d+)\.(\d+)\.(\d+)/.exec(t);return n==null?null:[Number.parseInt(n[1],10),Number.parseInt(n[2],10),Number.parseInt(n[3],10)]}function qn(e,t){let n=Kn(e),r=Kn(t);if(n==null||r==null)return 0;for(let e=0;e<3;e++){if(n[e]<r[e])return-1;if(n[e]>r[e])return 1}return 0}const Jn=3e3;async function Yn(){let e=new AbortController,t=setTimeout(()=>e.abort(),Jn);typeof t==`object`&&`unref`in t&&t.unref();try{let n=await fetch(Gn(),{headers:{Accept:`application/json`},signal:e.signal});if(clearTimeout(t),!n.ok)return{error:`HTTP ${n.status}: ${n.statusText}`};let r=await n.json();return r.version==null?{error:`Invalid response: missing version field`}:{version:r.version}}catch(e){return clearTimeout(t),e instanceof Error?e.name===`TimeoutError`||e.name===`AbortError`?{error:`Request timeout after ${Jn}ms`}:{error:e.message}:{error:`Unknown network error`}}}function Xn(){return`2026.10213.0`}async function Zn(){let e=Xn();if(e===`dev`)return{status:`development`,localVersion:e,remoteVersion:null};let t=await Yn();if(`error`in t)return{status:`current`,localVersion:e,remoteVersion:null,error:t.error};let n=t.version,r=qn(e,n);return r<0?{status:`outdated`,localVersion:e,remoteVersion:n}:r>0?{status:`development`,localVersion:e,remoteVersion:n}:{status:`current`,localVersion:e,remoteVersion:n}}function Qn(e,t){let{status:n,localVersion:r,remoteVersion:i}=e;switch(n){case`outdated`:t.warn(`Version outdated: ${r} → ${i}. Run 'npm i -g ${Wn()}@latest' to update.`);break;case`current`:e.error==null?t.info(`Version ${r} is up to date.`):t.error(`Version check failed: ${e.error}`);break;case`development`:i==null?t.debug(`Running in development mode, version check skipped.`):t.info(`Development version detected: ${r} > ${i}. Thanks for contributing!`);break}}function $n(){return new Date().getMinutes()%2==0}function er(e){$n()&&Zn().then(t=>{(t.status===`outdated`||t.error!=null)&&Qn(t,e)}).catch(t=>{let n=t instanceof Error?t.message:`Unknown error`;e.error(`Version check failed: ${n}`)})}var tr=class{name=`outdated`;async execute(e){let t=await Zn();return Qn(t,e.logger),{success:!0,filesAffected:0,dirsAffected:0,message:`Version status: ${t.status}`}}},nr=class{name=`plugins`;async execute(e){let{logger:t,outputPlugins:r,userConfigOptions:i}=e,a=i.plugins,o=[];for(let e of a)o.push({name:e.name,kind:e.type===Tt.Input?`Input`:`Output`,description:e.name,dependencies:[...e.dependsOn??[]]});let s=new Set(o.map(e=>e.name));for(let e of r)s.has(e.name)||o.push({name:e.name,kind:`Output`,description:e.name,dependencies:[...e.dependsOn??[]]});return n.stdout.write(`${JSON.stringify(o)}\n`),t.info(`plugins listed`,{count:o.length}),{success:!0,filesAffected:0,dirsAffected:0,message:`Listed ${o.length} plugin(s)`}}},rr=class{name=`unknown`;constructor(e){this.unknownCmd=e}async execute(e){return console.error(`Unknown command: ${this.unknownCmd}`),console.error(`Run "tnmsc help" for available commands.`),{success:!1,filesAffected:0,dirsAffected:0}}};const ir={default:{websearch:`web_search`,webfetch:`web_fetch`,readFile:`read_file`,writeFile:`write_file`,executeCommand:`execute_command`,todolistWrite:`todolist_write`,grep:`grep`,listDirectory:`list_directory`},claudeCode:{readFile:`Read`,writeFile:`Write`,executeCommand:`Execute`,todolistWrite:`TodoWrite`,listDirectory:`List`},kiro:{websearch:`remote_web_search`,webfetch:`webFetch`,readFile:`readFile`,writeFile:`fsWrite`,executeCommand:`executeBash`,todolistWrite:`todolistWrite`,grep:`grepSearch`,listDirectory:`listDir`}};let ar=function(e){return e.Bash=`bash`,e.Zsh=`zsh`,e.Fish=`fish`,e.Sh=`sh`,e.PowerShell=`powershell`,e.Pwsh=`pwsh`,e.Cmd=`cmd`,e.Unknown=`unknown`,e}({}),or=function(e){return e.Win=`win`,e.Mac=`mac`,e.Linux=`linux`,e.Unknown=`unknown`,e}({});var sr=class{userConfig;toolPreset;constructor(e={}){this.userConfig=e.userConfig,this.toolPreset=e.toolPreset??`default`}collect(){return{os:this.collectOsInfo(),env:this.collectEnvContext(),profile:this.collectProfile(),tool:this.collectToolReferences(),Md:this.createMdComponent()}}collectOsInfo(){let e=s.platform();return{platform:e,arch:s.arch(),hostname:s.hostname(),homedir:s.homedir(),tmpdir:s.tmpdir(),type:s.type(),release:s.release(),shellKind:this.detectShellKind(),kind:this.detectOsKind(e)}}detectOsKind(e){switch(e){case`win32`:return or.Win;case`darwin`:return or.Mac;case`linux`:case`freebsd`:case`openbsd`:case`sunos`:case`aix`:return or.Linux;default:return or.Unknown}}detectShellKind(){let e=(n.env.SHELL??n.env.ComSpec??``).toLowerCase();return e.includes(`bash`)?ar.Bash:e.includes(`zsh`)?ar.Zsh:e.includes(`fish`)?ar.Fish:e.includes(`pwsh`)?ar.Pwsh:e.includes(`powershell`)?ar.PowerShell:e.includes(`cmd`)?ar.Cmd:e.endsWith(`/sh`)?ar.Sh:ar.Unknown}collectEnvContext(){return{...n.env}}collectProfile(){return this.userConfig?.profile==null?{}:this.userConfig.profile}collectToolReferences(){let e={...ir.default};return this.toolPreset===`claudeCode`?{...e,...ir.claudeCode}:this.toolPreset===`kiro`?{...e,...ir.kiro}:e}createMdComponent(){let e=(e=>e.when===!1?null:e.children);return e.Line=e=>e.when===!1?null:e.children,e}};let cr=function(e){return e[e.SystemDefault=0]=`SystemDefault`,e[e.UserConfig=10]=`UserConfig`,e[e.PluginRegistered=20]=`PluginRegistered`,e[e.CompileTime=30]=`CompileTime`,e}({});var lr=class{registrations=[];globalScope=null;setGlobalScope(e){this.globalScope=e}getGlobalScope(){return this.globalScope}register(e,t,n=cr.PluginRegistered){this.registrations.push({namespace:e,values:t,priority:n})}getRegistrations(){return this.registrations}merge(e){let t={};this.globalScope!=null&&(t.os={...this.globalScope.os},t.env={...this.globalScope.env},t.profile={...this.globalScope.profile},t.tool={...this.globalScope.tool});let n=[...this.registrations].sort((e,t)=>e.priority-t.priority);for(let e of n)t[e.namespace]=this.deepMerge(t[e.namespace],e.values);if(e!=null)for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r&&!Array.isArray(r)?this.deepMerge(t[n],r):r;return t}deepMerge(e,t){if(e==null)return{...t};let n={...e};for(let[e,r]of Object.entries(t))n[e]=typeof r==`object`&&r&&!Array.isArray(r)&&typeof n[e]==`object`&&n[e]!==null&&!Array.isArray(n[e])?this.deepMerge(n[e],r):r;return n}clear(){this.registrations.length=0,this.globalScope=null}};function ur(e){let t=[...e],n=t[0];n!=null&&dr(n)&&t.shift();let r=t[0];return r!=null&&fr(r)&&t.shift(),t}function dr(e){let t=[`node`,`nodejs`,`bun`,`deno`,`tsx`,`ts-node`,`npx`,`pnpx`,`yarn`,`pnpm`],n=e.toLowerCase().replaceAll(`\\`,`/`);return t.some(e=>RegExp(`(?:^|/)${e}(?:\\.exe|\\.cmd|\\.ps1)?$`,`i`).test(n)||n===e)}function fr(e){return/\.(?:m?[jt]s|cjs)$/.test(e)||/[/\\]/.test(e)&&!e.startsWith(`-`)?!0:/^(?:@[\w-]+\/)?[\w-]+$/.test(e)&&!e.startsWith(`-`)}const pr=new Set([`help`,`version`,`outdated`,`init`,`dry-run`,`clean`,`config`,`plugins`]),mr=new Map([[`--trace`,`trace`],[`--debug`,`debug`],[`--info`,`info`],[`--warn`,`warn`],[`--error`,`error`]]),hr=new Map([[`trace`,0],[`debug`,1],[`info`,2],[`warn`,3],[`error`,4]]);function gr(e){let{logLevelFlags:t}=e;if(t.length===0)return;let n=t[0],r=hr.get(n)??4;for(let e of t){let t=hr.get(e)??4;t<r&&(r=t,n=e)}return n}function _r(e){let{helpFlag:t,versionFlag:n,subcommand:r,dryRun:i,unknownCommand:a,setOption:o,positional:s,showFlag:c}=e;if(n)return new Nn;if(t)return new In;if(a!=null)return new rr(a);if(r===`version`)return new Nn;if(r===`help`)return new In;if(r===`outdated`)return new tr;if(r===`init`)return new Vn;if(r===`dry-run`)return new An;if(r===`clean`)return i?new kn:new wt;if(r===`plugins`)return new nr;if(r===`config`&&c)return new On;if(r!==`config`||o.length>0)return new jn;let l=[];for(let e of s){let t=e.indexOf(`=`);t>0&&l.push([e.slice(0,t),e.slice(t+1)])}return new Dn([...o,...l])}function vr(e){let t={subcommand:void 0,helpFlag:!1,versionFlag:!1,dryRun:!1,jsonFlag:!1,showFlag:!1,logLevel:void 0,logLevelFlags:[],setOption:[],unknownCommand:void 0,positional:[],unknown:[]},n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i!=null){if(i===`--`){t.positional.push(...e.slice(r+1).filter(e=>e!=null));break}if(i.startsWith(`--`)){let n=i.split(`=`),a=n[0]??``,o=mr.get(a);if(o!=null){t.logLevelFlags.push(o),t.logLevel=o;continue}switch(a){case`--help`:t.helpFlag=!0;break;case`--version`:t.versionFlag=!0;break;case`--dry-run`:t.dryRun=!0;break;case`--json`:t.jsonFlag=!0;break;case`--show`:t.showFlag=!0;break;case`--set`:if(n.length>1){let e=n.slice(1).join(`=`),r=e.indexOf(`=`);r>0&&t.setOption.push([e.slice(0,r),e.slice(r+1)])}else{let n=e[r+1];if(n!=null){let e=n.indexOf(`=`);e>0&&(t.setOption.push([n.slice(0,e),n.slice(e+1)]),r++)}}break;default:t.unknown.push(i)}continue}if(i.startsWith(`-`)&&i.length>1){let e=i.slice(1);for(let n of e)switch(n){case`h`:t.helpFlag=!0;break;case`v`:t.versionFlag=!0;break;case`n`:t.dryRun=!0;break;case`j`:t.jsonFlag=!0;break;default:t.unknown.push(`-${n}`)}continue}if(!n){n=!0,pr.has(i)?t.subcommand=i:t.unknownCommand=i;continue}t.positional.push(i)}}return t}var yr=class{logger;args;outputPlugins=[];constructor(...e){this.args=vr(ur(e.filter(e=>e!=null)));let t=gr(this.args);t!=null&&on(t),this.logger=cn(`PluginPipeline`,t),this.logger.debug(`initialized`,{args:this.args})}registerOutputPlugins(e){return this.outputPlugins.push(...e),this}async run(e){er(this.logger);let{context:t,outputPlugins:n,userConfigOptions:r}=e;this.registerOutputPlugins([...n]);let i=this.resolveCommand();this.args.jsonFlag&&(on(`silent`),new Set([`config-show`,`plugins`]).has(i.name)||(i=new Hn(i)));let a=this.createCommandContext(t,r);await i.execute(a)}resolveCommand(){return _r(this.args)}createCommandContext(e,t){return{logger:this.logger,outputPlugins:this.outputPlugins,collectedInputContext:e,userConfigOptions:t,createCleanContext:t=>this.createCleanContext(e,t),createWriteContext:t=>this.createWriteContext(e,t)}}createCleanContext(e,t){return{logger:this.logger,fs:r,path:i,glob:et.default,collectedInputContext:e,dryRun:t}}createWriteContext(e,t){return{logger:this.logger,fs:r,path:i,glob:et.default,collectedInputContext:e,dryRun:t,registeredPluginNames:this.outputPlugins.map(e=>e.name)}}buildDependencyGraph(e){let t=new Map;for(let n of e){let e=n.dependsOn??[];t.set(n.name,[...e])}return t}validateDependencies(e){let t=new Set(e.map(e=>e.name));for(let n of e){let e=n.dependsOn??[];for(let r of e)if(!t.has(r))throw new Mt(n.name,r)}}topologicalSort(e){this.validateDependencies(e);let t=new Map;for(let n of e)t.set(n.name,n);let n=new Map;for(let t of e)n.set(t.name,0);let r=new Map;for(let t of e)r.set(t.name,[]);for(let t of e){let e=t.dependsOn??[];for(let i of e){n.set(t.name,(n.get(t.name)??0)+1);let e=r.get(i)??[];e.push(t.name),r.set(i,e)}}let i=[];for(let t of e)n.get(t.name)===0&&i.push(t.name);let a=[];for(;i.length>0;){let o=i.shift(),s=t.get(o);a.push(s);let c=(r.get(o)??[]).sort((t,n)=>e.findIndex(e=>e.name===t)-e.findIndex(e=>e.name===n));for(let e of c){let t=(n.get(e)??0)-1;n.set(e,t),t===0&&i.push(e)}}if(a.length===e.length)return a;throw new jt(this.findCyclePath(e,n))}findCyclePath(e,t){let n=new Set;for(let[e,r]of t)r>0&&n.add(e);let r=new Map;for(let t of e)if(n.has(t.name)){let e=(t.dependsOn??[]).filter(e=>n.has(e));r.set(t.name,e)}let i=new Set,a=[],o=e=>{if(a.includes(e))return a.push(e),!0;if(i.has(e))return!1;i.add(e),a.push(e);for(let t of r.get(e)??[])if(o(t))return!0;return a.pop(),!1};for(let e of n){if(o(e)){let e=a.indexOf(a.at(-1));return a.slice(e)}i.clear(),a.length=0}return[...n]}async executePluginsInOrder(e,t,n=!1,r){if(e.length===0)return{};let i=this.topologicalSort(e),a=new sr({userConfig:r}).collect(),o=new lr;o.setGlobalScope(a),this.logger.debug(`global scope collected`,{osInfo:{platform:a.os.platform,arch:a.os.arch,shellKind:a.os.shellKind},hasProfile:Object.keys(a.profile).length>0,hasTool:Object.keys(a.tool).length>0});let s=new Map,c={};for(let e of i){let r=this.buildDependencyContext(e,s),i={...t,dependencyContext:r,globalScope:a,scopeRegistry:o},l=e;l.executeEffects!=null&&await l.executeEffects(i,n);let u=await e.collect(i);s.set(e.name,u),c=this.mergeContexts(c,u);let d=e;if(d.getRegisteredScopes!=null){let t=d.getRegisteredScopes();for(let{namespace:n,values:r}of t)o.register(n,r,cr.PluginRegistered),this.logger.debug(`plugin scope registered`,{plugin:e.name,namespace:n,keys:Object.keys(r)})}}return c}buildDependencyContext(e,t){if((e.dependsOn??[]).length===0)return{};let n=this.collectTransitiveDependencies(e,t),r={};for(let e of n){let n=t.get(e);n!=null&&(r=this.mergeContexts(r,n))}return r}collectTransitiveDependencies(e,t){let n=new Set,r=[];return(e=>{for(let i of e)n.has(i)||(n.add(i),t.get(i)!=null&&r.push(i))})(e.dependsOn??[]),r}mergeContexts(e,t){let{workspace:n}=e;if(t.workspace!=null)if(n!=null){let e=new Map;for(let t of n.projects)e.set(t.name,t);for(let n of t.workspace.projects)e.set(n.name,n);n={directory:t.workspace.directory??n.directory,projects:[...e.values()]}}else ({workspace:n}=t);let r=t.externalProjects==null?e.externalProjects:[...e.externalProjects??[],...t.externalProjects],i=t.ideConfigFiles==null?e.ideConfigFiles:[...e.ideConfigFiles??[],...t.ideConfigFiles],a=t.fastCommands==null?e.fastCommands:[...e.fastCommands??[],...t.fastCommands],o=t.subAgents==null?e.subAgents:[...e.subAgents??[],...t.subAgents],s=t.skills==null?e.skills:[...e.skills??[],...t.skills],c=t.aiAgentIgnoreConfigFiles==null?e.aiAgentIgnoreConfigFiles:[...e.aiAgentIgnoreConfigFiles??[],...t.aiAgentIgnoreConfigFiles],l=t.globalMemory??e.globalMemory,u=t.shadowSourceProjectDir??e.shadowSourceProjectDir,d=t.readmePrompts==null?e.readmePrompts:[...e.readmePrompts??[],...t.readmePrompts],f=t.globalGitIgnore??e.globalGitIgnore,p=t.shadowGitExclude??e.shadowGitExclude;return{...n==null?{}:{workspace:n},...r==null?{}:{externalProjects:r},...i==null?{}:{ideConfigFiles:i},...a==null?{}:{fastCommands:a},...o==null?{}:{subAgents:o},...s==null?{}:{skills:s},...c==null?{}:{aiAgentIgnoreConfigFiles:c},...l==null?{}:{globalMemory:l},...u==null?{}:{shadowSourceProjectDir:u},...d==null?{}:{readmePrompts:d},...f==null?{}:{globalGitIgnore:f},...p==null?{}:{shadowGitExclude:p}}}};const br={...Jt,externalProjects:[],excludePatterns:{},fastCommandSeriesOptions:{},plugins:[]};function xr(e){return{...e.workspaceDir==null?{}:{workspaceDir:e.workspaceDir},...e.shadowSourceProjectDir==null?{}:{shadowSourceProjectDir:e.shadowSourceProjectDir},...e.shadowSkillSourceDir==null?{}:{shadowSkillSourceDir:e.shadowSkillSourceDir},...e.shadowFastCommandDir==null?{}:{shadowFastCommandDir:e.shadowFastCommandDir},...e.shadowSubAgentDir==null?{}:{shadowSubAgentDir:e.shadowSubAgentDir},...e.globalMemoryFile==null?{}:{globalMemoryFile:e.globalMemoryFile},...e.shadowProjectsDir==null?{}:{shadowProjectsDir:e.shadowProjectsDir},...e.externalProjects==null?{}:{externalProjects:e.externalProjects},...e.excludePatterns==null?{}:{excludePatterns:e.excludePatterns},...e.fastCommandSeriesOptions==null?{}:{fastCommandSeriesOptions:e.fastCommandSeriesOptions},...e.logLevel==null?{}:{logLevel:e.logLevel}}}function Sr(...e){return e.reduce((e,t)=>Cr(e,t),{...br})}function Cr(e,t){let n=t.externalProjects,r=t.plugins,i=t.excludePatterns,a=t.fastCommandSeriesOptions;return{...e,...t,externalProjects:[...e.externalProjects,...n??[]],plugins:[...e.plugins,...r??[]],excludePatterns:wr(e.excludePatterns,i),fastCommandSeriesOptions:Tr(e.fastCommandSeriesOptions,a)}}function wr(e,t){let n={...e};if(t)for(let[e,r]of Object.entries(t))n[e]=[...n[e]??[],...r];return n}function Tr(e,t){if(t==null)return e??{};if(e==null)return t;let n={};if(e.pluginOverrides!=null)for(let[t,r]of Object.entries(e.pluginOverrides))n[t]={...r};if(t.pluginOverrides!=null)for(let[e,r]of Object.entries(t.pluginOverrides))n[e]={...n[e],...r};let r=t.includeSeriesPrefix??e.includeSeriesPrefix,i=Object.keys(n).length>0;return r!=null&&i?{includeSeriesPrefix:r,pluginOverrides:n}:r==null?i?{pluginOverrides:n}:{}:{includeSeriesPrefix:r}}function Er(e){return`pluginOptions`in e||`configLoaderOptions`in e||`loadUserConfig`in e}async function Dr(e={}){vn().shouldExit&&n.exit(1);let t,a,o;Er(e)?({pluginOptions:o={},cwd:a}={pluginOptions:e.pluginOptions,cwd:e.cwd},t=e.loadUserConfig??!0):(o=e,t=!0);let s={},c=!1,l=[],u;if(t){let e=_n(a);c=e.found,l=e.sources,e.found&&(s=xr(e.config),u=e.config)}let d=Sr(s,o),{plugins:f=[],logLevel:p}=d,m=cn(`defineConfig`,p);c?m.info(`user config loaded`,{sources:l}):m.info(`no user config found, using defaults`,{workspaceDir:br.workspaceDir,shadowSourceProjectDir:br.shadowSourceProjectDir,shadowSkillSourceDir:br.shadowSkillSourceDir,shadowFastCommandDir:br.shadowFastCommandDir,shadowSubAgentDir:br.shadowSubAgentDir,globalMemoryFile:br.globalMemoryFile,shadowProjectsDir:br.shadowProjectsDir,logLevel:br.logLevel});let h={logger:m,userConfigOptions:d,fs:r,path:i,glob:et.default},g=f.filter(e=>e.type===Tt.Input),_=f.filter(e=>e.type===Tt.Output),v=await new yr().executePluginsInOrder(g,h,!1,u);if(v.workspace==null)throw Error(`Workspace not initialized by any plugin`);let y={workspace:v.workspace,ideConfigFiles:v.ideConfigFiles??[],...v.externalProjects!=null&&{externalProjects:v.externalProjects},...v.fastCommands!=null&&{fastCommands:v.fastCommands},...v.subAgents!=null&&{subAgents:v.subAgents},...v.skills!=null&&{skills:v.skills},...v.globalMemory!=null&&{globalMemory:v.globalMemory},...v.aiAgentIgnoreConfigFiles!=null&&{aiAgentIgnoreConfigFiles:v.aiAgentIgnoreConfigFiles},...v.shadowSourceProjectDir!=null&&{shadowSourceProjectDir:v.shadowSourceProjectDir},...v.readmePrompts!=null&&{readmePrompts:v.readmePrompts},...v.globalGitIgnore!=null&&{globalGitIgnore:v.globalGitIgnore},...v.shadowGitExclude!=null&&{shadowGitExclude:v.shadowGitExclude}};return v.shadowSourceProjectDir!=null&&Ln(v.shadowSourceProjectDir,m),{context:y,outputPlugins:_,userConfigOptions:d}}const Or=Lr(/[A-Za-z]/),kr=Lr(/[\dA-Za-z]/),Ar=Lr(/[#-'*+\--9=?A-Z^-~]/);function jr(e){return e!==null&&(e<32||e===127)}const Mr=Lr(/\d/),Nr=Lr(/[\dA-Fa-f]/),Pr=Lr(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function V(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}const Fr=Lr(/\p{P}|\p{S}/u),Ir=Lr(/\s/);function Lr(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var Rr=S(y(((e,t)=>{(function(){var e=t===void 0?function(){return this||(0,eval)(`this`)}():t.exports=i;e.format=i,e.vsprintf=r,typeof console<`u`&&typeof console.log==`function`&&(e.printf=n);function n(){console.log(i.apply(null,arguments))}function r(e,t){return i.apply(null,[e].concat(t))}function i(e){for(var t=1,n=[].slice.call(arguments),r=0,i=e.length,a=``,o,s=!1,c,l,u=!1,d,f=function(){return n[t++]},p=function(){for(var t=``;/\d/.test(e[r]);)t+=e[r++],o=e[r];return t.length>0?parseInt(t):null};r<i;++r)if(o=e[r],s)switch(s=!1,o==`.`?(u=!1,o=e[++r]):o==`0`&&e[r+1]==`.`?(u=!0,r+=2,o=e[r]):u=!0,d=p(),o){case`b`:a+=parseInt(f(),10).toString(2);break;case`c`:c=f(),typeof c==`string`||c instanceof String?a+=c:a+=String.fromCharCode(parseInt(c,10));break;case`d`:a+=parseInt(f(),10);break;case`f`:l=String(parseFloat(f()).toFixed(d||6)),a+=u?l:l.replace(/^0/,``);break;case`j`:a+=JSON.stringify(f());break;case`o`:a+=`0`+parseInt(f(),10).toString(8);break;case`s`:a+=f();break;case`x`:a+=`0x`+parseInt(f(),10).toString(16);break;case`X`:a+=`0x`+parseInt(f(),10).toString(16).toUpperCase();break;default:a+=o;break}else o===`%`?s=!0:a+=o;return a}})()}))(),1);const zr=Object.assign(Br(Error),{eval:Br(EvalError),range:Br(RangeError),reference:Br(ReferenceError),syntax:Br(SyntaxError),type:Br(TypeError),uri:Br(URIError)});function Br(e){return t.displayName=e.displayName||e.name,t;function t(t,...n){return new e(t&&(0,Rr.default)(t,...n))}}const Vr={}.hasOwnProperty,Hr={yaml:`-`,toml:`+`};function Ur(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:[`yaml`];for(;++n<r.length;)t[n]=Wr(r[n]);return t}function Wr(e){let t=e;if(typeof t==`string`){if(!Vr.call(Hr,t))throw zr("Missing matter definition for `%s`",t);t={type:t,marker:Hr[t]}}else if(typeof t!=`object`)throw zr("Expected matter to be an object, not `%j`",t);if(!Vr.call(t,`type`))throw zr("Missing `type` in matter `%j`",t);if(!Vr.call(t,`fence`)&&!Vr.call(t,`marker`))throw zr("Missing `marker` or `fence` in matter `%j`",t);return t}function Gr(e){let t=Ur(e),n={},r=-1;for(;++r<t.length;){let e=t[r],i=qr(e,`open`).charCodeAt(0),a=Kr(e),o=n[i];Array.isArray(o)?o.push(a):n[i]=[a]}return{flow:n}}function Kr(e){let t=e.anywhere,n=e.type,r=n+`Fence`,i=r+`Sequence`,a=n+`Value`,o={tokenize:u,partial:!0},s,c=0;return{tokenize:l,concrete:!0};function l(l,u,d){let f=this;return p;function p(a){let o=f.now();return o.column===1&&(o.line===1||t)&&(s=qr(e,`open`),c=0,a===s.charCodeAt(c))?(l.enter(n),l.enter(r),l.enter(i),m(a)):d(a)}function m(e){return c===s.length?(l.exit(i),H(e)?(l.enter(`whitespace`),h(e)):g(e)):e===s.charCodeAt(c++)?(l.consume(e),m):d(e)}function h(e){return H(e)?(l.consume(e),h):(l.exit(`whitespace`),g(e))}function g(t){return B(t)?(l.exit(r),l.enter(`lineEnding`),l.consume(t),l.exit(`lineEnding`),s=qr(e,`close`),c=0,l.attempt(o,b,_)):d(t)}function _(e){return e===null||B(e)?y(e):(l.enter(a),v(e))}function v(e){return e===null||B(e)?(l.exit(a),y(e)):(l.consume(e),v)}function y(e){return e===null?d(e):(l.enter(`lineEnding`),l.consume(e),l.exit(`lineEnding`),l.attempt(o,b,_))}function b(e){return l.exit(n),u(e)}}function u(e,t,n){let a=0;return o;function o(t){return t===s.charCodeAt(a)?(e.enter(r),e.enter(i),c(t)):n(t)}function c(t){return a===s.length?(e.exit(i),H(t)?(e.enter(`whitespace`),l(t)):u(t)):t===s.charCodeAt(a++)?(e.consume(t),c):n(t)}function l(t){return H(t)?(e.consume(t),l):(e.exit(`whitespace`),u(t))}function u(i){return i===null||B(i)?(e.exit(r),t(i)):n(i)}}}function qr(e,t){return e.marker?Jr(e.marker,t).repeat(3):Jr(e.fence,t)}function Jr(e,t){return typeof e==`string`?e:e[t]}function Yr(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Xr(e){let t=Ur(e),n={},r={},i=-1;for(;++i<t.length;){let e=t[i];n[e.type]=Zr(e),r[e.type]=Qr,r[e.type+`Value`]=$r}return{enter:n,exit:r}}function Zr(e){return t;function t(t){this.enter({type:e.type,value:``},t),this.buffer()}}function Qr(e){let t=this.resume(),n=this.stack[this.stack.length-1];`value`in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``)}function $r(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function ei(e){let t=[],n={},r=Ur(e),i=-1;for(;++i<r.length;){let e=r[i];n[e.type]=ti(e);let a=ni(e,`open`);t.push({atBreak:!0,character:a.charAt(0),after:Yr(a.charAt(1))})}return{unsafe:t,handlers:n}}function ti(e){let t=ni(e,`open`),n=ni(e,`close`);return r;function r(e){return t+(e.value?`
|
|
1011
|
+
`.trim();var In=class{name=`help`;async execute(e){return console.log(Fn),{success:!0,filesAffected:0,dirsAffected:0,message:`Help displayed`}}};function Ln(e,t){let n=i.join(e,`.git`),a=r.existsSync(n);return a?t?.info(`version control detected`,{path:n}):t?.warn(`no version control detected, please use git to manage your shadow source project`,{path:e}),{hasGit:a,gitPath:n}}function Rn(e,t,n,a,o){if(n==null)return a;let s=i.relative(t,e),c=i.join(n,s);return r.existsSync(c)&&r.statSync(c).isFile()?(o?.debug(`copying from source`,{path:c}),r.readFileSync(c,`utf8`)):a}function zn(e,t={}){let{sourceDir:n,logger:a}=t,o=[],s=[],c=[],l=[],u=new Set;r.existsSync(e)?(c.push(e),a?.debug(`directory exists`,{path:e})):(r.mkdirSync(e,{recursive:!0}),o.push(e),u.add(e),a?.info(`created directory`,{path:e}));for(let t of Object.values(Kt)){let c=t.path,d=i.join(e,c),f=i.dirname(d);if(!r.existsSync(f)){r.mkdirSync(f,{recursive:!0});let t=f;for(;t!==e&&!u.has(t);)u.add(t),o.push(t),a?.info(`created directory`,{path:t}),t=i.dirname(t)}if(r.existsSync(d))l.push(d),a?.debug(`file exists`,{path:d});else{let i=Rn(d,e,n,t.content,a);r.writeFileSync(d,i,`utf8`),s.push(d),a?.info(`created file`,{path:d})}}return{success:!0,rootPath:e,createdDirs:o,createdFiles:s,existedDirs:c,existedFiles:l}}function Bn(e,t,n){let r=e;return r=r.replace(qt.SHADOW_SOURCE_PROJECT,n),r=r.replace(qt.WORKSPACE,t),r.startsWith(`~`)&&(r=i.join(s.homedir(),r.slice(1))),i.normalize(r)}var Vn=class{name=`init`;async execute(e){let{logger:t,userConfigOptions:n}=e;t.info(`initializing shadow source project structure`,{command:`init`});let r=Bn(n.workspaceDir,``,``),i=zn(Bn(n.shadowSourceProjectDir,r,``),{logger:t}),a=i.createdDirs.length===0&&i.createdFiles.length===0?`All ${i.existedDirs.length} directories and ${i.existedFiles.length} files already exist`:`Created ${i.createdDirs.length} directories and ${i.createdFiles.length} files (${i.existedDirs.length} dirs, ${i.existedFiles.length} files already existed)`;return t.info(`initialization complete`,{dirsCreated:i.createdDirs.length,filesCreated:i.createdFiles.length,dirsExisted:i.existedDirs.length,filesExisted:i.existedFiles.length}),{success:i.success,filesAffected:i.createdFiles.length,dirsAffected:i.createdDirs.length,message:a}}},Hn=class{name;inner;constructor(e){this.inner=e,this.name=`json:${e.name}`}async execute(e){let t=await this.inner.execute(e),r=Un(t);return n.stdout.write(`${JSON.stringify(r)}\n`),t}};function Un(e){return{success:e.success,filesAffected:e.filesAffected,dirsAffected:e.dirsAffected,...e.message!=null&&{message:e.message},pluginResults:[],errors:[]}}function Wn(){return`@truenine/memory-sync-cli`}function Gn(){return`https://registry.npmjs.org/${Wn()}/latest`}function Kn(e){let t=e.replace(/^v/,``),n=/^(\d+)\.(\d+)\.(\d+)/.exec(t);return n==null?null:[Number.parseInt(n[1],10),Number.parseInt(n[2],10),Number.parseInt(n[3],10)]}function qn(e,t){let n=Kn(e),r=Kn(t);if(n==null||r==null)return 0;for(let e=0;e<3;e++){if(n[e]<r[e])return-1;if(n[e]>r[e])return 1}return 0}const Jn=3e3;async function Yn(){let e=new AbortController,t=setTimeout(()=>e.abort(),Jn);typeof t==`object`&&`unref`in t&&t.unref();try{let n=await fetch(Gn(),{headers:{Accept:`application/json`},signal:e.signal});if(clearTimeout(t),!n.ok)return{error:`HTTP ${n.status}: ${n.statusText}`};let r=await n.json();return r.version==null?{error:`Invalid response: missing version field`}:{version:r.version}}catch(e){return clearTimeout(t),e instanceof Error?e.name===`TimeoutError`||e.name===`AbortError`?{error:`Request timeout after ${Jn}ms`}:{error:e.message}:{error:`Unknown network error`}}}function Xn(){return`2026.10213.10155`}async function Zn(){let e=Xn();if(e===`dev`)return{status:`development`,localVersion:e,remoteVersion:null};let t=await Yn();if(`error`in t)return{status:`current`,localVersion:e,remoteVersion:null,error:t.error};let n=t.version,r=qn(e,n);return r<0?{status:`outdated`,localVersion:e,remoteVersion:n}:r>0?{status:`development`,localVersion:e,remoteVersion:n}:{status:`current`,localVersion:e,remoteVersion:n}}function Qn(e,t){let{status:n,localVersion:r,remoteVersion:i}=e;switch(n){case`outdated`:t.warn(`Version outdated: ${r} → ${i}. Run 'npm i -g ${Wn()}@latest' to update.`);break;case`current`:e.error==null?t.info(`Version ${r} is up to date.`):t.error(`Version check failed: ${e.error}`);break;case`development`:i==null?t.debug(`Running in development mode, version check skipped.`):t.info(`Development version detected: ${r} > ${i}. Thanks for contributing!`);break}}function $n(){return new Date().getMinutes()%2==0}function er(e){$n()&&Zn().then(t=>{(t.status===`outdated`||t.error!=null)&&Qn(t,e)}).catch(t=>{let n=t instanceof Error?t.message:`Unknown error`;e.error(`Version check failed: ${n}`)})}var tr=class{name=`outdated`;async execute(e){let t=await Zn();return Qn(t,e.logger),{success:!0,filesAffected:0,dirsAffected:0,message:`Version status: ${t.status}`}}},nr=class{name=`plugins`;async execute(e){let{logger:t,outputPlugins:r,userConfigOptions:i}=e,a=i.plugins,o=[];for(let e of a)o.push({name:e.name,kind:e.type===Tt.Input?`Input`:`Output`,description:e.name,dependencies:[...e.dependsOn??[]]});let s=new Set(o.map(e=>e.name));for(let e of r)s.has(e.name)||o.push({name:e.name,kind:`Output`,description:e.name,dependencies:[...e.dependsOn??[]]});return n.stdout.write(`${JSON.stringify(o)}\n`),t.info(`plugins listed`,{count:o.length}),{success:!0,filesAffected:0,dirsAffected:0,message:`Listed ${o.length} plugin(s)`}}},rr=class{name=`unknown`;constructor(e){this.unknownCmd=e}async execute(e){return console.error(`Unknown command: ${this.unknownCmd}`),console.error(`Run "tnmsc help" for available commands.`),{success:!1,filesAffected:0,dirsAffected:0}}};const ir={default:{websearch:`web_search`,webfetch:`web_fetch`,readFile:`read_file`,writeFile:`write_file`,executeCommand:`execute_command`,todolistWrite:`todolist_write`,grep:`grep`,listDirectory:`list_directory`},claudeCode:{readFile:`Read`,writeFile:`Write`,executeCommand:`Execute`,todolistWrite:`TodoWrite`,listDirectory:`List`},kiro:{websearch:`remote_web_search`,webfetch:`webFetch`,readFile:`readFile`,writeFile:`fsWrite`,executeCommand:`executeBash`,todolistWrite:`todolistWrite`,grep:`grepSearch`,listDirectory:`listDir`}};let ar=function(e){return e.Bash=`bash`,e.Zsh=`zsh`,e.Fish=`fish`,e.Sh=`sh`,e.PowerShell=`powershell`,e.Pwsh=`pwsh`,e.Cmd=`cmd`,e.Unknown=`unknown`,e}({}),or=function(e){return e.Win=`win`,e.Mac=`mac`,e.Linux=`linux`,e.Unknown=`unknown`,e}({});var sr=class{userConfig;toolPreset;constructor(e={}){this.userConfig=e.userConfig,this.toolPreset=e.toolPreset??`default`}collect(){return{os:this.collectOsInfo(),env:this.collectEnvContext(),profile:this.collectProfile(),tool:this.collectToolReferences(),Md:this.createMdComponent()}}collectOsInfo(){let e=s.platform();return{platform:e,arch:s.arch(),hostname:s.hostname(),homedir:s.homedir(),tmpdir:s.tmpdir(),type:s.type(),release:s.release(),shellKind:this.detectShellKind(),kind:this.detectOsKind(e)}}detectOsKind(e){switch(e){case`win32`:return or.Win;case`darwin`:return or.Mac;case`linux`:case`freebsd`:case`openbsd`:case`sunos`:case`aix`:return or.Linux;default:return or.Unknown}}detectShellKind(){let e=(n.env.SHELL??n.env.ComSpec??``).toLowerCase();return e.includes(`bash`)?ar.Bash:e.includes(`zsh`)?ar.Zsh:e.includes(`fish`)?ar.Fish:e.includes(`pwsh`)?ar.Pwsh:e.includes(`powershell`)?ar.PowerShell:e.includes(`cmd`)?ar.Cmd:e.endsWith(`/sh`)?ar.Sh:ar.Unknown}collectEnvContext(){return{...n.env}}collectProfile(){return this.userConfig?.profile==null?{}:this.userConfig.profile}collectToolReferences(){let e={...ir.default};return this.toolPreset===`claudeCode`?{...e,...ir.claudeCode}:this.toolPreset===`kiro`?{...e,...ir.kiro}:e}createMdComponent(){let e=(e=>e.when===!1?null:e.children);return e.Line=e=>e.when===!1?null:e.children,e}};let cr=function(e){return e[e.SystemDefault=0]=`SystemDefault`,e[e.UserConfig=10]=`UserConfig`,e[e.PluginRegistered=20]=`PluginRegistered`,e[e.CompileTime=30]=`CompileTime`,e}({});var lr=class{registrations=[];globalScope=null;setGlobalScope(e){this.globalScope=e}getGlobalScope(){return this.globalScope}register(e,t,n=cr.PluginRegistered){this.registrations.push({namespace:e,values:t,priority:n})}getRegistrations(){return this.registrations}merge(e){let t={};this.globalScope!=null&&(t.os={...this.globalScope.os},t.env={...this.globalScope.env},t.profile={...this.globalScope.profile},t.tool={...this.globalScope.tool});let n=[...this.registrations].sort((e,t)=>e.priority-t.priority);for(let e of n)t[e.namespace]=this.deepMerge(t[e.namespace],e.values);if(e!=null)for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r&&!Array.isArray(r)?this.deepMerge(t[n],r):r;return t}deepMerge(e,t){if(e==null)return{...t};let n={...e};for(let[e,r]of Object.entries(t))n[e]=typeof r==`object`&&r&&!Array.isArray(r)&&typeof n[e]==`object`&&n[e]!==null&&!Array.isArray(n[e])?this.deepMerge(n[e],r):r;return n}clear(){this.registrations.length=0,this.globalScope=null}};function ur(e){let t=[...e],n=t[0];n!=null&&dr(n)&&t.shift();let r=t[0];return r!=null&&fr(r)&&t.shift(),t}function dr(e){let t=[`node`,`nodejs`,`bun`,`deno`,`tsx`,`ts-node`,`npx`,`pnpx`,`yarn`,`pnpm`],n=e.toLowerCase().replaceAll(`\\`,`/`);return t.some(e=>RegExp(`(?:^|/)${e}(?:\\.exe|\\.cmd|\\.ps1)?$`,`i`).test(n)||n===e)}function fr(e){return/\.(?:m?[jt]s|cjs)$/.test(e)||/[/\\]/.test(e)&&!e.startsWith(`-`)?!0:/^(?:@[\w-]+\/)?[\w-]+$/.test(e)&&!e.startsWith(`-`)}const pr=new Set([`help`,`version`,`outdated`,`init`,`dry-run`,`clean`,`config`,`plugins`]),mr=new Map([[`--trace`,`trace`],[`--debug`,`debug`],[`--info`,`info`],[`--warn`,`warn`],[`--error`,`error`]]),hr=new Map([[`trace`,0],[`debug`,1],[`info`,2],[`warn`,3],[`error`,4]]);function gr(e){let{logLevelFlags:t}=e;if(t.length===0)return;let n=t[0],r=hr.get(n)??4;for(let e of t){let t=hr.get(e)??4;t<r&&(r=t,n=e)}return n}function _r(e){let{helpFlag:t,versionFlag:n,subcommand:r,dryRun:i,unknownCommand:a,setOption:o,positional:s,showFlag:c}=e;if(n)return new Nn;if(t)return new In;if(a!=null)return new rr(a);if(r===`version`)return new Nn;if(r===`help`)return new In;if(r===`outdated`)return new tr;if(r===`init`)return new Vn;if(r===`dry-run`)return new An;if(r===`clean`)return i?new kn:new wt;if(r===`plugins`)return new nr;if(r===`config`&&c)return new On;if(r!==`config`||o.length>0)return new jn;let l=[];for(let e of s){let t=e.indexOf(`=`);t>0&&l.push([e.slice(0,t),e.slice(t+1)])}return new Dn([...o,...l])}function vr(e){let t={subcommand:void 0,helpFlag:!1,versionFlag:!1,dryRun:!1,jsonFlag:!1,showFlag:!1,logLevel:void 0,logLevelFlags:[],setOption:[],unknownCommand:void 0,positional:[],unknown:[]},n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i!=null){if(i===`--`){t.positional.push(...e.slice(r+1).filter(e=>e!=null));break}if(i.startsWith(`--`)){let n=i.split(`=`),a=n[0]??``,o=mr.get(a);if(o!=null){t.logLevelFlags.push(o),t.logLevel=o;continue}switch(a){case`--help`:t.helpFlag=!0;break;case`--version`:t.versionFlag=!0;break;case`--dry-run`:t.dryRun=!0;break;case`--json`:t.jsonFlag=!0;break;case`--show`:t.showFlag=!0;break;case`--set`:if(n.length>1){let e=n.slice(1).join(`=`),r=e.indexOf(`=`);r>0&&t.setOption.push([e.slice(0,r),e.slice(r+1)])}else{let n=e[r+1];if(n!=null){let e=n.indexOf(`=`);e>0&&(t.setOption.push([n.slice(0,e),n.slice(e+1)]),r++)}}break;default:t.unknown.push(i)}continue}if(i.startsWith(`-`)&&i.length>1){let e=i.slice(1);for(let n of e)switch(n){case`h`:t.helpFlag=!0;break;case`v`:t.versionFlag=!0;break;case`n`:t.dryRun=!0;break;case`j`:t.jsonFlag=!0;break;default:t.unknown.push(`-${n}`)}continue}if(!n){n=!0,pr.has(i)?t.subcommand=i:t.unknownCommand=i;continue}t.positional.push(i)}}return t}var yr=class{logger;args;outputPlugins=[];constructor(...e){this.args=vr(ur(e.filter(e=>e!=null)));let t=gr(this.args);t!=null&&on(t),this.logger=cn(`PluginPipeline`,t),this.logger.debug(`initialized`,{args:this.args})}registerOutputPlugins(e){return this.outputPlugins.push(...e),this}async run(e){er(this.logger);let{context:t,outputPlugins:n,userConfigOptions:r}=e;this.registerOutputPlugins([...n]);let i=this.resolveCommand();this.args.jsonFlag&&(on(`silent`),new Set([`config-show`,`plugins`]).has(i.name)||(i=new Hn(i)));let a=this.createCommandContext(t,r);await i.execute(a)}resolveCommand(){return _r(this.args)}createCommandContext(e,t){return{logger:this.logger,outputPlugins:this.outputPlugins,collectedInputContext:e,userConfigOptions:t,createCleanContext:t=>this.createCleanContext(e,t),createWriteContext:t=>this.createWriteContext(e,t)}}createCleanContext(e,t){return{logger:this.logger,fs:r,path:i,glob:et.default,collectedInputContext:e,dryRun:t}}createWriteContext(e,t){return{logger:this.logger,fs:r,path:i,glob:et.default,collectedInputContext:e,dryRun:t,registeredPluginNames:this.outputPlugins.map(e=>e.name)}}buildDependencyGraph(e){let t=new Map;for(let n of e){let e=n.dependsOn??[];t.set(n.name,[...e])}return t}validateDependencies(e){let t=new Set(e.map(e=>e.name));for(let n of e){let e=n.dependsOn??[];for(let r of e)if(!t.has(r))throw new Mt(n.name,r)}}topologicalSort(e){this.validateDependencies(e);let t=new Map;for(let n of e)t.set(n.name,n);let n=new Map;for(let t of e)n.set(t.name,0);let r=new Map;for(let t of e)r.set(t.name,[]);for(let t of e){let e=t.dependsOn??[];for(let i of e){n.set(t.name,(n.get(t.name)??0)+1);let e=r.get(i)??[];e.push(t.name),r.set(i,e)}}let i=[];for(let t of e)n.get(t.name)===0&&i.push(t.name);let a=[];for(;i.length>0;){let o=i.shift(),s=t.get(o);a.push(s);let c=(r.get(o)??[]).sort((t,n)=>e.findIndex(e=>e.name===t)-e.findIndex(e=>e.name===n));for(let e of c){let t=(n.get(e)??0)-1;n.set(e,t),t===0&&i.push(e)}}if(a.length===e.length)return a;throw new jt(this.findCyclePath(e,n))}findCyclePath(e,t){let n=new Set;for(let[e,r]of t)r>0&&n.add(e);let r=new Map;for(let t of e)if(n.has(t.name)){let e=(t.dependsOn??[]).filter(e=>n.has(e));r.set(t.name,e)}let i=new Set,a=[],o=e=>{if(a.includes(e))return a.push(e),!0;if(i.has(e))return!1;i.add(e),a.push(e);for(let t of r.get(e)??[])if(o(t))return!0;return a.pop(),!1};for(let e of n){if(o(e)){let e=a.indexOf(a.at(-1));return a.slice(e)}i.clear(),a.length=0}return[...n]}async executePluginsInOrder(e,t,n=!1,r){if(e.length===0)return{};let i=this.topologicalSort(e),a=new sr({userConfig:r}).collect(),o=new lr;o.setGlobalScope(a),this.logger.debug(`global scope collected`,{osInfo:{platform:a.os.platform,arch:a.os.arch,shellKind:a.os.shellKind},hasProfile:Object.keys(a.profile).length>0,hasTool:Object.keys(a.tool).length>0});let s=new Map,c={};for(let e of i){let r=this.buildDependencyContext(e,s),i={...t,dependencyContext:r,globalScope:a,scopeRegistry:o},l=e;l.executeEffects!=null&&await l.executeEffects(i,n);let u=await e.collect(i);s.set(e.name,u),c=this.mergeContexts(c,u);let d=e;if(d.getRegisteredScopes!=null){let t=d.getRegisteredScopes();for(let{namespace:n,values:r}of t)o.register(n,r,cr.PluginRegistered),this.logger.debug(`plugin scope registered`,{plugin:e.name,namespace:n,keys:Object.keys(r)})}}return c}buildDependencyContext(e,t){if((e.dependsOn??[]).length===0)return{};let n=this.collectTransitiveDependencies(e,t),r={};for(let e of n){let n=t.get(e);n!=null&&(r=this.mergeContexts(r,n))}return r}collectTransitiveDependencies(e,t){let n=new Set,r=[];return(e=>{for(let i of e)n.has(i)||(n.add(i),t.get(i)!=null&&r.push(i))})(e.dependsOn??[]),r}mergeContexts(e,t){let{workspace:n}=e;if(t.workspace!=null)if(n!=null){let e=new Map;for(let t of n.projects)e.set(t.name,t);for(let n of t.workspace.projects)e.set(n.name,n);n={directory:t.workspace.directory??n.directory,projects:[...e.values()]}}else ({workspace:n}=t);let r=t.externalProjects==null?e.externalProjects:[...e.externalProjects??[],...t.externalProjects],i=t.ideConfigFiles==null?e.ideConfigFiles:[...e.ideConfigFiles??[],...t.ideConfigFiles],a=t.fastCommands==null?e.fastCommands:[...e.fastCommands??[],...t.fastCommands],o=t.subAgents==null?e.subAgents:[...e.subAgents??[],...t.subAgents],s=t.skills==null?e.skills:[...e.skills??[],...t.skills],c=t.aiAgentIgnoreConfigFiles==null?e.aiAgentIgnoreConfigFiles:[...e.aiAgentIgnoreConfigFiles??[],...t.aiAgentIgnoreConfigFiles],l=t.globalMemory??e.globalMemory,u=t.shadowSourceProjectDir??e.shadowSourceProjectDir,d=t.readmePrompts==null?e.readmePrompts:[...e.readmePrompts??[],...t.readmePrompts],f=t.globalGitIgnore??e.globalGitIgnore,p=t.shadowGitExclude??e.shadowGitExclude;return{...n==null?{}:{workspace:n},...r==null?{}:{externalProjects:r},...i==null?{}:{ideConfigFiles:i},...a==null?{}:{fastCommands:a},...o==null?{}:{subAgents:o},...s==null?{}:{skills:s},...c==null?{}:{aiAgentIgnoreConfigFiles:c},...l==null?{}:{globalMemory:l},...u==null?{}:{shadowSourceProjectDir:u},...d==null?{}:{readmePrompts:d},...f==null?{}:{globalGitIgnore:f},...p==null?{}:{shadowGitExclude:p}}}};const br={...Jt,externalProjects:[],excludePatterns:{},fastCommandSeriesOptions:{},plugins:[]};function xr(e){return{...e.workspaceDir==null?{}:{workspaceDir:e.workspaceDir},...e.shadowSourceProjectDir==null?{}:{shadowSourceProjectDir:e.shadowSourceProjectDir},...e.shadowSkillSourceDir==null?{}:{shadowSkillSourceDir:e.shadowSkillSourceDir},...e.shadowFastCommandDir==null?{}:{shadowFastCommandDir:e.shadowFastCommandDir},...e.shadowSubAgentDir==null?{}:{shadowSubAgentDir:e.shadowSubAgentDir},...e.globalMemoryFile==null?{}:{globalMemoryFile:e.globalMemoryFile},...e.shadowProjectsDir==null?{}:{shadowProjectsDir:e.shadowProjectsDir},...e.externalProjects==null?{}:{externalProjects:e.externalProjects},...e.excludePatterns==null?{}:{excludePatterns:e.excludePatterns},...e.fastCommandSeriesOptions==null?{}:{fastCommandSeriesOptions:e.fastCommandSeriesOptions},...e.logLevel==null?{}:{logLevel:e.logLevel}}}function Sr(...e){return e.reduce((e,t)=>Cr(e,t),{...br})}function Cr(e,t){let n=t.externalProjects,r=t.plugins,i=t.excludePatterns,a=t.fastCommandSeriesOptions;return{...e,...t,externalProjects:[...e.externalProjects,...n??[]],plugins:[...e.plugins,...r??[]],excludePatterns:wr(e.excludePatterns,i),fastCommandSeriesOptions:Tr(e.fastCommandSeriesOptions,a)}}function wr(e,t){let n={...e};if(t)for(let[e,r]of Object.entries(t))n[e]=[...n[e]??[],...r];return n}function Tr(e,t){if(t==null)return e??{};if(e==null)return t;let n={};if(e.pluginOverrides!=null)for(let[t,r]of Object.entries(e.pluginOverrides))n[t]={...r};if(t.pluginOverrides!=null)for(let[e,r]of Object.entries(t.pluginOverrides))n[e]={...n[e],...r};let r=t.includeSeriesPrefix??e.includeSeriesPrefix,i=Object.keys(n).length>0;return r!=null&&i?{includeSeriesPrefix:r,pluginOverrides:n}:r==null?i?{pluginOverrides:n}:{}:{includeSeriesPrefix:r}}function Er(e){return`pluginOptions`in e||`configLoaderOptions`in e||`loadUserConfig`in e}async function Dr(e={}){vn().shouldExit&&n.exit(1);let t,a,o;Er(e)?({pluginOptions:o={},cwd:a}={pluginOptions:e.pluginOptions,cwd:e.cwd},t=e.loadUserConfig??!0):(o=e,t=!0);let s={},c=!1,l=[],u;if(t){let e=_n(a);c=e.found,l=e.sources,e.found&&(s=xr(e.config),u=e.config)}let d=Sr(s,o),{plugins:f=[],logLevel:p}=d,m=cn(`defineConfig`,p);c?m.info(`user config loaded`,{sources:l}):m.info(`no user config found, using defaults`,{workspaceDir:br.workspaceDir,shadowSourceProjectDir:br.shadowSourceProjectDir,shadowSkillSourceDir:br.shadowSkillSourceDir,shadowFastCommandDir:br.shadowFastCommandDir,shadowSubAgentDir:br.shadowSubAgentDir,globalMemoryFile:br.globalMemoryFile,shadowProjectsDir:br.shadowProjectsDir,logLevel:br.logLevel});let h={logger:m,userConfigOptions:d,fs:r,path:i,glob:et.default},g=f.filter(e=>e.type===Tt.Input),_=f.filter(e=>e.type===Tt.Output),v=await new yr().executePluginsInOrder(g,h,!1,u);if(v.workspace==null)throw Error(`Workspace not initialized by any plugin`);let y={workspace:v.workspace,ideConfigFiles:v.ideConfigFiles??[],...v.externalProjects!=null&&{externalProjects:v.externalProjects},...v.fastCommands!=null&&{fastCommands:v.fastCommands},...v.subAgents!=null&&{subAgents:v.subAgents},...v.skills!=null&&{skills:v.skills},...v.globalMemory!=null&&{globalMemory:v.globalMemory},...v.aiAgentIgnoreConfigFiles!=null&&{aiAgentIgnoreConfigFiles:v.aiAgentIgnoreConfigFiles},...v.shadowSourceProjectDir!=null&&{shadowSourceProjectDir:v.shadowSourceProjectDir},...v.readmePrompts!=null&&{readmePrompts:v.readmePrompts},...v.globalGitIgnore!=null&&{globalGitIgnore:v.globalGitIgnore},...v.shadowGitExclude!=null&&{shadowGitExclude:v.shadowGitExclude}};return v.shadowSourceProjectDir!=null&&Ln(v.shadowSourceProjectDir,m),{context:y,outputPlugins:_,userConfigOptions:d}}const Or=Lr(/[A-Za-z]/),kr=Lr(/[\dA-Za-z]/),Ar=Lr(/[#-'*+\--9=?A-Z^-~]/);function jr(e){return e!==null&&(e<32||e===127)}const Mr=Lr(/\d/),Nr=Lr(/[\dA-Fa-f]/),Pr=Lr(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function V(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}const Fr=Lr(/\p{P}|\p{S}/u),Ir=Lr(/\s/);function Lr(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var Rr=S(y(((e,t)=>{(function(){var e=t===void 0?function(){return this||(0,eval)(`this`)}():t.exports=i;e.format=i,e.vsprintf=r,typeof console<`u`&&typeof console.log==`function`&&(e.printf=n);function n(){console.log(i.apply(null,arguments))}function r(e,t){return i.apply(null,[e].concat(t))}function i(e){for(var t=1,n=[].slice.call(arguments),r=0,i=e.length,a=``,o,s=!1,c,l,u=!1,d,f=function(){return n[t++]},p=function(){for(var t=``;/\d/.test(e[r]);)t+=e[r++],o=e[r];return t.length>0?parseInt(t):null};r<i;++r)if(o=e[r],s)switch(s=!1,o==`.`?(u=!1,o=e[++r]):o==`0`&&e[r+1]==`.`?(u=!0,r+=2,o=e[r]):u=!0,d=p(),o){case`b`:a+=parseInt(f(),10).toString(2);break;case`c`:c=f(),typeof c==`string`||c instanceof String?a+=c:a+=String.fromCharCode(parseInt(c,10));break;case`d`:a+=parseInt(f(),10);break;case`f`:l=String(parseFloat(f()).toFixed(d||6)),a+=u?l:l.replace(/^0/,``);break;case`j`:a+=JSON.stringify(f());break;case`o`:a+=`0`+parseInt(f(),10).toString(8);break;case`s`:a+=f();break;case`x`:a+=`0x`+parseInt(f(),10).toString(16);break;case`X`:a+=`0x`+parseInt(f(),10).toString(16).toUpperCase();break;default:a+=o;break}else o===`%`?s=!0:a+=o;return a}})()}))(),1);const zr=Object.assign(Br(Error),{eval:Br(EvalError),range:Br(RangeError),reference:Br(ReferenceError),syntax:Br(SyntaxError),type:Br(TypeError),uri:Br(URIError)});function Br(e){return t.displayName=e.displayName||e.name,t;function t(t,...n){return new e(t&&(0,Rr.default)(t,...n))}}const Vr={}.hasOwnProperty,Hr={yaml:`-`,toml:`+`};function Ur(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:[`yaml`];for(;++n<r.length;)t[n]=Wr(r[n]);return t}function Wr(e){let t=e;if(typeof t==`string`){if(!Vr.call(Hr,t))throw zr("Missing matter definition for `%s`",t);t={type:t,marker:Hr[t]}}else if(typeof t!=`object`)throw zr("Expected matter to be an object, not `%j`",t);if(!Vr.call(t,`type`))throw zr("Missing `type` in matter `%j`",t);if(!Vr.call(t,`fence`)&&!Vr.call(t,`marker`))throw zr("Missing `marker` or `fence` in matter `%j`",t);return t}function Gr(e){let t=Ur(e),n={},r=-1;for(;++r<t.length;){let e=t[r],i=qr(e,`open`).charCodeAt(0),a=Kr(e),o=n[i];Array.isArray(o)?o.push(a):n[i]=[a]}return{flow:n}}function Kr(e){let t=e.anywhere,n=e.type,r=n+`Fence`,i=r+`Sequence`,a=n+`Value`,o={tokenize:u,partial:!0},s,c=0;return{tokenize:l,concrete:!0};function l(l,u,d){let f=this;return p;function p(a){let o=f.now();return o.column===1&&(o.line===1||t)&&(s=qr(e,`open`),c=0,a===s.charCodeAt(c))?(l.enter(n),l.enter(r),l.enter(i),m(a)):d(a)}function m(e){return c===s.length?(l.exit(i),H(e)?(l.enter(`whitespace`),h(e)):g(e)):e===s.charCodeAt(c++)?(l.consume(e),m):d(e)}function h(e){return H(e)?(l.consume(e),h):(l.exit(`whitespace`),g(e))}function g(t){return B(t)?(l.exit(r),l.enter(`lineEnding`),l.consume(t),l.exit(`lineEnding`),s=qr(e,`close`),c=0,l.attempt(o,b,_)):d(t)}function _(e){return e===null||B(e)?y(e):(l.enter(a),v(e))}function v(e){return e===null||B(e)?(l.exit(a),y(e)):(l.consume(e),v)}function y(e){return e===null?d(e):(l.enter(`lineEnding`),l.consume(e),l.exit(`lineEnding`),l.attempt(o,b,_))}function b(e){return l.exit(n),u(e)}}function u(e,t,n){let a=0;return o;function o(t){return t===s.charCodeAt(a)?(e.enter(r),e.enter(i),c(t)):n(t)}function c(t){return a===s.length?(e.exit(i),H(t)?(e.enter(`whitespace`),l(t)):u(t)):t===s.charCodeAt(a++)?(e.consume(t),c):n(t)}function l(t){return H(t)?(e.consume(t),l):(e.exit(`whitespace`),u(t))}function u(i){return i===null||B(i)?(e.exit(r),t(i)):n(i)}}}function qr(e,t){return e.marker?Jr(e.marker,t).repeat(3):Jr(e.fence,t)}function Jr(e,t){return typeof e==`string`?e:e[t]}function Yr(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Xr(e){let t=Ur(e),n={},r={},i=-1;for(;++i<t.length;){let e=t[i];n[e.type]=Zr(e),r[e.type]=Qr,r[e.type+`Value`]=$r}return{enter:n,exit:r}}function Zr(e){return t;function t(t){this.enter({type:e.type,value:``},t),this.buffer()}}function Qr(e){let t=this.resume(),n=this.stack[this.stack.length-1];`value`in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``)}function $r(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function ei(e){let t=[],n={},r=Ur(e),i=-1;for(;++i<r.length;){let e=r[i];n[e.type]=ti(e);let a=ni(e,`open`);t.push({atBreak:!0,character:a.charAt(0),after:Yr(a.charAt(1))})}return{unsafe:t,handlers:n}}function ti(e){let t=ni(e,`open`),n=ni(e,`close`);return r;function r(e){return t+(e.value?`
|
|
1012
1012
|
`+e.value:``)+`
|
|
1013
1013
|
`+n}}function ni(e,t){return e.marker?ri(e.marker,t).repeat(3):ri(e.fence,t)}function ri(e,t){return typeof e==`string`?e:e[t]}function ii(e){let t=this,n=e||`yaml`,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Gr(n)),a.push(Xr(n)),o.push(ei(n))}function ai(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const oi=(function(e){if(e==null)return di;if(typeof e==`function`)return ui(e);if(typeof e==`object`)return Array.isArray(e)?si(e):ci(e);if(typeof e==`string`)return li(e);throw Error(`Expected function, string, or object as test`)});function si(e){let t=[],n=-1;for(;++n<e.length;)t[n]=oi(e[n]);return ui(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function ci(e){let t=e;return ui(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function li(e){return ui(t);function t(t){return t&&t.type===e}}function ui(e){return t;function t(t,n,r){return!!(fi(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function di(){return!0}function fi(e){return typeof e==`object`&&!!e&&`type`in e}function pi(e){return`\x1B[33m`+e+`\x1B[39m`}const mi=[];function hi(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=oi(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+pi(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=mi,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=gi(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function gi(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?mi:[e]}function _i(e,t,n){let r=oi((n||{}).ignore||[]),i=vi(t),a=-1;for(;++a<i.length;)hi(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function vi(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([yi(e[0]),bi(e[1])])}return t}function yi(e){return typeof e==`string`?new RegExp(Yr(e),`g`):e}function bi(e){return typeof e==`function`?e:function(){return e}}const xi=`phrasing`,Si=[`autolink`,`link`,`image`,`label`];function Ci(){return{transforms:[ji],enter:{literalAutolink:Ti,literalAutolinkEmail:Ei,literalAutolinkHttp:Ei,literalAutolinkWww:Ei},exit:{literalAutolink:Ai,literalAutolinkEmail:ki,literalAutolinkHttp:Di,literalAutolinkWww:Oi}}}function wi(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:xi,notInConstruct:Si},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:xi,notInConstruct:Si},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:xi,notInConstruct:Si}]}}function Ti(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Ei(e){this.config.enter.autolinkProtocol.call(this,e)}function Di(e){this.config.exit.autolinkProtocol.call(this,e)}function Oi(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function ki(e){this.config.exit.autolinkEmail.call(this,e)}function Ai(e){this.exit(e)}function ji(e){_i(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Mi],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Ni]],{ignore:[`link`,`linkReference`]})}function Mi(e,t,n,r,i){let a=``;if(!Ii(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Pi(n)))return!1;let o=Fi(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Ni(e,t,n,r){return!Ii(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Pi(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Fi(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=ai(e,`(`),a=ai(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Ii(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Ir(n)||Fr(n))&&(!t||n!==47)}function Li(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}qi.peek=Ki;function Ri(){this.buffer()}function zi(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Bi(){this.buffer()}function Vi(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Hi(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Li(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ui(e){this.exit(e)}function Wi(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Li(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Gi(e){this.exit(e)}function Ki(){return`[`}function qi(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Ji(){return{enter:{gfmFootnoteCallString:Ri,gfmFootnoteCall:zi,gfmFootnoteDefinitionLabelString:Bi,gfmFootnoteDefinition:Vi},exit:{gfmFootnoteCallString:Hi,gfmFootnoteCall:Ui,gfmFootnoteDefinitionLabelString:Wi,gfmFootnoteDefinition:Gi}}}function Yi(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:qi},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
1014
1014
|
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Zi:Xi))),s(),o}}function Xi(e,t,n){return t===0?e:Zi(e,t,n)}function Zi(e,t,n){return(n?``:` `)+e}const Qi=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];ra.peek=ia;function $i(){return{canContainEols:[`delete`],enter:{strikethrough:ta},exit:{strikethrough:na}}}function ea(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Qi}],handlers:{delete:ra}}}function ta(e){this.enter({type:`delete`,children:[]},e)}function na(e){this.exit(e)}function ra(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function ia(){return`~`}function aa(e){return e.length}function oa(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||aa,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=sa(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=ca(r[d]);else{let e=ca(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truenine/memory-sync-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2026.10213.
|
|
4
|
+
"version": "2026.10213.10155",
|
|
5
5
|
"description": "TrueNine Memory Synchronization CLI",
|
|
6
6
|
"author": "TrueNine",
|
|
7
7
|
"license": "AGPL-3.0-only",
|
|
@@ -36,38 +36,37 @@
|
|
|
36
36
|
"access": "public",
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@clack/prompts": "^1.0.0",
|
|
41
|
+
"fast-glob": "^3.3.3",
|
|
42
|
+
"fs-extra": "^11.3.3",
|
|
43
|
+
"picocolors": "^1.1.1",
|
|
44
|
+
"picomatch": "^4.0.3"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@truenine/eslint10-config": "^2026.10209.11105",
|
|
48
|
+
"@types/fs-extra": "^11.0.4",
|
|
49
|
+
"@types/node": "^25.2.3",
|
|
50
|
+
"@types/picomatch": "^4.0.2",
|
|
51
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
52
|
+
"eslint": "^10.0.0",
|
|
53
|
+
"fast-check": "^4.5.3",
|
|
54
|
+
"tsx": "^4.21.0",
|
|
55
|
+
"typescript": "^5.9.3",
|
|
56
|
+
"@truenine/desk-paths": "1.0.0",
|
|
57
|
+
"@truenine/init-bundle": "1.0.0",
|
|
58
|
+
"@truenine/logger": "1.0.0",
|
|
59
|
+
"@truenine/md-compiler": "1.0.0"
|
|
60
|
+
},
|
|
39
61
|
"scripts": {
|
|
40
62
|
"build": "run-s build:deps check bundle",
|
|
41
63
|
"build:deps": "pnpm exec turbo run build --filter=...@truenine/memory-sync-cli --filter=!@truenine/memory-sync-cli",
|
|
42
64
|
"bundle": "pnpm exec tsdown",
|
|
43
65
|
"check": "run-p typecheck lint",
|
|
44
66
|
"lint": "eslint --cache .",
|
|
45
|
-
"prepublishOnly": "run-s build",
|
|
46
67
|
"test": "run-s build:deps test:run",
|
|
47
68
|
"test:run": "vitest run",
|
|
48
69
|
"lintfix": "eslint --fix --cache .",
|
|
49
70
|
"typecheck": "tsc --noEmit -p tsconfig.lib.json"
|
|
50
|
-
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@clack/prompts": "catalog:",
|
|
53
|
-
"fast-glob": "catalog:",
|
|
54
|
-
"fs-extra": "catalog:",
|
|
55
|
-
"picocolors": "catalog:",
|
|
56
|
-
"picomatch": "catalog:"
|
|
57
|
-
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"@truenine/desk-paths": "workspace:*",
|
|
60
|
-
"@truenine/eslint10-config": "catalog:",
|
|
61
|
-
"@truenine/init-bundle": "workspace:*",
|
|
62
|
-
"@truenine/logger": "workspace:*",
|
|
63
|
-
"@truenine/md-compiler": "workspace:*",
|
|
64
|
-
"@types/fs-extra": "catalog:",
|
|
65
|
-
"@types/node": "catalog:",
|
|
66
|
-
"@types/picomatch": "catalog:",
|
|
67
|
-
"@vitest/coverage-v8": "catalog:",
|
|
68
|
-
"eslint": "catalog:",
|
|
69
|
-
"fast-check": "catalog:",
|
|
70
|
-
"tsx": "catalog:",
|
|
71
|
-
"typescript": "catalog:"
|
|
72
71
|
}
|
|
73
|
-
}
|
|
72
|
+
}
|