@applica-software-guru/sdd-core 1.3.4 → 1.4.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.
Files changed (53) hide show
  1. package/dist/errors.d.ts +7 -0
  2. package/dist/errors.d.ts.map +1 -1
  3. package/dist/errors.js +17 -1
  4. package/dist/errors.js.map +1 -1
  5. package/dist/index.d.ts +9 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +27 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/prompt/apply-prompt-generator.d.ts +2 -1
  10. package/dist/prompt/apply-prompt-generator.d.ts.map +1 -1
  11. package/dist/prompt/apply-prompt-generator.js +51 -2
  12. package/dist/prompt/apply-prompt-generator.js.map +1 -1
  13. package/dist/prompt/draft-prompt-generator.d.ts +8 -0
  14. package/dist/prompt/draft-prompt-generator.d.ts.map +1 -0
  15. package/dist/prompt/draft-prompt-generator.js +59 -0
  16. package/dist/prompt/draft-prompt-generator.js.map +1 -0
  17. package/dist/remote/api-client.d.ts +38 -0
  18. package/dist/remote/api-client.d.ts.map +1 -0
  19. package/dist/remote/api-client.js +101 -0
  20. package/dist/remote/api-client.js.map +1 -0
  21. package/dist/remote/state.d.ts +4 -0
  22. package/dist/remote/state.d.ts.map +1 -0
  23. package/dist/remote/state.js +35 -0
  24. package/dist/remote/state.js.map +1 -0
  25. package/dist/remote/sync-engine.d.ts +11 -0
  26. package/dist/remote/sync-engine.d.ts.map +1 -0
  27. package/dist/remote/sync-engine.js +258 -0
  28. package/dist/remote/sync-engine.js.map +1 -0
  29. package/dist/remote/types.d.ts +93 -0
  30. package/dist/remote/types.d.ts.map +1 -0
  31. package/dist/remote/types.js +3 -0
  32. package/dist/remote/types.js.map +1 -0
  33. package/dist/sdd.d.ts +15 -0
  34. package/dist/sdd.d.ts.map +1 -1
  35. package/dist/sdd.js +99 -6
  36. package/dist/sdd.js.map +1 -1
  37. package/dist/types.d.ts +9 -4
  38. package/dist/types.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/errors.ts +16 -0
  41. package/src/index.ts +23 -1
  42. package/src/prompt/apply-prompt-generator.ts +61 -2
  43. package/src/prompt/draft-prompt-generator.ts +74 -0
  44. package/src/remote/api-client.ts +138 -0
  45. package/src/remote/state.ts +35 -0
  46. package/src/remote/sync-engine.ts +302 -0
  47. package/src/remote/types.ts +102 -0
  48. package/src/sdd.ts +114 -6
  49. package/src/types.ts +10 -4
  50. package/tests/api-client.test.ts +198 -0
  51. package/tests/cr.test.ts +27 -10
  52. package/tests/remote-state.test.ts +90 -0
  53. package/tests/sync-engine.test.ts +341 -0
