ref0-git 0.26.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/app/apps/github/README.md +1 -5
  2. package/app/apps/github/package.json +0 -1
  3. package/app/apps/github/src/signin/auth.ts +17 -89
  4. package/app/apps/github/src/signin/credentials.ts +10 -14
  5. package/app/apps/github/src/signin/guarded-write.ts +19 -0
  6. package/app/apps/github/src/signin/owner-names.ts +11 -41
  7. package/app/apps/github/src/signin/unborn.ts +20 -30
  8. package/app/apps/github/tsconfig.json +0 -2
  9. package/app/pnpm-workspace.yaml +14 -34
  10. package/dist/cli/documents.mjs +39 -25
  11. package/dist/cli/keys.mjs +9 -3
  12. package/dist/cli/node.mjs +1 -2
  13. package/dist/cli/runtime.mjs +3 -4
  14. package/dist/cli/setup.mjs +216 -468
  15. package/dist/cli/tools-node.mjs +8 -7
  16. package/dist/cli/tools.mjs +3 -3
  17. package/dist/cli/vercel-stores.mjs +287 -0
  18. package/dist/init/app.mjs +4 -37
  19. package/dist/init/choices.mjs +62 -209
  20. package/dist/init/cloudflare.mjs +1 -2
  21. package/dist/init/detect.mjs +77 -167
  22. package/dist/init/files.mjs +2 -12
  23. package/dist/init/frameworks.mjs +50 -174
  24. package/dist/init/git-module.mjs +5 -1
  25. package/dist/init/metadata.mjs +4 -22
  26. package/dist/init/next.mjs +13 -66
  27. package/dist/init/output.mjs +3 -6
  28. package/dist/init/plan.mjs +1 -29
  29. package/dist/init/routes.mjs +1 -78
  30. package/dist/init/stores.mjs +6 -35
  31. package/dist/init/template.mjs +14 -49
  32. package/dist/init/templates.mjs +30 -115
  33. package/dist/init/vercel-regions.mjs +87 -0
  34. package/dist/init/vercel.mjs +313 -212
  35. package/dist/init/versions.mjs +3 -3
  36. package/package.json +5 -11
  37. package/app/apps/github/migrations/postgres/0001_auth.sql +0 -53
  38. package/app/apps/github/src/camo/lookup.ts +0 -23
  39. package/app/apps/github/src/camo/node.ts +0 -50
  40. package/app/apps/github/src/signin/person-lock.ts +0 -104
  41. package/dist/cli/sqlite.mjs +0 -28
  42. package/dist/init/astro.mjs +0 -49
  43. package/dist/init/create.mjs +0 -152
  44. package/dist/init/mounts.mjs +0 -104
  45. package/dist/init/node-app.mjs +0 -196
  46. package/dist/init/node.mjs +0 -446
  47. package/dist/init/nuxt.mjs +0 -240
  48. package/dist/init/react-router.mjs +0 -59
  49. package/dist/init/sveltekit.mjs +0 -141
@@ -99,12 +99,13 @@ const HelpDocument = /* @__PURE__ */ Schema.Struct({
99
99
  lifecycle: Lifecycle
100
100
  }))
101
101
  });
102
- /** One check `doctor` ran, and whether it passed. */
102
+ /** One check `doctor` ran, and whether it passed, or that it couldn't run it. */
103
103
  const FindingDocument = /* @__PURE__ */ Schema.Struct({
104
104
  check: Schema.String,
105
105
  ok: Schema.Boolean,
106
106
  says: Schema.String,
107
- blocks: Schema.optional(Schema.String)
107
+ blocks: Schema.optional(Schema.String),
108
+ skipped: Schema.optional(Schema.Literal(true))
108
109
  });
109
110
  /**
110
111
  * A failed run's one document, on stderr: the `cli-design` skill's error document. Its `data` is
@@ -127,7 +128,6 @@ const SettledDocument = /* @__PURE__ */ Schema.Struct({
127
128
  "prompt"
128
129
  ]),
129
130
  detectedFrom: Schema.optional(Schema.String),
130
- because: Schema.optional(Schema.String),
131
131
  moved: Schema.optional(Schema.String)
132
132
  });
133
133
  /** A file `init` plans, as `--json` shows it: its action, and what it writes or would. */
