@camerontaylor/paseo-protocol 0.8.0-fork.1 → 0.9.0-beta.2.fork.1

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.
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ export declare const PluginIdSchema: z.ZodString;
3
+ export declare const PluginRequirementsSchema: z.ZodObject<{
4
+ paseo: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ export type PluginRequirements = z.infer<typeof PluginRequirementsSchema>;
7
+ export declare const DirectoryPluginSourceSchema: z.ZodObject<{
8
+ source: z.ZodLiteral<"directory">;
9
+ path: z.ZodString;
10
+ enabled: z.ZodOptional<z.ZodBoolean>;
11
+ }, z.core.$strict>;
12
+ export declare const PluginSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
13
+ source: z.ZodLiteral<"directory">;
14
+ path: z.ZodString;
15
+ enabled: z.ZodOptional<z.ZodBoolean>;
16
+ }, z.core.$strict>], "source">;
17
+ export type PluginSource = z.infer<typeof PluginSourceSchema>;
18
+ //# sourceMappingURL=plugin-config.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ export const PluginIdSchema = z.string().regex(/^[a-z][a-z0-9-]*$/);
3
+ // Semver validation belongs at the manifest/runtime boundary, not on the wire.
4
+ export const PluginRequirementsSchema = z.object({ paseo: z.string().optional() });
5
+ export const DirectoryPluginSourceSchema = z
6
+ .object({
7
+ source: z.literal("directory"),
8
+ path: z.string().min(1),
9
+ enabled: z.boolean().optional(),
10
+ })
11
+ .strict();
12
+ export const PluginSourceSchema = z.discriminatedUnion("source", [DirectoryPluginSourceSchema]);
13
+ //# sourceMappingURL=plugin-config.js.map
@@ -19,7 +19,7 @@ export function assertPluginCompatibility(input) {
19
19
  if (satisfies(version, range) || satisfies(stableCore, range))
20
20
  return;
21
21
  const action = input.requirements?.paseo === undefined
22
- ? "This plugin has no requirements.paseo and targets Paseo before 0.8. Ask its author to migrate it: https://paseo.sh/docs/plugins/v0.8/migration"
22
+ ? "This plugin has no requirements.paseo and targets Paseo before 0.8. Ask its author to migrate it: https://paseo.sh/docs/plugins/migration"
23
23
  : `Use a compatible plugin version or update the ${input.runtime}.`;
24
24
  throw new Error(`Plugin "${input.id}" requires Paseo ${range}. Your ${input.runtime} is ${input.version}. ${action}`);
25
25
  }
@@ -1,7 +1,10 @@
1
+ import type { PluginInstallation } from "./messages.js";
1
2
  export interface PluginSourceReference {
2
3
  source: string;
3
4
  pluginPath: string | undefined;
4
5
  }
5
6
  export declare function parsePluginSourceReference(reference: string): PluginSourceReference;
6
7
  export declare function formatPluginSourceReference(source: string, pluginPath: string | undefined): string;
8
+ export declare function formatPluginIdentity(identity: PluginInstallation["identity"]): string;
9
+ export declare function formatPluginInstallation(installation: PluginInstallation): string;
7
10
  //# sourceMappingURL=plugin-source-reference.d.ts.map
@@ -1,4 +1,10 @@
1
1
  export function parsePluginSourceReference(reference) {
2
+ const prefix = /^(npm:|github:|git:(?!\/\/))/.exec(reference)?.[0];
3
+ const source = prefix ? reference.slice(prefix.length) : reference;
4
+ const parsed = splitPluginPath(source, { scp: prefix !== "npm:" });
5
+ return { ...parsed, source: `${prefix ?? ""}${parsed.source}` };
6
+ }
7
+ function splitPluginPath(reference, options) {
2
8
  const separator = reference.lastIndexOf(":");
3
9
  if (separator === -1)
4
10
  return { source: reference, pluginPath: undefined };
@@ -13,7 +19,7 @@ export function parsePluginSourceReference(reference) {
13
19
  return { source: reference, pluginPath: undefined };
14
20
  }
15
21
  }