package/dist/errors.d.ts CHANGED
@@ -10,4 +10,11 @@ export declare class ParseError extends SDDError {
10
10
  export declare class ProjectNotInitializedError extends SDDError {
11
11
  constructor(root: string);
12
12
  }
13
+ export declare class RemoteError extends SDDError {
14
+ statusCode: number;
15
+ constructor(statusCode: number, message: string);
16
+ }
17
+ export declare class RemoteNotConfiguredError extends SDDError {
18
+ constructor();
19
+ }
13
20
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,qBAAsB,SAAQ,QAAQ;gBACrC,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,UAAW,SAAQ,QAAQ;gBAC1B,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI7C;AAED,qBAAa,0BAA2B,SAAQ,QAAQ;gBAC1C,IAAI,EAAE,MAAM;CAIzB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,qBAAsB,SAAQ,QAAQ;gBACrC,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,UAAW,SAAQ,QAAQ;gBAC1B,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI7C;AAED,qBAAa,0BAA2B,SAAQ,QAAQ;gBAC1C,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,WAAY,SAAQ,QAAQ;IAChC,UAAU,EAAE,MAAM,CAAC;gBACd,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAKhD;AAED,qBAAa,wBAAyB,SAAQ,QAAQ;;CAKrD"}
package/dist/errors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectNotInitializedError = exports.ParseError = exports.LockFileNotFoundError = exports.SDDError = void 0;
3
+ exports.RemoteNotConfiguredError = exports.RemoteError = exports.ProjectNotInitializedError = exports.ParseError = exports.LockFileNotFoundError = exports.SDDError = void 0;
4
4
  class SDDError extends Error {
5
5
  constructor(message) {
6
6
  super(message);
@@ -29,4 +29,20 @@ class ProjectNotInitializedError extends SDDError {
29
29
  }
30
30
  }
31
31
  exports.ProjectNotInitializedError = ProjectNotInitializedError;
32
+ class RemoteError extends SDDError {
33
+ statusCode;
34
+ constructor(statusCode, message) {
35
+ super(`Remote error (${statusCode}): ${message}`);
36
+ this.name = 'RemoteError';
37
+ this.statusCode = statusCode;
38
+ }
39
+ }
40
+ exports.RemoteError = RemoteError;
41
+ class RemoteNotConfiguredError extends SDDError {
42
+ constructor() {
43
+ super('Remote not configured. Run "sdd remote init" first.');
44
+ this.name = 'RemoteNotConfiguredError';
45
+ }
46
+ }
47
+ exports.RemoteNotConfiguredError = RemoteNotConfiguredError;
32
48
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAS,SAAQ,KAAK;IACjC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CA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;AAED,MAAa,0BAA2B,SAAQ,QAAQ;IACtD,YAAY,IAAY;QACtB,KAAK,CAAC,2BAA2B,IAAI,yBAAyB,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC3C,CAAC;CACF;AALD,gEAKC;AAED,MAAa,WAAY,SAAQ,QAAQ;IAChC,UAAU,CAAS;IAC1B,YAAY,UAAkB,EAAE,OAAe;QAC7C,KAAK,CAAC,iBAAiB,UAAU,MAAM,OAAO,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAPD,kCAOC;AAED,MAAa,wBAAyB,SAAQ,QAAQ;IACpD;QACE,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AALD,4DAKC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { SDD } from "./sdd.js";
2
- export type { StoryFrontmatter, StoryFile, PendingItem, Delta, DeltaFile, ValidationResult, ValidationIssue, StoryStatus, StoryFileStatus, SDDConfig, ChangeRequest, ChangeRequestFrontmatter, ChangeRequestStatus, Bug, BugFrontmatter, BugStatus, } from "./types.js";
3
- export { SDDError, LockFileNotFoundError, ParseError, ProjectNotInitializedError } from "./errors.js";
2
+ export type { StoryFrontmatter, StoryFile, PendingItem, Delta, DeltaFile, ValidationResult, ValidationIssue, StoryStatus, StoryFileStatus, SDDConfig, ChangeRequest, ChangeRequestFrontmatter, ChangeRequestStatus, Bug, BugFrontmatter, BugStatus, RemoteConfig, } from "./types.js";
3
+ export { SDDError, LockFileNotFoundError, ParseError, ProjectNotInitializedError, RemoteError, RemoteNotConfiguredError } from "./errors.js";
4
4
  export type { ProjectInfo } from "./scaffold/templates.js";
5
5
  export { isSDDProject, readConfig, writeConfig } from "./config/config-manager.js";
6
6
  export { runAgent } from "./agent/agent-runner.js";
@@ -8,4 +8,11 @@ export type { AgentRunnerOptions } from "./agent/agent-runner.js";
8
8
  export { DEFAULT_AGENTS, resolveAgentCommand } from "./agent/agent-defaults.js";
9
9
  export { listSupportedAdapters, SKILL_ADAPTERS, syncSkillAdapters } from "./scaffold/skill-adapters.js";
10
10
  export type { AdapterMode, SkillAdapterDefinition, SyncAdaptersOptions, AdapterFileAction, AdapterFileChange, SyncAdaptersResult, } from "./scaffold/skill-adapters.js";
11
+ export { generateDraftEnrichmentPrompt } from "./prompt/draft-prompt-generator.js";
12
+ export type { DraftElements } from "./prompt/draft-prompt-generator.js";
13
+ export { resolveApiKey, buildApiConfig, pullDocs, pushDocs, fetchPendingCRs, fetchOpenBugs, markCRAppliedRemote, markBugResolvedRemote, markDocEnriched, markCREnriched, markBugEnriched } from "./remote/api-client.js";
14
+ export type { ApiClientConfig } from "./remote/api-client.js";
15
+ export { readRemoteState, writeRemoteState } from "./remote/state.js";
16
+ export { pushToRemote, pullFromRemote, pullCRsFromRemote, pullBugsFromRemote, getRemoteStatus } from "./remote/sync-engine.js";
17
+ export type { RemoteDocResponse, RemoteDocBulkResponse, RemoteCRResponse, RemoteBugResponse, RemoteState, RemoteDocState, PushResult, PullResult, PullConflict, PullEntitiesResult, RemoteStatusResult, } from "./remote/types.js";
11
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,YAAY,EACV,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,eAAe,EACf,SAAS,EACT,aAAa,EACb,wBAAwB,EACxB,mBAAmB,EACnB,GAAG,EACH,cAAc,EACd,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE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E,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACxG,YAAY,EACV,WAAW,EACX,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,YAAY,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzN,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/H,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,UAAU,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.syncSkillAdapters = exports.SKILL_ADAPTERS = exports.listSupportedAdapters = exports.resolveAgentCommand = exports.DEFAULT_AGENTS = exports.runAgent = exports.writeConfig = exports.readConfig = exports.isSDDProject = exports.ProjectNotInitializedError = exports.ParseError = exports.LockFileNotFoundError = exports.SDDError = exports.SDD = void 0;
3
+ exports.getRemoteStatus = exports.pullBugsFromRemote = exports.pullCRsFromRemote = exports.pullFromRemote = exports.pushToRemote = exports.writeRemoteState = exports.readRemoteState = exports.markBugEnriched = exports.markCREnriched = exports.markDocEnriched = exports.markBugResolvedRemote = exports.markCRAppliedRemote = exports.fetchOpenBugs = exports.fetchPendingCRs = exports.pushDocs = exports.pullDocs = exports.buildApiConfig = exports.resolveApiKey = exports.generateDraftEnrichmentPrompt = exports.syncSkillAdapters = exports.SKILL_ADAPTERS = exports.listSupportedAdapters = exports.resolveAgentCommand = exports.DEFAULT_AGENTS = exports.runAgent = exports.writeConfig = exports.readConfig = exports.isSDDProject = exports.RemoteNotConfiguredError = exports.RemoteError = exports.ProjectNotInitializedError = exports.ParseError = exports.LockFileNotFoundError = exports.SDDError = exports.SDD = void 0;
4
4
  var sdd_js_1 = require("./sdd.js");
5
5
  Object.defineProperty(exports, "SDD", { enumerable: true, get: function () { return sdd_js_1.SDD; } });
6
6
  var errors_js_1 = require("./errors.js");
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "SDDError", { enumerable: true, get: function ()
8
8
  Object.defineProperty(exports, "LockFileNotFoundError", { enumerable: true, get: function () { return errors_js_1.LockFileNotFoundError; } });
9
9
  Object.defineProperty(exports, "ParseError", { enumerable: true, get: function () { return errors_js_1.ParseError; } });
10
10
  Object.defineProperty(exports, "ProjectNotInitializedError", { enumerable: true, get: function () { return errors_js_1.ProjectNotInitializedError; } });
11
+ Object.defineProperty(exports, "RemoteError", { enumerable: true, get: function () { return errors_js_1.RemoteError; } });
12
+ Object.defineProperty(exports, "RemoteNotConfiguredError", { enumerable: true, get: function () { return errors_js_1.RemoteNotConfiguredError; } });
11
13
  var config_manager_js_1 = require("./config/config-manager.js");
12
14
  Object.defineProperty(exports, "isSDDProject", { enumerable: true, get: function () { return config_manager_js_1.isSDDProject; } });
13
15
  Object.defineProperty(exports, "readConfig", { enumerable: true, get: function () { return config_manager_js_1.readConfig; } });
@@ -21,4 +23,28 @@ var skill_adapters_js_1 = require("./scaffold/skill-adapters.js");
21
23
  Object.defineProperty(exports, "listSupportedAdapters", { enumerable: true, get: function () { return skill_adapters_js_1.listSupportedAdapters; } });
22
24
  Object.defineProperty(exports, "SKILL_ADAPTERS", { enumerable: true, get: function () { return skill_adapters_js_1.SKILL_ADAPTERS; } });
23
25
  Object.defineProperty(exports, "syncSkillAdapters", { enumerable: true, get: function () { return skill_adapters_js_1.syncSkillAdapters; } });
26
+ // Remote sync
27
+ var draft_prompt_generator_js_1 = require("./prompt/draft-prompt-generator.js");
28
+ Object.defineProperty(exports, "generateDraftEnrichmentPrompt", { enumerable: true, get: function () { return draft_prompt_generator_js_1.generateDraftEnrichmentPrompt; } });
29
+ var api_client_js_1 = require("./remote/api-client.js");
30
+ Object.defineProperty(exports, "resolveApiKey", { enumerable: true, get: function () { return api_client_js_1.resolveApiKey; } });
31
+ Object.defineProperty(exports, "buildApiConfig", { enumerable: true, get: function () { return api_client_js_1.buildApiConfig; } });
32
+ Object.defineProperty(exports, "pullDocs", { enumerable: true, get: function () { return api_client_js_1.pullDocs; } });
33
+ Object.defineProperty(exports, "pushDocs", { enumerable: true, get: function () { return api_client_js_1.pushDocs; } });
34
+ Object.defineProperty(exports, "fetchPendingCRs", { enumerable: true, get: function () { return api_client_js_1.fetchPendingCRs; } });
35
+ Object.defineProperty(exports, "fetchOpenBugs", { enumerable: true, get: function () { return api_client_js_1.fetchOpenBugs; } });
36
+ Object.defineProperty(exports, "markCRAppliedRemote", { enumerable: true, get: function () { return api_client_js_1.markCRAppliedRemote; } });
37
+ Object.defineProperty(exports, "markBugResolvedRemote", { enumerable: true, get: function () { return api_client_js_1.markBugResolvedRemote; } });
38
+ Object.defineProperty(exports, "markDocEnriched", { enumerable: true, get: function () { return api_client_js_1.markDocEnriched; } });
39
+ Object.defineProperty(exports, "markCREnriched", { enumerable: true, get: function () { return api_client_js_1.markCREnriched; } });
40
+ Object.defineProperty(exports, "markBugEnriched", { enumerable: true, get: function () { return api_client_js_1.markBugEnriched; } });
41
+ var state_js_1 = require("./remote/state.js");
42
+ Object.defineProperty(exports, "readRemoteState", { enumerable: true, get: function () { return state_js_1.readRemoteState; } });
43
+ Object.defineProperty(exports, "writeRemoteState", { enumerable: true, get: function () { return state_js_1.writeRemoteState; } });
44
+ var sync_engine_js_1 = require("./remote/sync-engine.js");
45
+ Object.defineProperty(exports, "pushToRemote", { enumerable: true, get: function () { return sync_engine_js_1.pushToRemote; } });
46
+ Object.defineProperty(exports, "pullFromRemote", { enumerable: true, get: function () { return sync_engine_js_1.pullFromRemote; } });
47
+ Object.defineProperty(exports, "pullCRsFromRemote", { enumerable: true, get: function () { return sync_engine_js_1.pullCRsFromRemote; } });
48
+ Object.defineProperty(exports, "pullBugsFromRemote", { enumerable: true, get: function () { return sync_engine_js_1.pullBugsFromRemote; } });
49
+ Object.defineProperty(exports, "getRemoteStatus", { enumerable: true, get: function () { return sync_engine_js_1.getRemoteStatus; } });
24
50
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AAmBZ,yCAAsG;AAA7F,qGAAA,QAAQ,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,uHAAA,0BAA0B,OAAA;AAEhF,gEAAmF;AAA1E,iHAAA,YAAY,OAAA;AAAE,+GAAA,UAAU,OAAA;AAAE,gHAAA,WAAW,OAAA;AAC9C,2DAAmD;AAA1C,2GAAA,QAAQ,OAAA;AAEjB,+DAAgF;AAAvE,mHAAA,cAAc,OAAA;AAAE,wHAAA,mBAAmB,OAAA;AAC5C,kEAAwG;AAA/F,0HAAA,qBAAqB,OAAA;AAAE,mHAAA,cAAc,OAAA;AAAE,sHAAA,iBAAiB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AAoBZ,yCAA6I;AAApI,qGAAA,QAAQ,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,uHAAA,0BAA0B,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,qHAAA,wBAAwB,OAAA;AAEvH,gEAAmF;AAA1E,iHAAA,YAAY,OAAA;AAAE,+GAAA,UAAU,OAAA;AAAE,gHAAA,WAAW,OAAA;AAC9C,2DAAmD;AAA1C,2GAAA,QAAQ,OAAA;AAEjB,+DAAgF;AAAvE,mHAAA,cAAc,OAAA;AAAE,wHAAA,mBAAmB,OAAA;AAC5C,kEAAwG;AAA/F,0HAAA,qBAAqB,OAAA;AAAE,mHAAA,cAAc,OAAA;AAAE,sHAAA,iBAAiB,OAAA;AAUjE,cAAc;AACd,gFAAmF;AAA1E,0IAAA,6BAA6B,OAAA;AAEtC,wDAAyN;AAAhN,8GAAA,aAAa,OAAA;AAAE,+GAAA,cAAc,OAAA;AAAE,yGAAA,QAAQ,OAAA;AAAE,yGAAA,QAAQ,OAAA;AAAE,gHAAA,eAAe,OAAA;AAAE,8GAAA,aAAa,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAAE,sHAAA,qBAAqB,OAAA;AAAE,gHAAA,eAAe,OAAA;AAAE,+GAAA,cAAc,OAAA;AAAE,gHAAA,eAAe,OAAA;AAExL,8CAAsE;AAA7D,2GAAA,eAAe,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAC1C,0DAA+H;AAAtH,8GAAA,YAAY,OAAA;AAAE,gHAAA,cAAc,OAAA;AAAE,mHAAA,iBAAiB,OAAA;AAAE,oHAAA,kBAAkB,OAAA;AAAE,iHAAA,eAAe,OAAA"}
@@ -1,3 +1,4 @@
1
1
  import type { Bug, ChangeRequest, StoryFile } from '../types.js';
2
- export declare function generateApplyPrompt(bugs: Bug[], changeRequests: ChangeRequest[], pendingFiles: StoryFile[], root: string): string | null;
2
+ import type { DraftElements } from './draft-prompt-generator.js';
3
+ export declare function generateApplyPrompt(bugs: Bug[], changeRequests: ChangeRequest[], pendingFiles: StoryFile[], root: string, drafts?: DraftElements, projectContext?: StoryFile[], projectDescription?: string): string | null;
3
4
  //# sourceMappingURL=apply-prompt-generator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apply-prompt-generator.d.ts","sourceRoot":"","sources":["../../src/prompt/apply-prompt-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGjE,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,EAAE,EACX,cAAc,EAAE,aAAa,EAAE,EAC/B,YAAY,EAAE,SAAS,EAAE,EACzB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAiDf"}
1
+ {"version":3,"file":"apply-prompt-generator.d.ts","sourceRoot":"","sources":["../../src/prompt/apply-prompt-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,EAAE,EACX,cAAc,EAAE,aAAa,EAAE,EAC/B,YAAY,EAAE,SAAS,EAAE,EACzB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,aAAa,EACtB,cAAc,CAAC,EAAE,SAAS,EAAE,EAC5B,kBAAkB,CAAC,EAAE,MAAM,GAC1B,MAAM,GAAG,IAAI,CAwGf"}
@@ -2,11 +2,60 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateApplyPrompt = generateApplyPrompt;
4
4
  const git_js_1 = require("../git/git.js");
5
- function generateApplyPrompt(bugs, changeRequests, pendingFiles, root) {
6
- if (bugs.length === 0 && changeRequests.length === 0 && pendingFiles.length === 0) {
5
+ function generateApplyPrompt(bugs, changeRequests, pendingFiles, root, drafts, projectContext, projectDescription) {
6
+ const hasDrafts = drafts && (drafts.docs.length > 0 || drafts.crs.length > 0 || drafts.bugs.length > 0);
7
+ if (bugs.length === 0 && changeRequests.length === 0 && pendingFiles.length === 0 && !hasDrafts) {
7
8
  return null;
8
9
  }
9
10
  const sections = [];
11
+ // Draft enrichment section (takes priority)
12
+ if (hasDrafts) {
13
+ sections.push(`# Draft Enrichment\n`);
14
+ if (projectDescription) {
15
+ sections.push(`## Project\n\n${projectDescription}\n`);
16
+ }
17
+ // Global context for enrichment
18
+ if (projectContext && projectContext.length > 0) {
19
+ const ctxLines = [`## Project context (${projectContext.length} documents)\n`];
20
+ ctxLines.push('Use the following existing documents as context to produce complete, coherent documentation.\n');
21
+ for (const f of projectContext) {
22
+ ctxLines.push(`### \`${f.relativePath}\` — ${f.frontmatter.title}\n`);
23
+ ctxLines.push(f.body.trim());
24
+ ctxLines.push('');
25
+ }
26
+ sections.push(ctxLines.join('\n'));
27
+ }
28
+ if (drafts.docs.length > 0) {
29
+ const lines = [`## Draft documents to enrich (${drafts.docs.length})\n`];
30
+ lines.push('Each draft below contains incomplete human-written content. Produce a complete version for each document, preserving the original intent while adding missing details based on project context.\n');
31
+ for (const f of drafts.docs) {
32
+ lines.push(`### \`${f.relativePath}\` — ${f.frontmatter.title}\n`);
33
+ lines.push(f.body.trim());
34
+ lines.push('');
35
+ }
36
+ sections.push(lines.join('\n'));
37
+ }
38
+ if (drafts.crs.length > 0) {
39
+ const lines = [`## Draft change requests to enrich (${drafts.crs.length})\n`];
40
+ lines.push('Each draft CR contains a rough description of requested changes. Produce a complete, actionable change request for each.\n');
41
+ for (const cr of drafts.crs) {
42
+ lines.push(`### \`${cr.relativePath}\` — ${cr.frontmatter.title}\n`);
43
+ lines.push(cr.body.trim());
44
+ lines.push('');
45
+ }
46
+ sections.push(lines.join('\n'));
47
+ }
48
+ if (drafts.bugs.length > 0) {
49
+ const lines = [`## Draft bugs to enrich (${drafts.bugs.length})\n`];
50
+ lines.push('Each draft bug contains a rough description of an issue. Produce a complete bug report for each.\n');
51
+ for (const bug of drafts.bugs) {
52
+ lines.push(`### \`${bug.relativePath}\` — ${bug.frontmatter.title}\n`);
53
+ lines.push(bug.body.trim());
54
+ lines.push('');
55
+ }
56
+ sections.push(lines.join('\n'));
57
+ }
58
+ }
10
59
  // Bugs
11
60
  if (bugs.length > 0) {
12
61
  const lines = [`## Open bugs (${bugs.length})\n`];
@@ -1 +1 @@
1
- {"version":3,"file":"apply-prompt-generator.js","sourceRoot":"","sources":["../../src/prompt/apply-prompt-generator.ts"],"names":[],"mappings":";;AAGA,kDAsDC;AAxDD,0CAA4C;AAE5C,SAAgB,mBAAmB,CACjC,IAAW,EACX,cAA+B,EAC/B,YAAyB,EACzB,IAAY;IAEZ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,OAAO;IACP,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,CAAC,iBAAiB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,YAAY,QAAQ,GAAG,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,CAAC;YACvE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QACD,QAAQ,CAAC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AC,MAAM,IAAI,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;QAC/E,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,IAAA,oBAAW,EAAC,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC;YAC/C,IAAI,IAAI,EAAE,CAAC;gBACT,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,YAAY,qBAAqB,IAAI,UAAU,CAAC,CAAC;YAC/E,CAAC;QACH,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Bug, ChangeRequest, StoryFile } from '../types.js';
2
+ export interface DraftElements {
3
+ docs: StoryFile[];
4
+ crs: ChangeRequest[];
5
+ bugs: Bug[];
6
+ }
7
+ export declare function generateDraftEnrichmentPrompt(drafts: DraftElements, projectContext: StoryFile[], projectDescription: string): string | null;
8
+ //# sourceMappingURL=draft-prompt-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-prompt-generator.d.ts","sourceRoot":"","sources":["../../src/prompt/draft-prompt-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,GAAG,EAAE,aAAa,EAAE,CAAC;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,SAAS,EAAE,EAC3B,kBAAkB,EAAE,MAAM,GACzB,MAAM,GAAG,IAAI,CA6Df"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateDraftEnrichmentPrompt = generateDraftEnrichmentPrompt;
4
+ function generateDraftEnrichmentPrompt(drafts, projectContext, projectDescription) {
5
+ const totalDrafts = drafts.docs.length + drafts.crs.length + drafts.bugs.length;
6
+ if (totalDrafts === 0) {
7
+ return null;
8
+ }
9
+ const sections = [];
10
+ // Project context header
11
+ sections.push(`# Draft Enrichment\n`);
12
+ sections.push(`## Project\n\n${projectDescription}\n`);
13
+ // Global context: all non-draft documents
14
+ if (projectContext.length > 0) {
15
+ const ctxLines = [`## Project context (${projectContext.length} documents)\n`];
16
+ ctxLines.push('Use the following existing documents as context to produce complete, coherent documentation.\n');
17
+ for (const f of projectContext) {
18
+ ctxLines.push(`### \`${f.relativePath}\` — ${f.frontmatter.title}\n`);
19
+ ctxLines.push(f.body.trim());
20
+ ctxLines.push('');
21
+ }
22
+ sections.push(ctxLines.join('\n'));
23
+ }
24
+ // Draft documents
25
+ if (drafts.docs.length > 0) {
26
+ const lines = [`## Draft documents to enrich (${drafts.docs.length})\n`];
27
+ lines.push('Each draft below contains incomplete human-written content. Produce a complete version for each document, preserving the original intent while adding missing details based on project context.\n');
28
+ for (const f of drafts.docs) {
29
+ lines.push(`### \`${f.relativePath}\` — ${f.frontmatter.title}\n`);
30
+ lines.push(f.body.trim());
31
+ lines.push('');
32
+ }
33
+ sections.push(lines.join('\n'));
34
+ }
35
+ // Draft change requests
36
+ if (drafts.crs.length > 0) {
37
+ const lines = [`## Draft change requests to enrich (${drafts.crs.length})\n`];
38
+ lines.push('Each draft CR contains a rough description of requested changes. Produce a complete, actionable change request for each, specifying which documents are affected and what changes should be made.\n');
39
+ for (const cr of drafts.crs) {
40
+ lines.push(`### \`${cr.relativePath}\` — ${cr.frontmatter.title}\n`);
41
+ lines.push(cr.body.trim());
42
+ lines.push('');
43
+ }
44
+ sections.push(lines.join('\n'));
45
+ }
46
+ // Draft bugs
47
+ if (drafts.bugs.length > 0) {
48
+ const lines = [`## Draft bugs to enrich (${drafts.bugs.length})\n`];
49
+ lines.push('Each draft bug contains a rough description of an issue. Produce a complete bug report for each, including affected components, expected vs actual behavior, and steps to reproduce when possible.\n');
50
+ for (const bug of drafts.bugs) {
51
+ lines.push(`### \`${bug.relativePath}\` — ${bug.frontmatter.title}\n`);
52
+ lines.push(bug.body.trim());
53
+ lines.push('');
54
+ }
55
+ sections.push(lines.join('\n'));
56
+ }
57
+ return sections.join('\n\n');
58
+ }
59
+ //# sourceMappingURL=draft-prompt-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-prompt-generator.js","sourceRoot":"","sources":["../../src/prompt/draft-prompt-generator.ts"],"names":[],"mappings":";;AAQA,sEAiEC;AAjED,SAAgB,6BAA6B,CAC3C,MAAqB,EACrB,cAA2B,EAC3B,kBAA0B;IAE1B,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;IAChF,IAAI,WAAW,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,kBAAkB,IAAI,CAAC,CAAC;IAEvD,0CAA0C;IAC1C,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,CAAC,uBAAuB,cAAc,CAAC,MAAM,eAAe,CAAC,CAAC;QAC/E,QAAQ,CAAC,I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+ export interface ApiClientConfig {
4
+ baseUrl: string;
5
+ apiKey: string;
6
+ }
7
+ /**
8
+ * Resolve API key: SDD_API_KEY env var > config.remote.api-key > null
9
+ */
10
+ export declare function resolveApiKey(config: SDDConfig): string | null;
11
+ /**
12
+ * Build an ApiClientConfig from the SDD project config.
13
+ * Throws RemoteNotConfiguredError if URL or API key is missing.
14
+ */
15
+ export declare function buildApiConfig(config: SDDConfig): ApiClientConfig;
16
+ /** GET /cli/pull-docs */
17
+ export declare function pullDocs(config: ApiClientConfig): Promise<RemoteDocResponse[]>;
18
+ /** POST /cli/push-docs */
19
+ export declare function pushDocs(config: ApiClientConfig, documents: Array<{
20
+ path: string;
21
+ title: string;
22
+ content: string;
23
+ }>): Promise<RemoteDocBulkResponse>;
24
+ /** GET /cli/pending-crs */
25
+ export declare function fetchPendingCRs(config: ApiClientConfig): Promise<RemoteCRResponse[]>;
26
+ /** GET /cli/open-bugs */
27
+ export declare function fetchOpenBugs(config: ApiClientConfig): Promise<RemoteBugResponse[]>;
28
+ /** POST /cli/crs/:crId/applied */
29
+ export declare function markCRAppliedRemote(config: ApiClientConfig, crId: string): Promise<RemoteCRResponse>;
30
+ /** POST /cli/bugs/:bugId/resolved */
31
+ export declare function markBugResolvedRemote(config: ApiClientConfig, bugId: string): Promise<RemoteBugResponse>;
32
+ /** POST /cli/docs/:docId/enriched — Notify remote that a draft doc has been enriched */
33
+ export declare function markDocEnriched(config: ApiClientConfig, docId: string, content: string): Promise<RemoteDocResponse>;
34
+ /** POST /cli/crs/:crId/enriched — Notify remote that a draft CR has been enriched */
35
+ export declare function markCREnriched(config: ApiClientConfig, crId: string, body: string): Promise<RemoteCRResponse>;
36
+ /** POST /cli/bugs/:bugId/enriched — Notify remote that a draft bug has been enriched */
37
+ export declare function markBugEnriched(config: ApiClientConfig, bugId: string, body: string): Promise<RemoteBugResponse>;
38
+ //# sourceMappingURL=api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.d.ts","sour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iB,CAAC,CAE5B;AAED,wFAAwF;AACxF,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,iBAAiB,CAAC,CAE5B;AAED,qFAAqF;AACrF,wBAAsB,cAAc,CAClC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED,wFAAwF;AACxF,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,CAAC,CAE5B"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveApiKey = resolveApiKey;
4
+ exports.buildApiConfig = buildApiConfig;
5
+ exports.pullDocs = pullDocs;
6
+ exports.pushDocs = pushDocs;
7
+ exports.fetchPendingCRs = fetchPendingCRs;
8
+ exports.fetchOpenBugs = fetchOpenBugs;
9
+ exports.markCRAppliedRemote = markCRAppliedRemote;
10
+ exports.markBugResolvedRemote = markBugResolvedRemote;
11
+ exports.markDocEnriched = markDocEnriched;
12
+ exports.markCREnriched = markCREnriched;
13
+ exports.markBugEnriched = markBugEnriched;
14
+ const errors_js_1 = require("../errors.js");
15
+ /**
16
+ * Resolve API key: SDD_API_KEY env var > config.remote.api-key > null
17
+ */
18
+ function resolveApiKey(config) {
19
+ const envKey = process.env.SDD_API_KEY;
20
+ if (envKey)
21
+ return envKey;
22
+ return config.remote?.['api-key'] ?? null;
23
+ }
24
+ /**
25
+ * Build an ApiClientConfig from the SDD project config.
26
+ * Throws RemoteNotConfiguredError if URL or API key is missing.
27
+ */
28
+ function buildApiConfig(config) {
29
+ if (!config.remote?.url) {
30
+ throw new errors_js_1.RemoteNotConfiguredError();
31
+ }
32
+ const apiKey = resolveApiKey(config);
33
+ if (!apiKey) {
34
+ throw new errors_js_1.RemoteNotConfiguredError();
35
+ }
36
+ return {
37
+ baseUrl: config.remote.url.replace(/\/+$/, ''),
38
+ apiKey,
39
+ };
40
+ }
41
+ async function request(config, method, path, body) {
42
+ const url = `${config.baseUrl}${path}`;
43
+ const headers = {
44
+ Authorization: `Bearer ${config.apiKey}`,
45
+ 'Content-Type': 'application/json',
46
+ };
47
+ const res = await fetch(url, {
48
+ method,
49
+ headers,
50
+ body: body != null ? JSON.stringify(body) : undefined,
51
+ });
52
+ if (!res.ok) {
53
+ let message;
54
+ try {
55
+ const err = (await res.json());
56
+ message = err.detail ?? res.statusText;
57
+ }
58
+ catch {
59
+ message = res.statusText;
60
+ }
61
+ throw new errors_js_1.RemoteError(res.status, message);
62
+ }
63
+ return (await res.json());
64
+ }
65
+ /** GET /cli/pull-docs */
66
+ async function pullDocs(config) {
67
+ return request(config, 'GET', '/cli/pull-docs');
68
+ }
69
+ /** POST /cli/push-docs */
70
+ async function pushDocs(config, documents) {
71
+ return request(config, 'POST', '/cli/push-docs', { documents });
72
+ }
73
+ /** GET /cli/pending-crs */
74
+ async function fetchPendingCRs(config) {
75
+ return request(config, 'GET', '/cli/pending-crs');
76
+ }
77
+ /** GET /cli/open-bugs */
78
+ async function fetchOpenBugs(config) {
79
+ return request(config, 'GET', '/cli/open-bugs');
80
+ }
81
+ /** POST /cli/crs/:crId/applied */
82
+ async function markCRAppliedRemote(config, crId) {
83
+ return request(config, 'POST', `/cli/crs/${crId}/applied`);
84
+ }
85
+ /** POST /cli/bugs/:bugId/resolved */
86
+ async function markBugResolvedRemote(config, bugId) {
87
+ return request(config, 'POST', `/cli/bugs/${bugId}/resolved`);
88
+ }
89
+ /** POST /cli/docs/:docId/enriched — Notify remote that a draft doc has been enriched */
90
+ async function markDocEnriched(config, docId, content) {
91
+ return request(config, 'POST', `/cli/docs/${docId}/enriched`, { content });
92
+ }
93
+ /** POST /cli/crs/:crId/enriched — Notify remote that a draft CR has been enriched */
94
+ async function markCREnriched(config, crId, body) {
95
+ return request(config, 'POST', `/cli/crs/${crId}/enriched`, { body });
96
+ }
97
+ /** POST /cli/bugs/:bugId/enriched — Notify remote that a draft bug has been enriched */
98
+ async function markBugEnriched(config, bugId, body) {
99
+ return request(config, 'POST', `/cli/bugs/${bugId}/enriched`, { body });
100
+ }
101
+ //# sourceMappingURL=api-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/remote/api-client.ts"],"names":[],"mappings":";;AAiBA,sCAIC;AAMD,wCAYC;AAmCD,4BAEC;AAGD,4BAKC;AAGD,0CAEC;AAGD,sCAEC;AAGD,kDAKC;AAGD,sDAKC;AAGD,0CAMC;AAGD,wCAMC;AAGD,0CAMC;AAxID,4CAAqE;AAarE;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAiB;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IACvC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,MAAiB;IAC9C,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;QACxB,MAAM,IAAI,oCAAwB,EAAE,CAAC;IACvC,CAAC;IACD,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,oCAAwB,EAAE,CAAC;IACvC,CAAC;IACD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9C,MAAM;KACP,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,MAAuB,EACvB,MAAc,EACd,IAAY,EACZ,IAAc;IAEd,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CAAqB,MAAM,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;AACxE,CAAC;AAED,yBAAyB;AAClB,KAAK,UAAU,aAAa,CAAC,MAAuB;IACzD,OAAO,OAAO,CAAsB,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;AACvE,CAAC;AAED,kCAAkC;AAC3B,KAAK,UAAU,mBAAmB,CACvC,MAAuB,EACvB,IAAY;IAEZ,OAAO,OAAO,CAAmB,MAAM,EAAE,MAAM,EAAE,YAAY,IAAI,UAAU,CAAC,CAAC;AAC/E,CAAC;AAED,qCAAqC;AAC9B,KAAK,UAAU,qBAAqB,CACzC,MAAuB,EACvB,KAAa;IAEb,OAAO,OAAO,CAAoB,MAAM,EAAE,MAAM,EAAE,aAAa,KAAK,WAAW,CAAC,CAAC;AACnF,CAAC;AAED,wFAAwF;AACjF,KAAK,UAAU,eAAe,CACnC,MAAuB,EACvB,KAAa,EACb,OAAe;IAEf,OAAO,OAAO,CAAoB,MAAM,EAAE,MAAM,EAAE,aAAa,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAChG,CAAC;AAED,qFAAqF;AAC9E,KAAK,UAAU,cAAc,CAClC,MAAuB,EACvB,IAAY,EACZ,IAAY;IAEZ,OAAO,OAAO,CAAmB,MAAM,EAAE,MAAM,EAAE,YAAY,IAAI,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,wFAAwF;AACjF,KAAK,UAAU,eAAe,CACnC,MAAuB,EACvB,KAAa,EACb,IAAY;IAEZ,OAAO,OAAO,CAAoB,MAAM,EAAE,MAAM,EAAE,aAAa,KAAK,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RemoteState } from './types.js';
2
+ export declare function readRemoteState(root: string): Promise<RemoteState>;
3
+ export declare function writeRemoteState(root: string, state: RemoteState): Promise<void>;
4
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/remote/state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAY9C,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAWxE;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAMtF"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readRemoteState = readRemoteState;
4
+ exports.writeRemoteState = writeRemoteState;
5
+ const promises_1 = require("node:fs/promises");
6
+ const node_fs_1 = require("node:fs");
7
+ const node_path_1 = require("node:path");
8
+ const REMOTE_STATE_FILE = 'remote-state.json';
9
+ function stateFilePath(root) {
10
+ return (0, node_path_1.resolve)(root, '.sdd', REMOTE_STATE_FILE);
11
+ }
12
+ function emptyState() {
13
+ return { documents: {} };
14
+ }
15
+ async function readRemoteState(root) {
16
+ const path = stateFilePath(root);
17
+ if (!(0, node_fs_1.existsSync)(path)) {
18
+ return emptyState();
19
+ }
20
+ const content = await (0, promises_1.readFile)(path, 'utf-8');
21
+ try {
22
+ return JSON.parse(content);
23
+ }
24
+ catch {
25
+ return emptyState();
26
+ }
27
+ }
28
+ async function writeRemoteState(root, state) {
29
+ const dir = (0, node_path_1.resolve)(root, '.sdd');
30
+ if (!(0, node_fs_1.existsSync)(dir)) {
31
+ await (0, promises_1.mkdir)(dir, { recursive: true });
32
+ }
33
+ await (0, promises_1.writeFile)(stateFilePath(root), JSON.stringify(state, null, 2), 'utf-8');
34
+ }
35
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/remote/state.ts"],"names":[],"mappings":";;AAeA,0CAWC;AAED,4CAM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2
+ export interface PushOptions {
3
+ paths?: string[];
4
+ all?: boolean;
5
+ }
6
+ export declare function pushToRemote(root: string, options?: PushOptions): Promise<PushResult>;
7
+ export declare function pullFromRemote(root: string): Promise<PullResult>;
8
+ export declare function pullCRsFromRemote(root: string): Promise<PullEntitiesResult>;
9
+ export declare function pullBugsFromRemote(root: string): Promise<PullEntitiesResult>;
10
+ export declare function getRemoteStatus(root: string): Promise<RemoteStatusResult>;
11
+ //# sourceMappingURL=sync-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-engine.d.ts","sourceRoot":"","sources":["../../src/remote/sync-engine.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EAEV,kBAAkB,EAClB,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAqDpB,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAuD3F;AAID,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAwDtE;AAkBD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA4BjF;AAID,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA4BlF;AAID,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA6B/E"}