reffy-cli 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,5 +4,5 @@ export { runDoctor } from "./doctor.js";
4
4
  export { createPlanScaffold } from "./plan.js";
5
5
  export { loadDotEnvIfPresent, parseDotEnv } from "./env.js";
6
6
  export { ensureGitignoreEntries } from "./gitignore.js";
7
- export { collectWorkspaceDocuments, ensureRemoteInit, extractWorkspaceIdentity, PaseoRemoteClient, readRemoteConfig, resolveRemoteConfigPath, resolveRemoteTarget, resolveSelectedWorkspaceId, toCanonicalRemotePath, writeRemoteConfig, } from "./remote.js";
7
+ export { collectWorkspaceDocuments, ensureManagerInit, ensureWorkspaceTarget, extractWorkspaceSummaryIdentity, PaseoManagerClient, PaseoWorkspaceBackendClient, readRemoteConfig, resolveRemoteConfigPath, resolveRemoteTarget, resolveSelectedWorkspaceId, toCanonicalRemotePath, writeRemoteConfig, } from "./remote.js";
8
8
  export { listSpecs, showSpec } from "./spec-runtime.js";
package/dist/index.js CHANGED
@@ -4,5 +4,5 @@ export { runDoctor } from "./doctor.js";
4
4
  export { createPlanScaffold } from "./plan.js";
5
5
  export { loadDotEnvIfPresent, parseDotEnv } from "./env.js";
6
6
  export { ensureGitignoreEntries } from "./gitignore.js";
7
- export { collectWorkspaceDocuments, ensureRemoteInit, extractWorkspaceIdentity, PaseoRemoteClient, readRemoteConfig, resolveRemoteConfigPath, resolveRemoteTarget, resolveSelectedWorkspaceId, toCanonicalRemotePath, writeRemoteConfig, } from "./remote.js";
7
+ export { collectWorkspaceDocuments, ensureManagerInit, ensureWorkspaceTarget, extractWorkspaceSummaryIdentity, PaseoManagerClient, PaseoWorkspaceBackendClient, readRemoteConfig, resolveRemoteConfigPath, resolveRemoteTarget, resolveSelectedWorkspaceId, toCanonicalRemotePath, writeRemoteConfig, } from "./remote.js";
8
8
  export { listSpecs, showSpec } from "./spec-runtime.js";
package/dist/remote.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import type { RemoteDocument, RemoteImportResult, RemoteLinkConfig, RemoteTarget, RemoteWorkspaceSummary } from "./types.js";
2
- export declare const REMOTE_CONFIG_VERSION = 2;
1
+ import type { RemoteActorIdentity, RemoteDocument, RemoteImportResult, RemoteLinkConfig, RemoteTarget, RemoteWorkspaceSummary } from "./types.js";
2
+ export declare const REMOTE_CONFIG_VERSION = 4;
3
3
  export declare const REMOTE_PROVIDER = "paseo";
4
4
  export declare const REMOTE_BACKEND_ACTOR_TYPE = "reffyRemoteBackend";
5
5
  export declare const REMOTE_BACKEND_VERSION = "v2";