16
- else {
22
+ else if (options.scp) {
17
23
  const scpSeparator = reference.match(/^[^/@\s]+@[^:\s]+:/)?.[0].length;
18
24
  if (scpSeparator !== undefined && separator === scpSeparator - 1) {
19
25
  return { source: reference, pluginPath: undefined };
@@ -38,4 +44,17 @@ function isPortableRelativePluginPath(pluginPath) {
38
44
  return false;
39
45
  return pluginPath.split(/[\\/]/).every((part) => part !== "" && part !== "." && part !== "..");
40
46
  }
47
+ export function formatPluginIdentity(identity) {
48
+ if (identity.kind === "directory")
49
+ return identity.path;
50
+ const source = identity.kind === "npm" ? `npm:${identity.packageName}` : `git:${identity.remote}`;
51
+ return identity.pluginPath === "." ? source : `${source}:${identity.pluginPath}`;
52
+ }
53
+ export function formatPluginInstallation(installation) {
54
+ const identity = formatPluginIdentity(installation.identity);
55
+ const revision = installation.identity.kind === "git"
56
+ ? installation.currentRevision?.slice(0, 12)
57
+ : installation.currentRevision;
58
+ return revision ? `${identity} · ${revision}` : identity;
59
+ }
41
60
  //# sourceMappingURL=plugin-source-reference.js.map
@@ -16,11 +16,8 @@ export interface MatchOptions {
16
16
  /** Omit or pass null to match exactly. `fuzzyPolicyForToken` picks a policy. */
17
17
  fuzzy?: FuzzyPolicy | null;
18
18
  /**
19
- * Match characters that appear in order but not adjacently, so `pasbab` finds
20
- * `paseo-babysit`. Defaults to on. Turn it off where a near miss has to read as
21
- * no match at all: it widens far enough that most typos hit something, and a
22
- * list that preselects its first row would then act on that row when the user
23
- * presses Enter expecting nothing to happen.
19
+ * Match characters in order within one whitespace-delimited word, so `pasbab`
20
+ * finds `paseo-babysit`, but `labdes` cannot join "Label as Design". Defaults to on.
24
21
  */
25
22
  subsequence?: boolean;
26
23
  }
@@ -56,6 +56,12 @@ function scoreSubsequenceMatch(query, text) {
56
56
  let firstIndex = -1;
57
57
  let lastIndex = -1;
58
58
  for (let textIndex = 0; textIndex < text.length && queryIndex < query.length; textIndex += 1) {
59
+ if (/\s/u.test(text[textIndex])) {
60
+ queryIndex = 0;
61
+ firstIndex = -1;
62
+ lastIndex = -1;
63
+ continue;
64
+ }
59
65
  if (text[textIndex] !== query[queryIndex])
60
66
  continue;
61
67
  if (firstIndex === -1)
@@ -242,7 +248,7 @@ export function matchRanges(query, text, score) {
242
248
  if (score.tier === TIER_SUBSEQUENCE) {
243
249
  const indices = [];
244
250
  let queryIndex = 0;
245
- for (let textIndex = 0; textIndex < t.length && queryIndex < q.length; textIndex += 1) {
251
+ for (let textIndex = score.offset; textIndex < t.length && queryIndex < q.length; textIndex += 1) {
246
252
  if (t[textIndex] !== q[queryIndex])
247
253
  continue;
248
254
  indices.push(textIndex);
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ export declare const TerminalProfileSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ command: z.ZodString;
6
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ icon: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$loose>;
9
+ export type TerminalProfile = z.infer<typeof TerminalProfileSchema>;
10
+ //# sourceMappingURL=terminal-profile.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ export const TerminalProfileSchema = z
3
+ .object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ command: z.string(),
7
+ args: z.array(z.string()).optional(),
8
+ icon: z.string().optional(),
9
+ })
10
+ .passthrough();
11
+ //# sourceMappingURL=terminal-profile.js.map