lastlight 0.16.0 → 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/README.md +71 -692
- package/dist/cli-config.js.map +1 -0
- package/dist/cli-format.js.map +1 -0
- package/dist/{cli/cli-server.d.ts → cli-server.d.ts} +26 -1
- package/dist/{cli/cli-server.js → cli-server.js} +40 -5
- package/dist/cli-server.js.map +1 -0
- package/dist/cli-timeline.js.map +1 -0
- package/dist/{cli/cli.js → cli.js} +4 -3
- package/dist/cli.js.map +1 -0
- package/dist/{cli/fork-cli.d.ts → fork-cli.d.ts} +3 -3
- package/dist/{cli/fork-cli.js → fork-cli.js} +28 -27
- package/dist/fork-cli.js.map +1 -0
- package/dist/{cli/oauth-cli.js → oauth-cli.js} +1 -1
- package/dist/oauth-cli.js.map +1 -0
- package/dist/{cli/setup.js → setup.js} +10 -4
- package/dist/setup.js.map +1 -0
- package/dist/{cli/skills-install.d.ts → skills-install.d.ts} +6 -0
- package/dist/{cli/skills-install.js → skills-install.js} +6 -2
- package/dist/skills-install.js.map +1 -0
- package/package.json +20 -65
- package/plugins/lastlight/.claude-plugin/plugin.json +1 -1
- package/agent-context/rules.md +0 -80
- package/agent-context/security.md +0 -69
- package/agent-context/soul.md +0 -21
- package/config/default.yaml +0 -119
- package/deploy/.env.production.example +0 -100
- package/deploy/entrypoint.sh +0 -82
- package/deploy/native/README.md +0 -160
- package/deploy/native/install.sh +0 -110
- package/deploy/native/lastlight.env.example +0 -95
- package/deploy/native/lastlight.service +0 -50
- package/deploy/sandbox-entrypoint.sh +0 -93
- package/dist/admin/auth.d.ts +0 -51
- package/dist/admin/auth.js +0 -121
- package/dist/admin/auth.js.map +0 -1
- package/dist/admin/chat-session-reader.d.ts +0 -39
- package/dist/admin/chat-session-reader.js +0 -84
- package/dist/admin/chat-session-reader.js.map +0 -1
- package/dist/admin/docker.d.ts +0 -61
- package/dist/admin/docker.js +0 -187
- package/dist/admin/docker.js.map +0 -1
- package/dist/admin/index.d.ts +0 -9
- package/dist/admin/index.js +0 -59
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/routes.d.ts +0 -81
- package/dist/admin/routes.js +0 -1381
- package/dist/admin/routes.js.map +0 -1
- package/dist/admin/sessions.d.ts +0 -89
- package/dist/admin/sessions.js +0 -204
- package/dist/admin/sessions.js.map +0 -1
- package/dist/admin/tail.d.ts +0 -12
- package/dist/admin/tail.js +0 -145
- package/dist/admin/tail.js.map +0 -1
- package/dist/admin/version.d.ts +0 -22
- package/dist/admin/version.js +0 -92
- package/dist/admin/version.js.map +0 -1
- package/dist/cli/cli-config.js.map +0 -1
- package/dist/cli/cli-format.js.map +0 -1
- package/dist/cli/cli-server.js.map +0 -1
- package/dist/cli/cli-timeline.js.map +0 -1
- package/dist/cli/cli.js.map +0 -1
- package/dist/cli/fork-cli.js.map +0 -1
- package/dist/cli/oauth-cli.js.map +0 -1
- package/dist/cli/setup.js.map +0 -1
- package/dist/cli/skills-install.js.map +0 -1
- package/dist/config/config-resolve.d.ts +0 -28
- package/dist/config/config-resolve.js +0 -47
- package/dist/config/config-resolve.js.map +0 -1
- package/dist/config/config.d.ts +0 -157
- package/dist/config/config.js +0 -581
- package/dist/config/config.js.map +0 -1
- package/dist/config/core-pin.d.ts +0 -16
- package/dist/config/core-pin.js +0 -85
- package/dist/config/core-pin.js.map +0 -1
- package/dist/config/overlay-assets.d.ts +0 -20
- package/dist/config/overlay-assets.js +0 -114
- package/dist/config/overlay-assets.js.map +0 -1
- package/dist/config/overlay-bootstrap.d.ts +0 -44
- package/dist/config/overlay-bootstrap.js +0 -304
- package/dist/config/overlay-bootstrap.js.map +0 -1
- package/dist/connectors/github-webhook.d.ts +0 -45
- package/dist/connectors/github-webhook.js +0 -321
- package/dist/connectors/github-webhook.js.map +0 -1
- package/dist/connectors/index.d.ts +0 -18
- package/dist/connectors/index.js +0 -41
- package/dist/connectors/index.js.map +0 -1
- package/dist/connectors/messaging/base.d.ts +0 -42
- package/dist/connectors/messaging/base.js +0 -139
- package/dist/connectors/messaging/base.js.map +0 -1
- package/dist/connectors/messaging/delivery.d.ts +0 -14
- package/dist/connectors/messaging/delivery.js +0 -38
- package/dist/connectors/messaging/delivery.js.map +0 -1
- package/dist/connectors/messaging/index.d.ts +0 -4
- package/dist/connectors/messaging/index.js +0 -4
- package/dist/connectors/messaging/index.js.map +0 -1
- package/dist/connectors/messaging/session-manager.d.ts +0 -53
- package/dist/connectors/messaging/session-manager.js +0 -255
- package/dist/connectors/messaging/session-manager.js.map +0 -1
- package/dist/connectors/messaging/types.d.ts +0 -58
- package/dist/connectors/messaging/types.js +0 -7
- package/dist/connectors/messaging/types.js.map +0 -1
- package/dist/connectors/slack/connector.d.ts +0 -142
- package/dist/connectors/slack/connector.js +0 -494
- package/dist/connectors/slack/connector.js.map +0 -1
- package/dist/connectors/slack/index.d.ts +0 -2
- package/dist/connectors/slack/index.js +0 -3
- package/dist/connectors/slack/index.js.map +0 -1
- package/dist/connectors/slack/mrkdwn.d.ts +0 -19
- package/dist/connectors/slack/mrkdwn.js +0 -240
- package/dist/connectors/slack/mrkdwn.js.map +0 -1
- package/dist/connectors/types.d.ts +0 -61
- package/dist/connectors/types.js +0 -2
- package/dist/connectors/types.js.map +0 -1
- package/dist/cron/fanout.d.ts +0 -33
- package/dist/cron/fanout.js +0 -55
- package/dist/cron/fanout.js.map +0 -1
- package/dist/cron/jobs.d.ts +0 -18
- package/dist/cron/jobs.js +0 -37
- package/dist/cron/jobs.js.map +0 -1
- package/dist/cron/scheduler.d.ts +0 -45
- package/dist/cron/scheduler.js +0 -105
- package/dist/cron/scheduler.js.map +0 -1
- package/dist/engine/agent-executor.d.ts +0 -34
- package/dist/engine/agent-executor.js +0 -246
- package/dist/engine/agent-executor.js.map +0 -1
- package/dist/engine/chat/chat-runner.d.ts +0 -132
- package/dist/engine/chat/chat-runner.js +0 -424
- package/dist/engine/chat/chat-runner.js.map +0 -1
- package/dist/engine/chat/chat-skills.d.ts +0 -45
- package/dist/engine/chat/chat-skills.js +0 -184
- package/dist/engine/chat/chat-skills.js.map +0 -1
- package/dist/engine/chat/chat.d.ts +0 -54
- package/dist/engine/chat/chat.js +0 -316
- package/dist/engine/chat/chat.js.map +0 -1
- package/dist/engine/chat/message-batcher.d.ts +0 -32
- package/dist/engine/chat/message-batcher.js +0 -109
- package/dist/engine/chat/message-batcher.js.map +0 -1
- package/dist/engine/dispatcher.d.ts +0 -73
- package/dist/engine/dispatcher.js +0 -663
- package/dist/engine/dispatcher.js.map +0 -1
- package/dist/engine/event-shim.d.ts +0 -117
- package/dist/engine/event-shim.js +0 -435
- package/dist/engine/event-shim.js.map +0 -1
- package/dist/engine/executors/orchestrator.d.ts +0 -81
- package/dist/engine/executors/orchestrator.js +0 -365
- package/dist/engine/executors/orchestrator.js.map +0 -1
- package/dist/engine/executors/shared.d.ts +0 -189
- package/dist/engine/executors/shared.js +0 -616
- package/dist/engine/executors/shared.js.map +0 -1
- package/dist/engine/github/git-auth.d.ts +0 -62
- package/dist/engine/github/git-auth.js +0 -161
- package/dist/engine/github/git-auth.js.map +0 -1
- package/dist/engine/github/github-app-client.d.ts +0 -23
- package/dist/engine/github/github-app-client.js +0 -33
- package/dist/engine/github/github-app-client.js.map +0 -1
- package/dist/engine/github/github-tools.d.ts +0 -18
- package/dist/engine/github/github-tools.js +0 -263
- package/dist/engine/github/github-tools.js.map +0 -1
- package/dist/engine/github/github.d.ts +0 -1193
- package/dist/engine/github/github.js +0 -357
- package/dist/engine/github/github.js.map +0 -1
- package/dist/engine/github/profiles.d.ts +0 -279
- package/dist/engine/github/profiles.js +0 -42
- package/dist/engine/github/profiles.js.map +0 -1
- package/dist/engine/github/review-poster.d.ts +0 -98
- package/dist/engine/github/review-poster.js +0 -177
- package/dist/engine/github/review-poster.js.map +0 -1
- package/dist/engine/llm.d.ts +0 -79
- package/dist/engine/llm.js +0 -269
- package/dist/engine/llm.js.map +0 -1
- package/dist/engine/oauth.d.ts +0 -43
- package/dist/engine/oauth.js +0 -103
- package/dist/engine/oauth.js.map +0 -1
- package/dist/engine/router.d.ts +0 -29
- package/dist/engine/router.js +0 -680
- package/dist/engine/router.js.map +0 -1
- package/dist/engine/screen/classifier.d.ts +0 -93
- package/dist/engine/screen/classifier.js +0 -215
- package/dist/engine/screen/classifier.js.map +0 -1
- package/dist/engine/screen/screen.d.ts +0 -41
- package/dist/engine/screen/screen.js +0 -93
- package/dist/engine/screen/screen.js.map +0 -1
- package/dist/evals-api.d.ts +0 -24
- package/dist/evals-api.js +0 -22
- package/dist/evals-api.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -940
- package/dist/index.js.map +0 -1
- package/dist/managed-repos.d.ts +0 -30
- package/dist/managed-repos.js +0 -72
- package/dist/managed-repos.js.map +0 -1
- package/dist/notify/blocks.d.ts +0 -23
- package/dist/notify/blocks.js +0 -118
- package/dist/notify/blocks.js.map +0 -1
- package/dist/notify/index.d.ts +0 -17
- package/dist/notify/index.js +0 -7
- package/dist/notify/index.js.map +0 -1
- package/dist/notify/model.d.ts +0 -57
- package/dist/notify/model.js +0 -89
- package/dist/notify/model.js.map +0 -1
- package/dist/notify/notifier.d.ts +0 -18
- package/dist/notify/notifier.js +0 -100
- package/dist/notify/notifier.js.map +0 -1
- package/dist/notify/render.d.ts +0 -21
- package/dist/notify/render.js +0 -59
- package/dist/notify/render.js.map +0 -1
- package/dist/notify/transports/github.d.ts +0 -26
- package/dist/notify/transports/github.js +0 -27
- package/dist/notify/transports/github.js.map +0 -1
- package/dist/notify/transports/slack.d.ts +0 -27
- package/dist/notify/transports/slack.js +0 -37
- package/dist/notify/transports/slack.js.map +0 -1
- package/dist/notify/types.d.ts +0 -119
- package/dist/notify/types.js +0 -16
- package/dist/notify/types.js.map +0 -1
- package/dist/providers.d.ts +0 -125
- package/dist/providers.js +0 -279
- package/dist/providers.js.map +0 -1
- package/dist/sandbox/docker.d.ts +0 -180
- package/dist/sandbox/docker.js +0 -517
- package/dist/sandbox/docker.js.map +0 -1
- package/dist/sandbox/egress-allowlist.d.ts +0 -74
- package/dist/sandbox/egress-allowlist.js +0 -164
- package/dist/sandbox/egress-allowlist.js.map +0 -1
- package/dist/sandbox/egress-firewall-config.d.ts +0 -127
- package/dist/sandbox/egress-firewall-config.js +0 -434
- package/dist/sandbox/egress-firewall-config.js.map +0 -1
- package/dist/sandbox/images.d.ts +0 -23
- package/dist/sandbox/images.js +0 -55
- package/dist/sandbox/images.js.map +0 -1
- package/dist/sandbox/index.d.ts +0 -112
- package/dist/sandbox/index.js +0 -332
- package/dist/sandbox/index.js.map +0 -1
- package/dist/sandbox/sandbox.d.ts +0 -214
- package/dist/sandbox/sandbox.js +0 -453
- package/dist/sandbox/sandbox.js.map +0 -1
- package/dist/sandbox/smol.d.ts +0 -162
- package/dist/sandbox/smol.js +0 -485
- package/dist/sandbox/smol.js.map +0 -1
- package/dist/session-log.d.ts +0 -63
- package/dist/session-log.js +0 -290
- package/dist/session-log.js.map +0 -1
- package/dist/state/approval-store.d.ts +0 -88
- package/dist/state/approval-store.js +0 -149
- package/dist/state/approval-store.js.map +0 -1
- package/dist/state/build-assets.d.ts +0 -50
- package/dist/state/build-assets.js +0 -154
- package/dist/state/build-assets.js.map +0 -1
- package/dist/state/db.d.ts +0 -81
- package/dist/state/db.js +0 -155
- package/dist/state/db.js.map +0 -1
- package/dist/state/execution-store.d.ts +0 -257
- package/dist/state/execution-store.js +0 -527
- package/dist/state/execution-store.js.map +0 -1
- package/dist/state/migrate.d.ts +0 -15
- package/dist/state/migrate.js +0 -175
- package/dist/state/migrate.js.map +0 -1
- package/dist/state/workflow-run-store.d.ts +0 -216
- package/dist/state/workflow-run-store.js +0 -403
- package/dist/state/workflow-run-store.js.map +0 -1
- package/dist/telemetry/index.d.ts +0 -38
- package/dist/telemetry/index.js +0 -253
- package/dist/telemetry/index.js.map +0 -1
- package/dist/telemetry/pi-events.d.ts +0 -12
- package/dist/telemetry/pi-events.js +0 -134
- package/dist/telemetry/pi-events.js.map +0 -1
- package/dist/workflows/dag.d.ts +0 -37
- package/dist/workflows/dag.js +0 -118
- package/dist/workflows/dag.js.map +0 -1
- package/dist/workflows/loader.d.ts +0 -53
- package/dist/workflows/loader.js +0 -421
- package/dist/workflows/loader.js.map +0 -1
- package/dist/workflows/loop-eval.d.ts +0 -28
- package/dist/workflows/loop-eval.js +0 -74
- package/dist/workflows/loop-eval.js.map +0 -1
- package/dist/workflows/phase-executor.d.ts +0 -222
- package/dist/workflows/phase-executor.js +0 -1153
- package/dist/workflows/phase-executor.js.map +0 -1
- package/dist/workflows/phase-ref.d.ts +0 -50
- package/dist/workflows/phase-ref.js +0 -91
- package/dist/workflows/phase-ref.js.map +0 -1
- package/dist/workflows/resume.d.ts +0 -58
- package/dist/workflows/resume.js +0 -313
- package/dist/workflows/resume.js.map +0 -1
- package/dist/workflows/runner.d.ts +0 -63
- package/dist/workflows/runner.js +0 -381
- package/dist/workflows/runner.js.map +0 -1
- package/dist/workflows/schema.d.ts +0 -344
- package/dist/workflows/schema.js +0 -460
- package/dist/workflows/schema.js.map +0 -1
- package/dist/workflows/simple.d.ts +0 -90
- package/dist/workflows/simple.js +0 -393
- package/dist/workflows/simple.js.map +0 -1
- package/dist/workflows/target-policy.d.ts +0 -74
- package/dist/workflows/target-policy.js +0 -80
- package/dist/workflows/target-policy.js.map +0 -1
- package/dist/workflows/templates.d.ts +0 -88
- package/dist/workflows/templates.js +0 -127
- package/dist/workflows/templates.js.map +0 -1
- package/dist/workflows/triggers.d.ts +0 -21
- package/dist/workflows/triggers.js +0 -45
- package/dist/workflows/triggers.js.map +0 -1
- package/dist/workflows/verdict.d.ts +0 -19
- package/dist/workflows/verdict.js +0 -30
- package/dist/workflows/verdict.js.map +0 -1
- package/dist/worktree/manager.d.ts +0 -43
- package/dist/worktree/manager.js +0 -127
- package/dist/worktree/manager.js.map +0 -1
- package/docker-compose.yml +0 -274
- package/sandbox.Dockerfile +0 -68
- package/skills/README.md +0 -42
- package/skills/browser-qa/SKILL.md +0 -208
- package/skills/browser-qa/scripts/agent-browser.mjs +0 -531
- package/skills/building/SKILL.md +0 -95
- package/skills/chat/SKILL.md +0 -36
- package/skills/code-review/SKILL.md +0 -82
- package/skills/debug-production/SKILL.md +0 -108
- package/skills/demo/SKILL.md +0 -228
- package/skills/demo/scripts/compose-demo.sh +0 -243
- package/skills/issue-answer/SKILL.md +0 -91
- package/skills/issue-comment/SKILL.md +0 -49
- package/skills/issue-triage/SKILL.md +0 -149
- package/skills/issue-triage/references/AGENT-BRIEF.md +0 -65
- package/skills/pr-comment/SKILL.md +0 -64
- package/skills/pr-review/SKILL.md +0 -148
- package/skills/pr-review/references/findings-schema.md +0 -89
- package/skills/qa-test/SKILL.md +0 -97
- package/skills/repo-health/SKILL.md +0 -67
- package/skills/security-feedback/SKILL.md +0 -173
- package/skills/security-feedback/references/templates.md +0 -77
- package/skills/security-review/SKILL.md +0 -215
- package/skills/security-review/references/issue-format.md +0 -302
- package/skills/verify/SKILL.md +0 -118
- package/workflows/answer.yaml +0 -44
- package/workflows/build.yaml +0 -129
- package/workflows/cron-health.yaml +0 -6
- package/workflows/cron-review.yaml +0 -8
- package/workflows/cron-security.yaml +0 -6
- package/workflows/cron-triage.yaml +0 -8
- package/workflows/demo.yaml +0 -62
- package/workflows/examples/bash-smoke.yaml +0 -41
- package/workflows/examples/parallel-review.yaml +0 -36
- package/workflows/examples/tdd-loop.yaml +0 -17
- package/workflows/explore.yaml +0 -80
- package/workflows/issue-comment.yaml +0 -15
- package/workflows/issue-triage.yaml +0 -22
- package/workflows/pr-comment.yaml +0 -16
- package/workflows/pr-fix.yaml +0 -17
- package/workflows/pr-review.yaml +0 -50
- package/workflows/prompts/answer.md +0 -68
- package/workflows/prompts/architect.md +0 -44
- package/workflows/prompts/classifier.md +0 -60
- package/workflows/prompts/classify-adds-info.md +0 -17
- package/workflows/prompts/demo.md +0 -125
- package/workflows/prompts/executor.md +0 -42
- package/workflows/prompts/explore-ask.md +0 -99
- package/workflows/prompts/explore-publish.md +0 -31
- package/workflows/prompts/explore-read.md +0 -120
- package/workflows/prompts/explore-synthesize.md +0 -88
- package/workflows/prompts/fix.md +0 -18
- package/workflows/prompts/guardrails.md +0 -96
- package/workflows/prompts/pr-fix.md +0 -26
- package/workflows/prompts/pr.md +0 -39
- package/workflows/prompts/qa-browser.md +0 -95
- package/workflows/prompts/qa-synth.md +0 -44
- package/workflows/prompts/qa-test.md +0 -60
- package/workflows/prompts/re-reviewer.md +0 -33
- package/workflows/prompts/reviewer.md +0 -60
- package/workflows/prompts/verify-browser.md +0 -93
- package/workflows/prompts/verify-synth.md +0 -44
- package/workflows/prompts/verify.md +0 -63
- package/workflows/qa-test.yaml +0 -94
- package/workflows/repo-health.yaml +0 -15
- package/workflows/security-feedback.yaml +0 -25
- package/workflows/security-review.yaml +0 -37
- package/workflows/verify.yaml +0 -93
- /package/dist/{cli/cli-config.d.ts → cli-config.d.ts} +0 -0
- /package/dist/{cli/cli-config.js → cli-config.js} +0 -0
- /package/dist/{cli/cli-format.d.ts → cli-format.d.ts} +0 -0
- /package/dist/{cli/cli-format.js → cli-format.js} +0 -0
- /package/dist/{cli/cli-timeline.d.ts → cli-timeline.d.ts} +0 -0
- /package/dist/{cli/cli-timeline.js → cli-timeline.js} +0 -0
- /package/dist/{cli/cli.d.ts → cli.d.ts} +0 -0
- /package/dist/{cli/oauth-cli.d.ts → oauth-cli.d.ts} +0 -0
- /package/dist/{cli/setup.d.ts → setup.d.ts} +0 -0
package/dist/config/core-pin.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read the core-version pin an overlay declares.
|
|
3
|
-
*
|
|
4
|
-
* The overlay's `config.yaml` may carry a `deploy.version` — a git tag/ref
|
|
5
|
-
* (e.g. `v0.10.6`) that pins which core version this instance runs. When set,
|
|
6
|
-
* `lastlight server update|setup` checks the core repo out at that ref instead
|
|
7
|
-
* of tracking `main`, and the dashboard drift banner compares the running image
|
|
8
|
-
* to the pinned tag rather than to `main` HEAD.
|
|
9
|
-
*
|
|
10
|
-
* This reader is deliberately standalone (a raw YAML read, not the full
|
|
11
|
-
* default/overlay/env config machinery) because its two callers run in very
|
|
12
|
-
* different contexts against a raw overlay checkout path:
|
|
13
|
-
* - the host-local `lastlight server` CLI (no harness / runtime config) —
|
|
14
|
-
* against `<serverHome>/instance`;
|
|
15
|
-
* - the in-container harness banner (`src/admin/version.ts`) — against the
|
|
16
|
-
* mounted `LASTLIGHT_OVERLAY_DIR` (`/app/instance`).
|
|
17
|
-
*
|
|
18
|
-
* `LASTLIGHT_CORE_VERSION` (env) overrides the file so CI can pin without
|
|
19
|
-
* editing config.yaml. Unset, or the sentinels `main` / `latest`, mean "track
|
|
20
|
-
* main" and return `null`.
|
|
21
|
-
*/
|
|
22
|
-
import { readFileSync } from "node:fs";
|
|
23
|
-
import { join } from "node:path";
|
|
24
|
-
import { parse as parseYaml } from "yaml";
|
|
25
|
-
/** Normalize a raw pin value: trim, treat empty / `main` / `latest` as null. */
|
|
26
|
-
function normalizePin(raw) {
|
|
27
|
-
if (typeof raw !== "string")
|
|
28
|
-
return null;
|
|
29
|
-
const v = raw.trim();
|
|
30
|
-
if (!v)
|
|
31
|
-
return null;
|
|
32
|
-
const lower = v.toLowerCase();
|
|
33
|
-
if (lower === "main" || lower === "latest")
|
|
34
|
-
return null;
|
|
35
|
-
return v;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Pick the *commit* SHA for tag `pin` from `git ls-remote … 'refs/tags/<pin>*'`
|
|
39
|
-
* output. Annotated tags emit two rows — the tag object (`refs/tags/<pin>`) and
|
|
40
|
-
* the peeled commit (`refs/tags/<pin>^{}`); only the glob pattern surfaces the
|
|
41
|
-
* peeled row (an exact `refs/tags/<pin>` hides it). We want the commit, since
|
|
42
|
-
* that's what `git checkout <pin>` lands HEAD on and what an image built at the
|
|
43
|
-
* tag is stamped with. Preference: peeled commit → exact tag ref (lightweight
|
|
44
|
-
* tag / branch) → first row. Null when nothing looks like a SHA.
|
|
45
|
-
*/
|
|
46
|
-
export function pickTagCommit(lsRemoteOut, pin) {
|
|
47
|
-
if (!lsRemoteOut)
|
|
48
|
-
return null;
|
|
49
|
-
const rows = lsRemoteOut
|
|
50
|
-
.split("\n")
|
|
51
|
-
.map((l) => l.trim())
|
|
52
|
-
.filter(Boolean)
|
|
53
|
-
.map((l) => {
|
|
54
|
-
const [sha, ref] = l.split(/\s+/);
|
|
55
|
-
return { sha: sha ?? "", ref: ref ?? "" };
|
|
56
|
-
});
|
|
57
|
-
const peeled = rows.find((r) => r.ref === `refs/tags/${pin}^{}`);
|
|
58
|
-
const exact = rows.find((r) => r.ref === `refs/tags/${pin}`);
|
|
59
|
-
const chosen = (peeled ?? exact ?? rows[0])?.sha ?? "";
|
|
60
|
-
return /^[0-9a-f]{7,40}$/i.test(chosen) ? chosen : null;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* The core-version pin for the overlay at `overlayDir`, or `null` to track main.
|
|
64
|
-
* `LASTLIGHT_CORE_VERSION` wins over the file. Missing / unreadable / malformed
|
|
65
|
-
* config.yaml is treated as unpinned (never throws).
|
|
66
|
-
*/
|
|
67
|
-
export function readCorePin(overlayDir) {
|
|
68
|
-
const fromEnv = normalizePin(process.env.LASTLIGHT_CORE_VERSION);
|
|
69
|
-
if (fromEnv)
|
|
70
|
-
return fromEnv;
|
|
71
|
-
try {
|
|
72
|
-
const parsed = parseYaml(readFileSync(join(overlayDir, "config.yaml"), "utf8"));
|
|
73
|
-
if (parsed && typeof parsed === "object") {
|
|
74
|
-
const deploy = parsed.deploy;
|
|
75
|
-
if (deploy && typeof deploy === "object") {
|
|
76
|
-
return normalizePin(deploy.version);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
/* no overlay / no config.yaml / parse error → track main */
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingUR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|
-
export interface OverlayAsset {
|
|
3
|
-
type: OverlayAssetType;
|
|
4
|
-
/** Logical name — workflow/cron/skill name, or the filename for prompts/context. */
|
|
5
|
-
name: string;
|
|
6
|
-
/** True when a same-named built-in exists under `coreRoot` (overlay shadows it);
|
|
7
|
-
* false when the overlay adds something the built-ins don't have. */
|
|
8
|
-
shadowsDefault: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface EnumerateOpts {
|
|
11
|
-
/** Built-in asset tree (the lastlight checkout root). */
|
|
12
|
-
coreRoot?: string;
|
|
13
|
-
/** Overlay asset tree (the instance/ overlay root). */
|
|
14
|
-
overlayRoot?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* List every asset the overlay provides, tagging each as shadowing a built-in or
|
|
18
|
-
* a fresh addition. Returns `[]` when no overlay is configured or present.
|
|
19
|
-
*/
|
|
20
|
-
export declare function enumerateOverlayAssets(opts: EnumerateOpts): OverlayAsset[];
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumerate the assets a deployment overlay overrides or adds.
|
|
3
|
-
*
|
|
4
|
-
* The instance overlay (`$LASTLIGHT_OVERLAY_DIR`, prod `instance/`) can replace
|
|
5
|
-
* or add workflows, prompts, skills, and agent-context files by logical name —
|
|
6
|
-
* the layer-aware resolution lives in `src/workflows/loader.ts`. This module is
|
|
7
|
-
* the read-only inverse: given the built-in (`coreRoot`) and overlay
|
|
8
|
-
* (`overlayRoot`) trees, list every asset the overlay provides and whether it
|
|
9
|
-
* **shadows** a same-named built-in or is a fresh **addition**.
|
|
10
|
-
*
|
|
11
|
-
* It's a pure filesystem walk (no loader caches), so the host-local CLI
|
|
12
|
-
* (`lastlight server status`, `lastlight fork`) and the in-harness admin API
|
|
13
|
-
* (`GET /admin/api/overrides`) can share one source of truth.
|
|
14
|
-
*/
|
|
15
|
-
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
16
|
-
import { join } from "node:path";
|
|
17
|
-
import { parse as parseYaml } from "yaml";
|
|
18
|
-
function isDir(path) {
|
|
19
|
-
try {
|
|
20
|
-
return statSync(path).isDirectory();
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function listFiles(dir, predicate) {
|
|
27
|
-
if (!isDir(dir))
|
|
28
|
-
return [];
|
|
29
|
-
return readdirSync(dir).filter(predicate).sort();
|
|
30
|
-
}
|
|
31
|
-
function listDirs(dir) {
|
|
32
|
-
if (!isDir(dir))
|
|
33
|
-
return [];
|
|
34
|
-
return readdirSync(dir)
|
|
35
|
-
.filter((n) => isDir(join(dir, n)))
|
|
36
|
-
.sort();
|
|
37
|
-
}
|
|
38
|
-
const isYaml = (n) => n.endsWith(".yaml") || n.endsWith(".yml");
|
|
39
|
-
const isMarkdown = (n) => n.endsWith(".md");
|
|
40
|
-
/** Read a workflow YAML's `name`/`kind` without throwing on malformed files. */
|
|
41
|
-
function readWorkflowMeta(filePath) {
|
|
42
|
-
try {
|
|
43
|
-
const raw = parseYaml(readFileSync(filePath, "utf-8"));
|
|
44
|
-
if (!raw || typeof raw.name !== "string")
|
|
45
|
-
return null;
|
|
46
|
-
return { name: raw.name, kind: typeof raw.kind === "string" ? raw.kind : "" };
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Index built-in assets by logical name so overlay entries can be tagged as
|
|
54
|
-
* shadowing vs adding. Workflows/crons are keyed by their YAML `name`; prompts,
|
|
55
|
-
* skills, and agent-context by filename / directory name.
|
|
56
|
-
*/
|
|
57
|
-
function indexBuiltins(coreRoot) {
|
|
58
|
-
const workflows = new Set();
|
|
59
|
-
const crons = new Set();
|
|
60
|
-
const workflowDir = join(coreRoot, "workflows");
|
|
61
|
-
for (const file of listFiles(workflowDir, isYaml)) {
|
|
62
|
-
const meta = readWorkflowMeta(join(workflowDir, file));
|
|
63
|
-
if (!meta)
|
|
64
|
-
continue;
|
|
65
|
-
(meta.kind === "cron" ? crons : workflows).add(meta.name);
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
workflows,
|
|
69
|
-
crons,
|
|
70
|
-
prompts: new Set(listFiles(join(coreRoot, "workflows", "prompts"), isMarkdown)),
|
|
71
|
-
skills: new Set(listDirs(join(coreRoot, "skills"))),
|
|
72
|
-
agentContext: new Set(listFiles(join(coreRoot, "agent-context"), isMarkdown)),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* List every asset the overlay provides, tagging each as shadowing a built-in or
|
|
77
|
-
* a fresh addition. Returns `[]` when no overlay is configured or present.
|
|
78
|
-
*/
|
|
79
|
-
export function enumerateOverlayAssets(opts) {
|
|
80
|
-
const { coreRoot, overlayRoot } = opts;
|
|
81
|
-
if (!overlayRoot || !isDir(overlayRoot))
|
|
82
|
-
return [];
|
|
83
|
-
const builtins = coreRoot && isDir(coreRoot)
|
|
84
|
-
? indexBuiltins(coreRoot)
|
|
85
|
-
: { workflows: new Set(), crons: new Set(), prompts: new Set(), skills: new Set(), agentContext: new Set() };
|
|
86
|
-
const assets = [];
|
|
87
|
-
// Workflows + crons — keyed by YAML `name`, split by `kind`.
|
|
88
|
-
const overlayWorkflowDir = join(overlayRoot, "workflows");
|
|
89
|
-
for (const file of listFiles(overlayWorkflowDir, isYaml)) {
|
|
90
|
-
const meta = readWorkflowMeta(join(overlayWorkflowDir, file));
|
|
91
|
-
if (!meta)
|
|
92
|
-
continue;
|
|
93
|
-
const isCron = meta.kind === "cron";
|
|
94
|
-
assets.push({
|
|
95
|
-
type: isCron ? "cron" : "workflow",
|
|
96
|
-
name: meta.name,
|
|
97
|
-
shadowsDefault: (isCron ? builtins.crons : builtins.workflows).has(meta.name),
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
// Prompts — keyed by filename under workflows/prompts/.
|
|
101
|
-
for (const file of listFiles(join(overlayRoot, "workflows", "prompts"), isMarkdown)) {
|
|
102
|
-
assets.push({ type: "prompt", name: file, shadowsDefault: builtins.prompts.has(file) });
|
|
103
|
-
}
|
|
104
|
-
// Skills — keyed by directory name under skills/.
|
|
105
|
-
for (const dir of listDirs(join(overlayRoot, "skills"))) {
|
|
106
|
-
assets.push({ type: "skill", name: dir, shadowsDefault: builtins.skills.has(dir) });
|
|
107
|
-
}
|
|
108
|
-
// Agent-context — keyed by filename under agent-context/.
|
|
109
|
-
for (const file of listFiles(join(overlayRoot, "agent-context"), isMarkdown)) {
|
|
110
|
-
assets.push({ type: "agent-context", name: file, shadowsDefault: builtins.agentContext.has(file) });
|
|
111
|
-
}
|
|
112
|
-
return assets;
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=overlay-assets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-assets.js","sourceRoot":"","sources":["../../src/config/overlay-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAc,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAoB1C,SAAS,KAAK,CAAC,IAAY;IACzB,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,GAAW,EAAE,SAAoC;IAClE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,QAAQ,CAAC,GAA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C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,0DAA0D;IAC1D,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC;QAC7E,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtG,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** `.gitignore` for the overlay so it can be its own private repo without
|
|
2
|
-
* leaking secrets. Everything under `secrets/` is ignored except the template. */
|
|
3
|
-
export declare const OVERLAY_GITIGNORE: string;
|
|
4
|
-
/** Placeholder `config.yaml` for a fresh overlay (no managed repos yet). */
|
|
5
|
-
export declare const OVERLAY_CONFIG_PLACEHOLDER: string;
|
|
6
|
-
/** Template `secrets/.env.example` — the only tracked file under `secrets/`.
|
|
7
|
-
* Mirrors the keys `npx lastlight setup` writes into `secrets/.env`. */
|
|
8
|
-
export declare const OVERLAY_ENV_EXAMPLE: string;
|
|
9
|
-
/** README dropped into a freshly scaffolded overlay. */
|
|
10
|
-
export declare const OVERLAY_README: string;
|
|
11
|
-
export interface GhStatus {
|
|
12
|
-
/** `gh` is on PATH. */
|
|
13
|
-
installed: boolean;
|
|
14
|
-
/** `gh auth status` succeeded — we can create repos. */
|
|
15
|
-
authed: boolean;
|
|
16
|
-
/** Authenticated GitHub login, when resolvable. */
|
|
17
|
-
login?: string;
|
|
18
|
-
}
|
|
19
|
-
/** Probe the GitHub CLI. Never throws — a missing/unauthed `gh` resolves to a
|
|
20
|
-
* status the callers fall back from (print manual commands instead). */
|
|
21
|
-
export declare function detectGh(): Promise<GhStatus>;
|
|
22
|
-
export interface ScaffoldResult {
|
|
23
|
-
/** Repo-relative paths of files this call created (existing files untouched). */
|
|
24
|
-
created: string[];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Write the default overlay files into `instanceDir`, creating only what's
|
|
28
|
-
* missing — never overwriting an existing file. Returns the relative paths
|
|
29
|
-
* created so callers can report them.
|
|
30
|
-
*/
|
|
31
|
-
export declare function scaffoldOverlayFiles(instanceDir: string): ScaffoldResult;
|
|
32
|
-
export interface BootstrapOpts {
|
|
33
|
-
/** Pre-probed gh status (call {@link detectGh} once and pass it in). */
|
|
34
|
-
gh: GhStatus;
|
|
35
|
-
/** Non-interactive — skip prompts, just print the manual commands. */
|
|
36
|
-
yes?: boolean;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Version `instanceDir` as a private git repo and (optionally) create + push a
|
|
40
|
-
* GitHub repo for it. Idempotent: skips `git init` when already a repo, and
|
|
41
|
-
* skips repo creation when an `origin` remote already exists. Falls back to
|
|
42
|
-
* printing the manual commands whenever `gh` is unavailable or the user declines.
|
|
43
|
-
*/
|
|
44
|
-
export declare function bootstrapOverlayRepo(instanceDir: string, opts: BootstrapOpts): Promise<void>;
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared bootstrap for the private deployment overlay (`instance/`).
|
|
3
|
-
*
|
|
4
|
-
* The overlay is a separate, private folder (typically its own GitHub repo)
|
|
5
|
-
* holding this deployment's `config.yaml` + `secrets/` + optional asset
|
|
6
|
-
* overrides. It's mounted read-only at `/app/instance` and selected via
|
|
7
|
-
* `LASTLIGHT_OVERLAY_DIR`. On a clean server there's nothing to clone yet — so
|
|
8
|
-
* this module can *create* one from scratch:
|
|
9
|
-
*
|
|
10
|
-
* - {@link scaffoldOverlayFiles} — write the default files into a fresh overlay
|
|
11
|
-
* (never overwriting anything that already exists).
|
|
12
|
-
* - {@link detectGh} — probe the GitHub CLI for install + auth status.
|
|
13
|
-
* - {@link bootstrapOverlayRepo} — `git init` + initial commit, then offer to
|
|
14
|
-
* create + push a private GitHub repo (via `gh` when authed, otherwise print
|
|
15
|
-
* the exact git/GitHub commands to run by hand).
|
|
16
|
-
*
|
|
17
|
-
* Used by both setup entry points: the `lastlight setup` wizard (`src/setup.ts`)
|
|
18
|
-
* and host-local `lastlight server setup` (`src/cli-server.ts`).
|
|
19
|
-
*/
|
|
20
|
-
import { execFile, spawn } from "node:child_process";
|
|
21
|
-
import { promisify } from "node:util";
|
|
22
|
-
import fs from "node:fs";
|
|
23
|
-
import path from "node:path";
|
|
24
|
-
import * as p from "@clack/prompts";
|
|
25
|
-
import chalk from "chalk";
|
|
26
|
-
const exec = promisify(execFile);
|
|
27
|
-
const dim = chalk.dim;
|
|
28
|
-
const teal = chalk.hex("#1A7A8A");
|
|
29
|
-
// ── templates ────────────────────────────────────────────────────────────────
|
|
30
|
-
/** `.gitignore` for the overlay so it can be its own private repo without
|
|
31
|
-
* leaking secrets. Everything under `secrets/` is ignored except the template. */
|
|
32
|
-
export const OVERLAY_GITIGNORE = [
|
|
33
|
-
"# Host-only secrets — never commit. Everything under secrets/ is ignored",
|
|
34
|
-
"# except the template.",
|
|
35
|
-
"secrets/*",
|
|
36
|
-
"!secrets/.env.example",
|
|
37
|
-
".env",
|
|
38
|
-
"*.pem",
|
|
39
|
-
"",
|
|
40
|
-
].join("\n");
|
|
41
|
-
/** Placeholder `config.yaml` for a fresh overlay (no managed repos yet). */
|
|
42
|
-
export const OVERLAY_CONFIG_PLACEHOLDER = [
|
|
43
|
-
"# Last Light — private deployment overlay config",
|
|
44
|
-
"# Merged over the public config/default.yaml at startup; arrays replace,",
|
|
45
|
-
"# maps deep-merge, env vars override. Restart the agent to apply:",
|
|
46
|
-
"# docker compose restart agent (or: lastlight server restart agent)",
|
|
47
|
-
"",
|
|
48
|
-
"managedRepos:",
|
|
49
|
-
" [] # add owner/repo entries — the bot ignores repos not listed here",
|
|
50
|
-
"",
|
|
51
|
-
"# Pin which core version this instance runs. `lastlight server update|setup`",
|
|
52
|
-
"# checks core out at this git tag/ref and rebuilds; unset (or main/latest)",
|
|
53
|
-
"# tracks main. Bump + commit here to drive deploys from the overlay.",
|
|
54
|
-
"# deploy:",
|
|
55
|
-
"# version: v0.10.6",
|
|
56
|
-
"",
|
|
57
|
-
].join("\n");
|
|
58
|
-
/** Template `secrets/.env.example` — the only tracked file under `secrets/`.
|
|
59
|
-
* Mirrors the keys `npx lastlight setup` writes into `secrets/.env`. */
|
|
60
|
-
export const OVERLAY_ENV_EXAMPLE = [
|
|
61
|
-
"# ── Last Light — environment template ───────────────────────────",
|
|
62
|
-
"# Copy to secrets/.env and fill in. The whole instance/ folder is mounted",
|
|
63
|
-
"# read-only at /app/instance; the entrypoint reads secrets from",
|
|
64
|
-
"# /app/instance/secrets. secrets/.env and *.pem are gitignored.",
|
|
65
|
-
"",
|
|
66
|
-
"# ── Overlay (this deployment's private config + assets) ──",
|
|
67
|
-
"LASTLIGHT_OVERLAY_DIR=/app/instance",
|
|
68
|
-
"",
|
|
69
|
-
"# ── GitHub App (required) ────────────────────────────────",
|
|
70
|
-
"GITHUB_APP_ID=",
|
|
71
|
-
"# PEM lives at instance/secrets/app.pem; the entrypoint symlinks it to /app/app.pem.",
|
|
72
|
-
"GITHUB_APP_PRIVATE_KEY_PATH=./app.pem",
|
|
73
|
-
"GITHUB_APP_INSTALLATION_ID=",
|
|
74
|
-
"",
|
|
75
|
-
"# ── Webhook (required) — must match the GitHub App webhook secret ──",
|
|
76
|
-
"WEBHOOK_SECRET=",
|
|
77
|
-
"",
|
|
78
|
-
"# ── Domain (used by Caddy for TLS) ───────────────────────",
|
|
79
|
-
"DOMAIN=localhost",
|
|
80
|
-
"",
|
|
81
|
-
"# ── Model + provider API key ─────────────────────────────",
|
|
82
|
-
"LASTLIGHT_MODEL=anthropic/claude-sonnet-4-6",
|
|
83
|
-
"# Set the env var that matches your LASTLIGHT_MODEL's provider.",
|
|
84
|
-
"# The wizard-able registry (src/providers.ts): anthropic, openai, openrouter,",
|
|
85
|
-
"# google (GEMINI_API_KEY), mistral, groq, cerebras, xai, huggingface (HF_TOKEN),",
|
|
86
|
-
"# moonshotai, nvidia, fireworks, together, deepseek, zai, kimi-coding, minimax.",
|
|
87
|
-
"# ANTHROPIC_API_KEY=",
|
|
88
|
-
"# OPENAI_API_KEY=",
|
|
89
|
-
"# OPENROUTER_API_KEY=",
|
|
90
|
-
"",
|
|
91
|
-
"# ── Admin dashboard ──────────────────────────────────────",
|
|
92
|
-
"ADMIN_SECRET=",
|
|
93
|
-
"# ADMIN_PASSWORD=",
|
|
94
|
-
"",
|
|
95
|
-
"# ── Slack (optional) ─────────────────────────────────────",
|
|
96
|
-
"# SLACK_BOT_TOKEN=",
|
|
97
|
-
"# SLACK_APP_TOKEN=",
|
|
98
|
-
"# SLACK_DELIVERY_CHANNEL=",
|
|
99
|
-
"# SLACK_ALLOWED_USERS=",
|
|
100
|
-
"",
|
|
101
|
-
].join("\n");
|
|
102
|
-
/** README dropped into a freshly scaffolded overlay. */
|
|
103
|
-
export const OVERLAY_README = [
|
|
104
|
-
"# lastlight-instance",
|
|
105
|
-
"",
|
|
106
|
-
"Private deployment overlay for [Last Light](https://github.com/nearform/lastlight).",
|
|
107
|
-
"Keeps deployment-specific config and secrets out of the public repo.",
|
|
108
|
-
"",
|
|
109
|
-
"Cloned into `instance/` next to the lastlight checkout's `docker-compose.yml`,",
|
|
110
|
-
"mounted read-only at `/app/instance`, selected via `LASTLIGHT_OVERLAY_DIR=/app/instance`.",
|
|
111
|
-
"",
|
|
112
|
-
"## Layout",
|
|
113
|
-
"",
|
|
114
|
-
"```",
|
|
115
|
-
"config.yaml # overlay config — merged over public config/default.yaml",
|
|
116
|
-
"agent-context/*.md # (optional) persona/rules overrides, merged by filename",
|
|
117
|
-
"workflows/*.yaml # (optional) add or replace workflows by logical name",
|
|
118
|
-
"workflows/prompts/*.md # (optional) prompt overrides",
|
|
119
|
-
"skills/<name>/SKILL.md # (optional) skill overrides",
|
|
120
|
-
"secrets/ # host-only, gitignored: .env + GitHub App *.pem",
|
|
121
|
-
" .env.example # template (the only tracked file under secrets/)",
|
|
122
|
-
"```",
|
|
123
|
-
"",
|
|
124
|
-
"## First-time secrets",
|
|
125
|
-
"",
|
|
126
|
-
"```bash",
|
|
127
|
-
"cp secrets/.env.example secrets/.env # then fill in keys, DOMAIN, etc.",
|
|
128
|
-
"cp /path/to/app.pem secrets/app.pem # GitHub App private key",
|
|
129
|
-
"```",
|
|
130
|
-
"",
|
|
131
|
-
"Editing the overlay is **restart-only** (no image rebuild):",
|
|
132
|
-
"`git pull` then `lastlight server restart agent`.",
|
|
133
|
-
"",
|
|
134
|
-
"## Pinning the core version",
|
|
135
|
-
"",
|
|
136
|
-
"Add a `deploy.version` to `config.yaml` to pin which core release this",
|
|
137
|
-
"instance runs (a git tag/ref); unset — or `main`/`latest` — tracks `main`:",
|
|
138
|
-
"",
|
|
139
|
-
"```yaml",
|
|
140
|
-
"deploy:",
|
|
141
|
-
" version: v0.10.6",
|
|
142
|
-
"```",
|
|
143
|
-
"",
|
|
144
|
-
"`lastlight server update` (and `server setup`) checks core out at that tag and",
|
|
145
|
-
"rebuilds. Bump + commit here and run `lastlight server update` on the host —",
|
|
146
|
-
"so this overlay repo is the single source of truth for the deployed version.",
|
|
147
|
-
"",
|
|
148
|
-
].join("\n");
|
|
149
|
-
/** Probe the GitHub CLI. Never throws — a missing/unauthed `gh` resolves to a
|
|
150
|
-
* status the callers fall back from (print manual commands instead). */
|
|
151
|
-
export async function detectGh() {
|
|
152
|
-
try {
|
|
153
|
-
await exec("gh", ["--version"], { timeout: 10_000 });
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
return { installed: false, authed: false };
|
|
157
|
-
}
|
|
158
|
-
let authed = false;
|
|
159
|
-
try {
|
|
160
|
-
await exec("gh", ["auth", "status"], { timeout: 10_000 });
|
|
161
|
-
authed = true;
|
|
162
|
-
}
|
|
163
|
-
catch {
|
|
164
|
-
return { installed: true, authed: false };
|
|
165
|
-
}
|
|
166
|
-
let login;
|
|
167
|
-
try {
|
|
168
|
-
const { stdout } = await exec("gh", ["api", "user", "--jq", ".login"], { timeout: 10_000 });
|
|
169
|
-
login = stdout.trim() || undefined;
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
/* authed but couldn't read login — leave undefined */
|
|
173
|
-
}
|
|
174
|
-
return { installed: true, authed, login };
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Write the default overlay files into `instanceDir`, creating only what's
|
|
178
|
-
* missing — never overwriting an existing file. Returns the relative paths
|
|
179
|
-
* created so callers can report them.
|
|
180
|
-
*/
|
|
181
|
-
export function scaffoldOverlayFiles(instanceDir) {
|
|
182
|
-
const created = [];
|
|
183
|
-
const secretsDir = path.join(instanceDir, "secrets");
|
|
184
|
-
fs.mkdirSync(secretsDir, { recursive: true });
|
|
185
|
-
const writeIfMissing = (rel, content) => {
|
|
186
|
-
const abs = path.join(instanceDir, rel);
|
|
187
|
-
if (fs.existsSync(abs))
|
|
188
|
-
return;
|
|
189
|
-
fs.writeFileSync(abs, content, { encoding: "utf8" });
|
|
190
|
-
created.push(rel);
|
|
191
|
-
};
|
|
192
|
-
writeIfMissing("config.yaml", OVERLAY_CONFIG_PLACEHOLDER);
|
|
193
|
-
writeIfMissing(".gitignore", OVERLAY_GITIGNORE);
|
|
194
|
-
writeIfMissing("README.md", OVERLAY_README);
|
|
195
|
-
writeIfMissing(path.join("secrets", ".env.example"), OVERLAY_ENV_EXAMPLE);
|
|
196
|
-
return { created };
|
|
197
|
-
}
|
|
198
|
-
/** Run a command with inherited stdio so the user sees native git/gh output. */
|
|
199
|
-
function run(label, cmd, args, cwd) {
|
|
200
|
-
p.log.step(chalk.bold(label));
|
|
201
|
-
console.log(dim(` $ ${cmd} ${args.join(" ")}`));
|
|
202
|
-
return new Promise((resolve, reject) => {
|
|
203
|
-
const child = spawn(cmd, args, { stdio: "inherit", cwd });
|
|
204
|
-
child.on("error", reject);
|
|
205
|
-
child.on("exit", (code) => code === 0 ? resolve() : reject(new Error(`${label} failed (exit ${code ?? "signal"})`)));
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
async function gitCaptureSoft(args, cwd) {
|
|
209
|
-
try {
|
|
210
|
-
const { stdout } = await exec("git", args, { cwd, timeout: 20_000 });
|
|
211
|
-
return stdout.trim();
|
|
212
|
-
}
|
|
213
|
-
catch {
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function isGitRepo(dir) {
|
|
218
|
-
return fs.existsSync(path.join(dir, ".git"));
|
|
219
|
-
}
|
|
220
|
-
/** Print the exact commands to version + publish the overlay by hand. */
|
|
221
|
-
function printManualHint(instanceDir, gh, needsInit) {
|
|
222
|
-
const slug = gh.login ? `${gh.login}/lastlight-instance` : "<owner>/lastlight-instance";
|
|
223
|
-
const lines = ["To version + publish this overlay yourself:"];
|
|
224
|
-
if (needsInit) {
|
|
225
|
-
lines.push(` git -C ${instanceDir} init -b main`, ` git -C ${instanceDir} add -A`, ` git -C ${instanceDir} commit -m "Initial Last Light overlay"`);
|
|
226
|
-
}
|
|
227
|
-
if (gh.installed) {
|
|
228
|
-
lines.push(` gh repo create ${slug} --private --source ${instanceDir} --remote origin --push`);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
lines.push(` # create a PRIVATE repo on GitHub (e.g. ${slug}), then:`, ` git -C ${instanceDir} remote add origin git@github.com:${slug}.git`, ` git -C ${instanceDir} push -u origin main`);
|
|
232
|
-
}
|
|
233
|
-
p.log.info(lines.map((l, i) => (i === 0 ? l : dim(l))).join("\n "));
|
|
234
|
-
p.log.info(dim("Secrets (secrets/.env, *.pem) stay gitignored. To match the prod deploy-key style,") +
|
|
235
|
-
"\n " +
|
|
236
|
-
dim("clone via an SSH host alias, e.g. git@github-instance:<owner>/lastlight-instance.git."));
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Version `instanceDir` as a private git repo and (optionally) create + push a
|
|
240
|
-
* GitHub repo for it. Idempotent: skips `git init` when already a repo, and
|
|
241
|
-
* skips repo creation when an `origin` remote already exists. Falls back to
|
|
242
|
-
* printing the manual commands whenever `gh` is unavailable or the user declines.
|
|
243
|
-
*/
|
|
244
|
-
export async function bootstrapOverlayRepo(instanceDir, opts) {
|
|
245
|
-
let versioned = isGitRepo(instanceDir);
|
|
246
|
-
if (!versioned) {
|
|
247
|
-
if (opts.yes) {
|
|
248
|
-
printManualHint(instanceDir, opts.gh, true);
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const want = await p.confirm({
|
|
252
|
-
message: "Version instance/ as a private git repo now?",
|
|
253
|
-
initialValue: true,
|
|
254
|
-
});
|
|
255
|
-
if (p.isCancel(want) || !want) {
|
|
256
|
-
printManualHint(instanceDir, opts.gh, true);
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
try {
|
|
260
|
-
await run("git init", "git", ["init", "-b", "main", instanceDir]);
|
|
261
|
-
await run("Stage overlay files", "git", ["-C", instanceDir, "add", "-A"]);
|
|
262
|
-
await run("Initial commit", "git", ["-C", instanceDir, "commit", "-m", "Initial Last Light overlay"]);
|
|
263
|
-
versioned = true;
|
|
264
|
-
}
|
|
265
|
-
catch (err) {
|
|
266
|
-
p.log.warn(`Couldn't auto-create the git repo: ${err.message}\n` +
|
|
267
|
-
" (Is git's user.name / user.email configured?)");
|
|
268
|
-
printManualHint(instanceDir, opts.gh, !versioned);
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
// Already (or now) a repo — does it already point somewhere?
|
|
273
|
-
const remotes = await gitCaptureSoft(["remote"], instanceDir);
|
|
274
|
-
if (remotes && remotes.split(/\s+/).includes("origin")) {
|
|
275
|
-
p.log.info("Overlay already has an 'origin' remote — leaving it as-is.");
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (opts.gh.authed && !opts.yes) {
|
|
279
|
-
const want = await p.confirm({
|
|
280
|
-
message: "Create a private GitHub repo and push the overlay now?",
|
|
281
|
-
initialValue: true,
|
|
282
|
-
});
|
|
283
|
-
if (!p.isCancel(want) && want) {
|
|
284
|
-
const def = opts.gh.login ? `${opts.gh.login}/lastlight-instance` : "lastlight-instance";
|
|
285
|
-
const slug = await p.text({ message: "Repository (owner/name)", initialValue: def });
|
|
286
|
-
if (!p.isCancel(slug) && slug.trim()) {
|
|
287
|
-
try {
|
|
288
|
-
await run("Create + push private repo", "gh", [
|
|
289
|
-
"repo", "create", slug.trim(),
|
|
290
|
-
"--private", "--source", instanceDir, "--remote", "origin", "--push",
|
|
291
|
-
]);
|
|
292
|
-
p.log.success(`Pushed overlay to ${teal(slug.trim())} ${dim("(private)")}.`);
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
catch (err) {
|
|
296
|
-
p.log.warn(`gh repo create failed: ${err.message}`);
|
|
297
|
-
// fall through to the manual hint
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
printManualHint(instanceDir, opts.gh, false);
|
|
303
|
-
}
|
|
304
|
-
//# sourceMappingURL=overlay-bootstrap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-bootstrap.js","sourceRoot":"","sources":["../../src/config/overlay-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AACjC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,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AAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;oBAC7E,OAAO;gBACT,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,0BAA2B,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;oBAC/D,kCAAkC;gBACpC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,eAAe,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import { Hono } from "hono";
|
|
3
|
-
import type { Connector } from "./types.js";
|
|
4
|
-
export interface GitHubWebhookConfig {
|
|
5
|
-
/**
|
|
6
|
-
* Port the harness HTTP server listens on. Retained for compatibility with
|
|
7
|
-
* existing callers/tests; the connector no longer opens the listener itself
|
|
8
|
-
* — `main()` owns the shared Hono app + `serve()` lifecycle now.
|
|
9
|
-
*/
|
|
10
|
-
port: number;
|
|
11
|
-
webhookSecret: string;
|
|
12
|
-
/** Bot login name to ignore self-events */
|
|
13
|
-
botLogin: string;
|
|
14
|
-
/**
|
|
15
|
-
* Shared Hono app to register `/webhooks/github` onto. When omitted, the
|
|
16
|
-
* connector creates its own app (used by unit tests that drive it via
|
|
17
|
-
* `honoApp.request(...)` standalone).
|
|
18
|
-
*/
|
|
19
|
-
app?: Hono;
|
|
20
|
-
/** GitHub App MCP client for posting replies */
|
|
21
|
-
replyFn?: (owner: string, repo: string, issueNumber: number, body: string) => Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
export declare class GitHubWebhookConnector extends EventEmitter implements Connector {
|
|
24
|
-
readonly name = "github";
|
|
25
|
-
private app;
|
|
26
|
-
private config;
|
|
27
|
-
constructor(config: GitHubWebhookConfig);
|
|
28
|
-
/**
|
|
29
|
-
* Expose the Hono app so the main server can mount additional routes
|
|
30
|
-
* (e.g., /api/run for the CLI trigger).
|
|
31
|
-
*/
|
|
32
|
-
get honoApp(): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
33
|
-
private setupRoutes;
|
|
34
|
-
/**
|
|
35
|
-
* Apply an `installation` / `installation_repositories` event to the in-memory
|
|
36
|
-
* managed-repo list (src/managed-repos.ts). We apply the payload diff directly
|
|
37
|
-
* — the events carry the affected repos' `full_name`, so no API round-trip is
|
|
38
|
-
* needed. The list is seeded at boot; these keep it current between restarts.
|
|
39
|
-
*/
|
|
40
|
-
private handleInstallationEvent;
|
|
41
|
-
private verifySignature;
|
|
42
|
-
private normalize;
|
|
43
|
-
start(): Promise<void>;
|
|
44
|
-
stop(): Promise<void>;
|
|
45
|
-
}
|