@@ -136,26 +136,13 @@ const PlannedFile = /* @__PURE__ */ Schema.Struct({
136
136
  action: Schema.Literals([
137
137
  "create",
138
138
  "merge",
139
- "edit",
140
139
  "unchanged",
141
140
  "replace",
142
141
  "differs"
143
142
  ]),
144
143
  secrets: Schema.optional(Schema.Array(Schema.String)),
145
144
  content: Schema.optional(Schema.String),
146
- patch: Schema.optional(Schema.String),
147
- adds: Schema.optional(Schema.Array(Schema.Struct({
148
- at: Schema.Array(Schema.String),
149
- raw: Schema.String
150
- }))),
151
- edit: Schema.optional(Schema.Struct({
152
- anchor: Schema.String,
153
- adds: Schema.Array(Schema.String),
154
- swaps: Schema.Array(Schema.Struct({
155
- from: Schema.String,
156
- to: Schema.String
157
- }))
158
- }))
145
+ patch: Schema.optional(Schema.String)
159
146
  });
160
147
  /**
161
148
  * `keys`' document: the Worker and bucket it put R2's keys for, the Access Key ID, how the key came,
@@ -174,6 +161,16 @@ const KeysDocument = /* @__PURE__ */ Schema.Struct({
174
161
  })),
175
162
  nextStep: Schema.optionalKey(NextStepDocument)
176
163
  });
164
+ /** A store `init` looked at: made, there already, failed or left, with why for the last two. */
165
+ const StoreStateFields = {
166
+ state: Schema.Literals([
167
+ "made",
168
+ "present",
169
+ "failed",
170
+ "left"
171
+ ]),
172
+ why: Schema.optionalKey(Schema.String)
173
+ };
177
174
  /** `init`'s receipt as `--json` prints it, and as its failures carry it. */
178
175
  const InitDocument = /* @__PURE__ */ Schema.Struct({
179
176
  folder: Schema.String,
@@ -184,18 +181,11 @@ const InitDocument = /* @__PURE__ */ Schema.Struct({
184
181
  files: Schema.Array(PlannedFile),
185
182
  manual: Schema.Array(Schema.Struct({
186
183
  path: Schema.String,
187
- why: Schema.Literals(["yours", "template_changed"]),
184
+ why: Schema.Literals(["yours"]),
188
185
  says: Schema.String,
189
186
  lines: Schema.Array(Schema.String)
190
187
  })),
191
188
  needs: Schema.Array(Schema.String),
192
- create: Schema.optional(Schema.Struct({
193
- command: Schema.Struct({
194
- line: Schema.String,
195
- argv: Schema.Array(Schema.String)
196
- }),
197
- exit: Schema.NullOr(Schema.Number)
198
- })),
199
189
  install: Schema.Struct({
200
190
  manager: Schema.String,
201
191
  packages: Schema.Array(Schema.String),
@@ -210,6 +200,30 @@ const InitDocument = /* @__PURE__ */ Schema.Struct({
210
200
  Schema.Struct({ present: Schema.Literal(true) }),
211
201
  Schema.Struct({ notPut: Schema.String })
212
202
  ])),
203
+ /**
204
+ * On Vercel, what `init` did about the project's stores, in its region: the Blob store and its
205
+ * Postgres, named as `init` makes Neon's, each `made`, `present` already, as a Postgres whose two
206
+ * URLs Production holds, `failed` with why, or `left` with why, and `skipped` naming why it made
207
+ * none.
208
+ */
209
+ stores: Schema.optional(Schema.Struct({
210
+ region: Schema.String,
211
+ skipped: Schema.NullOr(Schema.Literals([
212
+ "dry_run",
213
+ "not_asked",
214
+ "declined",
215
+ "not_linked",
216
+ "unread"
217
+ ])),
218
+ blob: Schema.Struct({
219
+ name: Schema.String,
220
+ ...StoreStateFields
221
+ }),
222
+ postgres: Schema.Struct({
223
+ name: Schema.String,
224
+ ...StoreStateFields
225
+ })
226
+ })),
213
227
  nextStep: NextStepDocument
214
228
  });
215
229
  /** `doctor`'s document when every check passed, with the step to deploy. */
package/dist/cli/keys.mjs CHANGED
@@ -76,10 +76,16 @@ const workerIn = /* @__PURE__ */ Effect.fnUntraced(function* (folder, argv) {
76
76
  run: [["init", ...argv]]
77
77
  });
78
78
  });
79
- /** A child's first line on stderr, made safe to print, or its exit, for a sentence's end. */
79
+ /** An error document's message, as a CLI writes one line of JSON on stderr when an agent runs it. */
80
+ const readMessage = /* @__PURE__ */ Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Struct({ message: Schema.String })));
81
+ /**
82
+ * A child's error on stderr, made safe to print, or its exit, for a sentence's end: its `Error`
83
+ * line, else the message of an error document, else its first line.
84
+ */
80
85
  const saidBy = (ran, program) => {
81
86
  if (ran.exit === null) return ran.signal === null ? `${program} isn't on PATH` : `${program} stopped on ${ran.signal}`;
82
- const line = ran.stderr.split("\n").map((each) => each.trim()).find((each) => each !== "");
87
+ const lines = ran.stderr.split("\n").map((each) => each.trim()).filter((each) => each !== "" && !/^\S+ CLI \d/.test(each) && !/^<[^>]*\/>$/.test(each));
88
+ const line = lines.find((each) => each.startsWith("Error")) ?? lines.map((each) => Option.getOrUndefined(readMessage(each))?.message).find(Boolean) ?? lines[0];
83
89
  return line === void 0 ? `${program} exited ${ran.exit}` : `${program} said "${printable(line).slice(0, 200)}"`;
84
90
  };
