project-logbook 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/commands/build.js +7 -4
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/log.js +2 -0
- package/dist/commands/log.js.map +1 -1
- package/dist/commands/new-helpers.d.ts +0 -1
- package/dist/commands/new-helpers.js +6 -3
- package/dist/commands/new-helpers.js.map +1 -1
- package/dist/commands/release.js +2 -0
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/start.js +90 -21
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.js +3 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/watch.d.ts +15 -0
- package/dist/commands/watch.js +153 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/autolink.d.ts +5 -0
- package/dist/lib/autolink.js +36 -2
- package/dist/lib/autolink.js.map +1 -1
- package/dist/lib/build-helpers.d.ts +10 -1
- package/dist/lib/build-helpers.js +27 -4
- package/dist/lib/build-helpers.js.map +1 -1
- package/dist/lib/build-steps.js +2 -1
- package/dist/lib/build-steps.js.map +1 -1
- package/dist/lib/config.d.ts +8 -0
- package/dist/lib/config.js +7 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/custom-card-renderer.js +2 -1
- package/dist/lib/custom-card-renderer.js.map +1 -1
- package/dist/lib/entry-href.d.ts +7 -0
- package/dist/lib/entry-href.js +8 -0
- package/dist/lib/entry-href.js.map +1 -0
- package/dist/lib/markdown-processors.d.ts +2 -1
- package/dist/lib/post-template.js +3 -3
- package/dist/lib/post-template.js.map +1 -1
- package/dist/lib/template-helpers.js +3 -2
- package/dist/lib/template-helpers.js.map +1 -1
- package/dist/lib/template-types.d.ts +2 -0
- package/dist/lib/templates.js +5 -3
- package/dist/lib/templates.js.map +1 -1
- package/dist/linters/jira-prefix.js +32 -16
- package/dist/linters/jira-prefix.js.map +1 -1
- package/dist/templates/about-watch.md +29 -0
- package/dist/templates/hub.css +677 -0
- package/dist/templates/hub.js +628 -0
- package/dist/utils/id.d.ts +1 -1
- package/dist/utils/id.js +4 -1
- package/dist/utils/id.js.map +1 -1
- package/dist/watch/collector.d.ts +14 -0
- package/dist/watch/collector.js +33 -0
- package/dist/watch/collector.js.map +1 -0
- package/dist/watch/collectors/acli.d.ts +15 -0
- package/dist/watch/collectors/acli.js +197 -0
- package/dist/watch/collectors/acli.js.map +1 -0
- package/dist/watch/collectors/entries.d.ts +9 -0
- package/dist/watch/collectors/entries.js +90 -0
- package/dist/watch/collectors/entries.js.map +1 -0
- package/dist/watch/collectors/git.d.ts +12 -0
- package/dist/watch/collectors/git.js +58 -0
- package/dist/watch/collectors/git.js.map +1 -0
- package/dist/watch/collectors/glab.d.ts +10 -0
- package/dist/watch/collectors/glab.js +184 -0
- package/dist/watch/collectors/glab.js.map +1 -0
- package/dist/watch/collectors/index.d.ts +10 -0
- package/dist/watch/collectors/index.js +21 -0
- package/dist/watch/collectors/index.js.map +1 -0
- package/dist/watch/collectors/jira.d.ts +3 -0
- package/dist/watch/collectors/jira.js +110 -0
- package/dist/watch/collectors/jira.js.map +1 -0
- package/dist/watch/collectors/type-guards.d.ts +17 -0
- package/dist/watch/collectors/type-guards.js +35 -0
- package/dist/watch/collectors/type-guards.js.map +1 -0
- package/dist/watch/collectors/types.d.ts +37 -0
- package/dist/watch/collectors/types.js +9 -0
- package/dist/watch/collectors/types.js.map +1 -0
- package/dist/watch/dashboard-html.d.ts +11 -0
- package/dist/watch/dashboard-html.js +73 -0
- package/dist/watch/dashboard-html.js.map +1 -0
- package/dist/watch/dashboard-script.d.ts +12 -0
- package/dist/watch/dashboard-script.js +20 -0
- package/dist/watch/dashboard-script.js.map +1 -0
- package/dist/watch/dashboard-styles.d.ts +12 -0
- package/dist/watch/dashboard-styles.js +20 -0
- package/dist/watch/dashboard-styles.js.map +1 -0
- package/dist/watch/dashboard.d.ts +12 -0
- package/dist/watch/dashboard.js +50 -0
- package/dist/watch/dashboard.js.map +1 -0
- package/dist/watch/git-utils.d.ts +30 -0
- package/dist/watch/git-utils.js +101 -0
- package/dist/watch/git-utils.js.map +1 -0
- package/dist/watch/hub-state.d.ts +37 -0
- package/dist/watch/hub-state.js +55 -0
- package/dist/watch/hub-state.js.map +1 -0
- package/dist/watch/hub.d.ts +2 -0
- package/dist/watch/hub.js +219 -0
- package/dist/watch/hub.js.map +1 -0
- package/dist/watch/log-utils.d.ts +13 -0
- package/dist/watch/log-utils.js +24 -0
- package/dist/watch/log-utils.js.map +1 -0
- package/dist/watch/notify.d.ts +18 -0
- package/dist/watch/notify.js +45 -0
- package/dist/watch/notify.js.map +1 -0
- package/dist/watch/state.d.ts +34 -0
- package/dist/watch/state.js +36 -0
- package/dist/watch/state.js.map +1 -0
- package/dist/watch/strategies/behind-default.d.ts +5 -0
- package/dist/watch/strategies/behind-default.js +21 -0
- package/dist/watch/strategies/behind-default.js.map +1 -0
- package/dist/watch/strategies/idle.d.ts +5 -0
- package/dist/watch/strategies/idle.js +21 -0
- package/dist/watch/strategies/idle.js.map +1 -0
- package/dist/watch/strategies/in-progress.d.ts +5 -0
- package/dist/watch/strategies/in-progress.js +21 -0
- package/dist/watch/strategies/in-progress.js.map +1 -0
- package/dist/watch/strategies/index.d.ts +34 -0
- package/dist/watch/strategies/index.js +148 -0
- package/dist/watch/strategies/index.js.map +1 -0
- package/dist/watch/strategies/jira-not-in-review.d.ts +2 -0
- package/dist/watch/strategies/jira-not-in-review.js +29 -0
- package/dist/watch/strategies/jira-not-in-review.js.map +1 -0
- package/dist/watch/strategies/jira-still-open.d.ts +2 -0
- package/dist/watch/strategies/jira-still-open.js +31 -0
- package/dist/watch/strategies/jira-still-open.js.map +1 -0
- package/dist/watch/strategies/mr-approval-optional.d.ts +5 -0
- package/dist/watch/strategies/mr-approval-optional.js +21 -0
- package/dist/watch/strategies/mr-approval-optional.js.map +1 -0
- package/dist/watch/strategies/mr-approved.d.ts +5 -0
- package/dist/watch/strategies/mr-approved.js +21 -0
- package/dist/watch/strategies/mr-approved.js.map +1 -0
- package/dist/watch/strategies/mr-conflicts.d.ts +5 -0
- package/dist/watch/strategies/mr-conflicts.js +21 -0
- package/dist/watch/strategies/mr-conflicts.js.map +1 -0
- package/dist/watch/strategies/mr-draft.d.ts +5 -0
- package/dist/watch/strategies/mr-draft.js +21 -0
- package/dist/watch/strategies/mr-draft.js.map +1 -0
- package/dist/watch/strategies/mr-open-comments.d.ts +5 -0
- package/dist/watch/strategies/mr-open-comments.js +21 -0
- package/dist/watch/strategies/mr-open-comments.js.map +1 -0
- package/dist/watch/strategies/narrative-missing.d.ts +5 -0
- package/dist/watch/strategies/narrative-missing.js +21 -0
- package/dist/watch/strategies/narrative-missing.js.map +1 -0
- package/dist/watch/strategies/no-mr.d.ts +5 -0
- package/dist/watch/strategies/no-mr.js +21 -0
- package/dist/watch/strategies/no-mr.js.map +1 -0
- package/dist/watch/strategies/pipeline-failed.d.ts +5 -0
- package/dist/watch/strategies/pipeline-failed.js +21 -0
- package/dist/watch/strategies/pipeline-failed.js.map +1 -0
- package/dist/watch/strategies/pipeline-running.d.ts +5 -0
- package/dist/watch/strategies/pipeline-running.js +21 -0
- package/dist/watch/strategies/pipeline-running.js.map +1 -0
- package/dist/watch/strategies/ready-for-release.d.ts +7 -0
- package/dist/watch/strategies/ready-for-release.js +35 -0
- package/dist/watch/strategies/ready-for-release.js.map +1 -0
- package/dist/watch/strategies/ready-to-commit.d.ts +5 -0
- package/dist/watch/strategies/ready-to-commit.js +21 -0
- package/dist/watch/strategies/ready-to-commit.js.map +1 -0
- package/dist/watch/strategies/ready-to-push.d.ts +5 -0
- package/dist/watch/strategies/ready-to-push.js +21 -0
- package/dist/watch/strategies/ready-to-push.js.map +1 -0
- package/dist/watch/strategies/released.d.ts +6 -0
- package/dist/watch/strategies/released.js +21 -0
- package/dist/watch/strategies/released.js.map +1 -0
- package/dist/watch/strategies/squash-merged.d.ts +6 -0
- package/dist/watch/strategies/squash-merged.js +21 -0
- package/dist/watch/strategies/squash-merged.js.map +1 -0
- package/dist/watch/strategies/types.d.ts +31 -0
- package/dist/watch/strategies/types.js +12 -0
- package/dist/watch/strategies/types.js.map +1 -0
- package/dist/watch/strategies/unstaged-changes.d.ts +5 -0
- package/dist/watch/strategies/unstaged-changes.js +21 -0
- package/dist/watch/strategies/unstaged-changes.js.map +1 -0
- package/dist/watch/strategies/wrong-branch.d.ts +6 -0
- package/dist/watch/strategies/wrong-branch.js +26 -0
- package/dist/watch/strategies/wrong-branch.js.map +1 -0
- package/dist/watch/types.d.ts +190 -0
- package/dist/watch/types.js +25 -0
- package/dist/watch/types.js.map +1 -0
- package/dist/watch/watcher-fs.d.ts +39 -0
- package/dist/watch/watcher-fs.js +105 -0
- package/dist/watch/watcher-fs.js.map +1 -0
- package/dist/watch/watcher-http.d.ts +19 -0
- package/dist/watch/watcher-http.js +47 -0
- package/dist/watch/watcher-http.js.map +1 -0
- package/dist/watch/watcher.d.ts +4 -0
- package/dist/watch/watcher.js +174 -0
- package/dist/watch/watcher.js.map +1 -0
- package/package.json +2 -1
- package/src/templates/about-watch.md +29 -0
- package/src/templates/hub.css +677 -0
- package/src/templates/hub.js +628 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ready to Commit — there are staged changes waiting to be committed.
|
|
3
|
+
*/
|
|
4
|
+
export const readyToCommitCheck = {
|
|
5
|
+
id: 'ready-to-commit',
|
|
6
|
+
source: 'Git',
|
|
7
|
+
description: 'There are staged changes ready to be committed.',
|
|
8
|
+
blockedBy: ['squash-merged', 'released'],
|
|
9
|
+
check(metrics) {
|
|
10
|
+
if (metrics.stagedFiles > 0) {
|
|
11
|
+
return {
|
|
12
|
+
id: 'ready-to-commit',
|
|
13
|
+
label: 'Ready to Commit',
|
|
14
|
+
severity: 'warning',
|
|
15
|
+
detail: `${metrics.stagedFiles} file${metrics.stagedFiles !== 1 ? 's' : ''} staged`,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=ready-to-commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ready-to-commit.js","sourceRoot":"","sources":["../../../src/watch/strategies/ready-to-commit.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,EAAE,EAAE,iBAAiB;IACrB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,iDAAiD;IAC9D,SAAS,EAAE,CAAC,eAAe,EAAE,UAAU,CAAC;IACxC,KAAK,CAAC,OAAO;QACX,IAAI,OAAO,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACL,EAAE,EAAE,iBAAiB;gBACrB,KAAK,EAAE,iBAAiB;gBACxB,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,QAAQ,OAAO,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS;aACpF,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ready to Push — local commits are ahead of the remote.
|
|
3
|
+
*/
|
|
4
|
+
export const readyToPushCheck = {
|
|
5
|
+
id: 'ready-to-push',
|
|
6
|
+
source: 'Git',
|
|
7
|
+
description: 'Local commits are ahead of the remote tracking branch.',
|
|
8
|
+
blockedBy: ['squash-merged', 'released'],
|
|
9
|
+
check(metrics) {
|
|
10
|
+
if (metrics.isAheadOfRemote) {
|
|
11
|
+
return {
|
|
12
|
+
id: 'ready-to-push',
|
|
13
|
+
label: 'Ready to Push',
|
|
14
|
+
severity: 'warning',
|
|
15
|
+
detail: 'Commits are ahead of remote.',
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=ready-to-push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ready-to-push.js","sourceRoot":"","sources":["../../../src/watch/strategies/ready-to-push.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC9C,EAAE,EAAE,eAAe;IACnB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,wDAAwD;IACrE,SAAS,EAAE,CAAC,eAAe,EAAE,UAAU,CAAC;IACxC,KAAK,CAAC,OAAO;QACX,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;YAC5B,OAAO;gBACL,EAAE,EAAE,eAAe;gBACnB,KAAK,EAAE,eAAe;gBACtB,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,8BAA8B;aACvC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Released — the active ticket has a dateEnd set (was released).
|
|
3
|
+
* When true, no other actionable strategies should show.
|
|
4
|
+
*/
|
|
5
|
+
export const releasedCheck = {
|
|
6
|
+
id: 'released',
|
|
7
|
+
source: 'LOGBOOK',
|
|
8
|
+
description: 'The active ticket has a dateEnd set, meaning it has been released.',
|
|
9
|
+
check(metrics) {
|
|
10
|
+
if (metrics.isReleased && !metrics.isDirty) {
|
|
11
|
+
return {
|
|
12
|
+
id: 'released',
|
|
13
|
+
label: 'Released',
|
|
14
|
+
severity: 'success',
|
|
15
|
+
detail: 'Ticket has been released.',
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=released.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"released.js","sourceRoot":"","sources":["../../../src/watch/strategies/released.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,EAAE,EAAE,UAAU;IACd,MAAM,EAAE,SAAS;IACjB,WAAW,EAAE,oEAAoE;IACjF,KAAK,CAAC,OAAO;QACX,IAAI,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3C,OAAO;gBACL,EAAE,EAAE,UAAU;gBACd,KAAK,EAAE,UAAU;gBACjB,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,2BAA2B;aACpC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Squash Merged — all branch commits are already on the default branch.
|
|
3
|
+
* When true, no other actionable strategies should show.
|
|
4
|
+
*/
|
|
5
|
+
export const squashMergedCheck = {
|
|
6
|
+
id: 'squash-merged',
|
|
7
|
+
source: 'Git',
|
|
8
|
+
description: 'All commits on this branch are already on the default branch (squash-merged).',
|
|
9
|
+
check(metrics) {
|
|
10
|
+
if (metrics.isSquashMerged && !metrics.isDirty) {
|
|
11
|
+
return {
|
|
12
|
+
id: 'squash-merged',
|
|
13
|
+
label: 'Squash Merged',
|
|
14
|
+
severity: 'success',
|
|
15
|
+
detail: 'Branch commits are already on the default branch.',
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=squash-merged.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"squash-merged.js","sourceRoot":"","sources":["../../../src/watch/strategies/squash-merged.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAmB;IAC/C,EAAE,EAAE,eAAe;IACnB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,+EAA+E;IAC5F,KAAK,CAAC,OAAO;QACX,IAAI,OAAO,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC/C,OAAO;gBACL,EAAE,EAAE,eAAe;gBACnB,KAAK,EAAE,eAAe;gBACtB,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,mDAAmD;aAC5D,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy interface for logbook watch status evaluations.
|
|
3
|
+
*
|
|
4
|
+
* A strategy inspects WatcherMetrics and returns a StatusResult when its
|
|
5
|
+
* condition is met, or null when the condition is not applicable.
|
|
6
|
+
*
|
|
7
|
+
* Strategies can declare a `blockedBy` list: if any ID in that list is
|
|
8
|
+
* already present in the results, this strategy is suppressed (not evaluated).
|
|
9
|
+
* This prevents redundant or contradictory badges from appearing together.
|
|
10
|
+
*/
|
|
11
|
+
import type { StatusResult, WatcherMetrics } from '../types.js';
|
|
12
|
+
/** The origin source of a strategy (shown in the Help tab). */
|
|
13
|
+
export type StrategySource = 'LOGBOOK' | 'Git' | 'GitLab' | 'Jira';
|
|
14
|
+
/** A single status strategy. */
|
|
15
|
+
export interface StatusStrategy {
|
|
16
|
+
/** Human-readable ID used for blockedBy references. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** The source tool this strategy belongs to (for Help tab metadata). */
|
|
19
|
+
source?: StrategySource;
|
|
20
|
+
/** Human-readable description (for Help tab). */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** List of strategy IDs that block this one. */
|
|
23
|
+
blockedBy?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Evaluate the strategy against the current metrics.
|
|
26
|
+
*
|
|
27
|
+
* @param metrics - The collected watcher metrics.
|
|
28
|
+
* @returns A status result when this strategy's condition is met, null otherwise.
|
|
29
|
+
*/
|
|
30
|
+
check(metrics: WatcherMetrics): StatusResult | null;
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy interface for logbook watch status evaluations.
|
|
3
|
+
*
|
|
4
|
+
* A strategy inspects WatcherMetrics and returns a StatusResult when its
|
|
5
|
+
* condition is met, or null when the condition is not applicable.
|
|
6
|
+
*
|
|
7
|
+
* Strategies can declare a `blockedBy` list: if any ID in that list is
|
|
8
|
+
* already present in the results, this strategy is suppressed (not evaluated).
|
|
9
|
+
* This prevents redundant or contradictory badges from appearing together.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/watch/strategies/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unstaged Changes — there are files with unstaged modifications.
|
|
3
|
+
*/
|
|
4
|
+
export const unstagedChangesCheck = {
|
|
5
|
+
id: 'unstaged-changes',
|
|
6
|
+
source: 'Git',
|
|
7
|
+
description: 'There are unstaged changes in the working tree.',
|
|
8
|
+
blockedBy: ['squash-merged', 'released'],
|
|
9
|
+
check(metrics) {
|
|
10
|
+
if (metrics.unstagedFiles > 0) {
|
|
11
|
+
return {
|
|
12
|
+
id: 'unstaged-changes',
|
|
13
|
+
label: 'Unstaged Changes',
|
|
14
|
+
severity: 'warning',
|
|
15
|
+
detail: `${metrics.unstagedFiles} file${metrics.unstagedFiles !== 1 ? 's' : ''} with unstaged changes`,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=unstaged-changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unstaged-changes.js","sourceRoot":"","sources":["../../../src/watch/strategies/unstaged-changes.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAmB;IAClD,EAAE,EAAE,kBAAkB;IACtB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,iDAAiD;IAC9D,SAAS,EAAE,CAAC,eAAe,EAAE,UAAU,CAAC;IACxC,KAAK,CAAC,OAAO;QACX,IAAI,OAAO,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO;gBACL,EAAE,EAAE,kBAAkB;gBACtB,KAAK,EAAE,kBAAkB;gBACzB,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,QAAQ,OAAO,CAAC,aAAa,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,wBAAwB;aACvG,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrong Branch — the active ticket slug doesn't match the current git branch.
|
|
3
|
+
* Only fires when a lockfile exists (explicit active entry).
|
|
4
|
+
*/
|
|
5
|
+
export const wrongBranchCheck = {
|
|
6
|
+
id: 'wrong-branch',
|
|
7
|
+
source: 'Git',
|
|
8
|
+
description: "The current git branch name does not match the active ticket. Run 'logbook start' on the correct branch.",
|
|
9
|
+
blockedBy: ['squash-merged', 'released'],
|
|
10
|
+
check(metrics) {
|
|
11
|
+
if (metrics.hasActiveTicket &&
|
|
12
|
+
metrics.hasLockfile &&
|
|
13
|
+
metrics.branch &&
|
|
14
|
+
metrics.activeTicketSlug &&
|
|
15
|
+
!metrics.branch.includes(metrics.activeTicketSlug)) {
|
|
16
|
+
return {
|
|
17
|
+
id: 'wrong-branch',
|
|
18
|
+
label: 'Not on Ticket Branch',
|
|
19
|
+
severity: 'warning',
|
|
20
|
+
detail: `Branch '${metrics.branch}' does not match '${metrics.activeTicketSlug}'`,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=wrong-branch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrong-branch.js","sourceRoot":"","sources":["../../../src/watch/strategies/wrong-branch.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC9C,EAAE,EAAE,cAAc;IAClB,MAAM,EAAE,KAAK;IACb,WAAW,EACT,0GAA0G;IAC5G,SAAS,EAAE,CAAC,eAAe,EAAE,UAAU,CAAC;IACxC,KAAK,CAAC,OAAO;QACX,IACE,OAAO,CAAC,eAAe;YACvB,OAAO,CAAC,WAAW;YACnB,OAAO,CAAC,MAAM;YACd,OAAO,CAAC,gBAAgB;YACxB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAClD,CAAC;YACD,OAAO;gBACL,EAAE,EAAE,cAAc;gBAClB,KAAK,EAAE,sBAAsB;gBAC7B,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,WAAW,OAAO,CAAC,MAAM,qBAAqB,OAAO,CAAC,gBAAgB,GAAG;aAClF,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the logbook watch subsystem.
|
|
3
|
+
*
|
|
4
|
+
* Defines the data contracts between the watcher, hub, status strategies,
|
|
5
|
+
* and dashboard.
|
|
6
|
+
*/
|
|
7
|
+
/** Severity levels for status checks. */
|
|
8
|
+
export type StatusSeverity = 'info' | 'warning' | 'success';
|
|
9
|
+
/** A single status determination produced by a strategy. */
|
|
10
|
+
export interface StatusResult {
|
|
11
|
+
/** Machine-readable status identifier. */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Human-readable label for display. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Severity determines badge color and priority. */
|
|
16
|
+
severity: StatusSeverity;
|
|
17
|
+
/** Optional detail message for context. */
|
|
18
|
+
detail?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Raw metrics collected by the watcher before status evaluation. */
|
|
21
|
+
export interface WatcherMetrics {
|
|
22
|
+
/** Current git branch name. */
|
|
23
|
+
branch: string | undefined;
|
|
24
|
+
/** Default branch (main/master). */
|
|
25
|
+
defaultBranch: string;
|
|
26
|
+
/** Whether there is an active logbook ticket. */
|
|
27
|
+
hasActiveTicket: boolean;
|
|
28
|
+
/** Active ticket ID (e.g., "LB-83"). */
|
|
29
|
+
activeTicketId: string | undefined;
|
|
30
|
+
/** Active ticket slug (full folder name). */
|
|
31
|
+
activeTicketSlug: string | undefined;
|
|
32
|
+
/** Latest log entry message. */
|
|
33
|
+
latestLog: string | undefined;
|
|
34
|
+
/** Latest log entry timestamp (ISO). */
|
|
35
|
+
latestLogTimestamp: string | undefined;
|
|
36
|
+
/** Whether the working tree has uncommitted changes. */
|
|
37
|
+
isDirty: boolean;
|
|
38
|
+
/** Number of files with staged changes. */
|
|
39
|
+
stagedFiles: number;
|
|
40
|
+
/** Number of files with unstaged changes. */
|
|
41
|
+
unstagedFiles: number;
|
|
42
|
+
/** Whether local commits are ahead of the remote. */
|
|
43
|
+
isAheadOfRemote: boolean;
|
|
44
|
+
/** Whether index.md has unfilled placeholders. */
|
|
45
|
+
hasNarrativePlaceholders: boolean;
|
|
46
|
+
/** Whether the most recent ticket has a dateEnd set (released). */
|
|
47
|
+
isReleased: boolean;
|
|
48
|
+
/** Whether the lockfile (.logbook-active) exists. */
|
|
49
|
+
hasLockfile: boolean;
|
|
50
|
+
/** Whether all branch commits are already on the default branch (squash-merged). */
|
|
51
|
+
isSquashMerged: boolean;
|
|
52
|
+
/** Number of commits the current branch is behind the default branch (0 = up to date). */
|
|
53
|
+
commitsBehindDefault: number;
|
|
54
|
+
/** ISO timestamp of the last meaningful activity (commit, log entry, file edit). */
|
|
55
|
+
lastActivityTimestamp: string;
|
|
56
|
+
/** Merge request status. */
|
|
57
|
+
mrStatus?: 'approved' | 'approval-optional' | 'open-comments' | 'changes-requested' | 'open' | 'merged' | 'draft' | 'none';
|
|
58
|
+
/** Number of unresolved discussion threads. */
|
|
59
|
+
mrOpenThreads?: number;
|
|
60
|
+
/** Web URL of the MR. */
|
|
61
|
+
mrUrl?: string;
|
|
62
|
+
/** Whether the MR has merge conflicts with the target branch. */
|
|
63
|
+
mrHasConflicts?: boolean;
|
|
64
|
+
/** Pipeline status for the current branch. */
|
|
65
|
+
pipelineStatus?: 'running' | 'passed' | 'failed' | 'pending' | 'canceled' | 'none';
|
|
66
|
+
/** Jira ticket status (e.g., "To Do", "In Progress", "Done"). */
|
|
67
|
+
jiraStatus?: string;
|
|
68
|
+
}
|
|
69
|
+
/** The full project status snapshot pushed to the hub. */
|
|
70
|
+
export interface ProjectStatus {
|
|
71
|
+
/** Absolute path to the project root. */
|
|
72
|
+
projectPath: string;
|
|
73
|
+
/** Human-readable project name from .project-logbook config. */
|
|
74
|
+
projectName: string;
|
|
75
|
+
/** Current git branch. */
|
|
76
|
+
branch: string | undefined;
|
|
77
|
+
/** Active ticket ID. */
|
|
78
|
+
activeTicket: string | undefined;
|
|
79
|
+
/** Latest log entry text. */
|
|
80
|
+
latestLog: string | undefined;
|
|
81
|
+
/** Computed statuses from strategies. */
|
|
82
|
+
statuses: StatusResult[];
|
|
83
|
+
/** ISO timestamp of the last meaningful change in the project (file edit, commit, log entry). */
|
|
84
|
+
lastActivity: string;
|
|
85
|
+
/** Detailed metrics for the expandable detail view. */
|
|
86
|
+
details: ProjectDetails | undefined;
|
|
87
|
+
/** Rendered index.md HTML (story preview). Only set when a ticket is active. */
|
|
88
|
+
renderedStory: string | undefined;
|
|
89
|
+
/** Rendered log.md HTML (log preview). Only set when a ticket is active. */
|
|
90
|
+
renderedLog: string | undefined;
|
|
91
|
+
/** Rendered ticket.md HTML (ticket preview). Only set when a ticket is active. */
|
|
92
|
+
renderedTicket: string | undefined;
|
|
93
|
+
/** MR web URL for linking in the dashboard. */
|
|
94
|
+
mrUrl: string | undefined;
|
|
95
|
+
/** Jira ticket status (e.g., "In Progress", "Done"). */
|
|
96
|
+
jiraStatus: string | undefined;
|
|
97
|
+
/** Jira base URL for constructing ticket links. */
|
|
98
|
+
jiraBaseUrl: string | undefined;
|
|
99
|
+
/** Repository web URL for constructing branch links. */
|
|
100
|
+
repositoryUrl: string | undefined;
|
|
101
|
+
/** Primary accent color from the project's .project-logbook config. */
|
|
102
|
+
primaryColor: string | undefined;
|
|
103
|
+
/** Agent name from config, displayed alongside the project name. */
|
|
104
|
+
agentName: string | undefined;
|
|
105
|
+
/** ISO timestamp of last successful GitLab collector run. */
|
|
106
|
+
glabLastUpdated: string | undefined;
|
|
107
|
+
/** ISO timestamp of last successful Jira collector run. */
|
|
108
|
+
jiraLastUpdated: string | undefined;
|
|
109
|
+
}
|
|
110
|
+
/** Detailed metrics shown in the expandable project detail view. */
|
|
111
|
+
export interface ProjectDetails {
|
|
112
|
+
/** Lines of code changed (insertions + deletions) vs default branch. */
|
|
113
|
+
locChanged: number;
|
|
114
|
+
/** Insertions count. */
|
|
115
|
+
insertions: number;
|
|
116
|
+
/** Deletions count. */
|
|
117
|
+
deletions: number;
|
|
118
|
+
/** Number of files with unstaged changes. */
|
|
119
|
+
unstagedFiles: number;
|
|
120
|
+
/** Number of files staged for commit. */
|
|
121
|
+
stagedFiles: number;
|
|
122
|
+
/** Number of commits ahead of remote. */
|
|
123
|
+
commitsAhead: number;
|
|
124
|
+
/** Number of commits on this branch vs default branch. */
|
|
125
|
+
commitsOnBranch: number;
|
|
126
|
+
/** Default branch name. */
|
|
127
|
+
defaultBranch: string;
|
|
128
|
+
}
|
|
129
|
+
/** Registration payload sent to the hub. */
|
|
130
|
+
export interface RegisterPayload {
|
|
131
|
+
projectPath: string;
|
|
132
|
+
projectName: string;
|
|
133
|
+
}
|
|
134
|
+
/** Health response from the hub. */
|
|
135
|
+
export interface HealthResponse {
|
|
136
|
+
logbook: true;
|
|
137
|
+
version: string;
|
|
138
|
+
projects: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Resolve the hub port from environment or default.
|
|
142
|
+
*
|
|
143
|
+
* Checks `LOGBOOK_WATCH_PORT` env var first, falls back to 4201.
|
|
144
|
+
*
|
|
145
|
+
* @returns The port number to use for the hub.
|
|
146
|
+
*/
|
|
147
|
+
export declare function resolveWatchPort(): number;
|
|
148
|
+
/** A single event in the project activity timeline. */
|
|
149
|
+
export interface ActivityEvent {
|
|
150
|
+
/** ISO timestamp of the event. */
|
|
151
|
+
timestamp: string;
|
|
152
|
+
/** Short description of what happened. */
|
|
153
|
+
description: string;
|
|
154
|
+
/** The command/source that produced this event. */
|
|
155
|
+
source: string;
|
|
156
|
+
}
|
|
157
|
+
/** A Jira issue assigned to the current user (for the Jira tab). */
|
|
158
|
+
export interface JiraIssue {
|
|
159
|
+
/** Issue key (e.g., "ASP-232"). */
|
|
160
|
+
key: string;
|
|
161
|
+
/** Issue summary/title. */
|
|
162
|
+
summary: string;
|
|
163
|
+
/** Current status name (e.g., "In Review"). */
|
|
164
|
+
status: string;
|
|
165
|
+
/** Full URL to open the issue in the browser. */
|
|
166
|
+
url: string;
|
|
167
|
+
/** Jira base URL this issue belongs to (for grouping/dedup). */
|
|
168
|
+
jiraBaseUrl: string;
|
|
169
|
+
/** ISO timestamp of the last update in Jira. */
|
|
170
|
+
updated: string;
|
|
171
|
+
}
|
|
172
|
+
/** A GitLab merge request for the GitLab tab. */
|
|
173
|
+
export interface GitLabMr {
|
|
174
|
+
/** MR IID (project-scoped). */
|
|
175
|
+
iid: number;
|
|
176
|
+
/** MR title. */
|
|
177
|
+
title: string;
|
|
178
|
+
/** MR state: open, merged, draft. */
|
|
179
|
+
status: string;
|
|
180
|
+
/** Number of unresolved discussion threads. */
|
|
181
|
+
comments: number;
|
|
182
|
+
/** Web URL to open the MR. */
|
|
183
|
+
url: string;
|
|
184
|
+
/** Source branch name. */
|
|
185
|
+
sourceBranch: string;
|
|
186
|
+
/** Project web URL (for grouping/dedup). */
|
|
187
|
+
projectUrl: string;
|
|
188
|
+
/** Project name (human-readable). */
|
|
189
|
+
projectName: string;
|
|
190
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the logbook watch subsystem.
|
|
3
|
+
*
|
|
4
|
+
* Defines the data contracts between the watcher, hub, status strategies,
|
|
5
|
+
* and dashboard.
|
|
6
|
+
*/
|
|
7
|
+
/** The default port for the logbook watch hub. */
|
|
8
|
+
const WATCH_PORT_DEFAULT = 4201;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the hub port from environment or default.
|
|
11
|
+
*
|
|
12
|
+
* Checks `LOGBOOK_WATCH_PORT` env var first, falls back to 4201.
|
|
13
|
+
*
|
|
14
|
+
* @returns The port number to use for the hub.
|
|
15
|
+
*/
|
|
16
|
+
export function resolveWatchPort() {
|
|
17
|
+
const envPort = process.env.LOGBOOK_WATCH_PORT;
|
|
18
|
+
if (envPort) {
|
|
19
|
+
const parsed = parseInt(envPort, 10);
|
|
20
|
+
if (!isNaN(parsed) && parsed > 0 && parsed < 65536)
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
23
|
+
return WATCH_PORT_DEFAULT;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/watch/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0JH,kDAAkD;AAClD,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC/C,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,KAAK;YAAE,OAAO,MAAM,CAAC;IACpE,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-system watcher setup for logbook watch.
|
|
3
|
+
*
|
|
4
|
+
* Handles debounced file-system events that trigger collector re-runs.
|
|
5
|
+
*/
|
|
6
|
+
import { watch as fsWatch } from 'node:fs';
|
|
7
|
+
import type { Collector } from './collectors/types.js';
|
|
8
|
+
import type { WatcherState } from './state.js';
|
|
9
|
+
/** Context needed by the file-watcher to trigger collections and pushes. */
|
|
10
|
+
interface FsWatcherContext {
|
|
11
|
+
cwd: string;
|
|
12
|
+
port: number;
|
|
13
|
+
entriesDir: string;
|
|
14
|
+
lockfilePath: string;
|
|
15
|
+
activeCollectors: Collector[];
|
|
16
|
+
state: WatcherState;
|
|
17
|
+
/** Callback to push a full status snapshot to the hub. */
|
|
18
|
+
pushStatus: (_reason: string) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/** Handles returned by setupFileWatchers for cleanup. */
|
|
21
|
+
interface FsWatcherHandles {
|
|
22
|
+
/** Native fs.watch handles to close on shutdown. */
|
|
23
|
+
watchers: ReturnType<typeof fsWatch>[];
|
|
24
|
+
/** Debounce timer reference (may be null). */
|
|
25
|
+
getDebounceTimer: () => ReturnType<typeof setTimeout> | null;
|
|
26
|
+
/** Clear the debounce timer on shutdown. */
|
|
27
|
+
clearDebounce: () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Set up file watchers for fs-triggered collectors.
|
|
31
|
+
*
|
|
32
|
+
* Watches the lockfile and entries directory for changes, debounces events,
|
|
33
|
+
* then re-runs fs-triggered collectors and pushes status to the hub.
|
|
34
|
+
*
|
|
35
|
+
* @param ctx - Watcher context with project paths, collectors, and state.
|
|
36
|
+
* @returns Handles for cleanup (watchers to close, timer to clear).
|
|
37
|
+
*/
|
|
38
|
+
export declare function setupFileWatchers(ctx: FsWatcherContext): FsWatcherHandles;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-system watcher setup for logbook watch.
|
|
3
|
+
*
|
|
4
|
+
* Handles debounced file-system events that trigger collector re-runs.
|
|
5
|
+
*/
|
|
6
|
+
import { watch as fsWatch, existsSync } from 'node:fs';
|
|
7
|
+
import { postToHub } from './watcher-http.js';
|
|
8
|
+
/** Debounce interval for file watcher events (500ms). */
|
|
9
|
+
const DEBOUNCE_MS = 500;
|
|
10
|
+
/**
|
|
11
|
+
* Set up file watchers for fs-triggered collectors.
|
|
12
|
+
*
|
|
13
|
+
* Watches the lockfile and entries directory for changes, debounces events,
|
|
14
|
+
* then re-runs fs-triggered collectors and pushes status to the hub.
|
|
15
|
+
*
|
|
16
|
+
* @param ctx - Watcher context with project paths, collectors, and state.
|
|
17
|
+
* @returns Handles for cleanup (watchers to close, timer to clear).
|
|
18
|
+
*/
|
|
19
|
+
export function setupFileWatchers(ctx) {
|
|
20
|
+
const { cwd, port, entriesDir, lockfilePath, activeCollectors, state, pushStatus } = ctx;
|
|
21
|
+
const fsWatchers = [];
|
|
22
|
+
let debounceTimer = null;
|
|
23
|
+
let lastKnownLog = state.latestLog;
|
|
24
|
+
const debouncedCollectAndPush = (reason) => {
|
|
25
|
+
if (debounceTimer)
|
|
26
|
+
clearTimeout(debounceTimer);
|
|
27
|
+
debounceTimer = setTimeout(async () => {
|
|
28
|
+
// Run all fs-triggered collectors.
|
|
29
|
+
for (const c of activeCollectors.filter((c) => c.schedule.type === 'fs')) {
|
|
30
|
+
await c.collect(cwd, state);
|
|
31
|
+
}
|
|
32
|
+
// If latestLog changed, emit an activity event for the timeline.
|
|
33
|
+
if (state.latestLog && state.latestLog !== lastKnownLog) {
|
|
34
|
+
lastKnownLog = state.latestLog;
|
|
35
|
+
const event = {
|
|
36
|
+
projectPath: cwd,
|
|
37
|
+
timestamp: state.latestLogTimestamp ?? new Date().toISOString(),
|
|
38
|
+
description: state.latestLog,
|
|
39
|
+
source: 'logbook log',
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
await postToHub(port, '/_logbook/event', event);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Hub may have died.
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
await pushStatus(reason);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Hub may have died.
|
|
53
|
+
}
|
|
54
|
+
}, DEBOUNCE_MS);
|
|
55
|
+
};
|
|
56
|
+
// Watch the lockfile if it exists.
|
|
57
|
+
try {
|
|
58
|
+
if (existsSync(lockfilePath)) {
|
|
59
|
+
const w = fsWatch(lockfilePath, () => {
|
|
60
|
+
debouncedCollectAndPush('Lockfile changed — ticket started or released');
|
|
61
|
+
});
|
|
62
|
+
fsWatchers.push(w);
|
|
63
|
+
}
|
|
64
|
+
const cwdWatcher = fsWatch(cwd, (_, filename) => {
|
|
65
|
+
if (filename === '.logbook-active') {
|
|
66
|
+
debouncedCollectAndPush('Lockfile created or removed — ticket state changed');
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
fsWatchers.push(cwdWatcher);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// fs.watch not supported — fall back to polling only.
|
|
73
|
+
}
|
|
74
|
+
// Watch the entries directory recursively.
|
|
75
|
+
try {
|
|
76
|
+
if (existsSync(entriesDir)) {
|
|
77
|
+
const w = fsWatch(entriesDir, { recursive: true }, (_, filename) => {
|
|
78
|
+
if (!filename)
|
|
79
|
+
return;
|
|
80
|
+
if (filename.endsWith('log.md')) {
|
|
81
|
+
debouncedCollectAndPush(`Log updated: ${filename}`);
|
|
82
|
+
}
|
|
83
|
+
else if (filename.endsWith('index.md')) {
|
|
84
|
+
debouncedCollectAndPush(`Narrative updated: ${filename}`);
|
|
85
|
+
}
|
|
86
|
+
else if (filename.endsWith('ticket.md')) {
|
|
87
|
+
debouncedCollectAndPush(`Ticket updated: ${filename}`);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
fsWatchers.push(w);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Recursive watch not supported.
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
watchers: fsWatchers,
|
|
98
|
+
getDebounceTimer: () => debounceTimer,
|
|
99
|
+
clearDebounce: () => {
|
|
100
|
+
if (debounceTimer)
|
|
101
|
+
clearTimeout(debounceTimer);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=watcher-fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watcher-fs.js","sourceRoot":"","sources":["../../src/watch/watcher-fs.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP utilities for the logbook watcher.
|
|
3
|
+
*
|
|
4
|
+
* Provides the hub communication helper and terminal logging timestamp.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Send a JSON POST request to the hub.
|
|
8
|
+
*
|
|
9
|
+
* @param port - Hub port number.
|
|
10
|
+
* @param path - URL path (e.g., '/_logbook/status').
|
|
11
|
+
* @param data - JSON-serializable payload.
|
|
12
|
+
*/
|
|
13
|
+
export declare function postToHub(port: number, path: string, data: unknown): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Format a short timestamp for terminal logging (HH:MM:SS).
|
|
16
|
+
*
|
|
17
|
+
* @returns Formatted time string.
|
|
18
|
+
*/
|
|
19
|
+
export declare function logTime(): string;
|