@locusai/cli 0.15.4 → 0.16.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.
- package/bin/agent/worker.js +0 -99
- package/bin/locus.js +28 -716
- package/package.json +3 -4
package/bin/agent/worker.js
CHANGED
|
@@ -14343,32 +14343,6 @@ var init_auth = __esm(() => {
|
|
|
14343
14343
|
});
|
|
14344
14344
|
});
|
|
14345
14345
|
|
|
14346
|
-
// ../shared/src/models/autonomy.ts
|
|
14347
|
-
var RiskLevel, ChangeCategory, AutonomyRuleSchema;
|
|
14348
|
-
var init_autonomy = __esm(() => {
|
|
14349
|
-
init_zod();
|
|
14350
|
-
((RiskLevel2) => {
|
|
14351
|
-
RiskLevel2["LOW"] = "LOW";
|
|
14352
|
-
RiskLevel2["HIGH"] = "HIGH";
|
|
14353
|
-
})(RiskLevel ||= {});
|
|
14354
|
-
((ChangeCategory2) => {
|
|
14355
|
-
ChangeCategory2["FIX"] = "FIX";
|
|
14356
|
-
ChangeCategory2["REFACTOR"] = "REFACTOR";
|
|
14357
|
-
ChangeCategory2["STYLE"] = "STYLE";
|
|
14358
|
-
ChangeCategory2["DEPENDENCY"] = "DEPENDENCY";
|
|
14359
|
-
ChangeCategory2["FEATURE"] = "FEATURE";
|
|
14360
|
-
ChangeCategory2["ARCHITECTURE"] = "ARCHITECTURE";
|
|
14361
|
-
ChangeCategory2["DATABASE"] = "DATABASE";
|
|
14362
|
-
ChangeCategory2["AUTH"] = "AUTH";
|
|
14363
|
-
ChangeCategory2["API"] = "API";
|
|
14364
|
-
})(ChangeCategory ||= {});
|
|
14365
|
-
AutonomyRuleSchema = exports_external.object({
|
|
14366
|
-
category: exports_external.enum(ChangeCategory),
|
|
14367
|
-
riskLevel: exports_external.enum(RiskLevel),
|
|
14368
|
-
autoExecute: exports_external.boolean()
|
|
14369
|
-
});
|
|
14370
|
-
});
|
|
14371
|
-
|
|
14372
14346
|
// ../shared/src/models/aws-instance.ts
|
|
14373
14347
|
var InstanceAction, AwsCredentialsSchema, IntegrationSchema, AwsInstanceSchema, CreateAwsInstanceSchema, UpdateAwsInstanceSchema, SaveAwsCredentialsSchema, ProvisionAwsInstanceSchema, InstanceActionBodySchema, InstanceIdParamSchema, CIDR_REGEX, UpdateSecurityRulesSchema;
|
|
14374
14348
|
var init_aws_instance = __esm(() => {
|
|
@@ -14687,49 +14661,6 @@ var init_sprint = __esm(() => {
|
|
|
14687
14661
|
});
|
|
14688
14662
|
});
|
|
14689
14663
|
|
|
14690
|
-
// ../shared/src/models/suggestion.ts
|
|
14691
|
-
var SuggestionStatus, SuggestionType, SuggestionSchema, CreateSuggestionSchema, UpdateSuggestionStatusSchema;
|
|
14692
|
-
var init_suggestion = __esm(() => {
|
|
14693
|
-
init_zod();
|
|
14694
|
-
((SuggestionStatus2) => {
|
|
14695
|
-
SuggestionStatus2["NEW"] = "NEW";
|
|
14696
|
-
SuggestionStatus2["NOTIFIED"] = "NOTIFIED";
|
|
14697
|
-
SuggestionStatus2["ACTED_ON"] = "ACTED_ON";
|
|
14698
|
-
SuggestionStatus2["SKIPPED"] = "SKIPPED";
|
|
14699
|
-
SuggestionStatus2["EXPIRED"] = "EXPIRED";
|
|
14700
|
-
})(SuggestionStatus ||= {});
|
|
14701
|
-
((SuggestionType2) => {
|
|
14702
|
-
SuggestionType2["CODE_FIX"] = "CODE_FIX";
|
|
14703
|
-
SuggestionType2["DEPENDENCY_UPDATE"] = "DEPENDENCY_UPDATE";
|
|
14704
|
-
SuggestionType2["NEXT_STEP"] = "NEXT_STEP";
|
|
14705
|
-
SuggestionType2["REFACTOR"] = "REFACTOR";
|
|
14706
|
-
SuggestionType2["TEST_FIX"] = "TEST_FIX";
|
|
14707
|
-
})(SuggestionType ||= {});
|
|
14708
|
-
SuggestionSchema = exports_external.object({
|
|
14709
|
-
id: exports_external.string(),
|
|
14710
|
-
type: exports_external.enum(SuggestionType),
|
|
14711
|
-
status: exports_external.enum(SuggestionStatus),
|
|
14712
|
-
title: exports_external.string(),
|
|
14713
|
-
description: exports_external.string(),
|
|
14714
|
-
jobRunId: exports_external.string().optional(),
|
|
14715
|
-
workspaceId: exports_external.string(),
|
|
14716
|
-
createdAt: exports_external.string(),
|
|
14717
|
-
expiresAt: exports_external.string(),
|
|
14718
|
-
metadata: exports_external.record(exports_external.string(), exports_external.any()).optional()
|
|
14719
|
-
});
|
|
14720
|
-
CreateSuggestionSchema = exports_external.object({
|
|
14721
|
-
type: exports_external.enum(SuggestionType),
|
|
14722
|
-
title: exports_external.string().min(1, "Title is required"),
|
|
14723
|
-
description: exports_external.string().min(1, "Description is required"),
|
|
14724
|
-
jobRunId: exports_external.string().uuid().optional(),
|
|
14725
|
-
metadata: exports_external.record(exports_external.string(), exports_external.any()).optional(),
|
|
14726
|
-
expiresAt: exports_external.string().optional()
|
|
14727
|
-
});
|
|
14728
|
-
UpdateSuggestionStatusSchema = exports_external.object({
|
|
14729
|
-
status: exports_external.enum(SuggestionStatus)
|
|
14730
|
-
});
|
|
14731
|
-
});
|
|
14732
|
-
|
|
14733
14664
|
// ../shared/src/models/task.ts
|
|
14734
14665
|
var AcceptanceItemSchema, TaskSchema, CreateTaskSchema, UpdateTaskSchema, AddCommentSchema, DispatchTaskSchema, TaskIdParamSchema, TaskQuerySchema, TaskResponseSchema, TasksResponseSchema;
|
|
14735
14666
|
var init_task = __esm(() => {
|
|
@@ -14869,7 +14800,6 @@ var init_models = __esm(() => {
|
|
|
14869
14800
|
init_activity();
|
|
14870
14801
|
init_agent();
|
|
14871
14802
|
init_auth();
|
|
14872
|
-
init_autonomy();
|
|
14873
14803
|
init_aws_instance();
|
|
14874
14804
|
init_ci();
|
|
14875
14805
|
init_doc();
|
|
@@ -14877,7 +14807,6 @@ var init_models = __esm(() => {
|
|
|
14877
14807
|
init_invitation();
|
|
14878
14808
|
init_organization();
|
|
14879
14809
|
init_sprint();
|
|
14880
|
-
init_suggestion();
|
|
14881
14810
|
init_task();
|
|
14882
14811
|
init_user();
|
|
14883
14812
|
init_workspace();
|
|
@@ -15621,7 +15550,6 @@ var init_resolve_bin = __esm(() => {
|
|
|
15621
15550
|
join2(homedir(), ".local", "bin"),
|
|
15622
15551
|
join2(homedir(), ".npm", "bin"),
|
|
15623
15552
|
join2(homedir(), ".npm-global", "bin"),
|
|
15624
|
-
join2(homedir(), ".npm-packages", "bin"),
|
|
15625
15553
|
join2(homedir(), ".yarn", "bin"),
|
|
15626
15554
|
join2(homedir(), ".bun", "bin"),
|
|
15627
15555
|
join2(homedir(), "Library", "pnpm"),
|
|
@@ -31777,29 +31705,6 @@ var init_sprints = __esm(() => {
|
|
|
31777
31705
|
};
|
|
31778
31706
|
});
|
|
31779
31707
|
|
|
31780
|
-
// ../sdk/src/modules/suggestions.ts
|
|
31781
|
-
var SuggestionsModule;
|
|
31782
|
-
var init_suggestions = __esm(() => {
|
|
31783
|
-
SuggestionsModule = class SuggestionsModule extends BaseModule {
|
|
31784
|
-
async create(workspaceId, data) {
|
|
31785
|
-
const { data: res } = await this.api.post(`/workspaces/${workspaceId}/suggestions`, data);
|
|
31786
|
-
return res.suggestion;
|
|
31787
|
-
}
|
|
31788
|
-
async list(workspaceId, params) {
|
|
31789
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/suggestions`, { params });
|
|
31790
|
-
return data.suggestions;
|
|
31791
|
-
}
|
|
31792
|
-
async get(workspaceId, id) {
|
|
31793
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/suggestions/${id}`);
|
|
31794
|
-
return data.suggestion;
|
|
31795
|
-
}
|
|
31796
|
-
async updateStatus(workspaceId, id, status) {
|
|
31797
|
-
const { data } = await this.api.patch(`/workspaces/${workspaceId}/suggestions/${id}/status`, status);
|
|
31798
|
-
return data.suggestion;
|
|
31799
|
-
}
|
|
31800
|
-
};
|
|
31801
|
-
});
|
|
31802
|
-
|
|
31803
31708
|
// ../sdk/src/modules/tasks.ts
|
|
31804
31709
|
var TasksModule;
|
|
31805
31710
|
var init_tasks = __esm(() => {
|
|
@@ -31984,7 +31889,6 @@ class LocusClient {
|
|
|
31984
31889
|
docs;
|
|
31985
31890
|
ci;
|
|
31986
31891
|
instances;
|
|
31987
|
-
suggestions;
|
|
31988
31892
|
constructor(config2) {
|
|
31989
31893
|
this.emitter = new LocusEmitter;
|
|
31990
31894
|
this.api = axios_default.create({
|
|
@@ -32005,7 +31909,6 @@ class LocusClient {
|
|
|
32005
31909
|
this.docs = new DocsModule(this.api, this.emitter);
|
|
32006
31910
|
this.ci = new CiModule(this.api, this.emitter);
|
|
32007
31911
|
this.instances = new InstancesModule(this.api, this.emitter);
|
|
32008
|
-
this.suggestions = new SuggestionsModule(this.api, this.emitter);
|
|
32009
31912
|
if (config2.retryOptions) {
|
|
32010
31913
|
this.setupRetryInterceptor(config2.retryOptions);
|
|
32011
31914
|
}
|
|
@@ -32075,7 +31978,6 @@ var init_src2 = __esm(() => {
|
|
|
32075
31978
|
init_invitations();
|
|
32076
31979
|
init_organizations();
|
|
32077
31980
|
init_sprints();
|
|
32078
|
-
init_suggestions();
|
|
32079
31981
|
init_tasks();
|
|
32080
31982
|
init_workspaces();
|
|
32081
31983
|
init_discussion_types();
|
|
@@ -32087,7 +31989,6 @@ var init_src2 = __esm(() => {
|
|
|
32087
31989
|
init_invitations();
|
|
32088
31990
|
init_organizations();
|
|
32089
31991
|
init_sprints();
|
|
32090
|
-
init_suggestions();
|
|
32091
31992
|
init_tasks();
|
|
32092
31993
|
init_workspaces();
|
|
32093
31994
|
});
|
package/bin/locus.js
CHANGED
|
@@ -7055,7 +7055,6 @@ var init_resolve_bin = __esm(() => {
|
|
|
7055
7055
|
join4(homedir(), ".local", "bin"),
|
|
7056
7056
|
join4(homedir(), ".npm", "bin"),
|
|
7057
7057
|
join4(homedir(), ".npm-global", "bin"),
|
|
7058
|
-
join4(homedir(), ".npm-packages", "bin"),
|
|
7059
7058
|
join4(homedir(), ".yarn", "bin"),
|
|
7060
7059
|
join4(homedir(), ".bun", "bin"),
|
|
7061
7060
|
join4(homedir(), "Library", "pnpm"),
|
|
@@ -23353,29 +23352,6 @@ var init_sprints = __esm(() => {
|
|
|
23353
23352
|
};
|
|
23354
23353
|
});
|
|
23355
23354
|
|
|
23356
|
-
// ../sdk/src/modules/suggestions.ts
|
|
23357
|
-
var SuggestionsModule;
|
|
23358
|
-
var init_suggestions = __esm(() => {
|
|
23359
|
-
SuggestionsModule = class SuggestionsModule extends BaseModule {
|
|
23360
|
-
async create(workspaceId, data) {
|
|
23361
|
-
const { data: res } = await this.api.post(`/workspaces/${workspaceId}/suggestions`, data);
|
|
23362
|
-
return res.suggestion;
|
|
23363
|
-
}
|
|
23364
|
-
async list(workspaceId, params) {
|
|
23365
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/suggestions`, { params });
|
|
23366
|
-
return data.suggestions;
|
|
23367
|
-
}
|
|
23368
|
-
async get(workspaceId, id) {
|
|
23369
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/suggestions/${id}`);
|
|
23370
|
-
return data.suggestion;
|
|
23371
|
-
}
|
|
23372
|
-
async updateStatus(workspaceId, id, status) {
|
|
23373
|
-
const { data } = await this.api.patch(`/workspaces/${workspaceId}/suggestions/${id}/status`, status);
|
|
23374
|
-
return data.suggestion;
|
|
23375
|
-
}
|
|
23376
|
-
};
|
|
23377
|
-
});
|
|
23378
|
-
|
|
23379
23355
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
23380
23356
|
function $constructor(name, initializer, params) {
|
|
23381
23357
|
function init(inst, def) {
|
|
@@ -37691,75 +37667,6 @@ var init_auth2 = __esm(() => {
|
|
|
37691
37667
|
});
|
|
37692
37668
|
});
|
|
37693
37669
|
|
|
37694
|
-
// ../shared/src/models/autonomy.ts
|
|
37695
|
-
var RiskLevel, ChangeCategory, AutonomyRuleSchema, DEFAULT_AUTONOMY_RULES;
|
|
37696
|
-
var init_autonomy = __esm(() => {
|
|
37697
|
-
init_zod();
|
|
37698
|
-
((RiskLevel2) => {
|
|
37699
|
-
RiskLevel2["LOW"] = "LOW";
|
|
37700
|
-
RiskLevel2["HIGH"] = "HIGH";
|
|
37701
|
-
})(RiskLevel ||= {});
|
|
37702
|
-
((ChangeCategory2) => {
|
|
37703
|
-
ChangeCategory2["FIX"] = "FIX";
|
|
37704
|
-
ChangeCategory2["REFACTOR"] = "REFACTOR";
|
|
37705
|
-
ChangeCategory2["STYLE"] = "STYLE";
|
|
37706
|
-
ChangeCategory2["DEPENDENCY"] = "DEPENDENCY";
|
|
37707
|
-
ChangeCategory2["FEATURE"] = "FEATURE";
|
|
37708
|
-
ChangeCategory2["ARCHITECTURE"] = "ARCHITECTURE";
|
|
37709
|
-
ChangeCategory2["DATABASE"] = "DATABASE";
|
|
37710
|
-
ChangeCategory2["AUTH"] = "AUTH";
|
|
37711
|
-
ChangeCategory2["API"] = "API";
|
|
37712
|
-
})(ChangeCategory ||= {});
|
|
37713
|
-
AutonomyRuleSchema = exports_external.object({
|
|
37714
|
-
category: exports_external.enum(ChangeCategory),
|
|
37715
|
-
riskLevel: exports_external.enum(RiskLevel),
|
|
37716
|
-
autoExecute: exports_external.boolean()
|
|
37717
|
-
});
|
|
37718
|
-
DEFAULT_AUTONOMY_RULES = [
|
|
37719
|
-
{ category: "FIX" /* FIX */, riskLevel: "LOW" /* LOW */, autoExecute: true },
|
|
37720
|
-
{
|
|
37721
|
-
category: "REFACTOR" /* REFACTOR */,
|
|
37722
|
-
riskLevel: "LOW" /* LOW */,
|
|
37723
|
-
autoExecute: true
|
|
37724
|
-
},
|
|
37725
|
-
{
|
|
37726
|
-
category: "STYLE" /* STYLE */,
|
|
37727
|
-
riskLevel: "LOW" /* LOW */,
|
|
37728
|
-
autoExecute: true
|
|
37729
|
-
},
|
|
37730
|
-
{
|
|
37731
|
-
category: "DEPENDENCY" /* DEPENDENCY */,
|
|
37732
|
-
riskLevel: "LOW" /* LOW */,
|
|
37733
|
-
autoExecute: true
|
|
37734
|
-
},
|
|
37735
|
-
{
|
|
37736
|
-
category: "FEATURE" /* FEATURE */,
|
|
37737
|
-
riskLevel: "HIGH" /* HIGH */,
|
|
37738
|
-
autoExecute: false
|
|
37739
|
-
},
|
|
37740
|
-
{
|
|
37741
|
-
category: "ARCHITECTURE" /* ARCHITECTURE */,
|
|
37742
|
-
riskLevel: "HIGH" /* HIGH */,
|
|
37743
|
-
autoExecute: false
|
|
37744
|
-
},
|
|
37745
|
-
{
|
|
37746
|
-
category: "DATABASE" /* DATABASE */,
|
|
37747
|
-
riskLevel: "HIGH" /* HIGH */,
|
|
37748
|
-
autoExecute: false
|
|
37749
|
-
},
|
|
37750
|
-
{
|
|
37751
|
-
category: "AUTH" /* AUTH */,
|
|
37752
|
-
riskLevel: "HIGH" /* HIGH */,
|
|
37753
|
-
autoExecute: false
|
|
37754
|
-
},
|
|
37755
|
-
{
|
|
37756
|
-
category: "API" /* API */,
|
|
37757
|
-
riskLevel: "HIGH" /* HIGH */,
|
|
37758
|
-
autoExecute: false
|
|
37759
|
-
}
|
|
37760
|
-
];
|
|
37761
|
-
});
|
|
37762
|
-
|
|
37763
37670
|
// ../shared/src/models/aws-instance.ts
|
|
37764
37671
|
var InstanceAction, AwsCredentialsSchema, IntegrationSchema, AwsInstanceSchema, CreateAwsInstanceSchema, UpdateAwsInstanceSchema, SaveAwsCredentialsSchema, ProvisionAwsInstanceSchema, InstanceActionBodySchema, InstanceIdParamSchema, CIDR_REGEX, UpdateSecurityRulesSchema;
|
|
37765
37672
|
var init_aws_instance = __esm(() => {
|
|
@@ -38078,49 +37985,6 @@ var init_sprint = __esm(() => {
|
|
|
38078
37985
|
});
|
|
38079
37986
|
});
|
|
38080
37987
|
|
|
38081
|
-
// ../shared/src/models/suggestion.ts
|
|
38082
|
-
var SuggestionStatus, SuggestionType, SuggestionSchema, CreateSuggestionSchema, UpdateSuggestionStatusSchema;
|
|
38083
|
-
var init_suggestion = __esm(() => {
|
|
38084
|
-
init_zod();
|
|
38085
|
-
((SuggestionStatus2) => {
|
|
38086
|
-
SuggestionStatus2["NEW"] = "NEW";
|
|
38087
|
-
SuggestionStatus2["NOTIFIED"] = "NOTIFIED";
|
|
38088
|
-
SuggestionStatus2["ACTED_ON"] = "ACTED_ON";
|
|
38089
|
-
SuggestionStatus2["SKIPPED"] = "SKIPPED";
|
|
38090
|
-
SuggestionStatus2["EXPIRED"] = "EXPIRED";
|
|
38091
|
-
})(SuggestionStatus ||= {});
|
|
38092
|
-
((SuggestionType2) => {
|
|
38093
|
-
SuggestionType2["CODE_FIX"] = "CODE_FIX";
|
|
38094
|
-
SuggestionType2["DEPENDENCY_UPDATE"] = "DEPENDENCY_UPDATE";
|
|
38095
|
-
SuggestionType2["NEXT_STEP"] = "NEXT_STEP";
|
|
38096
|
-
SuggestionType2["REFACTOR"] = "REFACTOR";
|
|
38097
|
-
SuggestionType2["TEST_FIX"] = "TEST_FIX";
|
|
38098
|
-
})(SuggestionType ||= {});
|
|
38099
|
-
SuggestionSchema = exports_external.object({
|
|
38100
|
-
id: exports_external.string(),
|
|
38101
|
-
type: exports_external.enum(SuggestionType),
|
|
38102
|
-
status: exports_external.enum(SuggestionStatus),
|
|
38103
|
-
title: exports_external.string(),
|
|
38104
|
-
description: exports_external.string(),
|
|
38105
|
-
jobRunId: exports_external.string().optional(),
|
|
38106
|
-
workspaceId: exports_external.string(),
|
|
38107
|
-
createdAt: exports_external.string(),
|
|
38108
|
-
expiresAt: exports_external.string(),
|
|
38109
|
-
metadata: exports_external.record(exports_external.string(), exports_external.any()).optional()
|
|
38110
|
-
});
|
|
38111
|
-
CreateSuggestionSchema = exports_external.object({
|
|
38112
|
-
type: exports_external.enum(SuggestionType),
|
|
38113
|
-
title: exports_external.string().min(1, "Title is required"),
|
|
38114
|
-
description: exports_external.string().min(1, "Description is required"),
|
|
38115
|
-
jobRunId: exports_external.string().uuid().optional(),
|
|
38116
|
-
metadata: exports_external.record(exports_external.string(), exports_external.any()).optional(),
|
|
38117
|
-
expiresAt: exports_external.string().optional()
|
|
38118
|
-
});
|
|
38119
|
-
UpdateSuggestionStatusSchema = exports_external.object({
|
|
38120
|
-
status: exports_external.enum(SuggestionStatus)
|
|
38121
|
-
});
|
|
38122
|
-
});
|
|
38123
|
-
|
|
38124
37988
|
// ../shared/src/models/task.ts
|
|
38125
37989
|
var AcceptanceItemSchema, TaskSchema, CreateTaskSchema, UpdateTaskSchema, AddCommentSchema, DispatchTaskSchema, TaskIdParamSchema, TaskQuerySchema, TaskResponseSchema, TasksResponseSchema;
|
|
38126
37990
|
var init_task = __esm(() => {
|
|
@@ -38260,7 +38124,6 @@ var init_models = __esm(() => {
|
|
|
38260
38124
|
init_activity();
|
|
38261
38125
|
init_agent();
|
|
38262
38126
|
init_auth2();
|
|
38263
|
-
init_autonomy();
|
|
38264
38127
|
init_aws_instance();
|
|
38265
38128
|
init_ci2();
|
|
38266
38129
|
init_doc();
|
|
@@ -38268,7 +38131,6 @@ var init_models = __esm(() => {
|
|
|
38268
38131
|
init_invitation();
|
|
38269
38132
|
init_organization();
|
|
38270
38133
|
init_sprint();
|
|
38271
|
-
init_suggestion();
|
|
38272
38134
|
init_task();
|
|
38273
38135
|
init_user();
|
|
38274
38136
|
init_workspace();
|
|
@@ -38991,7 +38853,6 @@ class LocusClient {
|
|
|
38991
38853
|
docs;
|
|
38992
38854
|
ci;
|
|
38993
38855
|
instances;
|
|
38994
|
-
suggestions;
|
|
38995
38856
|
constructor(config2) {
|
|
38996
38857
|
this.emitter = new LocusEmitter;
|
|
38997
38858
|
this.api = axios_default.create({
|
|
@@ -39012,7 +38873,6 @@ class LocusClient {
|
|
|
39012
38873
|
this.docs = new DocsModule(this.api, this.emitter);
|
|
39013
38874
|
this.ci = new CiModule(this.api, this.emitter);
|
|
39014
38875
|
this.instances = new InstancesModule(this.api, this.emitter);
|
|
39015
|
-
this.suggestions = new SuggestionsModule(this.api, this.emitter);
|
|
39016
38876
|
if (config2.retryOptions) {
|
|
39017
38877
|
this.setupRetryInterceptor(config2.retryOptions);
|
|
39018
38878
|
}
|
|
@@ -39082,7 +38942,6 @@ var init_src2 = __esm(() => {
|
|
|
39082
38942
|
init_invitations();
|
|
39083
38943
|
init_organizations();
|
|
39084
38944
|
init_sprints();
|
|
39085
|
-
init_suggestions();
|
|
39086
38945
|
init_tasks();
|
|
39087
38946
|
init_workspaces();
|
|
39088
38947
|
init_discussion_types();
|
|
@@ -39094,7 +38953,6 @@ var init_src2 = __esm(() => {
|
|
|
39094
38953
|
init_invitations();
|
|
39095
38954
|
init_organizations();
|
|
39096
38955
|
init_sprints();
|
|
39097
|
-
init_suggestions();
|
|
39098
38956
|
init_tasks();
|
|
39099
38957
|
init_workspaces();
|
|
39100
38958
|
});
|
|
@@ -42037,22 +41895,6 @@ var init_planning = __esm(() => {
|
|
|
42037
41895
|
init_sprint_plan();
|
|
42038
41896
|
});
|
|
42039
41897
|
|
|
42040
|
-
// ../sdk/src/proposals/context-gatherer.ts
|
|
42041
|
-
var init_context_gatherer = () => {};
|
|
42042
|
-
|
|
42043
|
-
// ../sdk/src/proposals/proposal-engine.ts
|
|
42044
|
-
var init_proposal_engine = __esm(() => {
|
|
42045
|
-
init_src();
|
|
42046
|
-
init_factory();
|
|
42047
|
-
init_context_gatherer();
|
|
42048
|
-
});
|
|
42049
|
-
|
|
42050
|
-
// ../sdk/src/proposals/index.ts
|
|
42051
|
-
var init_proposals = __esm(() => {
|
|
42052
|
-
init_context_gatherer();
|
|
42053
|
-
init_proposal_engine();
|
|
42054
|
-
});
|
|
42055
|
-
|
|
42056
41898
|
// ../sdk/src/index-node.ts
|
|
42057
41899
|
var init_index_node = __esm(() => {
|
|
42058
41900
|
init_prompt_builder();
|
|
@@ -42067,7 +41909,6 @@ var init_index_node = __esm(() => {
|
|
|
42067
41909
|
init_git();
|
|
42068
41910
|
init_src2();
|
|
42069
41911
|
init_planning();
|
|
42070
|
-
init_proposals();
|
|
42071
41912
|
});
|
|
42072
41913
|
|
|
42073
41914
|
// src/utils/version.ts
|
|
@@ -42506,22 +42347,9 @@ class SettingsManager {
|
|
|
42506
42347
|
exists() {
|
|
42507
42348
|
return existsSync15(getSettingsPath(this.projectPath));
|
|
42508
42349
|
}
|
|
42509
|
-
getAutonomyRules() {
|
|
42510
|
-
const settings = this.load();
|
|
42511
|
-
const userRules = settings.autonomy?.rules ?? [];
|
|
42512
|
-
if (userRules.length === 0) {
|
|
42513
|
-
return DEFAULT_AUTONOMY_RULES;
|
|
42514
|
-
}
|
|
42515
|
-
const ruleMap = new Map(DEFAULT_AUTONOMY_RULES.map((r) => [r.category, r]));
|
|
42516
|
-
for (const rule of userRules) {
|
|
42517
|
-
ruleMap.set(rule.category, rule);
|
|
42518
|
-
}
|
|
42519
|
-
return Array.from(ruleMap.values());
|
|
42520
|
-
}
|
|
42521
42350
|
}
|
|
42522
42351
|
var init_settings_manager = __esm(() => {
|
|
42523
42352
|
init_index_node();
|
|
42524
|
-
init_src();
|
|
42525
42353
|
});
|
|
42526
42354
|
|
|
42527
42355
|
// src/workspace-resolver.ts
|
|
@@ -43126,19 +42954,31 @@ class ProgressRenderer {
|
|
|
43126
42954
|
toolDisplay = new ToolDisplay;
|
|
43127
42955
|
toolDisplayShown = false;
|
|
43128
42956
|
thinkingShown = false;
|
|
42957
|
+
animated;
|
|
43129
42958
|
spinnerInterval = null;
|
|
43130
42959
|
spinnerFrameIndex = 0;
|
|
43131
42960
|
thinkingStartTime = null;
|
|
43132
42961
|
isInTextBlock = false;
|
|
43133
42962
|
textBuffer = "";
|
|
42963
|
+
constructor(options = {}) {
|
|
42964
|
+
this.animated = options.animated ?? false;
|
|
42965
|
+
}
|
|
43134
42966
|
showThinkingStarted() {
|
|
43135
42967
|
if (this.isThinking)
|
|
43136
42968
|
return;
|
|
43137
42969
|
this.isThinking = true;
|
|
43138
42970
|
this.thinkingStartTime = Date.now();
|
|
43139
|
-
if (
|
|
43140
|
-
this.thinkingShown
|
|
43141
|
-
|
|
42971
|
+
if (this.animated) {
|
|
42972
|
+
if (!this.thinkingShown) {
|
|
42973
|
+
this.thinkingShown = true;
|
|
42974
|
+
this.startThinkingAnimation();
|
|
42975
|
+
}
|
|
42976
|
+
} else {
|
|
42977
|
+
if (!this.thinkingShown) {
|
|
42978
|
+
console.log(c.dim(`\uD83E\uDD14 Thinking...
|
|
42979
|
+
`));
|
|
42980
|
+
this.thinkingShown = true;
|
|
42981
|
+
}
|
|
43142
42982
|
}
|
|
43143
42983
|
}
|
|
43144
42984
|
showThinkingStopped() {
|
|
@@ -43169,7 +43009,7 @@ class ProgressRenderer {
|
|
|
43169
43009
|
clearInterval(this.spinnerInterval);
|
|
43170
43010
|
this.spinnerInterval = null;
|
|
43171
43011
|
}
|
|
43172
|
-
if (this.thinkingShown && this.isThinking) {
|
|
43012
|
+
if (this.animated && this.thinkingShown && this.isThinking) {
|
|
43173
43013
|
process.stdout.write(`${ANSI.MOVE_TO_START}${ANSI.CLEAR_LINE}
|
|
43174
43014
|
`);
|
|
43175
43015
|
}
|
|
@@ -44112,7 +43952,7 @@ class InteractiveSession {
|
|
|
44112
43952
|
model: options.model
|
|
44113
43953
|
});
|
|
44114
43954
|
this.promptBuilder = new PromptBuilder(options.projectPath);
|
|
44115
|
-
this.renderer = new ProgressRenderer;
|
|
43955
|
+
this.renderer = new ProgressRenderer({ animated: true });
|
|
44116
43956
|
this.historyManager = new HistoryManager(options.projectPath);
|
|
44117
43957
|
this.projectPath = options.projectPath;
|
|
44118
43958
|
this.model = options.model;
|
|
@@ -44854,7 +44694,7 @@ async function discussCommand(args) {
|
|
|
44854
44694
|
console.log(` ${c.dim("Topic:")} ${c.bold(topic)}`);
|
|
44855
44695
|
console.log(` ${c.dim("Model:")} ${c.dim(`${model} (${provider})`)}
|
|
44856
44696
|
`);
|
|
44857
|
-
const renderer = new ProgressRenderer;
|
|
44697
|
+
const renderer = new ProgressRenderer({ animated: true });
|
|
44858
44698
|
let discussionId;
|
|
44859
44699
|
try {
|
|
44860
44700
|
renderer.showThinkingStarted();
|
|
@@ -44918,7 +44758,7 @@ async function discussCommand(args) {
|
|
|
44918
44758
|
}
|
|
44919
44759
|
if (lowerInput === "summary") {
|
|
44920
44760
|
isProcessing = true;
|
|
44921
|
-
const summaryRenderer = new ProgressRenderer;
|
|
44761
|
+
const summaryRenderer = new ProgressRenderer({ animated: true });
|
|
44922
44762
|
try {
|
|
44923
44763
|
summaryRenderer.showThinkingStarted();
|
|
44924
44764
|
const summary = await facilitator.summarizeDiscussion(discussionId);
|
|
@@ -44962,7 +44802,7 @@ async function discussCommand(args) {
|
|
|
44962
44802
|
const cleanedInput = stripImagePaths(trimmed, images);
|
|
44963
44803
|
const effectiveInput = cleanedInput + buildImageContext(images);
|
|
44964
44804
|
isProcessing = true;
|
|
44965
|
-
const chunkRenderer = new ProgressRenderer;
|
|
44805
|
+
const chunkRenderer = new ProgressRenderer({ animated: true });
|
|
44966
44806
|
try {
|
|
44967
44807
|
chunkRenderer.showThinkingStarted();
|
|
44968
44808
|
const stream4 = facilitator.continueDiscussionStream(discussionId, effectiveInput);
|
|
@@ -45843,10 +45683,6 @@ function showHelp2() {
|
|
|
45843
45683
|
${c.dim("sessions show <id> Show session messages")}
|
|
45844
45684
|
${c.dim("sessions delete <id> Delete a session")}
|
|
45845
45685
|
${c.dim("sessions clear Clear all sessions")}
|
|
45846
|
-
${c.success("service")} Manage the Locus system service
|
|
45847
|
-
${c.dim("install Install as systemd/launchd service")}
|
|
45848
|
-
${c.dim("uninstall Remove the system service")}
|
|
45849
|
-
${c.dim("status Check if service is running")}
|
|
45850
45686
|
${c.success("artifacts")} List and manage knowledge artifacts
|
|
45851
45687
|
${c.dim("show <name> Show artifact content")}
|
|
45852
45688
|
${c.dim("plan <name> Convert artifact to a plan")}
|
|
@@ -45862,8 +45698,7 @@ function showHelp2() {
|
|
|
45862
45698
|
${c.header(" GETTING STARTED ")}
|
|
45863
45699
|
${c.dim("$")} ${c.primary("locus init")}
|
|
45864
45700
|
${c.dim("$")} ${c.primary("locus config setup")}
|
|
45865
|
-
${c.dim("$")} ${c.primary("locus
|
|
45866
|
-
${c.dim("$")} ${c.primary("locus service install")}
|
|
45701
|
+
${c.dim("$")} ${c.primary("locus run")}
|
|
45867
45702
|
|
|
45868
45703
|
${c.header(" EXAMPLES ")}
|
|
45869
45704
|
${c.dim("$")} ${c.primary("locus run")}
|
|
@@ -45874,7 +45709,6 @@ function showHelp2() {
|
|
|
45874
45709
|
${c.dim("$")} ${c.primary('locus discuss "how should we design the auth system?"')}
|
|
45875
45710
|
${c.dim("$")} ${c.primary("locus exec sessions list")}
|
|
45876
45711
|
${c.dim("$")} ${c.primary("locus artifacts")}
|
|
45877
|
-
${c.dim("$")} ${c.primary("locus service install")}
|
|
45878
45712
|
|
|
45879
45713
|
For more information, visit: ${c.underline("https://docs.locusai.dev")}
|
|
45880
45714
|
`);
|
|
@@ -46258,497 +46092,12 @@ ${c.info(`Received ${signal}. Stopping agent and cleaning up...`)}`);
|
|
|
46258
46092
|
console.log(` ${c.dim("A PR will be opened when all tasks are done")}`);
|
|
46259
46093
|
await orchestrator.start();
|
|
46260
46094
|
}
|
|
46261
|
-
// src/commands/service.ts
|
|
46262
|
-
init_index_node();
|
|
46263
|
-
init_settings_manager();
|
|
46264
|
-
init_utils3();
|
|
46265
|
-
import { spawn as spawn4 } from "node:child_process";
|
|
46266
|
-
import { existsSync as existsSync20, readdirSync as readdirSync6, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "node:fs";
|
|
46267
|
-
import { homedir as homedir3 } from "node:os";
|
|
46268
|
-
import { dirname as dirname4, join as join20 } from "node:path";
|
|
46269
|
-
async function findBinary() {
|
|
46270
|
-
const result = await runShell("which", ["locus-telegram"]);
|
|
46271
|
-
const p = result.stdout.trim();
|
|
46272
|
-
return p?.startsWith?.("/") ? p : null;
|
|
46273
|
-
}
|
|
46274
|
-
async function findBinDir(binary) {
|
|
46275
|
-
const result = await runShell("which", [binary]);
|
|
46276
|
-
const p = result.stdout.trim();
|
|
46277
|
-
if (p?.startsWith?.("/"))
|
|
46278
|
-
return dirname4(p);
|
|
46279
|
-
return null;
|
|
46280
|
-
}
|
|
46281
|
-
function resolveNvmBinDir() {
|
|
46282
|
-
const nvmDir = process.env.NVM_DIR || join20(homedir3(), ".nvm");
|
|
46283
|
-
const versionsDir = join20(nvmDir, "versions", "node");
|
|
46284
|
-
if (!existsSync20(versionsDir))
|
|
46285
|
-
return null;
|
|
46286
|
-
let versions2;
|
|
46287
|
-
try {
|
|
46288
|
-
versions2 = readdirSync6(versionsDir).filter((d) => d.startsWith("v"));
|
|
46289
|
-
} catch {
|
|
46290
|
-
return null;
|
|
46291
|
-
}
|
|
46292
|
-
if (versions2.length === 0)
|
|
46293
|
-
return null;
|
|
46294
|
-
const currentNodeVersion = `v${process.versions.node}`;
|
|
46295
|
-
const currentBin = join20(versionsDir, currentNodeVersion, "bin");
|
|
46296
|
-
if (versions2.includes(currentNodeVersion) && existsSync20(currentBin)) {
|
|
46297
|
-
return currentBin;
|
|
46298
|
-
}
|
|
46299
|
-
const aliasPath = join20(nvmDir, "alias", "default");
|
|
46300
|
-
if (existsSync20(aliasPath)) {
|
|
46301
|
-
try {
|
|
46302
|
-
const alias = readFileSync15(aliasPath, "utf-8").trim();
|
|
46303
|
-
const match = versions2.find((v) => v === `v${alias}` || v.startsWith(`v${alias}.`));
|
|
46304
|
-
if (match) {
|
|
46305
|
-
const bin2 = join20(versionsDir, match, "bin");
|
|
46306
|
-
if (existsSync20(bin2))
|
|
46307
|
-
return bin2;
|
|
46308
|
-
}
|
|
46309
|
-
} catch {}
|
|
46310
|
-
}
|
|
46311
|
-
const sorted = versions2.sort((a, b) => {
|
|
46312
|
-
const pa = a.slice(1).split(".").map(Number);
|
|
46313
|
-
const pb = b.slice(1).split(".").map(Number);
|
|
46314
|
-
for (let i = 0;i < 3; i++) {
|
|
46315
|
-
if ((pa[i] || 0) !== (pb[i] || 0))
|
|
46316
|
-
return (pb[i] || 0) - (pa[i] || 0);
|
|
46317
|
-
}
|
|
46318
|
-
return 0;
|
|
46319
|
-
});
|
|
46320
|
-
const bin = join20(versionsDir, sorted[0], "bin");
|
|
46321
|
-
return existsSync20(bin) ? bin : null;
|
|
46322
|
-
}
|
|
46323
|
-
async function buildServicePath() {
|
|
46324
|
-
const home = homedir3();
|
|
46325
|
-
const dirs = new Set;
|
|
46326
|
-
dirs.add("/usr/local/bin");
|
|
46327
|
-
dirs.add("/usr/bin");
|
|
46328
|
-
dirs.add("/bin");
|
|
46329
|
-
const candidates = [
|
|
46330
|
-
join20(home, ".bun", "bin"),
|
|
46331
|
-
join20(home, ".local", "bin"),
|
|
46332
|
-
join20(home, ".npm", "bin"),
|
|
46333
|
-
join20(home, ".npm-global", "bin"),
|
|
46334
|
-
join20(home, ".yarn", "bin")
|
|
46335
|
-
];
|
|
46336
|
-
for (const d of candidates) {
|
|
46337
|
-
if (existsSync20(d))
|
|
46338
|
-
dirs.add(d);
|
|
46339
|
-
}
|
|
46340
|
-
const nvmBin = resolveNvmBinDir();
|
|
46341
|
-
if (nvmBin)
|
|
46342
|
-
dirs.add(nvmBin);
|
|
46343
|
-
const fnmCurrent = join20(home, ".fnm", "current", "bin");
|
|
46344
|
-
if (existsSync20(fnmCurrent))
|
|
46345
|
-
dirs.add(fnmCurrent);
|
|
46346
|
-
for (const bin of ["claude", "codex"]) {
|
|
46347
|
-
const dir = await findBinDir(bin);
|
|
46348
|
-
if (dir)
|
|
46349
|
-
dirs.add(dir);
|
|
46350
|
-
}
|
|
46351
|
-
return Array.from(dirs).join(":");
|
|
46352
|
-
}
|
|
46353
|
-
var SERVICE_NAME = "locus";
|
|
46354
|
-
var SYSTEMD_UNIT_PATH = `/etc/systemd/system/${SERVICE_NAME}.service`;
|
|
46355
|
-
var PLIST_LABEL = "com.locus.agent";
|
|
46356
|
-
function getPlistPath() {
|
|
46357
|
-
return join20(homedir3(), "Library/LaunchAgents", `${PLIST_LABEL}.plist`);
|
|
46358
|
-
}
|
|
46359
|
-
function showServiceHelp() {
|
|
46360
|
-
console.log(`
|
|
46361
|
-
${c.header(" SERVICE ")}
|
|
46362
|
-
${c.primary("locus service")} ${c.dim("<subcommand>")}
|
|
46363
|
-
|
|
46364
|
-
${c.header(" SUBCOMMANDS ")}
|
|
46365
|
-
${c.success("install")} Install Locus as a system service
|
|
46366
|
-
${c.dim("Sets up systemd (Linux) or launchd (macOS)")}
|
|
46367
|
-
${c.dim("to run the Telegram bot + proposal scheduler")}
|
|
46368
|
-
${c.success("uninstall")} Remove the system service
|
|
46369
|
-
${c.success("status")} Check if the service is running
|
|
46370
|
-
|
|
46371
|
-
${c.header(" EXAMPLES ")}
|
|
46372
|
-
${c.dim("$")} ${c.primary("locus service install")}
|
|
46373
|
-
${c.dim("$")} ${c.primary("locus service status")}
|
|
46374
|
-
${c.dim("$")} ${c.primary("locus service uninstall")}
|
|
46375
|
-
`);
|
|
46376
|
-
}
|
|
46377
|
-
function runShell(cmd, args) {
|
|
46378
|
-
return new Promise((resolve2) => {
|
|
46379
|
-
const proc = spawn4(cmd, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
46380
|
-
let stdout = "";
|
|
46381
|
-
let stderr = "";
|
|
46382
|
-
proc.stdout?.on("data", (d) => {
|
|
46383
|
-
stdout += d.toString();
|
|
46384
|
-
});
|
|
46385
|
-
proc.stderr?.on("data", (d) => {
|
|
46386
|
-
stderr += d.toString();
|
|
46387
|
-
});
|
|
46388
|
-
proc.on("close", (exitCode) => resolve2({ exitCode, stdout, stderr }));
|
|
46389
|
-
proc.on("error", (err) => resolve2({ exitCode: 1, stdout, stderr: err.message }));
|
|
46390
|
-
});
|
|
46391
|
-
}
|
|
46392
|
-
async function killOrphanedProcesses() {
|
|
46393
|
-
const result = await runShell("pgrep", ["-f", "locus-telegram"]);
|
|
46394
|
-
const pids = result.stdout.trim().split(`
|
|
46395
|
-
`).filter((p) => p.length > 0);
|
|
46396
|
-
if (pids.length === 0)
|
|
46397
|
-
return;
|
|
46398
|
-
console.log(` ${c.info("▶")} Killing ${pids.length} orphaned locus-telegram process${pids.length > 1 ? "es" : ""}...`);
|
|
46399
|
-
await runShell("pkill", ["-f", "locus-telegram"]);
|
|
46400
|
-
await new Promise((resolve2) => setTimeout(resolve2, 2000));
|
|
46401
|
-
const check2 = await runShell("pgrep", ["-f", "locus-telegram"]);
|
|
46402
|
-
if (check2.stdout.trim().length > 0) {
|
|
46403
|
-
await runShell("pkill", ["-9", "-f", "locus-telegram"]);
|
|
46404
|
-
}
|
|
46405
|
-
}
|
|
46406
|
-
function generateSystemdUnit(projectPath, user2, binaryPath, servicePath) {
|
|
46407
|
-
return `[Unit]
|
|
46408
|
-
Description=Locus AI Agent (Telegram bot + proposal scheduler)
|
|
46409
|
-
After=network-online.target
|
|
46410
|
-
Wants=network-online.target
|
|
46411
|
-
|
|
46412
|
-
[Service]
|
|
46413
|
-
Type=simple
|
|
46414
|
-
User=${user2}
|
|
46415
|
-
WorkingDirectory=${projectPath}
|
|
46416
|
-
ExecStart=${binaryPath}
|
|
46417
|
-
Restart=on-failure
|
|
46418
|
-
RestartSec=10
|
|
46419
|
-
Environment=PATH=${servicePath}
|
|
46420
|
-
Environment=HOME=${homedir3()}
|
|
46421
|
-
|
|
46422
|
-
[Install]
|
|
46423
|
-
WantedBy=multi-user.target
|
|
46424
|
-
`;
|
|
46425
|
-
}
|
|
46426
|
-
async function installSystemd(projectPath) {
|
|
46427
|
-
const user2 = process.env.USER || "root";
|
|
46428
|
-
const binaryPath = await findBinary();
|
|
46429
|
-
if (!binaryPath) {
|
|
46430
|
-
console.error(`
|
|
46431
|
-
${c.error("✖")} ${c.bold("Could not find locus-telegram binary.")}
|
|
46432
|
-
` + ` Install with: ${c.primary("npm install -g @locusai/telegram")}
|
|
46433
|
-
`);
|
|
46434
|
-
process.exit(1);
|
|
46435
|
-
}
|
|
46436
|
-
if (!await findBinDir("claude")) {
|
|
46437
|
-
console.warn(`
|
|
46438
|
-
${c.secondary("⚠")} ${c.bold("Could not find 'claude' CLI in PATH.")}
|
|
46439
|
-
` + ` The service needs the Claude Code CLI to execute tasks.
|
|
46440
|
-
` + ` Install with: ${c.primary("npm install -g @anthropic-ai/claude-code")}
|
|
46441
|
-
`);
|
|
46442
|
-
}
|
|
46443
|
-
if (!await findBinDir("codex")) {
|
|
46444
|
-
console.warn(`
|
|
46445
|
-
${c.secondary("⚠")} ${c.bold("Could not find 'codex' CLI in PATH.")}
|
|
46446
|
-
` + ` The service needs the Codex CLI if using the Codex provider.
|
|
46447
|
-
` + ` Install with: ${c.primary("npm install -g @openai/codex")}
|
|
46448
|
-
`);
|
|
46449
|
-
}
|
|
46450
|
-
const servicePath = await buildServicePath();
|
|
46451
|
-
const unit = generateSystemdUnit(projectPath, user2, binaryPath, servicePath);
|
|
46452
|
-
console.log(`
|
|
46453
|
-
${c.info("▶")} Writing systemd unit to ${c.dim(SYSTEMD_UNIT_PATH)}`);
|
|
46454
|
-
writeFileSync9(SYSTEMD_UNIT_PATH, unit, "utf-8");
|
|
46455
|
-
console.log(` ${c.info("▶")} Reloading systemd daemon...`);
|
|
46456
|
-
await runShell("systemctl", ["daemon-reload"]);
|
|
46457
|
-
console.log(` ${c.info("▶")} Enabling and starting ${SERVICE_NAME}...`);
|
|
46458
|
-
await runShell("systemctl", ["enable", SERVICE_NAME]);
|
|
46459
|
-
const startResult = await runShell("systemctl", ["start", SERVICE_NAME]);
|
|
46460
|
-
if (startResult.exitCode !== 0) {
|
|
46461
|
-
console.error(`
|
|
46462
|
-
${c.error("✖")} Failed to start service: ${startResult.stderr.trim()}`);
|
|
46463
|
-
console.error(` ${c.dim("Check logs with:")} ${c.primary(`journalctl -u ${SERVICE_NAME} -f`)}`);
|
|
46464
|
-
return;
|
|
46465
|
-
}
|
|
46466
|
-
console.log(`
|
|
46467
|
-
${c.success("✔")} ${c.bold("Locus service installed and running!")}
|
|
46468
|
-
|
|
46469
|
-
${c.bold("Service:")} ${SERVICE_NAME}
|
|
46470
|
-
${c.bold("Unit file:")} ${SYSTEMD_UNIT_PATH}
|
|
46471
|
-
|
|
46472
|
-
${c.bold("Useful commands:")}
|
|
46473
|
-
${c.dim("$")} ${c.primary(`sudo systemctl status ${SERVICE_NAME}`)}
|
|
46474
|
-
${c.dim("$")} ${c.primary(`sudo systemctl restart ${SERVICE_NAME}`)}
|
|
46475
|
-
${c.dim("$")} ${c.primary(`journalctl -u ${SERVICE_NAME} -f`)}
|
|
46476
|
-
`);
|
|
46477
|
-
}
|
|
46478
|
-
async function uninstallSystemd() {
|
|
46479
|
-
if (!existsSync20(SYSTEMD_UNIT_PATH)) {
|
|
46480
|
-
console.log(`
|
|
46481
|
-
${c.dim("No systemd service found. Nothing to remove.")}
|
|
46482
|
-
`);
|
|
46483
|
-
await killOrphanedProcesses();
|
|
46484
|
-
return;
|
|
46485
|
-
}
|
|
46486
|
-
console.log(` ${c.info("▶")} Stopping and disabling ${SERVICE_NAME}...`);
|
|
46487
|
-
await runShell("systemctl", ["stop", SERVICE_NAME]);
|
|
46488
|
-
await runShell("systemctl", ["disable", SERVICE_NAME]);
|
|
46489
|
-
const { unlinkSync: unlinkSync6 } = await import("node:fs");
|
|
46490
|
-
unlinkSync6(SYSTEMD_UNIT_PATH);
|
|
46491
|
-
await runShell("systemctl", ["daemon-reload"]);
|
|
46492
|
-
await killOrphanedProcesses();
|
|
46493
|
-
console.log(`
|
|
46494
|
-
${c.success("✔")} ${c.bold("Locus service removed.")}
|
|
46495
|
-
`);
|
|
46496
|
-
}
|
|
46497
|
-
async function statusSystemd() {
|
|
46498
|
-
const result = await runShell("systemctl", ["is-active", SERVICE_NAME]);
|
|
46499
|
-
const state = result.stdout.trim();
|
|
46500
|
-
if (state === "active") {
|
|
46501
|
-
console.log(`
|
|
46502
|
-
${c.success("●")} ${c.bold("Locus service is running")} ${c.dim("(systemd)")}
|
|
46503
|
-
`);
|
|
46504
|
-
} else if (existsSync20(SYSTEMD_UNIT_PATH)) {
|
|
46505
|
-
console.log(`
|
|
46506
|
-
${c.secondary("●")} ${c.bold(`Locus service is ${state}`)} ${c.dim("(systemd)")}
|
|
46507
|
-
`);
|
|
46508
|
-
console.log(` ${c.dim("Start with:")} ${c.primary(`sudo systemctl start ${SERVICE_NAME}`)}
|
|
46509
|
-
`);
|
|
46510
|
-
} else {
|
|
46511
|
-
console.log(`
|
|
46512
|
-
${c.secondary("●")} ${c.bold("Locus service is not installed")}
|
|
46513
|
-
`);
|
|
46514
|
-
console.log(` ${c.dim("Install with:")} ${c.primary("locus service install")}
|
|
46515
|
-
`);
|
|
46516
|
-
}
|
|
46517
|
-
}
|
|
46518
|
-
function generatePlist(projectPath, binaryPath, binaryArgs, servicePath) {
|
|
46519
|
-
const argsXml = [binaryPath, ...binaryArgs].map((a) => ` <string>${a}</string>`).join(`
|
|
46520
|
-
`);
|
|
46521
|
-
const logDir = join20(homedir3(), "Library/Logs/Locus");
|
|
46522
|
-
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
46523
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
46524
|
-
<plist version="1.0">
|
|
46525
|
-
<dict>
|
|
46526
|
-
<key>Label</key>
|
|
46527
|
-
<string>${PLIST_LABEL}</string>
|
|
46528
|
-
<key>ProgramArguments</key>
|
|
46529
|
-
<array>
|
|
46530
|
-
${argsXml}
|
|
46531
|
-
</array>
|
|
46532
|
-
<key>WorkingDirectory</key>
|
|
46533
|
-
<string>${projectPath}</string>
|
|
46534
|
-
<key>RunAtLoad</key>
|
|
46535
|
-
<true/>
|
|
46536
|
-
<key>KeepAlive</key>
|
|
46537
|
-
<true/>
|
|
46538
|
-
<key>StandardOutPath</key>
|
|
46539
|
-
<string>${join20(logDir, "locus.log")}</string>
|
|
46540
|
-
<key>StandardErrorPath</key>
|
|
46541
|
-
<string>${join20(logDir, "locus-error.log")}</string>
|
|
46542
|
-
<key>EnvironmentVariables</key>
|
|
46543
|
-
<dict>
|
|
46544
|
-
<key>PATH</key>
|
|
46545
|
-
<string>${servicePath}</string>
|
|
46546
|
-
</dict>
|
|
46547
|
-
</dict>
|
|
46548
|
-
</plist>
|
|
46549
|
-
`;
|
|
46550
|
-
}
|
|
46551
|
-
async function installLaunchd(projectPath) {
|
|
46552
|
-
const plistPath = getPlistPath();
|
|
46553
|
-
if (existsSync20(plistPath)) {
|
|
46554
|
-
await runShell("launchctl", ["unload", plistPath]);
|
|
46555
|
-
}
|
|
46556
|
-
const binaryPath = await findBinary();
|
|
46557
|
-
if (!binaryPath) {
|
|
46558
|
-
console.error(`
|
|
46559
|
-
${c.error("✖")} ${c.bold("Could not find locus-telegram binary.")}
|
|
46560
|
-
Install with: ${c.primary("npm install -g @locusai/telegram")}
|
|
46561
|
-
`);
|
|
46562
|
-
process.exit(1);
|
|
46563
|
-
}
|
|
46564
|
-
const binaryArgs = [];
|
|
46565
|
-
if (!await findBinDir("claude")) {
|
|
46566
|
-
console.warn(`
|
|
46567
|
-
${c.secondary("⚠")} ${c.bold("Could not find 'claude' CLI in PATH.")}
|
|
46568
|
-
The service needs the Claude Code CLI to execute tasks.
|
|
46569
|
-
Install with: ${c.primary("npm install -g @anthropic-ai/claude-code")}
|
|
46570
|
-
`);
|
|
46571
|
-
}
|
|
46572
|
-
if (!await findBinDir("codex")) {
|
|
46573
|
-
console.warn(`
|
|
46574
|
-
${c.secondary("⚠")} ${c.bold("Could not find 'codex' CLI in PATH.")}
|
|
46575
|
-
The service needs the Codex CLI if using the Codex provider.
|
|
46576
|
-
Install with: ${c.primary("npm install -g @openai/codex")}
|
|
46577
|
-
`);
|
|
46578
|
-
}
|
|
46579
|
-
const logDir = join20(homedir3(), "Library/Logs/Locus");
|
|
46580
|
-
const { mkdirSync: mkdirSync10 } = await import("node:fs");
|
|
46581
|
-
mkdirSync10(logDir, { recursive: true });
|
|
46582
|
-
const launchAgentsDir = join20(homedir3(), "Library/LaunchAgents");
|
|
46583
|
-
mkdirSync10(launchAgentsDir, { recursive: true });
|
|
46584
|
-
const servicePath = await buildServicePath();
|
|
46585
|
-
const plist = generatePlist(projectPath, binaryPath, binaryArgs, servicePath);
|
|
46586
|
-
console.log(`
|
|
46587
|
-
${c.info("▶")} Writing plist to ${c.dim(plistPath)}`);
|
|
46588
|
-
writeFileSync9(plistPath, plist, "utf-8");
|
|
46589
|
-
console.log(` ${c.info("▶")} Loading service...`);
|
|
46590
|
-
const loadResult = await runShell("launchctl", ["load", plistPath]);
|
|
46591
|
-
if (loadResult.exitCode !== 0) {
|
|
46592
|
-
console.error(`
|
|
46593
|
-
${c.error("✖")} Failed to load service: ${loadResult.stderr.trim()}`);
|
|
46594
|
-
return;
|
|
46595
|
-
}
|
|
46596
|
-
const logPath = join20(logDir, "locus.log");
|
|
46597
|
-
console.log(`
|
|
46598
|
-
${c.success("✔")} ${c.bold("Locus service installed and running!")}
|
|
46599
|
-
|
|
46600
|
-
${c.bold("Plist:")} ${plistPath}
|
|
46601
|
-
${c.bold("Logs:")} ${logPath}
|
|
46602
|
-
|
|
46603
|
-
${c.bold("Useful commands:")}
|
|
46604
|
-
${c.dim("$")} ${c.primary(`launchctl list | grep ${PLIST_LABEL}`)}
|
|
46605
|
-
${c.dim("$")} ${c.primary(`tail -f ${logPath}`)}
|
|
46606
|
-
`);
|
|
46607
|
-
}
|
|
46608
|
-
async function uninstallLaunchd() {
|
|
46609
|
-
const plistPath = getPlistPath();
|
|
46610
|
-
if (!existsSync20(plistPath)) {
|
|
46611
|
-
console.log(`
|
|
46612
|
-
${c.dim("No launchd service found. Nothing to remove.")}
|
|
46613
|
-
`);
|
|
46614
|
-
await killOrphanedProcesses();
|
|
46615
|
-
return;
|
|
46616
|
-
}
|
|
46617
|
-
console.log(` ${c.info("▶")} Unloading service...`);
|
|
46618
|
-
await runShell("launchctl", ["unload", plistPath]);
|
|
46619
|
-
const { unlinkSync: unlinkSync6 } = await import("node:fs");
|
|
46620
|
-
unlinkSync6(plistPath);
|
|
46621
|
-
await killOrphanedProcesses();
|
|
46622
|
-
console.log(`
|
|
46623
|
-
${c.success("✔")} ${c.bold("Locus service removed.")}
|
|
46624
|
-
`);
|
|
46625
|
-
}
|
|
46626
|
-
async function statusLaunchd() {
|
|
46627
|
-
const plistPath = getPlistPath();
|
|
46628
|
-
if (!existsSync20(plistPath)) {
|
|
46629
|
-
console.log(`
|
|
46630
|
-
${c.secondary("●")} ${c.bold("Locus service is not installed")}
|
|
46631
|
-
`);
|
|
46632
|
-
console.log(` ${c.dim("Install with:")} ${c.primary("locus service install")}
|
|
46633
|
-
`);
|
|
46634
|
-
return;
|
|
46635
|
-
}
|
|
46636
|
-
const result = await runShell("launchctl", ["list"]);
|
|
46637
|
-
const lines = result.stdout.split(`
|
|
46638
|
-
`);
|
|
46639
|
-
const match = lines.find((l) => l.includes(PLIST_LABEL));
|
|
46640
|
-
if (match) {
|
|
46641
|
-
const parts = match.trim().split(/\s+/);
|
|
46642
|
-
const pid = parts[0] === "-" ? null : parts[0];
|
|
46643
|
-
if (pid) {
|
|
46644
|
-
console.log(`
|
|
46645
|
-
${c.success("●")} ${c.bold("Locus service is running")} ${c.dim(`(PID ${pid}, launchd)`)}
|
|
46646
|
-
`);
|
|
46647
|
-
} else {
|
|
46648
|
-
console.log(`
|
|
46649
|
-
${c.secondary("●")} ${c.bold("Locus service is stopped")} ${c.dim("(launchd)")}
|
|
46650
|
-
`);
|
|
46651
|
-
console.log(` ${c.dim("Start with:")} ${c.primary(`launchctl load ${plistPath}`)}
|
|
46652
|
-
`);
|
|
46653
|
-
}
|
|
46654
|
-
} else {
|
|
46655
|
-
console.log(`
|
|
46656
|
-
${c.secondary("●")} ${c.bold("Locus service is not loaded")} ${c.dim("(plist exists but not loaded)")}
|
|
46657
|
-
`);
|
|
46658
|
-
console.log(` ${c.dim("Load with:")} ${c.primary(`launchctl load ${plistPath}`)}
|
|
46659
|
-
`);
|
|
46660
|
-
}
|
|
46661
|
-
}
|
|
46662
|
-
function getPlatform() {
|
|
46663
|
-
if (process.platform === "linux")
|
|
46664
|
-
return "linux";
|
|
46665
|
-
if (process.platform === "darwin")
|
|
46666
|
-
return "darwin";
|
|
46667
|
-
return null;
|
|
46668
|
-
}
|
|
46669
|
-
async function installCommand(projectPath) {
|
|
46670
|
-
const platform = getPlatform();
|
|
46671
|
-
if (!platform) {
|
|
46672
|
-
console.error(`
|
|
46673
|
-
${c.error("✖")} ${c.bold(`Unsupported platform: ${process.platform}`)}
|
|
46674
|
-
Service management is supported on Linux (systemd) and macOS (launchd).
|
|
46675
|
-
`);
|
|
46676
|
-
process.exit(1);
|
|
46677
|
-
}
|
|
46678
|
-
const manager = new SettingsManager(projectPath);
|
|
46679
|
-
const settings = manager.load();
|
|
46680
|
-
if (!settings.telegram?.botToken || !settings.telegram?.chatId) {
|
|
46681
|
-
console.error(`
|
|
46682
|
-
${c.error("✖")} ${c.bold("Telegram is not configured.")}
|
|
46683
|
-
Run ${c.primary("locus telegram setup")} first.
|
|
46684
|
-
`);
|
|
46685
|
-
process.exit(1);
|
|
46686
|
-
}
|
|
46687
|
-
if (!settings.apiKey) {
|
|
46688
|
-
console.error(`
|
|
46689
|
-
${c.error("✖")} ${c.bold("API key is not configured.")}
|
|
46690
|
-
Run ${c.primary("locus config setup --api-key <key>")} first.
|
|
46691
|
-
`);
|
|
46692
|
-
process.exit(1);
|
|
46693
|
-
}
|
|
46694
|
-
if (platform === "linux") {
|
|
46695
|
-
await installSystemd(projectPath);
|
|
46696
|
-
} else {
|
|
46697
|
-
await installLaunchd(projectPath);
|
|
46698
|
-
}
|
|
46699
|
-
}
|
|
46700
|
-
async function uninstallCommand() {
|
|
46701
|
-
const platform = getPlatform();
|
|
46702
|
-
if (!platform) {
|
|
46703
|
-
console.error(`
|
|
46704
|
-
${c.error("✖")} Unsupported platform: ${process.platform}
|
|
46705
|
-
`);
|
|
46706
|
-
process.exit(1);
|
|
46707
|
-
}
|
|
46708
|
-
if (platform === "linux") {
|
|
46709
|
-
await uninstallSystemd();
|
|
46710
|
-
} else {
|
|
46711
|
-
await uninstallLaunchd();
|
|
46712
|
-
}
|
|
46713
|
-
}
|
|
46714
|
-
async function statusCommandHandler() {
|
|
46715
|
-
const platform = getPlatform();
|
|
46716
|
-
if (!platform) {
|
|
46717
|
-
console.error(`
|
|
46718
|
-
${c.error("✖")} Unsupported platform: ${process.platform}
|
|
46719
|
-
`);
|
|
46720
|
-
process.exit(1);
|
|
46721
|
-
}
|
|
46722
|
-
if (platform === "linux") {
|
|
46723
|
-
await statusSystemd();
|
|
46724
|
-
} else {
|
|
46725
|
-
await statusLaunchd();
|
|
46726
|
-
}
|
|
46727
|
-
}
|
|
46728
|
-
async function serviceCommand(args) {
|
|
46729
|
-
const projectPath = process.cwd();
|
|
46730
|
-
requireInitialization(projectPath, "service");
|
|
46731
|
-
const subcommand = args[0];
|
|
46732
|
-
switch (subcommand) {
|
|
46733
|
-
case "install":
|
|
46734
|
-
await installCommand(projectPath);
|
|
46735
|
-
break;
|
|
46736
|
-
case "uninstall":
|
|
46737
|
-
await uninstallCommand();
|
|
46738
|
-
break;
|
|
46739
|
-
case "status":
|
|
46740
|
-
await statusCommandHandler();
|
|
46741
|
-
break;
|
|
46742
|
-
default:
|
|
46743
|
-
showServiceHelp();
|
|
46744
|
-
}
|
|
46745
|
-
}
|
|
46746
46095
|
// src/commands/telegram.ts
|
|
46747
46096
|
init_index_node();
|
|
46748
46097
|
init_settings_manager();
|
|
46749
|
-
import { spawn as
|
|
46750
|
-
import { existsSync as
|
|
46751
|
-
import { join as
|
|
46098
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
46099
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
46100
|
+
import { join as join20 } from "node:path";
|
|
46752
46101
|
import { createInterface as createInterface2 } from "node:readline";
|
|
46753
46102
|
function ask2(question) {
|
|
46754
46103
|
const rl = createInterface2({
|
|
@@ -46866,8 +46215,7 @@ async function setupCommand2(args, projectPath) {
|
|
|
46866
46215
|
${c.primary("Chat ID:")} ${parsedChatId}
|
|
46867
46216
|
|
|
46868
46217
|
${c.bold("Next steps:")}
|
|
46869
|
-
|
|
46870
|
-
Or run manually: ${c.primary("locus telegram run")}
|
|
46218
|
+
Start the bot with: ${c.primary("locus telegram run")}
|
|
46871
46219
|
`);
|
|
46872
46220
|
}
|
|
46873
46221
|
function configCommand2(projectPath) {
|
|
@@ -46983,8 +46331,8 @@ function runBotCommand(projectPath) {
|
|
|
46983
46331
|
`);
|
|
46984
46332
|
process.exit(1);
|
|
46985
46333
|
}
|
|
46986
|
-
const monorepoTelegramEntry =
|
|
46987
|
-
const isMonorepo =
|
|
46334
|
+
const monorepoTelegramEntry = join20(projectPath, "packages/telegram/src/index.ts");
|
|
46335
|
+
const isMonorepo = existsSync20(monorepoTelegramEntry);
|
|
46988
46336
|
let cmd;
|
|
46989
46337
|
let args;
|
|
46990
46338
|
if (isMonorepo) {
|
|
@@ -46995,7 +46343,7 @@ function runBotCommand(projectPath) {
|
|
|
46995
46343
|
args = [];
|
|
46996
46344
|
}
|
|
46997
46345
|
const env = { ...process.env };
|
|
46998
|
-
const child =
|
|
46346
|
+
const child = spawn4(cmd, args, {
|
|
46999
46347
|
cwd: projectPath,
|
|
47000
46348
|
stdio: "inherit",
|
|
47001
46349
|
env
|
|
@@ -47043,10 +46391,7 @@ async function telegramCommand(args) {
|
|
|
47043
46391
|
// src/commands/upgrade.ts
|
|
47044
46392
|
init_index_node();
|
|
47045
46393
|
import { execSync as execSync3 } from "node:child_process";
|
|
47046
|
-
import { existsSync as existsSync22 } from "node:fs";
|
|
47047
46394
|
var PACKAGES = ["@locusai/cli", "@locusai/telegram"];
|
|
47048
|
-
var SYSTEMD_UNIT_PATH2 = "/etc/systemd/system/locus.service";
|
|
47049
|
-
var SYSTEMD_TELEGRAM_UNIT_PATH = "/etc/systemd/system/locus-telegram.service";
|
|
47050
46395
|
function getInstalledVersion(pkg) {
|
|
47051
46396
|
try {
|
|
47052
46397
|
const output = execSync3(`npm list -g ${pkg} --depth=0 --json`, {
|
|
@@ -47112,28 +46457,6 @@ async function upgradeCommand() {
|
|
|
47112
46457
|
`);
|
|
47113
46458
|
}
|
|
47114
46459
|
}
|
|
47115
|
-
if (process.platform === "linux") {
|
|
47116
|
-
for (const unit of [SYSTEMD_UNIT_PATH2, SYSTEMD_TELEGRAM_UNIT_PATH]) {
|
|
47117
|
-
if (!existsSync22(unit))
|
|
47118
|
-
continue;
|
|
47119
|
-
const split = unit.split("/").pop();
|
|
47120
|
-
if (!split) {
|
|
47121
|
-
throw "PATH NOTH FOUND";
|
|
47122
|
-
}
|
|
47123
|
-
const name = split.replace(".service", "");
|
|
47124
|
-
try {
|
|
47125
|
-
console.log(` ${c.info("▶")} Restarting ${name} service...`);
|
|
47126
|
-
execSync3(`systemctl restart ${name}`, {
|
|
47127
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
47128
|
-
});
|
|
47129
|
-
console.log(` ${c.success("✔")} ${name} service restarted
|
|
47130
|
-
`);
|
|
47131
|
-
} catch {
|
|
47132
|
-
console.log(` ${c.dim("⚠")} Could not restart ${name} service (may need sudo)
|
|
47133
|
-
`);
|
|
47134
|
-
}
|
|
47135
|
-
}
|
|
47136
|
-
}
|
|
47137
46460
|
console.log("");
|
|
47138
46461
|
}
|
|
47139
46462
|
// src/commands/version.ts
|
|
@@ -47205,9 +46528,6 @@ async function main() {
|
|
|
47205
46528
|
case "config":
|
|
47206
46529
|
await configCommand(args);
|
|
47207
46530
|
break;
|
|
47208
|
-
case "service":
|
|
47209
|
-
await serviceCommand(args);
|
|
47210
|
-
break;
|
|
47211
46531
|
case "docs":
|
|
47212
46532
|
await docsCommand(args);
|
|
47213
46533
|
break;
|
|
@@ -47236,11 +46556,3 @@ main().catch((err) => {
|
|
|
47236
46556
|
${c.error("✖ Fatal Error")} ${c.red(err.message)}`);
|
|
47237
46557
|
process.exit(1);
|
|
47238
46558
|
});
|
|
47239
|
-
|
|
47240
|
-
// index.ts
|
|
47241
|
-
var _emit = process.emit;
|
|
47242
|
-
process.emit = function(name, data, ...args) {
|
|
47243
|
-
if (name === "warning" && data?.code === "DEP0040")
|
|
47244
|
-
return false;
|
|
47245
|
-
return _emit.apply(process, [name, data, ...args]);
|
|
47246
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locusai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "CLI for Locus - AI-native project management platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
"author": "",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@locusai/sdk": "^0.
|
|
36
|
-
"@locusai/shared": "^0.
|
|
37
|
-
"@locusai/telegram": "^0.15.4"
|
|
35
|
+
"@locusai/sdk": "^0.16.1",
|
|
36
|
+
"@locusai/shared": "^0.16.1"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {}
|
|
40
39
|
}
|