85
91
  /** `cf`'s JSON on stdout as `schema` reads it, bare or in a `result`, or `undefined`. */
@@ -428,4 +434,4 @@ const initKeysNext = (keys) => {
428
434
  if (keys?.kind === "put") return keysNext(keys.put);
429
435
  if (keys?.kind === "notPut") return keys.next;
430
436
  };
431
- export { NotMinted, accountOf, deployed, initKeysDocument, initKeysFields, initKeysNext, itemWrite, keysCommand, keysDocument, keysFields, keysNext, keysOnInit, olderThan, policyOf, putKeys, tokenName, workerIn };
437
+ export { NotMinted, accountOf, deployed, initKeysDocument, initKeysFields, initKeysNext, itemWrite, keysCommand, keysDocument, keysFields, keysNext, keysOnInit, olderThan, policyOf, putKeys, saidBy, tokenName, workerIn };
package/dist/cli/node.mjs CHANGED
@@ -5,8 +5,7 @@ function missingNode() {
5
5
  const process = globalThis.process ?? missingNode();
6
6
  const node = {
7
7
  process,
8
- fs: process.getBuiltinModule("node:fs"),
9
- sqlite: () => process.getBuiltinModule("node:sqlite")
8
+ fs: process.getBuiltinModule("node:fs")
10
9
  };
11
10
  /** `chunk` written to `stream`, once it's taken. */
12
11
  const written = (stream, chunk) => new Promise((done, failed) => {
@@ -1,6 +1,5 @@
1
1
  import { layer as layer$1 } from "./folders.mjs";
2
2
  import { node, written } from "./node.mjs";
3
- import { layer as layer$2 } from "./sqlite.mjs";
4
3
  import * as Effect from "effect/Effect";
5
4
  import * as Stream from "effect/Stream";
6
5
  import * as Stdio from "effect/Stdio";
@@ -43,8 +42,8 @@ const quits = (input) => input.key.ctrl && input.key.name === "c";
43
42
  const platform = NodeChildProcessSpawner.layer.pipe(Layer.provideMerge(Layer.mergeAll(NodeFileSystem.layer, NodePath.layer)));
44
43
  /**
45
44
  * What `effect/cli` and the commands ask of the platform, in Node: the run's stdio, a terminal
46
- * whose keys a prompt reads, child processes, files, paths, HTTP over `fetch`, the folders `init`
47
- * and `doctor` read, and SQLite.
45
+ * whose keys a prompt reads, child processes, files, paths, HTTP over `fetch`, and the folders
46
+ * `init` and `doctor` read.
48
47
  */
49
- const layer = Layer.mergeAll(Layer.succeed(Stdio.Stdio, stdio), Layer.effect(Terminal.Terminal, NodeTerminal.make(quits)), platform, FetchHttpClient.layer, layer$1, layer$2);
48
+ const layer = Layer.mergeAll(Layer.succeed(Stdio.Stdio, stdio), Layer.effect(Terminal.Terminal, NodeTerminal.make(quits)), platform, FetchHttpClient.layer, layer$1);
50
49
  export { layer, quits };