6
+ export declare const REMOTE_MANAGER_ACTOR_TYPE = "reffyWorkspaceManager";
7
+ export declare const REMOTE_MANAGER_VERSION = "v1";
6
8
  export interface WorkspaceIdentity {
7
9
  project_id: string;
8
10
  workspace_id: string;
@@ -13,24 +15,10 @@ export interface ManifestIdentityLike {
13
15
  }
14
16
  export interface ResolvedRemoteTarget {
15
17
  endpoint: string;
16
- pod_name: string;
17
- actor_id: string;
18
+ manager: RemoteActorIdentity;
19
+ workspace_backend: RemoteActorIdentity;
18
20
  last_imported_at?: string;
19
21
  }
20
- export interface EnsureRemoteInitOptions {
21
- endpoint: string;
22
- podName?: string;
23
- actorId?: string;
24
- provision: boolean;
25
- identity: WorkspaceIdentity;
26
- existingConfig: RemoteLinkConfig | null;
27
- }
28
- export interface EnsureRemoteInitResult {
29
- config: RemoteLinkConfig;
30
- target: RemoteTarget;
31
- created_pod: boolean;
32
- created_actor: boolean;
33
- }
34
22
  export interface ValidatedImportResult {
35
23
  imported: number;
36
24
  created: number;
@@ -43,50 +31,144 @@ export declare function requireWorkspaceIdentity(identity: ManifestIdentityLike,
43
31
  export declare function readRemoteConfig(repoRoot: string): Promise<RemoteLinkConfig | null>;
44
32
  export declare function writeRemoteConfig(repoRoot: string, config: RemoteLinkConfig): Promise<string>;
45
33
  export declare function updateRemoteConfigMetadata(repoRoot: string, workspaceId: string, patch: Partial<Pick<RemoteTarget, "last_imported_at">>): Promise<RemoteLinkConfig | null>;
46
- export declare function resolveRemoteTarget(stored: RemoteLinkConfig | null, workspaceId: string, overrides: {
47
- endpoint?: string;
48
- pod_name?: string;
49
- actor_id?: string;
50
- }): ResolvedRemoteTarget | null;
34
+ export declare function removeWorkspaceTarget(repoRoot: string, existing: RemoteLinkConfig, workspaceId: string): Promise<{
35
+ config: RemoteLinkConfig;
36
+ existed: boolean;
37
+ }>;
38
+ export declare function upsertWorkspaceTarget(repoRoot: string, existing: RemoteLinkConfig, workspaceId: string, workspaceBackend: RemoteActorIdentity): Promise<RemoteLinkConfig>;
39
+ export declare function resolveRemoteTarget(stored: RemoteLinkConfig | null, workspaceId: string, endpoint: string): ResolvedRemoteTarget | null;
51
40
  export declare function describeRemoteLinkage(linkage: {
52
41
  endpoint: string;
53
- pod_name: string;
54
- actor_id: string;
42
+ manager: RemoteActorIdentity;
43
+ workspace_backend: RemoteActorIdentity;
55
44
  workspace_id: string;
56
45
  }): string;
57
- export declare class PaseoRemoteClient {
58
- private readonly config;
59
- constructor(config: {
60
- endpoint: string;
61
- pod_name: string;
62
- actor_id: string;
63
- });
46
+ export declare class RemoteHttpError extends Error {
47
+ readonly status: number;
48
+ readonly body: string;
49
+ readonly url: string;
50
+ readonly method: string;
51
+ constructor(status: number, statusText: string, body: string, url: string, method: string);
52
+ }
53
+ export interface ManagerWorkspaceResponse {
54
+ workspace?: {
55
+ workspace_id?: string;
56
+ backend?: {
57
+ pod_name?: string;
58
+ actor_id?: string;
59
+ };
60
+ metadata?: Record<string, unknown>;
61
+ };
62
+ }
63
+ export interface ManagerProjectListResponse {
64
+ projects?: Array<{
65
+ project_id?: string;
66
+ metadata?: Record<string, unknown>;
67
+ }>;
68
+ }
69
+ export interface ManagerProjectResponse {
70
+ project?: {
71
+ project_id?: string;
72
+ metadata?: Record<string, unknown>;
73
+ };
74
+ }
75
+ export interface CreateManagerActorResult {
76
+ actorId: string;
77
+ managerAuthToken: string;
78
+ }
79
+ export declare class PaseoManagerClient {
80
+ private readonly endpoint;
81
+ private readonly identity;
82
+ private readonly token?;
83
+ constructor(endpoint: string, identity: RemoteActorIdentity, token?: string);
84
+ private base;
85
+ private requireToken;
64
86
  createPod(): Promise<string>;
65
- createActor(identity: WorkspaceIdentity): Promise<string>;
66
- getWorkspace(workspaceId: string): Promise<RemoteWorkspaceSummary>;
67
- importWorkspace(workspaceId: string, documents: RemoteDocument[], replaceMissing?: boolean): Promise<RemoteImportResult>;
68
- getSnapshot(workspaceId: string, prefix?: string): Promise<{
69
- documents?: Array<{
70
- path?: string;
71
- }>;
87
+ createManagerActor(podName: string): Promise<CreateManagerActorResult>;
88
+ createWorkspace(workspaceId: string, metadata?: Record<string, unknown>): Promise<RemoteActorIdentity>;
89
+ getWorkspace(workspaceId: string): Promise<RemoteActorIdentity>;
90
+ registerProject(workspaceId: string, projectId: string): Promise<{
91
+ alreadyRegistered: boolean;
72
92
  }>;
73
- getDocument(workspaceId: string, documentPath: string): Promise<{
74
- document?: {
75
- path?: string;
76
- content?: string;
77
- content_type?: string;
78
- };
93
+ listProjects(workspaceId: string): Promise<ManagerProjectListResponse>;
94
+ getProject(workspaceId: string, projectId: string): Promise<ManagerProjectResponse>;
95
+ deleteWorkspace(workspaceId: string): Promise<{
96
+ alreadyAbsent: boolean;
79
97
  }>;
80
98
  }
81
- export declare function ensureRemoteInit(repoRoot: string, options: EnsureRemoteInitOptions): Promise<EnsureRemoteInitResult>;
82
- export declare function extractWorkspaceIdentity(summary: RemoteWorkspaceSummary): {
83
- project_id?: string | null;
99
+ export interface ProjectDocumentListResponse {
100
+ documents?: Array<{
101
+ path?: string;
102
+ content?: string;
103
+ content_type?: string;
104
+ metadata?: Record<string, unknown>;
105
+ }>;
106
+ }
107
+ export interface ProjectDocumentResponse {
108
+ document?: {
109
+ path?: string;
110
+ content?: string;
111
+ content_type?: string;
112
+ metadata?: Record<string, unknown>;
113
+ };
114
+ }
115
+ export interface ProjectSnapshotResponse {
116
+ snapshot?: Record<string, unknown>;
117
+ documents?: Array<{
118
+ path?: string;
119
+ }>;
120
+ }
121
+ export declare class PaseoWorkspaceBackendClient {
122
+ private readonly endpoint;
123
+ private readonly identity;
124
+ private readonly token;
125
+ constructor(endpoint: string, identity: RemoteActorIdentity, token: string);
126
+ private base;
127
+ getWorkspace(): Promise<RemoteWorkspaceSummary>;
128
+ importProject(projectId: string, documents: RemoteDocument[], replaceMissing?: boolean): Promise<RemoteImportResult>;
129
+ listProjectDocuments(projectId: string, options?: {
130
+ prefix?: string;
131
+ }): Promise<ProjectDocumentListResponse>;
132
+ getProjectDocument(projectId: string, documentPath: string): Promise<ProjectDocumentResponse>;
133
+ getProjectSnapshot(projectId: string): Promise<ProjectSnapshotResponse>;
134
+ }
135
+ export interface EnsureManagerInitOptions {
136
+ endpoint: string;
137
+ managerPodName?: string;
138
+ managerActorId?: string;
139
+ provision: boolean;
140
+ existingConfig: RemoteLinkConfig | null;
141
+ }
142
+ export interface EnsureManagerInitResult {
143
+ config: RemoteLinkConfig;
144
+ created_pod: boolean;
145
+ created_actor: boolean;
146
+ /** Bearer token returned by the backend when a fresh manager actor was created. Only set when `created_actor` is true. */
147
+ manager_auth_token?: string;
148
+ }
149
+ export declare function ensureManagerInit(repoRoot: string, options: EnsureManagerInitOptions): Promise<EnsureManagerInitResult>;
150
+ export type WorkspaceTargetMode = "create" | "resolve" | "auto";
151
+ export interface EnsureWorkspaceTargetOptions {
152
+ workspaceId: string;
153
+ mode: WorkspaceTargetMode;
154
+ endpoint: string;
155
+ token: string;
156
+ metadata?: Record<string, unknown>;
157
+ }
158
+ export interface EnsureWorkspaceTargetResult {
159
+ config: RemoteLinkConfig;
160
+ workspace_backend: RemoteActorIdentity;
161
+ outcome: "created" | "resolved" | "reused";
162
+ }
163
+ export declare function ensureWorkspaceTarget(repoRoot: string, config: RemoteLinkConfig, options: EnsureWorkspaceTargetOptions): Promise<EnsureWorkspaceTargetResult>;
164
+ export declare function extractWorkspaceSummaryIdentity(summary: RemoteWorkspaceSummary): {
84
165
  workspace_id?: string | null;
85
166
  actor_type?: string | null;
86
167
  backend_version?: string | null;
87
168
  document_count?: number | null;
169
+ registered_project_count?: number | null;
88
170
  };
89
- export declare function assertRemoteIdentity(summary: RemoteWorkspaceSummary, identity: WorkspaceIdentity): void;
171
+ export declare function assertWorkspaceSummaryIdentity(summary: RemoteWorkspaceSummary, expectedWorkspaceId: string): void;
90
172
  export declare function validateImportResult(result: RemoteImportResult): ValidatedImportResult;
91
173
  export declare function toCanonicalRemotePath(refsDir: string, filePath: string): string;
92
174
  export declare function collectWorkspaceDocuments(repoRoot: string): Promise<RemoteDocument[]>;